diff --git a/crypto/bn_extra/convert.c b/crypto/bn_extra/convert.c index a45943a737..7cc665cc10 100644 --- a/crypto/bn_extra/convert.c +++ b/crypto/bn_extra/convert.c @@ -452,7 +452,7 @@ BIGNUM *BN_mpi2bn(const uint8_t *in, size_t len, BIGNUM *out) { if (num_bits >= INT_MAX) { return NULL; } - BN_clear_bit(out, (int)BN_num_bits(out) - 1); + BN_clear_bit(out, (int)num_bits - 1); } return out; }