Merge: certs: Add ECDSA signature verification self-test
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6514 JIRA: https://issues.redhat.com/browse/RHEL-81929 commit 747ae81883d21595b162cc40523a982024700fed Author: Joachim Vandersmissen <git@jvdsn.com> Date: Sun May 12 23:55:07 2024 -0500 certs: Add ECDSA signature verification self-test Commit c27b2d2012e1 ("crypto: testmgr - allow ecdsa-nist-p256 and -p384 in FIPS mode") enabled support for ECDSA in crypto/testmgr.c. The PKCS#7 signature verification API builds upon the KCAPI primitives to perform its high-level operations. Therefore, this change in testmgr.c also allows ECDSA to be used by the PKCS#7 signature verification API (in FIPS mode). However, from a FIPS perspective, the PKCS#7 signature verification API is a distinct "service" from the KCAPI primitives. This is because the PKCS#7 API performs a "full" signature verification, which consists of both hashing the data to be verified, and the public key operation. On the other hand, the KCAPI primitive does not perform this hashing step - it accepts pre-hashed data from the caller and only performs the public key operation. For this reason, the ECDSA self-tests in crypto/testmgr.c are not sufficient to cover ECDSA signature verification offered by the PKCS#7 API. This is reflected by the self-test already present in this file for RSA PKCS#1 v1.5 signature verification. The solution is simply to add a second self-test here for ECDSA. P-256 with SHA-256 hashing was chosen as those parameters should remain FIPS-approved for the foreseeable future, while keeping the performance impact to a minimum. The ECDSA certificate and PKCS#7 signed data was generated using OpenSSL. The input data is identical to the input data for the existing RSA self-test. Signed-off-by:Joachim Vandersmissen <git@jvdsn.com> Reviewed-by:
Jarkko Sakkinen <jarkko@kernel.org> Acked-by:
Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by:
Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by:
Herbert Xu <herbert.xu@redhat.com> Approved-by:
Vladis Dronov <vdronov@redhat.com> Approved-by:
Coiby Xu <coxu@redhat.com> Approved-by:
Clemens Lang <cllang@redhat.com> Approved-by:
CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by:
Augusto Caringi <acaringi@redhat.com>
No related branches found
No related tags found
Showing
- certs/Kconfig 26 additions, 0 deletionscerts/Kconfig
- certs/Makefile 21 additions, 0 deletionscerts/Makefile
- crypto/asymmetric_keys/Kconfig 17 additions, 2 deletionscrypto/asymmetric_keys/Kconfig
- crypto/asymmetric_keys/Makefile 4 additions, 1 deletioncrypto/asymmetric_keys/Makefile
- crypto/asymmetric_keys/pkcs7_parser.c 8 additions, 0 deletionscrypto/asymmetric_keys/pkcs7_parser.c
- crypto/asymmetric_keys/pkcs7_verify.c 1 addition, 0 deletionscrypto/asymmetric_keys/pkcs7_verify.c
- crypto/asymmetric_keys/selftest.c 38 additions, 190 deletionscrypto/asymmetric_keys/selftest.c
- crypto/asymmetric_keys/selftest.h 22 additions, 0 deletionscrypto/asymmetric_keys/selftest.h
- crypto/asymmetric_keys/selftest_ecdsa.c 88 additions, 0 deletionscrypto/asymmetric_keys/selftest_ecdsa.c
- crypto/asymmetric_keys/selftest_rsa.c 171 additions, 0 deletionscrypto/asymmetric_keys/selftest_rsa.c
- crypto/asymmetric_keys/x509_parser.h 0 additions, 9 deletionscrypto/asymmetric_keys/x509_parser.h
- crypto/asymmetric_keys/x509_public_key.c 1 addition, 7 deletionscrypto/asymmetric_keys/x509_public_key.c
- include/linux/verification.h 1 addition, 0 deletionsinclude/linux/verification.h
- redhat/configs/common/generic/CONFIG_MODULE_SIG_KEY_TYPE_ECDSA 1 addition, 0 deletions...t/configs/common/generic/CONFIG_MODULE_SIG_KEY_TYPE_ECDSA
- redhat/configs/common/generic/CONFIG_MODULE_SIG_KEY_TYPE_RSA 1 addition, 0 deletionsredhat/configs/common/generic/CONFIG_MODULE_SIG_KEY_TYPE_RSA
crypto/asymmetric_keys/selftest.h
0 → 100644
crypto/asymmetric_keys/selftest_ecdsa.c
0 → 100644
crypto/asymmetric_keys/selftest_rsa.c
0 → 100644
Please register or sign in to comment