summaryrefslogtreecommitdiffstats
path: root/crypto/param_build.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/param_build.c')
-rw-r--r--crypto/param_build.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/crypto/param_build.c b/crypto/param_build.c
index e64deaa88f..eaece0026d 100644
--- a/crypto/param_build.c
+++ b/crypto/param_build.c
@@ -204,6 +204,12 @@ int OSSL_PARAM_BLD_push_BN_pad(OSSL_PARAM_BLD *bld, const char *key,
OSSL_PARAM_BLD_DEF *pd;
if (bn != NULL) {
+ if (BN_is_negative(bn)) {
+ ERR_raise_data(ERR_LIB_CRYPTO, ERR_R_UNSUPPORTED,
+ "Negative big numbers are unsupported for OSSL_PARAM");
+ return 0;
+ }
+
n = BN_num_bytes(bn);
if (n < 0) {
ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_ZERO_LENGTH_NUMBER);