Skip to content

Commit

Permalink
OSSL_PARAM_BLD_push_BN_pad(): Allow NULL BIGNUM
Browse files Browse the repository at this point in the history
This was supported previously and regressed
with commit 17898ec

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #21945)
  • Loading branch information
t8m committed Sep 5, 2023
1 parent 374945a commit 2ce79d9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crypto/param_build.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}
Expand Down

0 comments on commit 2ce79d9

Please sign in to comment.