summaryrefslogtreecommitdiffstats
path: root/crypto/rsa/rsa_lib.c
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2020-03-26 09:28:01 +1000
committerPauli <paul.dale@oracle.com>2020-03-28 12:27:22 +1000
commit6d4e6009d27712a405e1e3a4c33fb8a8566f134a (patch)
tree09d94a8c8f8f6f493cc758b6fd704837be82cb8c /crypto/rsa/rsa_lib.c
parentbe19d3caf0724b786ecc97ec4207c07cff63c745 (diff)
Param build: make structures opaque.
Since this is public, it is best to make the underlying structure opaque. This means converting from stack allocation to dynamic allocation for all usages. Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com> (Merged from https://github.com/openssl/openssl/pull/11390)
Diffstat (limited to 'crypto/rsa/rsa_lib.c')
-rw-r--r--crypto/rsa/rsa_lib.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/crypto/rsa/rsa_lib.c b/crypto/rsa/rsa_lib.c
index e65e303735..e9a5b48fbc 100644
--- a/crypto/rsa/rsa_lib.c
+++ b/crypto/rsa/rsa_lib.c
@@ -1296,7 +1296,7 @@ int EVP_PKEY_CTX_set_rsa_keygen_bits(EVP_PKEY_CTX *ctx, int bits)
int EVP_PKEY_CTX_set_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, BIGNUM *pubexp)
{
- OSSL_PARAM_BLD tmpl;
+ OSSL_PARAM_BLD *tmpl;
OSSL_PARAM *params;
int ret;
@@ -1315,13 +1315,17 @@ int EVP_PKEY_CTX_set_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, BIGNUM *pubexp)
return EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_KEYGEN,
EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP, 0, pubexp);
- OSSL_PARAM_BLD_init(&tmpl);
- if (!OSSL_PARAM_BLD_push_BN(&tmpl, OSSL_PKEY_PARAM_RSA_E, pubexp)
- || (params = OSSL_PARAM_BLD_to_param(&tmpl)) == NULL)
+ if ((tmpl = OSSL_PARAM_BLD_new()) == NULL)
return 0;
+ if (!OSSL_PARAM_BLD_push_BN(tmpl, OSSL_PKEY_PARAM_RSA_E, pubexp)
+ || (params = OSSL_PARAM_BLD_to_param(tmpl)) == NULL) {
+ OSSL_PARAM_BLD_free(tmpl);
+ return 0;
+ }
+ OSSL_PARAM_BLD_free(tmpl);
ret = EVP_PKEY_CTX_set_params(ctx, params);
- OSSL_PARAM_BLD_free(params);
+ OSSL_PARAM_BLD_free_params(params);
return ret;
}