Skip to content

Commit b119503

Browse files
committed
KEYS: asymmetric: Fix sign/verify on pkcs1pad without a hash
The new sign/verify code broke the case of pkcs1pad without a hash algorithm. Fix it by setting issig correctly for this case. Fixes: 63ba4d6 ("KEYS: asymmetric: Use new crypto interface without scatterlists") Cc: stable@vger.kernel.org # v6.5 Reported-by: Denis Kenzior <denkenz@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Tested-by: Denis Kenzior <denkenz@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 152d0bc commit b119503

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

crypto/asymmetric_keys/public_key.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,13 @@ software_key_determine_akcipher(const struct public_key *pkey,
8181
* RSA signatures usually use EMSA-PKCS1-1_5 [RFC3447 sec 8.2].
8282
*/
8383
if (strcmp(encoding, "pkcs1") == 0) {
84+
*sig = op == kernel_pkey_sign ||
85+
op == kernel_pkey_verify;
8486
if (!hash_algo) {
85-
*sig = false;
8687
n = snprintf(alg_name, CRYPTO_MAX_ALG_NAME,
8788
"pkcs1pad(%s)",
8889
pkey->pkey_algo);
8990
} else {
90-
*sig = op == kernel_pkey_sign ||
91-
op == kernel_pkey_verify;
9291
n = snprintf(alg_name, CRYPTO_MAX_ALG_NAME,
9392
"pkcs1pad(%s,%s)",
9493
pkey->pkey_algo, hash_algo);

0 commit comments

Comments
 (0)