mirror of https://github.com/openssl/openssl.git
decode_spki2typespki: 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
f9a5796357
commit
3b69c40a27
|
@ -6,13 +6,18 @@
|
|||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
{-
|
||||
use OpenSSL::paramnames qw(produce_param_decoder);
|
||||
-}
|
||||
|
||||
#include <string.h>
|
||||
#include <openssl/asn1t.h>
|
||||
#include <openssl/core_names.h>
|
||||
#include <openssl/core_object.h>
|
||||
#include <openssl/params.h>
|
||||
#include <openssl/proverr.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include "internal/sizes.h"
|
||||
#include "crypto/x509.h"
|
||||
#include "crypto/ec.h"
|
||||
|
@ -52,23 +57,27 @@ static void spki2typespki_freectx(void *vctx)
|
|||
OPENSSL_free(ctx);
|
||||
}
|
||||
|
||||
{- produce_param_decoder('spki2typespki_set_ctx_params',
|
||||
(['DECODER_PARAM_PROPERTIES', 'propq', 'utf8_string'],
|
||||
)); -}
|
||||
|
||||
static const OSSL_PARAM *spki2typespki_settable_ctx_params(ossl_unused void *provctx)
|
||||
{
|
||||
static const OSSL_PARAM settables[] = {
|
||||
OSSL_PARAM_utf8_string(OSSL_DECODER_PARAM_PROPERTIES, NULL, 0),
|
||||
OSSL_PARAM_END
|
||||
};
|
||||
return settables;
|
||||
return spki2typespki_set_ctx_params_list;
|
||||
}
|
||||
|
||||
static int spki2typespki_set_ctx_params(void *vctx, const OSSL_PARAM params[])
|
||||
{
|
||||
struct spki2typespki_ctx_st *ctx = vctx;
|
||||
const OSSL_PARAM *p;
|
||||
char *str = ctx->propq;
|
||||
struct spki2typespki_set_ctx_params_st p;
|
||||
char *str;
|
||||
|
||||
p = OSSL_PARAM_locate_const(params, OSSL_DECODER_PARAM_PROPERTIES);
|
||||
if (p != NULL && !OSSL_PARAM_get_utf8_string(p, &str, sizeof(ctx->propq)))
|
||||
if (ctx == NULL || !spki2typespki_set_ctx_params_decoder(params, &p))
|
||||
return 0;
|
||||
|
||||
str = ctx->propq;
|
||||
if (p.propq != NULL
|
||||
&& !OSSL_PARAM_get_utf8_string(p.propq, &str, sizeof(ctx->propq)))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue