Skip to content

PKCS#7 / X.509 fixes and cleanups

Eric Biggers keyrings linux-crypto stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9PKCS#7: fix certificate chain verificationcrypto/asymmetric_keys/pkcs7_verify.c+1 -10 replies
2/9PKCS#7: fix certificate blacklistingcrypto/asymmetric_keys/pkcs7_verify.c+6 -40 replies
3/9PKCS#7: fix direct verification of SignerInfo signaturecrypto/asymmetric_keys/pkcs7_trust.c+1 -00 replies
4/9X.509: fix BUG_ON() when hash algorithm is unsupportedcrypto/asymmetric_keys/public_key.c+3 -12 replies
5/9X.509: fix NULL dereference when restricting key with unsupported_sigcrypto/asymmetric_keys/restrict.c+13 -80 replies
6/9PKCS#7: remove unnecessary check for NULL sinfo->sig->hash_algocrypto/asymmetric_keys/pkcs7_verify.c+0 -31 reply
7/9X.509: remove never-set ->unsupported_key flagcrypto/asymmetric_keys/pkcs7_verify.c crypto/asymmetric_keys/x509_parser.h crypto/asymmetric_keys/x509_public_key.c+0 -130 replies
8/9X.509: remove dead code that set ->unsupported_sigcrypto/asymmetric_keys/x509_public_key.c+0 -91 reply
9/9X.509: self_signed implies !unsupported_sigcrypto/asymmetric_keys/pkcs7_verify.c crypto/asymmetric_keys/x509_parser.h+4 -160 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/9] PKCS#7 / X.509 fixes and cleanups

From: Eric Biggers <[email protected]>

Hi David, here is another set of fixes and cleanups for the PKCS#7 and X.509 code:

Patches 1-5 fix the BUG_ON() in public_key_verify_signature() reported by Paolo Valente as well as several other bugs I found. Notably both the PKCS#7 certificate chain verification and certificate blacklisting were broken. With the certificate chaining bug (introduced in v4.7) it is almost possible to bypass PKCS#7 signature verification completely, though I couldn't quite make it work.

Patches 6-9 remove dead code related to the unsupported_key and unsupported_sig flags on struct x509_certificate's. It's possible these flags should be fixed instead, so that we handle unrecognized or unsupported algorithms more gracefully. But evidently no one is complaining about the current behavior, and removing the dead code is strictly an improvement as it doesn't actually change the behavior...

Eric Biggers (9):
PKCS#7: fix certificate chain verification
PKCS#7: fix certificate blacklisting
PKCS#7: fix direct verification of SignerInfo signature X.509: fix BUG_ON() when hash algorithm is unsupported X.509: fix NULL dereference when restricting key with unsupported_sig PKCS#7: remove unnecessary check for NULL sinfo->sig->hash_algo X.509: remove never-set ->unsupported_key flag
X.509: remove dead code that set ->unsupported_sig
X.509: self_signed implies !unsupported_sig

 crypto/asymmetric_keys/pkcs7_trust.c     |  1 +
 crypto/asymmetric_keys/pkcs7_verify.c    | 36 +++++++++-----------------------
 crypto/asymmetric_keys/public_key.c      |  4 +++-
 crypto/asymmetric_keys/restrict.c        | 21 ++++++++++++-------
 crypto/asymmetric_keys/x509_parser.h     |  3 +--
 crypto/asymmetric_keys/x509_public_key.c | 18 ----------------
 6 files changed, 28 insertions(+), 55 deletions(-)
Signature · 1 line
2.16.0.rc1.238.g530d649a79-goog