]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
lib/crypto: support sha384/sha512 in x509/pkcs7
authorDhananjay Phadke <dphadke@linux.microsoft.com>
Tue, 15 Mar 2022 17:19:32 +0000 (10:19 -0700)
committerTom Rini <trini@konsulko.com>
Mon, 11 Apr 2022 15:39:19 +0000 (11:39 -0400)
Set digest_size SHA384 and SHA512 algorithms in pkcs7 and x509,
(not set by ported linux code, but needed by __UBOOT__ part).

EFI_CAPSULE_AUTHENTICATE doesn't select these algos but required for
correctness if certificates contain sha384WithRSAEncryption or
sha512WithRSAEncryption OIDs.

Signed-off-by: Dhananjay Phadke <dphadke@linux.microsoft.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
lib/crypto/pkcs7_verify.c
lib/crypto/x509_public_key.c

index 82c5c745d49bdb260874d88656efab43f8208eb3..b832f013566ff7c5a9f9abf4d03a3f029d564861 100644 (file)
@@ -65,6 +65,10 @@ static int pkcs7_digest(struct pkcs7_message *pkcs7,
                return -ENOPKG;
        if (!strcmp(sinfo->sig->hash_algo, "sha256"))
                sig->digest_size = SHA256_SUM_LEN;
+       else if (!strcmp(sinfo->sig->hash_algo, "sha384"))
+               sig->digest_size = SHA384_SUM_LEN;
+       else if (!strcmp(sinfo->sig->hash_algo, "sha512"))
+               sig->digest_size = SHA512_SUM_LEN;
        else if (!strcmp(sinfo->sig->hash_algo, "sha1"))
                sig->digest_size = SHA1_SUM_LEN;
        else
index d557ab27ae30a3e8e217c424e8d601f5d0fdd1c3..5c0e2b622db4a778cc30f03f68786a99d0419775 100644 (file)
@@ -71,6 +71,10 @@ int x509_get_sig_params(struct x509_certificate *cert)
                return -ENOPKG;
        if (!strcmp(sig->hash_algo, "sha256"))
                sig->digest_size = SHA256_SUM_LEN;
+       else if (!strcmp(sig->hash_algo, "sha384"))
+               sig->digest_size = SHA384_SUM_LEN;
+       else if (!strcmp(sig->hash_algo, "sha512"))
+               sig->digest_size = SHA512_SUM_LEN;
        else if (!strcmp(sig->hash_algo, "sha1"))
                sig->digest_size = SHA1_SUM_LEN;
        else