diff options
author | tb <> | 2023-11-07 16:09:13 +0000 |
---|---|---|
committer | tb <> | 2023-11-07 16:09:13 +0000 |
commit | 4982e9f4e24ca44cc8c4dbb7f3450197e6e86205 (patch) | |
tree | 9482cb7fd723007bbc17921872927cd627072e15 /src | |
parent | 463ea39308cbc1f0b60582e9356d5f66b1548ffa (diff) | |
download | openbsd-4982e9f4e24ca44cc8c4dbb7f3450197e6e86205.tar.gz openbsd-4982e9f4e24ca44cc8c4dbb7f3450197e6e86205.tar.bz2 openbsd-4982e9f4e24ca44cc8c4dbb7f3450197e6e86205.zip |
Trivial cleanup in rsa_cms_sign()
Check and assign the EVP_PKEY_CTX and move the extraction of the algorithm
identifier from the signer info a few lines down.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_ameth.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_ameth.c b/src/lib/libcrypto/rsa/rsa_ameth.c index 49eb4a014d..b742134509 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.37 2023/11/07 16:04:12 tb Exp $ */ | 1 | /* $OpenBSD: rsa_ameth.c,v 1.38 2023/11/07 16:09:13 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 | */ |
@@ -921,16 +921,16 @@ rsa_alg_set_pss_padding(X509_ALGOR *alg, EVP_PKEY_CTX *pkey_ctx) | |||
921 | static int | 921 | static int |
922 | rsa_cms_sign(CMS_SignerInfo *si) | 922 | rsa_cms_sign(CMS_SignerInfo *si) |
923 | { | 923 | { |
924 | int pad_mode = RSA_PKCS1_PADDING; | 924 | EVP_PKEY_CTX *pkctx; |
925 | X509_ALGOR *alg; | 925 | X509_ALGOR *alg; |
926 | EVP_PKEY_CTX *pkctx = CMS_SignerInfo_get0_pkey_ctx(si); | 926 | int pad_mode = RSA_PKCS1_PADDING; |
927 | 927 | ||
928 | CMS_SignerInfo_get0_algs(si, NULL, NULL, NULL, &alg); | 928 | if ((pkctx = CMS_SignerInfo_get0_pkey_ctx(si)) != NULL) { |
929 | if (pkctx) { | ||
930 | if (EVP_PKEY_CTX_get_rsa_padding(pkctx, &pad_mode) <= 0) | 929 | if (EVP_PKEY_CTX_get_rsa_padding(pkctx, &pad_mode) <= 0) |
931 | return 0; | 930 | return 0; |
932 | } | 931 | } |
933 | 932 | ||
933 | CMS_SignerInfo_get0_algs(si, NULL, NULL, NULL, &alg); | ||
934 | if (pad_mode == RSA_PKCS1_PADDING) | 934 | if (pad_mode == RSA_PKCS1_PADDING) |
935 | return rsa_alg_set_pkcs1_padding(alg); | 935 | return rsa_alg_set_pkcs1_padding(alg); |
936 | if (pad_mode == RSA_PKCS1_PSS_PADDING) | 936 | if (pad_mode == RSA_PKCS1_PSS_PADDING) |