Skip to content

Fix bugs in public_key_verify_signature()

Eric Biggers keyrings linux-crypto linux-integrity stable 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 2 repliesIn review
  2. v12 patches 12 repliesSuperseded

Changes in v2 from the cover letter

- Changed patch 1 to continue allowing a NULL sig->pkey_algo.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2KEYS: asymmetric: enforce that sig algo matches key algocrypto/asymmetric_keys/pkcs7_verify.c crypto/asymmetric_keys/public_key.c crypto/asymmetric_keys/x509_public_key.c+15 -121 reply
2/2KEYS: asymmetric: properly validate hash_algo and encodingcrypto/asymmetric_keys/public_key.c+76 -351 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchStefan BergerTianjia ZhangVitaly Chikunov
1/2T-b T-b R-b
2/2T-b T-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH v2 0/2] Fix bugs in public_key_verify_signature()

This patchset fixes some bugs in public_key_verify_signature() where it could be tricked into using the wrong algorithm, as was discussed at
https://lore.kernel.org/linux-integrity/[email protected]/T/#t

I'd appreciate it if the people who care about each of the supported public key algorithms (RSA, ECDSA, ECRDSA, and SM2) would test this patchset to make sure it still works for their use case(s). I've tested that X.509 and PKCS#7 with RSA still work.

Note, I have *not* included a fix for SM2 being implemented incorrectly. That is another bug that I pointed out in the above thread. I think that bug is for the people who actually care about SM2.

This applies to v5.17-rc3.

Changed v1 => v2:
- Changed patch 1 to continue allowing a NULL sig->pkey_algo.

Eric Biggers (2):
KEYS: asymmetric: enforce that sig algo matches key algo
KEYS: asymmetric: properly validate hash_algo and encoding

 crypto/asymmetric_keys/pkcs7_verify.c    |   6 --
 crypto/asymmetric_keys/public_key.c      | 126 ++++++++++++++++-------
 crypto/asymmetric_keys/x509_public_key.c |   6 --
 3 files changed, 91 insertions(+), 47 deletions(-)

base-commit: dfd42facf1e4ada021b939b4e19c935dcdd55566

Signature · 1 line
2.35.1