diff options
author | tb <> | 2023-11-07 22:35:03 +0000 |
---|---|---|
committer | tb <> | 2023-11-07 22:35:03 +0000 |
commit | 5679a6b9cce04f53ede5b1677c5fe12c866fe15e (patch) | |
tree | 331b46b1570ef5e1091ed117bfe1df5ec102825f /src/lib | |
parent | dea80baeb0e1dac8ee33631b3587b4ba621cb4a3 (diff) | |
download | openbsd-5679a6b9cce04f53ede5b1677c5fe12c866fe15e.tar.gz openbsd-5679a6b9cce04f53ede5b1677c5fe12c866fe15e.tar.bz2 openbsd-5679a6b9cce04f53ede5b1677c5fe12c866fe15e.zip |
Move CMS_RecipientInfo_ktri_get0_algs() down a few lines and fix its
error check
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_ameth.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_ameth.c b/src/lib/libcrypto/rsa/rsa_ameth.c index 7533264add..6fb4403231 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.41 2023/11/07 22:32:09 tb Exp $ */ | 1 | /* $OpenBSD: rsa_ameth.c,v 1.42 2023/11/07 22:35:03 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 | */ |
@@ -1065,17 +1065,20 @@ rsa_cms_encrypt(CMS_RecipientInfo *ri) | |||
1065 | int pad_mode = RSA_PKCS1_PADDING, rv = 0, labellen; | 1065 | int pad_mode = RSA_PKCS1_PADDING, rv = 0, labellen; |
1066 | unsigned char *label; | 1066 | unsigned char *label; |
1067 | 1067 | ||
1068 | if (CMS_RecipientInfo_ktri_get0_algs(ri, NULL, NULL, &alg) <= 0) | ||
1069 | return 0; | ||
1070 | if ((pkctx = CMS_RecipientInfo_get0_pkey_ctx(ri)) != NULL) { | 1068 | if ((pkctx = CMS_RecipientInfo_get0_pkey_ctx(ri)) != NULL) { |
1071 | if (EVP_PKEY_CTX_get_rsa_padding(pkctx, &pad_mode) <= 0) | 1069 | if (EVP_PKEY_CTX_get_rsa_padding(pkctx, &pad_mode) <= 0) |
1072 | return 0; | 1070 | return 0; |
1073 | } | 1071 | } |
1072 | |||
1073 | if (!CMS_RecipientInfo_ktri_get0_algs(ri, NULL, NULL, &alg)) | ||
1074 | return 0; | ||
1074 | if (pad_mode == RSA_PKCS1_PADDING) | 1075 | if (pad_mode == RSA_PKCS1_PADDING) |
1075 | return rsa_alg_set_pkcs1_padding(alg); | 1076 | return rsa_alg_set_pkcs1_padding(alg); |
1077 | |||
1076 | /* Not supported */ | 1078 | /* Not supported */ |
1077 | if (pad_mode != RSA_PKCS1_OAEP_PADDING) | 1079 | if (pad_mode != RSA_PKCS1_OAEP_PADDING) |
1078 | return 0; | 1080 | return 0; |
1081 | |||
1079 | if (EVP_PKEY_CTX_get_rsa_oaep_md(pkctx, &md) <= 0) | 1082 | if (EVP_PKEY_CTX_get_rsa_oaep_md(pkctx, &md) <= 0) |
1080 | goto err; | 1083 | goto err; |
1081 | if (EVP_PKEY_CTX_get_rsa_mgf1_md(pkctx, &mgf1md) <= 0) | 1084 | if (EVP_PKEY_CTX_get_rsa_mgf1_md(pkctx, &mgf1md) <= 0) |