mirror of https://github.com/openssl/openssl.git
decode_der2key: convert to use generated parameter parsing
Reviewed-by: Paul Yang <paulyang.inf@gmail.com> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/28152)
This commit is contained in:
parent
33651beaf7
commit
360388e55d
|
|
@ -6,6 +6,9 @@
|
||||||
* in the file LICENSE in the source distribution or at
|
* in the file LICENSE in the source distribution or at
|
||||||
* https://www.openssl.org/source/license.html
|
* https://www.openssl.org/source/license.html
|
||||||
*/
|
*/
|
||||||
|
{-
|
||||||
|
use OpenSSL::paramnames qw(produce_param_decoder);
|
||||||
|
-}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* low level APIs are deprecated for public use, but still ok for
|
* low level APIs are deprecated for public use, but still ok for
|
||||||
|
|
@ -42,8 +45,8 @@
|
||||||
#include "prov/implementations.h"
|
#include "prov/implementations.h"
|
||||||
#include "prov/endecoder_local.h"
|
#include "prov/endecoder_local.h"
|
||||||
#include "internal/nelem.h"
|
#include "internal/nelem.h"
|
||||||
#include "ml_dsa_codecs.h"
|
#include "prov/ml_dsa_codecs.h"
|
||||||
#include "ml_kem_codecs.h"
|
#include "prov/ml_kem_codecs.h"
|
||||||
|
|
||||||
#ifndef OPENSSL_NO_SLH_DSA
|
#ifndef OPENSSL_NO_SLH_DSA
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -169,23 +172,27 @@ der2key_newctx(void *provctx, const struct keytype_desc_st *desc)
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{- produce_param_decoder('der2key_set_ctx_params',
|
||||||
|
(['DECODER_PARAM_PROPERTIES', 'propq', 'utf8_string'],
|
||||||
|
)); -}
|
||||||
|
|
||||||
static const OSSL_PARAM *der2key_settable_ctx_params(ossl_unused void *provctx)
|
static const OSSL_PARAM *der2key_settable_ctx_params(ossl_unused void *provctx)
|
||||||
{
|
{
|
||||||
static const OSSL_PARAM settables[] = {
|
return der2key_set_ctx_params_list;
|
||||||
OSSL_PARAM_utf8_string(OSSL_DECODER_PARAM_PROPERTIES, NULL, 0),
|
|
||||||
OSSL_PARAM_END
|
|
||||||
};
|
|
||||||
return settables;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int der2key_set_ctx_params(void *vctx, const OSSL_PARAM params[])
|
static int der2key_set_ctx_params(void *vctx, const OSSL_PARAM params[])
|
||||||
{
|
{
|
||||||
struct der2key_ctx_st *ctx = vctx;
|
struct der2key_ctx_st *ctx = vctx;
|
||||||
const OSSL_PARAM *p;
|
struct der2key_set_ctx_params_st p;
|
||||||
char *str = ctx->propq;
|
char *str;
|
||||||
|
|
||||||
p = OSSL_PARAM_locate_const(params, OSSL_DECODER_PARAM_PROPERTIES);
|
if (ctx == NULL || !der2key_set_ctx_params_decoder(params, &p))
|
||||||
if (p != NULL && !OSSL_PARAM_get_utf8_string(p, &str, sizeof(ctx->propq)))
|
return 0;
|
||||||
|
|
||||||
|
str = ctx->propq;
|
||||||
|
if (p.propq != NULL
|
||||||
|
&& !OSSL_PARAM_get_utf8_string(p.propq, &str, sizeof(ctx->propq)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue