Centos-kernel-stream-9/crypto/asymmetric_keys
Herbert Xu 2ee439bf6d certs: Add ECDSA signature verification self-test
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>
2025-03-06 08:36:23 +08:00
..
Kconfig certs: Add ECDSA signature verification self-test 2025-03-06 08:36:23 +08:00
Makefile certs: Add ECDSA signature verification self-test 2025-03-06 08:36:23 +08:00
asym_tpm.c tpm: Store the length of the tpm_buf data separately. 2024-11-25 00:42:09 +01:00
asymmetric_keys.h
asymmetric_type.c
mscode.asn1
mscode_parser.c
pkcs7.asn1
pkcs7_key_type.c
pkcs7_parser.c certs: Add support for using elliptic curve keys for signing modules 2025-03-05 22:29:46 +08:00
pkcs7_parser.h
pkcs7_trust.c
pkcs7_verify.c crypto: certs: fix FIPS selftest dependency 2025-03-06 08:36:23 +08:00
pkcs8.asn1
pkcs8_parser.c
public_key.c KEYS: use kfree_sensitive with key 2023-07-29 15:50:30 +02:00
restrict.c KEYS: DigitalSignature link restriction 2023-05-27 08:41:17 +08:00
selftest.c certs: Add ECDSA signature verification self-test 2025-03-06 08:36:23 +08:00
selftest.h certs: Add ECDSA signature verification self-test 2025-03-06 08:36:23 +08:00
selftest_ecdsa.c certs: Add ECDSA signature verification self-test 2025-03-06 08:36:23 +08:00
selftest_rsa.c certs: Move RSA self-test data to separate file 2025-03-06 08:36:23 +08:00
signature.c
tpm.asn1
tpm_parser.c
verify_pefile.c
verify_pefile.h
x509.asn1
x509_akid.asn1
x509_cert_parser.c KEYS: X.509: Parse Key Usage 2023-05-27 08:41:16 +08:00
x509_loader.c wifi: cfg80211: Deduplicate certificate loading 2023-05-09 08:17:52 +02:00
x509_parser.h certs: Break circular dependency when selftest is modular 2025-03-06 08:36:23 +08:00
x509_public_key.c certs: Break circular dependency when selftest is modular 2025-03-06 08:36:23 +08:00