From: Eric Biggers <ebiggers@kernel.org>
To: Mike Lothian <mike@fireburn.co.uk>
Cc: linux-crypto@vger.kernel.org,
"Herbert Xu" <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
"Jason A. Donenfeld" <Jason@zx2c4.com>,
"Ard Biesheuvel" <ardb@kernel.org>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Tamir Duberstein" <tamird@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Onur Özkan" <work@onurozkan.dev>,
"Lyude Paul" <lyude@redhat.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Asahi Lina" <lina+kernel@asahilina.net>,
"Burak Emir" <bqe@google.com>, "Lorenzo Stoakes" <ljs@kernel.org>,
"Joel Fernandes" <joelagnelf@nvidia.com>,
"Yury Norov" <ynorov@nvidia.com>,
"David Gow" <david@davidgow.net>,
linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org
Subject: Re: [PATCH v3 2/2] rust: crypto: add synchronous RSA akcipher support
Date: Wed, 26 Aug 2026 20:03:52 -0700 [thread overview]
Message-ID: <20260827030352.GB2327@sol> (raw)
In-Reply-To: <20260826163004.3365-3-mike@fireburn.co.uk>
On Wed, Aug 26, 2026 at 05:29:49PM +0100, Mike Lothian wrote:
> +config RUST_CRYPTO_LIB_AES
> + bool
> + depends on RUST
> + select CRYPTO_LIB_AES
> + select CRYPTO_LIB_AES_CBC_MACS
> + help
> + Enable the Rust bindings for the synchronous AES library functions.
> + The selected C libraries are built into the kernel because Rust
> + abstractions are part of the built-in kernel crate.
This is being added in the wrong patch.
> config CRYPTO_LIB_AESGCM
> tristate
> select CRYPTO_LIB_AES
> @@ -216,6 +226,15 @@ config CRYPTO_LIB_SHA256
> Select this if your module uses any of these functions from
> <crypto/sha2.h>.
>
> +config RUST_CRYPTO_LIB_SHA256
> + bool
> + depends on RUST
> + select CRYPTO_LIB_SHA256
> + help
> + Enable the Rust bindings for the synchronous SHA-256 and HMAC-SHA256
> + library functions. The selected C library is built into the kernel
> + because Rust abstractions are part of the built-in kernel crate.
Likewise.
As I've been commenting on other of these bindings patches, it also
doesn't really make sense to have the kconfig symbol be in lib/ but then
have the actual code be in rust/. They should be in the same place.
> +__rust_helper void rust_helper_memzero_explicit(void *s, size_t count)
> +{
> + memzero_explicit(s, count);
> +}
Isn't there a standard Rust solution for this?
> +#ifdef CONFIG_RUST_CRYPTO_AKCIPHER
> +__rust_helper void rust_helper_crypto_free_akcipher(struct crypto_akcipher *tfm)
> +{
> + crypto_free_akcipher(tfm);
> +}
If you need RSA, then please just create an API for RSA specifically.
The crypto_akcipher abstraction has never worked well, due to
differences between the algorithms and various other reasons.
> +__rust_helper void rust_helper_aes_enckey_zero(struct aes_enckey *key)
> +{
> + memzero_explicit(key, sizeof(*key));
> +}
Similarly, isn't there a standard Rust solution to zeroize memory?
- Eric
next prev parent reply other threads:[~2026-08-27 3:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 16:29 [PATCH v3 0/2] rust: crypto: AES, CMAC, SHA-256, HMAC and RSA bindings Mike Lothian
2026-08-26 16:29 ` [PATCH v3 1/2] rust: crypto: add AES-128, AES-CMAC, SHA-256, and HMAC bindings Mike Lothian
2026-08-26 22:09 ` Eric Biggers
[not found] ` <CAHbf0-H-nZzg=kGkN-yrUdfUUrruyN0x2inQjhXxOy4RAauDOg@mail.gmail.com>
2026-08-31 17:05 ` Eric Biggers
2026-09-02 12:51 ` Mike Lothian
2026-08-26 16:29 ` [PATCH v3 2/2] rust: crypto: add synchronous RSA akcipher support Mike Lothian
2026-08-27 3:03 ` Eric Biggers [this message]
2026-08-27 14:46 ` Miguel Ojeda
2026-08-27 18:29 ` Eric Biggers
2026-08-27 23:00 ` Miguel Ojeda
2026-08-31 17:04 ` Mike Lothian
2026-08-27 14:59 ` Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260827030352.GB2327@sol \
--to=ebiggers@kernel.org \
--cc=Jason@zx2c4.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--cc=ardb@kernel.org \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=bqe@google.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=davem@davemloft.net \
--cc=david@davidgow.net \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=herbert@gondor.apana.org.au \
--cc=joelagnelf@nvidia.com \
--cc=lina+kernel@asahilina.net \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=lossin@kernel.org \
--cc=lyude@redhat.com \
--cc=mike@fireburn.co.uk \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
--cc=ynorov@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.