summaryrefslogtreecommitdiff
path: root/crypto/param_build_set.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/param_build_set.c')
-rw-r--r--crypto/param_build_set.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/crypto/param_build_set.c b/crypto/param_build_set.c
index db49683ed976..063e35d33b90 100644
--- a/crypto/param_build_set.c
+++ b/crypto/param_build_set.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2026 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -73,6 +73,11 @@ int ossl_param_build_set_bn_pad(OSSL_PARAM_BLD *bld, OSSL_PARAM *p,
return OSSL_PARAM_BLD_push_BN_pad(bld, key, bn, sz);
p = OSSL_PARAM_locate(p, key);
if (p != NULL) {
+ /* Size probe: NULL data means "report the required size". */
+ if (p->data == NULL) {
+ p->return_size = sz;
+ return 1;
+ }
if (sz > p->data_size) {
ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_TOO_SMALL_BUFFER);
return 0;