lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAH5fLgh3u8h9kcxMXvPiBTrTgpE81kopjWL1ySYSjWucHT+Dkg@mail.gmail.com>
Date: Thu, 18 Dec 2025 08:56:44 +0100
From: Alice Ryhl <aliceryhl@...gle.com>
To: Matthew Maurer <mmaurer@...gle.com>
Cc: Miguel Ojeda <ojeda@...nel.org>, Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>, 
	Björn Roy Baron <bjorn3_gh@...tonmail.com>, 
	Benno Lossin <lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>, 
	Trevor Gross <tmgross@...ch.edu>, Danilo Krummrich <dakr@...nel.org>, linux-kernel@...r.kernel.org, 
	rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v2] rust: Add support for feeding entropy to randomness pool

On Tue, Dec 16, 2025 at 1:37 AM Matthew Maurer <mmaurer@...gle.com> wrote:
>
> Adds just enough support to allow device drivers to feed entropy to the
> central pool.
>
> Signed-off-by: Matthew Maurer <mmaurer@...gle.com>

Some nits below. With those fixed:

Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>

> +//! Randomness.
> +//!
> +//! C header: [`include/linux/random.h`](../../../../include/linux/random.h)

Needs to use srctree instead of ../

> +use crate::bindings;
> +use crate::ffi::c_void;

Please import the prelude here.

> +/// Adds the given buffer to the entropy pool, but does not credit any entropy.
> +///
> +/// This is intended for use mixing in data that is likely to differ between devices or boots, but
> +/// may otherwise be predictable. Examples include MAC addresses or RTC values. This slightly
> +/// improves randomness in entropy-constrained environments (especially common for embedded
> +/// devices).
> +pub fn add_device_randomness(buf: &[u8]) {
> +    // SAFETY: We just need the pointer to be valid for the length, which a slice provides.
> +    unsafe { bindings::add_device_randomness(buf.as_ptr().cast::<c_void>(), buf.len()) };
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ