Message ID | ZSz12KHsfJmZGjKz@gondor.apana.org.au (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | KEYS: asymmetric: Fix sign/verify on pkcs1pad without a hash | expand |
Hi Herbert, On 10/16/23 03:35, Herbert Xu wrote: > On Thu, Oct 12, 2023 at 10:08:46AM -0500, Denis Kenzior wrote: >> >> Looks like something took out the ability to run sign/verify without a hash >> on asymmetric keys. > > Indeed this is what it was. Please try this patch. Thanks! > I can confirm that this fix does make all unit tests pass again. Feel free to add: Tested-by: Denis Kenzior <denkenz@gmail.com> Regards, -Denis
diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c index abeecb8329b3..2f9181c4cd59 100644 --- a/crypto/asymmetric_keys/public_key.c +++ b/crypto/asymmetric_keys/public_key.c @@ -81,14 +81,13 @@ software_key_determine_akcipher(const struct public_key *pkey, * RSA signatures usually use EMSA-PKCS1-1_5 [RFC3447 sec 8.2]. */ if (strcmp(encoding, "pkcs1") == 0) { + *sig = op == kernel_pkey_sign || + op == kernel_pkey_verify; if (!hash_algo) { - *sig = false; n = snprintf(alg_name, CRYPTO_MAX_ALG_NAME, "pkcs1pad(%s)", pkey->pkey_algo); } else { - *sig = op == kernel_pkey_sign || - op == kernel_pkey_verify; n = snprintf(alg_name, CRYPTO_MAX_ALG_NAME, "pkcs1pad(%s,%s)", pkey->pkey_algo, hash_algo);