diff options
author | tb <> | 2024-03-17 07:10:00 +0000 |
---|---|---|
committer | tb <> | 2024-03-17 07:10:00 +0000 |
commit | d1ab59206a7f50aee168d077e40fa7723efbd1d2 (patch) | |
tree | cb438d8d5a23a69148e0a6f042dba0d35afb6328 /src | |
parent | 867e80a6872b3ba4a6625c024b19d5ba20164111 (diff) | |
download | openbsd-d1ab59206a7f50aee168d077e40fa7723efbd1d2.tar.gz openbsd-d1ab59206a7f50aee168d077e40fa7723efbd1d2.tar.bz2 openbsd-d1ab59206a7f50aee168d077e40fa7723efbd1d2.zip |
Annotate RSA-PSS SHA parameter encoding as wrong
A historic blunderfest in the ASN.1 module for RSA-PSS led to very
confusing text in various RFCs. davidben and my current reading of
this is that parameters for SHA-* should be encoded as an ASN.1 NULL
rather than omitted. The use of X509_ALGOR_set_evp_md() leads to them
being omitted, and is therefore counter to the specification (but
allowed. We should fix this. For now, leave a reminder.
See https://boringssl-review.googlesource.com/c/boringssl/+/67088
for a lot more details.
ok davidben
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_ameth.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_ameth.c b/src/lib/libcrypto/rsa/rsa_ameth.c index 0c351f49ef..c722188c43 100644 --- a/src/lib/libcrypto/rsa/rsa_ameth.c +++ b/src/lib/libcrypto/rsa/rsa_ameth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_ameth.c,v 1.57 2024/01/10 14:59:19 tb Exp $ */ | 1 | /* $OpenBSD: rsa_ameth.c,v 1.58 2024/03/17 07:10:00 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -605,6 +605,10 @@ rsa_md_to_algor(const EVP_MD *md, X509_ALGOR **out_alg) | |||
605 | 605 | ||
606 | if ((alg = X509_ALGOR_new()) == NULL) | 606 | if ((alg = X509_ALGOR_new()) == NULL) |
607 | goto err; | 607 | goto err; |
608 | /* | ||
609 | * XXX - This omits the parameters, whereas RFC 4055, section 2.1 | ||
610 | * explicitly states that an explicit ASN.1 NULL is required. | ||
611 | */ | ||
608 | if (!X509_ALGOR_set_evp_md(alg, md)) | 612 | if (!X509_ALGOR_set_evp_md(alg, md)) |
609 | goto err; | 613 | goto err; |
610 | 614 | ||
@@ -640,6 +644,10 @@ rsa_mgf1md_to_maskGenAlgorithm(const EVP_MD *mgf1md, X509_ALGOR **out_alg) | |||
640 | 644 | ||
641 | if ((inner_alg = X509_ALGOR_new()) == NULL) | 645 | if ((inner_alg = X509_ALGOR_new()) == NULL) |
642 | goto err; | 646 | goto err; |
647 | /* | ||
648 | * XXX - This omits the parameters, whereas RFC 4055, section 2.1 | ||
649 | * explicitly states that an explicit ASN.1 NULL is required. | ||
650 | */ | ||
643 | if (!X509_ALGOR_set_evp_md(inner_alg, mgf1md)) | 651 | if (!X509_ALGOR_set_evp_md(inner_alg, mgf1md)) |
644 | goto err; | 652 | goto err; |
645 | if ((astr = ASN1_item_pack(inner_alg, &X509_ALGOR_it, NULL)) == NULL) | 653 | if ((astr = ASN1_item_pack(inner_alg, &X509_ALGOR_it, NULL)) == NULL) |