mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vitaly Chikunov <vt@altlinux.org>
To: Stefan Berger <stefanb@linux.ibm.com>
Cc: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au,
	davem@davemloft.net, linux-kernel@vger.kernel.org,
	saulo.alessandre@tse.jus.br
Subject: Re: [PATCH] crypto: ecdsa - Fix module auto-load on add-key
Date: Sat, 23 Mar 2024 01:27:57 +0300	[thread overview]
Message-ID: <20240322222757.gsr4kto47imm5spj@altlinux.org> (raw)
In-Reply-To: <20240321144433.1671394-1-stefanb@linux.ibm.com>

On Thu, Mar 21, 2024 at 10:44:33AM -0400, Stefan Berger wrote:
> Add module alias with the algorithm cra_name similar to what we have for
> RSA-related and other algorithms.
> 
> The kernel attempts to modprobe asymmetric algorithms using the names
> "crypto-$cra_name" and "crypto-$cra_name-all." However, since these
> aliases are currently missing, the modules are not loaded. For instance,
> when using the `add_key` function, the hash algorithm is typically
> loaded automatically, but the asymmetric algorithm is not.
> 
> Steps to test:
> 
> 1. Create certificate
> 
>   openssl req -x509 -sha256 -newkey ec \
>   -pkeyopt "ec_paramgen_curve:secp384r1" -keyout key.pem -days 365 \
>   -subj '/CN=test' -nodes -outform der -out nist-p384.der
> 
> 2. Optionally, trace module requests with: trace-cmd stream -e module &
> 
> 3. Trigger add_key call for the cert:
> 
>    # keyctl padd asymmetric "" @u < nist-p384.der
>    641069229
>    # lsmod | head -2
>    Module                  Size  Used by
>    ecdsa_generic          16384  0
> 
> Fixes: c12d448ba939 ("crypto: ecdsa - Register NIST P384 and extend test suite")
> Cc: stable@vger.kernel.org
> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>

Reviewed-by: Vitaly Chikunov <vt@altlinux.org>

> ---
>  crypto/ecdsa.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/crypto/ecdsa.c b/crypto/ecdsa.c
> index fbd76498aba8..3f9ec273a121 100644
> --- a/crypto/ecdsa.c
> +++ b/crypto/ecdsa.c
> @@ -373,4 +373,7 @@ module_exit(ecdsa_exit);
>  MODULE_LICENSE("GPL");
>  MODULE_AUTHOR("Stefan Berger <stefanb@linux.ibm.com>");
>  MODULE_DESCRIPTION("ECDSA generic algorithm");
> +MODULE_ALIAS_CRYPTO("ecdsa-nist-p192");
> +MODULE_ALIAS_CRYPTO("ecdsa-nist-p256");
> +MODULE_ALIAS_CRYPTO("ecdsa-nist-p384");
>  MODULE_ALIAS_CRYPTO("ecdsa-generic");
> -- 
> 2.43.0

  reply	other threads:[~2024-03-22 22:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-21 14:44 Stefan Berger
2024-03-22 22:27 ` Vitaly Chikunov [this message]
2024-03-28 10:56 ` Herbert Xu

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=20240322222757.gsr4kto47imm5spj@altlinux.org \
    --to=vt@altlinux.org \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=saulo.alessandre@tse.jus.br \
    --cc=stefanb@linux.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®