summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'crypto')
-rw-r--r--crypto/params.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/params.c b/crypto/params.c
index b270d7d849..e774dc5d27 100644
--- a/crypto/params.c
+++ b/crypto/params.c
@@ -1063,6 +1063,10 @@ int OSSL_PARAM_set_BN(OSSL_PARAM *p, const BIGNUM *val)
}
bytes = (size_t)BN_num_bytes(val);
+ /* We make sure that at least one byte is used, so zero is properly set */
+ if (bytes == 0)
+ bytes++;
+
p->return_size = bytes;
if (p->data == NULL)
return 1;