summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2023-10-21 09:49:13 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2023-10-21 09:49:13 -0700
commitf1de9aced809f1751bc97703bdf678c75da3fed3 (patch)
tree722187373e0777c13eecc9a5226ab407ed4628a5
parent5722119f674d81eb88d51463ece8096855d94cc0 (diff)
parentb11950356c4b416d2e87941f3aa7a8bf089db72b (diff)
Merge tag 'v6.6-p5' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fix from Herbert Xu: "Fix a 6.5 regression in crypto/asymmetric_keys" * tag 'v6.6-p5' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: KEYS: asymmetric: Fix sign/verify on pkcs1pad without a hash
-rw-r--r--crypto/asymmetric_keys/public_key.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c
index abeecb8329b3..1dcab27986a6 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);