summaryrefslogtreecommitdiff
path: root/crypto/params_from_text.c
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2020-02-10 13:29:49 +1000
committerRichard Levitte <levitte@openssl.org>2020-02-21 13:04:25 +0100
commit2ee0dfa684d5fbda5758136807e2732bd4f85139 (patch)
tree5560e23cc1c6316981d61bc19a105cd54c198d5f /crypto/params_from_text.c
parent7b5108dff4cfde059ca278147a188fb6254603d1 (diff)
downloadopenssl-new-2ee0dfa684d5fbda5758136807e2732bd4f85139.tar.gz
Params: add argument to the _from_text calls to indicate if the param exists.
The extra argument is a integer pointer and is optional. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11049)
Diffstat (limited to 'crypto/params_from_text.c')
-rw-r--r--crypto/params_from_text.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/crypto/params_from_text.c b/crypto/params_from_text.c
index 59cee5f115..71fa8aef92 100644
--- a/crypto/params_from_text.c
+++ b/crypto/params_from_text.c
@@ -24,7 +24,7 @@ static int prepare_from_text(const OSSL_PARAM *paramdefs, const char *key,
const char *value, size_t value_n,
/* Output parameters */
const OSSL_PARAM **paramdef, int *ishex,
- size_t *buf_n, BIGNUM **tmpbn)
+ size_t *buf_n, BIGNUM **tmpbn, int *found)
{
const OSSL_PARAM *p;
@@ -38,6 +38,8 @@ static int prepare_from_text(const OSSL_PARAM *paramdefs, const char *key,
key += 3;
p = *paramdef = OSSL_PARAM_locate_const(paramdefs, key);
+ if (found != NULL)
+ *found = p != NULL;
if (p == NULL)
return 0;
@@ -163,7 +165,7 @@ static int construct_from_text(OSSL_PARAM *to, const OSSL_PARAM *paramdef,
int OSSL_PARAM_allocate_from_text(OSSL_PARAM *to,
const OSSL_PARAM *paramdefs,
const char *key, const char *value,
- size_t value_n)
+ size_t value_n, int *found)
{
const OSSL_PARAM *paramdef = NULL;
int ishex = 0;
@@ -176,7 +178,7 @@ int OSSL_PARAM_allocate_from_text(OSSL_PARAM *to,
return 0;
if (!prepare_from_text(paramdefs, key, value, value_n,
- &paramdef, &ishex, &buf_n, &tmpbn))
+ &paramdef, &ishex, &buf_n, &tmpbn, found))
return 0;
if ((buf = OPENSSL_zalloc(buf_n > 0 ? buf_n : 1)) == NULL) {