diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2023-11-07 16:09:14 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2023-11-07 16:09:14 +0000 |
commit | 37f7a542cc1094034adad9c052bb1320ffa2ab8d (patch) | |
tree | 62dad63e4565c41afb099ec712300dd8d371d373 /lib | |
parent | 8cb246606e70ad94ca8a0f2d2293e1225d9aa5f7 (diff) |
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 'lib')
-rw-r--r-- | lib/libcrypto/rsa/rsa_ameth.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libcrypto/rsa/rsa_ameth.c b/lib/libcrypto/rsa/rsa_ameth.c index 49eb4a014dd..b7421345093 100644 --- a/lib/libcrypto/rsa/rsa_ameth.c +++ b/lib/libcrypto/rsa/rsa_ameth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_ameth.c,v 1.37 2023/11/07 16:04:12 tb Exp $ */ +/* $OpenBSD: rsa_ameth.c,v 1.38 2023/11/07 16:09:13 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -921,16 +921,16 @@ rsa_alg_set_pss_padding(X509_ALGOR *alg, EVP_PKEY_CTX *pkey_ctx) static int rsa_cms_sign(CMS_SignerInfo *si) { - int pad_mode = RSA_PKCS1_PADDING; + EVP_PKEY_CTX *pkctx; X509_ALGOR *alg; - EVP_PKEY_CTX *pkctx = CMS_SignerInfo_get0_pkey_ctx(si); + int pad_mode = RSA_PKCS1_PADDING; - CMS_SignerInfo_get0_algs(si, NULL, NULL, NULL, &alg); - if (pkctx) { + if ((pkctx = CMS_SignerInfo_get0_pkey_ctx(si)) != NULL) { if (EVP_PKEY_CTX_get_rsa_padding(pkctx, &pad_mode) <= 0) return 0; } + CMS_SignerInfo_get0_algs(si, NULL, NULL, NULL, &alg); if (pad_mode == RSA_PKCS1_PADDING) return rsa_alg_set_pkcs1_padding(alg); if (pad_mode == RSA_PKCS1_PSS_PADDING) |