diff options
author | Tomas Mraz <tomas@openssl.org> | 2023-09-04 08:59:53 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2023-09-05 12:50:39 +0200 |
commit | 2ce79d97e338c8eaacf67ce2e1a1b0fb1c639f11 (patch) | |
tree | 8ee0f90c1ce1b14469b6a88fa474db57838a4cb6 /crypto | |
parent | 374945a9aa545d4d6f015de0b48cbed6a90258e0 (diff) |
OSSL_PARAM_BLD_push_BN_pad(): Allow NULL BIGNUM
This was supported previously and regressed
with commit 17898ec6011cc583c5af69ca8f25f5d165ff3e6a
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21945)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/param_build.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/param_build.c b/crypto/param_build.c index 7604f9bd6c..def71f5718 100644 --- a/crypto/param_build.c +++ b/crypto/param_build.c @@ -233,8 +233,8 @@ static int push_BN(OSSL_PARAM_BLD *bld, const char *key, int OSSL_PARAM_BLD_push_BN(OSSL_PARAM_BLD *bld, const char *key, const BIGNUM *bn) { - if (BN_is_negative(bn)) - return push_BN(bld, key, bn, bn == NULL ? 0 : BN_num_bytes(bn) + 1, + if (bn != NULL && BN_is_negative(bn)) + return push_BN(bld, key, bn, BN_num_bytes(bn) + 1, OSSL_PARAM_INTEGER); return push_BN(bld, key, bn, bn == NULL ? 0 : BN_num_bytes(bn), OSSL_PARAM_UNSIGNED_INTEGER); @@ -243,8 +243,8 @@ int OSSL_PARAM_BLD_push_BN(OSSL_PARAM_BLD *bld, const char *key, int OSSL_PARAM_BLD_push_BN_pad(OSSL_PARAM_BLD *bld, const char *key, const BIGNUM *bn, size_t sz) { - if (BN_is_negative(bn)) - return push_BN(bld, key, bn, bn == NULL ? 0 : BN_num_bytes(bn), + if (bn != NULL && BN_is_negative(bn)) + return push_BN(bld, key, bn, BN_num_bytes(bn), OSSL_PARAM_INTEGER); return push_BN(bld, key, bn, sz, OSSL_PARAM_UNSIGNED_INTEGER); } |