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)
/* Skip over the separator so that vmtp points to the value */
vtmp++;
if (!OSSL_PARAM_allocate_from_text(¶ms[params_n], paramdefs,
- stmp, vtmp, strlen(vtmp)))
+ stmp, vtmp, strlen(vtmp), NULL))
goto err;
OPENSSL_free(stmp);
}
type = OSSL_KDF_PARAM_SCRYPT_N;
if (!OSSL_PARAM_allocate_from_text(¶ms[0], defs, type,
- value, strlen(value)))
+ value, strlen(value), NULL))
return 0;
/*
if (!OSSL_PARAM_allocate_from_text(¶ms[0],
EVP_MAC_settable_ctx_params(mac),
- type, value, strlen(value) + 1))
+ type, value, strlen(value) + 1, NULL))
return 0;
params[1] = OSSL_PARAM_construct_end();
ok = EVP_MAC_CTX_set_params(hctx->ctx, params);
int rv = 0;
if (!OSSL_PARAM_allocate_from_text(¶ms[0], settable, name, value,
- strlen(value)))
+ strlen(value), NULL))
return 0;
if (EVP_PKEY_CTX_set_params(ctx, params))
rv = 1;
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;
key += 3;
p = *paramdef = OSSL_PARAM_locate_const(paramdefs, key);
+ if (found != NULL)
+ *found = p != NULL;
if (p == NULL)
return 0;
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;
return 0;
if (!prepare_from_text(paramdefs, key, value, value_n,
- ¶mdef, &ishex, &buf_n, &tmpbn))
+ ¶mdef, &ishex, &buf_n, &tmpbn, found))
return 0;
if ((buf = OPENSSL_zalloc(buf_n > 0 ? buf_n : 1)) == NULL) {
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);
=head1 DESCRIPTION
should be.
I<buf> needs to be correctly aligned for the type of the B<OSSL_PARAM>
I<key>.
+If <found> is not NULL, it is set to 1 if the parameter can be located and
+to 0 otherwise.
+
The caller must remember to free the data of I<to> when it's not
useful any more.
*vtmp++ = '\0';
if (!OSSL_PARAM_allocate_from_text(¶ms[params_n],
paramdefs, stmp,
- vtmp, strlen(vtmp)))
+ vtmp, strlen(vtmp), NULL))
goto err;
}
params[params_n] = OSSL_PARAM_construct_end();
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);
int OSSL_PARAM_get_int(const OSSL_PARAM *p, int *val);
int OSSL_PARAM_get_uint(const OSSL_PARAM *p, unsigned int *val);
if (!OSSL_PARAM_allocate_from_text(¶ms[i], settables,
t->ctrls[i].name,
t->ctrls[i].value,
- strlen(t->ctrls[i].value)))
+ strlen(t->ctrls[i].value), NULL))
goto end;
}
if (!EVP_KDF_CTX_set_params(ctx, params))
|| !OSSL_PARAM_allocate_from_text(¶ms[params_n],
defined_params,
tmpkey, tmpval,
- strlen(tmpval))) {
+ strlen(tmpval), NULL)) {
OPENSSL_free(tmpkey);
t->err = "MAC_PARAM_ERROR";
goto err;
*p++ = '\0';
rv = OSSL_PARAM_allocate_from_text(kdata->p, defs, name, p,
- p != NULL ? strlen(p) : 0);
+ p != NULL ? strlen(p) : 0, NULL);
*++kdata->p = OSSL_PARAM_construct_end();
if (!rv) {
t->err = "KDF_PARAM_ERROR";