diff options
author | Richard Levitte <levitte@openssl.org> | 2020-08-16 21:25:08 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-08-21 09:23:58 +0200 |
commit | ece9304c96f71277ca95696d9bc49fdec51e9f17 (patch) | |
tree | 7038f8760e1538754bc67371cb5a466a83935dad /providers | |
parent | f650993f1de3dbb5eda9009ad0c4895a7b1b7fe2 (diff) |
Rename OSSL_SERIALIZER / OSSL_DESERIALIZER to OSSL_ENCODE / OSSL_DECODE
Fixes #12455
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12660)
Diffstat (limited to 'providers')
-rw-r--r-- | providers/baseprov.c | 24 | ||||
-rw-r--r-- | providers/decoders.inc | 42 | ||||
-rw-r--r-- | providers/defltprov.c | 24 | ||||
-rw-r--r-- | providers/deserializers.inc | 42 | ||||
-rw-r--r-- | providers/encoders.inc | 112 | ||||
-rw-r--r-- | providers/implementations/build.info | 2 | ||||
-rw-r--r-- | providers/implementations/encode_decode/build.info | 35 | ||||
-rw-r--r-- | providers/implementations/encode_decode/decode_common.c (renamed from providers/implementations/serializers/deserialize_common.c) | 2 | ||||
-rw-r--r-- | providers/implementations/encode_decode/decode_der2key.c (renamed from providers/implementations/serializers/deserialize_der2key.c) | 46 | ||||
-rw-r--r-- | providers/implementations/encode_decode/decode_ms2key.c (renamed from providers/implementations/serializers/deserialize_ms2key.c) | 64 | ||||
-rw-r--r-- | providers/implementations/encode_decode/decode_pem2der.c (renamed from providers/implementations/serializers/deserialize_pem2der.c) | 40 | ||||
-rw-r--r-- | providers/implementations/encode_decode/encoder_common.c (renamed from providers/implementations/serializers/serializer_common.c) | 2 | ||||
-rw-r--r-- | providers/implementations/encode_decode/encoder_dh.c (renamed from providers/implementations/serializers/serializer_dh.c) | 2 | ||||
-rw-r--r-- | providers/implementations/encode_decode/encoder_dh_param.c (renamed from providers/implementations/serializers/serializer_dh_param.c) | 52 | ||||
-rw-r--r-- | providers/implementations/encode_decode/encoder_dh_priv.c (renamed from providers/implementations/serializers/serializer_dh_priv.c) | 86 | ||||
-rw-r--r-- | providers/implementations/encode_decode/encoder_dh_pub.c (renamed from providers/implementations/serializers/serializer_dh_pub.c) | 58 | ||||
-rw-r--r-- | providers/implementations/encode_decode/encoder_dsa.c (renamed from providers/implementations/serializers/serializer_dsa.c) | 2 | ||||
-rw-r--r-- | providers/implementations/encode_decode/encoder_dsa_param.c (renamed from providers/implementations/serializers/serializer_dsa_param.c) | 48 | ||||
-rw-r--r-- | providers/implementations/encode_decode/encoder_dsa_priv.c (renamed from providers/implementations/serializers/serializer_dsa_priv.c) | 84 | ||||
-rw-r--r-- | providers/implementations/encode_decode/encoder_dsa_pub.c (renamed from providers/implementations/serializers/serializer_dsa_pub.c) | 48 | ||||
-rw-r--r-- | providers/implementations/encode_decode/encoder_ec.c (renamed from providers/implementations/serializers/serializer_ec.c) | 2 | ||||
-rw-r--r-- | providers/implementations/encode_decode/encoder_ec_param.c (renamed from providers/implementations/serializers/serializer_ec_param.c) | 54 | ||||
-rw-r--r-- | providers/implementations/encode_decode/encoder_ec_priv.c (renamed from providers/implementations/serializers/serializer_ec_priv.c) | 90 | ||||
-rw-r--r-- | providers/implementations/encode_decode/encoder_ec_pub.c (renamed from providers/implementations/serializers/serializer_ec_pub.c) | 49 | ||||
-rw-r--r-- | providers/implementations/encode_decode/encoder_ecx.c (renamed from providers/implementations/serializers/serializer_ecx.c) | 2 | ||||
-rw-r--r-- | providers/implementations/encode_decode/encoder_ecx_priv.c (renamed from providers/implementations/serializers/serializer_ecx_priv.c) | 108 | ||||
-rw-r--r-- | providers/implementations/encode_decode/encoder_ecx_pub.c (renamed from providers/implementations/serializers/serializer_ecx_pub.c) | 60 | ||||
-rw-r--r-- | providers/implementations/encode_decode/encoder_ffc_params.c (renamed from providers/implementations/serializers/serializer_ffc_params.c) | 2 | ||||
-rw-r--r-- | providers/implementations/encode_decode/encoder_local.h (renamed from providers/implementations/serializers/serializer_local.h) | 2 | ||||
-rw-r--r-- | providers/implementations/encode_decode/encoder_rsa.c (renamed from providers/implementations/serializers/serializer_rsa.c) | 4 | ||||
-rw-r--r-- | providers/implementations/encode_decode/encoder_rsa_priv.c (renamed from providers/implementations/serializers/serializer_rsa_priv.c) | 84 | ||||
-rw-r--r-- | providers/implementations/encode_decode/encoder_rsa_pub.c (renamed from providers/implementations/serializers/serializer_rsa_pub.c) | 48 | ||||
-rw-r--r-- | providers/implementations/include/prov/implementations.h | 146 | ||||
-rw-r--r-- | providers/implementations/serializers/build.info | 35 | ||||
-rw-r--r-- | providers/serializers.inc | 112 |
35 files changed, 805 insertions, 808 deletions
diff --git a/providers/baseprov.c b/providers/baseprov.c index 917bf680d4..eb0e4afbd3 100644 --- a/providers/baseprov.c +++ b/providers/baseprov.c @@ -64,37 +64,37 @@ static int base_get_params(void *provctx, OSSL_PARAM params[]) return 1; } -static const OSSL_ALGORITHM base_serializer[] = { -#define SER(name, fips, format, type, func_table) \ +static const OSSL_ALGORITHM base_encoder[] = { +#define ENCODER(name, fips, format, type, func_table) \ { name, \ "provider=base,fips=" fips ",format=" format ",type=" type, \ (func_table) } -#include "serializers.inc" +#include "encoders.inc" { NULL, NULL, NULL } }; -#undef SER +#undef ENCODER -static const OSSL_ALGORITHM base_deserializer[] = { -#define DESER(name, fips, input, func_table) \ +static const OSSL_ALGORITHM base_decoder[] = { +#define DECODER(name, fips, input, func_table) \ { name, \ "provider=base,fips=" fips ",input=" input, \ (func_table) } -#include "deserializers.inc" +#include "decoders.inc" { NULL, NULL, NULL } }; -#undef DESER +#undef DECODER static const OSSL_ALGORITHM *base_query(void *provctx, int operation_id, int *no_cache) { *no_cache = 0; switch (operation_id) { - case OSSL_OP_SERIALIZER: - return base_serializer; - case OSSL_OP_DESERIALIZER: - return base_deserializer; + case OSSL_OP_ENCODER: + return base_encoder; + case OSSL_OP_DECODER: + return base_decoder; } return NULL; } diff --git a/providers/decoders.inc b/providers/decoders.inc new file mode 100644 index 0000000000..d8c6da72e1 --- /dev/null +++ b/providers/decoders.inc @@ -0,0 +1,42 @@ +/* + * Copyright 2020 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 + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef DECODER +# error Macro DECODER undefined +#endif + +#ifndef OPENSSL_NO_DH + DECODER("DH", "yes", "der", der_to_dh_decoder_functions), + DECODER("DHX", "yes", "der", der_to_dhx_decoder_functions), +#endif +#ifndef OPENSSL_NO_DSA + DECODER("DSA", "yes", "der", der_to_dsa_decoder_functions), + DECODER("DSA", "yes", "mblob", msblob_to_dsa_decoder_functions), +# ifndef OPENSSL_NO_RC4 + DECODER("DSA", "yes", "pvk", pvk_to_dsa_decoder_functions), +# endif +#endif +#ifndef OPENSSL_NO_EC + DECODER("EC", "yes", "der", der_to_ec_decoder_functions), + DECODER("ED25519", "yes", "der", der_to_ed25519_decoder_functions), + DECODER("ED448", "yes", "der", der_to_ed448_decoder_functions), + DECODER("X25519", "yes", "der", der_to_x25519_decoder_functions), + DECODER("X448", "yes", "der", der_to_x448_decoder_functions), +#endif + DECODER("RSA", "yes", "der", der_to_rsa_decoder_functions), + DECODER("RSA-PSS", "yes", "der", der_to_rsapss_decoder_functions), +#ifndef OPENSSL_NO_DSA + DECODER("RSA", "yes", "mblob", msblob_to_rsa_decoder_functions), +# ifndef OPENSSL_NO_RC4 + DECODER("RSA", "yes", "pvk", pvk_to_rsa_decoder_functions), +# endif +#endif + + DECODER("DER", "yes", "pem", pem_to_der_decoder_functions), + diff --git a/providers/defltprov.c b/providers/defltprov.c index 083373a066..9aefa801a1 100644 --- a/providers/defltprov.c +++ b/providers/defltprov.c @@ -395,27 +395,27 @@ static const OSSL_ALGORITHM deflt_keymgmt[] = { { NULL, NULL, NULL } }; -static const OSSL_ALGORITHM deflt_serializer[] = { -#define SER(name, fips, format, type, func_table) \ +static const OSSL_ALGORITHM deflt_encoder[] = { +#define ENCODER(name, fips, format, type, func_table) \ { name, \ "provider=default,fips=" fips ",format=" format ",type=" type, \ (func_table) } -#include "serializers.inc" +#include "encoders.inc" { NULL, NULL, NULL } }; -#undef SER +#undef ENCODER -static const OSSL_ALGORITHM deflt_deserializer[] = { -#define DESER(name, fips, input, func_table) \ +static const OSSL_ALGORITHM deflt_decoder[] = { +#define DECODER(name, fips, input, func_table) \ { name, \ "provider=default,fips=" fips ",input=" input, \ (func_table) } -#include "deserializers.inc" +#include "decoders.inc" { NULL, NULL, NULL } }; -#undef DESER +#undef DECODER static const OSSL_ALGORITHM *deflt_query(void *provctx, int operation_id, int *no_cache) @@ -441,10 +441,10 @@ static const OSSL_ALGORITHM *deflt_query(void *provctx, int operation_id, return deflt_signature; case OSSL_OP_ASYM_CIPHER: return deflt_asym_cipher; - case OSSL_OP_SERIALIZER: - return deflt_serializer; - case OSSL_OP_DESERIALIZER: - return deflt_deserializer; + case OSSL_OP_ENCODER: + return deflt_encoder; + case OSSL_OP_DECODER: + return deflt_decoder; } return NULL; } diff --git a/providers/deserializers.inc b/providers/deserializers.inc deleted file mode 100644 index 2e363143b8..0000000000 --- a/providers/deserializers.inc +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2020 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 - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#ifndef DESER -# error Macro DESER undefined -#endif - -#ifndef OPENSSL_NO_DH - DESER("DH", "yes", "der", der_to_dh_deserializer_functions), - DESER("DHX", "yes", "der", der_to_dhx_deserializer_functions), -#endif -#ifndef OPENSSL_NO_DSA - DESER("DSA", "yes", "der", der_to_dsa_deserializer_functions), - DESER("DSA", "yes", "mblob", msblob_to_dsa_deserializer_functions), -# ifndef OPENSSL_NO_RC4 - DESER("DSA", "yes", "pvk", pvk_to_dsa_deserializer_functions), -# endif -#endif -#ifndef OPENSSL_NO_EC - DESER("EC", "yes", "der", der_to_ec_deserializer_functions), - DESER("ED25519", "yes", "der", der_to_ed25519_deserializer_functions), - DESER("ED448", "yes", "der", der_to_ed448_deserializer_functions), - DESER("X25519", "yes", "der", der_to_x25519_deserializer_functions), - DESER("X448", "yes", "der", der_to_x448_deserializer_functions), -#endif - DESER("RSA", "yes", "der", der_to_rsa_deserializer_functions), - DESER("RSA-PSS", "yes", "der", der_to_rsapss_deserializer_functions), -#ifndef OPENSSL_NO_DSA - DESER("RSA", "yes", "mblob", msblob_to_rsa_deserializer_functions), -# ifndef OPENSSL_NO_RC4 - DESER("RSA", "yes", "pvk", pvk_to_rsa_deserializer_functions), -# endif -#endif - - DESER("DER", "yes", "pem", pem_to_der_deserializer_functions), - diff --git a/providers/encoders.inc b/providers/encoders.inc new file mode 100644 index 0000000000..4d894a73e5 --- /dev/null +++ b/providers/encoders.inc @@ -0,0 +1,112 @@ +/* + * Copyright 2020 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 + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef ENCODER +# error Macro ENCODER undefined +#endif + + ENCODER("RSA", "yes", "text", "private", rsa_priv_text_encoder_functions), + ENCODER("RSA", "yes", "text", "public", rsa_pub_text_encoder_functions), + ENCODER("RSA", "yes", "der", "private", rsa_priv_der_encoder_functions), + ENCODER("RSA", "yes", "der", "public", rsa_pub_der_encoder_functions), + ENCODER("RSA", "yes", "pem", "private", rsa_priv_pem_encoder_functions), + ENCODER("RSA", "yes", "pem", "public", rsa_pub_pem_encoder_functions), + ENCODER("RSA-PSS", "yes", "text", "private", + rsa_priv_text_encoder_functions), + ENCODER("RSA-PSS", "yes", "text", "public", rsa_pub_text_encoder_functions), + ENCODER("RSA-PSS", "yes", "der", "private", rsa_priv_der_encoder_functions), + ENCODER("RSA-PSS", "yes", "der", "public", rsa_pub_der_encoder_functions), + ENCODER("RSA-PSS", "yes", "pem", "private", rsa_priv_pem_encoder_functions), + ENCODER("RSA-PSS", "yes", "pem", "public", rsa_pub_pem_encoder_functions), + +#ifndef OPENSSL_NO_DH + ENCODER("DH", "yes", "text", "private", dh_priv_text_encoder_functions), + ENCODER("DH", "yes", "text", "public", dh_pub_text_encoder_functions), + ENCODER("DH", "yes", "text", "parameters", dh_param_text_encoder_functions), + ENCODER("DH", "yes", "der", "private", dh_priv_der_encoder_functions), + ENCODER("DH", "yes", "der", "public", dh_pub_der_encoder_functions), + ENCODER("DH", "yes", "der", "parameters", dh_param_der_encoder_functions), + ENCODER("DH", "yes", "pem", "private", dh_priv_pem_encoder_functions), + ENCODER("DH", "yes", "pem", "public", dh_pub_pem_encoder_functions), + ENCODER("DH", "yes", "pem", "parameters", dh_param_pem_encoder_functions), + + ENCODER("DHX", "yes", "text", "private", dh_priv_text_encoder_functions), + ENCODER("DHX", "yes", "text", "public", dh_pub_text_encoder_functions), + ENCODER("DHX", "yes", "text", "parameters", dh_param_text_encoder_functions), + ENCODER("DHX", "yes", "der", "private", dh_priv_der_encoder_functions), + ENCODER("DHX", "yes", "der", "public", dh_pub_der_encoder_functions), + ENCODER("DHX", "yes", "der", "parameters", dh_param_der_encoder_functions), + ENCODER("DHX", "yes", "pem", "private", dh_priv_pem_encoder_functions), + ENCODER("DHX", "yes", "pem", "public", dh_pub_pem_encoder_functions), + ENCODER("DHX", "yes", "pem", "parameters", dh_param_pem_encoder_functions), +#endif + +#ifndef OPENSSL_NO_DSA + ENCODER("DSA", "yes", "text", "private", dsa_priv_text_encoder_functions), + ENCODER("DSA", "yes", "text", "public", dsa_pub_text_encoder_functions), + ENCODER("DSA", "yes", "text", "parameters", + dsa_param_text_encoder_functions), + ENCODER("DSA", "yes", "der", "private", dsa_priv_der_encoder_functions), + ENCODER("DSA", "yes", "der", "public", dsa_pub_der_encoder_functions), + ENCODER("DSA", "yes", "der", "parameters", dsa_param_der_encoder_functions), + ENCODER("DSA", "yes", "pem", "private", dsa_priv_pem_encoder_functions), + ENCODER("DSA", "yes", "pem", "public", dsa_pub_pem_encoder_functions), + ENCODER("DSA", "yes", "pem", "parameters", dsa_param_pem_encoder_functions), +#endif + +#ifndef OPENSSL_NO_EC + ENCODER("X25519", "yes", "text", "private", + x25519_priv_print_encoder_functions), + ENCODER("X25519", "yes", "text", "public", + x25519_pub_print_encoder_functions), + ENCODER("X25519", "yes", "der", "private", + x25519_priv_der_encoder_functions), + ENCODER("X25519", "yes", "der", "public", x25519_pub_der_encoder_functions), + ENCODER("X25519", "yes", "pem", "private", + x25519_priv_pem_encoder_functions), + ENCODER("X25519", "yes", "pem", "public", x25519_pub_pem_encoder_functions), + + ENCODER("X448", "no", "text", "private", x448_priv_print_encoder_functions), + ENCODER("X448", "no", "text", "public", x448_pub_print_encoder_functions), + ENCODER("X448", "no", "der", "private", x448_priv_der_encoder_functions), + ENCODER("X448", "no", "der", "public", x448_pub_der_encoder_functions), + ENCODER("X448", "no", "pem", "private", x448_priv_pem_encoder_functions), + ENCODER("X448", "no", "pem", "public", x448_pub_pem_encoder_functions), + + ENCODER("ED25519", "yes", "text", "private", + ed25519_priv_print_encoder_functions), + ENCODER("ED25519", "yes", "text", "public", + ed25519_pub_print_encoder_functions), + ENCODER("ED25519", "yes", "der", "private", + ed25519_priv_der_encoder_functions), + ENCODER("ED25519", "yes", "der", "public", + ed25519_pub_der_encoder_functions), + ENCODER("ED25519", "yes", "pem", "private", + ed25519_priv_pem_encoder_functions), + ENCODER("ED25519", "yes", "pem", "public", + ed25519_pub_pem_encoder_functions), + + ENCODER("ED448", "no", "text", "private", + ed448_priv_print_encoder_functions), + ENCODER("ED448", "no", "text", "public", ed448_pub_print_encoder_functions), + ENCODER("ED448", "no", "der", "private", ed448_priv_der_encoder_functions), + ENCODER("ED448", "no", "der", "public", ed448_pub_der_encoder_functions), + ENCODER("ED448", "no", "pem", "private", ed448_priv_pem_encoder_functions), + ENCODER("ED448", "no", "pem", "public", ed448_pub_pem_encoder_functions), + + ENCODER("EC", "yes", "text", "private", ec_priv_text_encoder_functions), + ENCODER("EC", "yes", "text", "public", ec_pub_text_encoder_functions), + ENCODER("EC", "yes", "text", "parameters", ec_param_text_encoder_functions), + ENCODER("EC", "yes", "der", "private", ec_priv_der_encoder_functions), + ENCODER("EC", "yes", "der", "public", ec_pub_der_encoder_functions), + ENCODER("EC", "yes", "der", "parameters", ec_param_der_encoder_functions), + ENCODER("EC", "yes", "pem", "private", ec_priv_pem_encoder_functions), + ENCODER("EC", "yes", "pem", "public", ec_pub_pem_encoder_functions), + ENCODER("EC", "yes", "pem", "parameters", ec_param_pem_encoder_functions), +#endif diff --git a/providers/implementations/build.info b/providers/implementations/build.info index 839478ef36..54392cf68b 100644 --- a/providers/implementations/build.info +++ b/providers/implementations/build.info @@ -1,2 +1,2 @@ SUBDIRS=digests ciphers rands macs kdfs exchange keymgmt signature asymciphers \ - serializers + encode_decode diff --git a/providers/implementations/encode_decode/build.info b/providers/implementations/encode_decode/build.info new file mode 100644 index 0000000000..3e78849dfc --- /dev/null +++ b/providers/implementations/encode_decode/build.info @@ -0,0 +1,35 @@ +# We make separate GOAL variables for each algorithm, to make it easy to +# switch each to the Legacy provider when needed. + +$ENCODER_GOAL=../../libimplementations.a +$DECODER_GOAL=../../libimplementations.a +$RSA_GOAL=../../libimplementations.a +$FFC_GOAL=../../libimplementations.a +$DH_GOAL=../../libimplementations.a +$DSA_GOAL=../../libimplementations.a +$ECX_GOAL=../../libimplementations.a +$EC_GOAL=../../libimplementations.a + +SOURCE[$ENCODER_GOAL]=encoder_common.c decode_common.c + +SOURCE[$DECODER_GOAL]=decode_der2key.c decode_pem2der.c +IF[{- !$disabled{dsa} -}] + SOURCE[$DECODER_GOAL]=decode_ms2key.c +ENDIF + +SOURCE[$RSA_GOAL]=encoder_rsa.c encoder_rsa_priv.c encoder_rsa_pub.c +DEPEND[encoder_rsa.o]=../../common/include/prov/der_rsa.h + +IF[{- !$disabled{"dh"} || !$disabled{"dsa"} -}] + SOURCE[$FFC_GOAL]=encoder_ffc_params.c +ENDIF +IF[{- !$disabled{dh} -}] + SOURCE[$DH_GOAL]=encoder_dh.c encoder_dh_priv.c encoder_dh_pub.c encoder_dh_param.c +ENDIF +IF[{- !$disabled{dsa} -}] + SOURCE[$DSA_GOAL]=encoder_dsa.c encoder_dsa_priv.c encoder_dsa_pub.c encoder_dsa_param.c +ENDIF +IF[{- !$disabled{ec} -}] + SOURCE[$ECX_GOAL]=encoder_ecx.c encoder_ecx_priv.c encoder_ecx_pub.c + SOURCE[$EC_GOAL]=encoder_ec.c encoder_ec_priv.c encoder_ec_pub.c encoder_ec_param.c +ENDIF diff --git a/providers/implementations/serializers/deserialize_common.c b/providers/implementations/encode_decode/decode_common.c index 54c63347fd..1b5eea4c8d 100644 --- a/providers/implementations/serializers/deserialize_common.c +++ b/providers/implementations/encode_decode/decode_common.c @@ -18,7 +18,7 @@ #include "crypto/asn1.h" #include "prov/bio.h" /* ossl_prov_bio_printf() */ #include "prov/providercommonerr.h" /* PROV_R_READ_KEY */ -#include "serializer_local.h" +#include "encoder_local.h" int ossl_prov_read_der(PROV_CTX *provctx, OSSL_CORE_BIO *cin, unsigned char **data, long *len) diff --git a/providers/implementations/serializers/deserialize_der2key.c b/providers/implementations/encode_decode/decode_der2key.c index 6975c9ceab..6af1c0927d 100644 --- a/providers/implementations/serializers/deserialize_der2key.c +++ b/providers/implementations/encode_decode/decode_der2key.c @@ -20,15 +20,15 @@ #include <openssl/x509.h> #include "prov/bio.h" #include "prov/implementations.h" -#include "serializer_local.h" +#include "encoder_local.h" -static OSSL_FUNC_deserializer_newctx_fn der2rsa_newctx; +static OSSL_FUNC_decoder_newctx_fn der2rsa_newctx; -static OSSL_FUNC_deserializer_freectx_fn der2key_freectx; -static OSSL_FUNC_deserializer_gettable_params_fn der2key_gettable_params; -static OSSL_FUNC_deserializer_get_params_fn der2key_get_params; -static OSSL_FUNC_deserializer_deserialize_fn der2key_deserialize; -static OSSL_FUNC_deserializer_export_object_fn der2key_export_object; +static OSSL_FUNC_decoder_freectx_fn der2key_freectx; +static OSSL_FUNC_decoder_gettable_params_fn der2key_gettable_params; +static OSSL_FUNC_decoder_get_params_fn der2key_get_params; +static OSSL_FUNC_decoder_decode_fn der2key_decode; +static OSSL_FUNC_decoder_export_object_fn der2key_export_object; typedef void *(extract_key_fn)(EVP_PKEY *); typedef void (free_key_fn)(void *); @@ -46,7 +46,7 @@ struct keytype_desc_st { }; /* - * Context used for DER to key deserialization. + * Context used for DER to key decoding. */ struct der2key_ctx_st { PROV_CTX *provctx; @@ -75,7 +75,7 @@ static void der2key_freectx(void *vctx) static const OSSL_PARAM *der2key_gettable_params(void *provctx) { static const OSSL_PARAM gettables[] = { - { OSSL_DESERIALIZER_PARAM_INPUT_TYPE, OSSL_PARAM_UTF8_PTR, NULL, 0, 0 }, + { OSSL_DECODER_PARAM_INPUT_TYPE, OSSL_PARAM_UTF8_PTR, NULL, 0, 0 }, OSSL_PARAM_END, }; @@ -86,16 +86,16 @@ static int der2key_get_params(OSSL_PARAM params[]) { OSSL_PARAM *p; - p = OSSL_PARAM_locate(params, OSSL_DESERIALIZER_PARAM_INPUT_TYPE); + p = OSSL_PARAM_locate(params, OSSL_DECODER_PARAM_INPUT_TYPE); if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, "DER")) return 0; return 1; } -static int der2key_deserialize(void *vctx, OSSL_CORE_BIO *cin, - OSSL_CALLBACK *data_cb, void *data_cbarg, - OSSL_PASSPHRASE_CALLBACK *pw_cb, void *pw_cbarg) +static int der2key_decode(void *vctx, OSSL_CORE_BIO *cin, + OSSL_CALLBACK *data_cb, void *data_cbarg, + OSSL_PASSPHRASE_CALLBACK *pw_cb, void *pw_cbarg) { struct der2key_ctx_st *ctx = vctx; void *libctx = PROV_LIBRARY_CONTEXT_OF(ctx->provctx); @@ -160,11 +160,11 @@ static int der2key_deserialize(void *vctx, OSSL_CORE_BIO *cin, OSSL_PARAM params[3]; params[0] = - OSSL_PARAM_construct_utf8_string(OSSL_DESERIALIZER_PARAM_DATA_TYPE, + OSSL_PARAM_construct_utf8_string(OSSL_DECODER_PARAM_DATA_TYPE, (char *)ctx->desc->name, 0); /* The address of the key becomes the octet string */ params[1] = - OSSL_PARAM_construct_octet_string(OSSL_DESERIALIZER_PARAM_REFERENCE, + OSSL_PARAM_construct_octet_string(OSSL_DECODER_PARAM_REFERENCE, &key, sizeof(key)); params[2] = OSSL_PARAM_construct_end(); @@ -203,18 +203,18 @@ static int der2key_export_object(void *vctx, { \ return der2key_newctx(provctx, &keytype##_desc); \ } \ - const OSSL_DISPATCH der_to_##keytype##_deserializer_functions[] = { \ - { OSSL_FUNC_DESERIALIZER_NEWCTX, \ + const OSSL_DISPATCH der_to_##keytype##_decoder_functions[] = { \ + { OSSL_FUNC_DECODER_NEWCTX, \ (void (*)(void))der2##keytype##_newctx }, \ - { OSSL_FUNC_DESERIALIZER_FREECTX, \ + { OSSL_FUNC_DECODER_FREECTX, \ (void (*)(void))der2key_freectx }, \ - { OSSL_FUNC_DESERIALIZER_GETTABLE_PARAMS, \ + { OSSL_FUNC_DECODER_GETTABLE_PARAMS, \ (void (*)(void))der2key_gettable_params }, \ - { OSSL_FUNC_DESERIALIZER_GET_PARAMS, \ + { OSSL_FUNC_DECODER_GET_PARAMS, \ (void (*)(void))der2key_get_params }, \ - { OSSL_FUNC_DESERIALIZER_DESERIALIZE, \ - (void (*)(void))der2key_deserialize }, \ - { OSSL_FUNC_DESERIALIZER_EXPORT_OBJECT, \ + { OSSL_FUNC_DECODER_DECODE, \ + (void (*)(void))der2key_decode }, \ + { OSSL_FUNC_DECODER_EXPORT_OBJECT, \ (void (*)(void))der2key_export_object }, \ { 0, NULL } \ } diff --git a/providers/implementations/serializers/deserialize_ms2key.c b/providers/implementations/encode_decode/decode_ms2key.c index 8b9ddec6a0..453e8188b3 100644 --- a/providers/implementations/serializers/deserialize_ms2key.c +++ b/providers/implementations/encode_decode/decode_ms2key.c @@ -21,19 +21,19 @@ #include "internal/pem.h" /* For PVK and "blob" PEM headers */ #include "prov/bio.h" #include "prov/implementations.h" -#include "serializer_local.h" +#include "encoder_local.h" -static OSSL_FUNC_deserializer_freectx_fn ms2key_freectx; -static OSSL_FUNC_deserializer_gettable_params_fn ms2key_gettable_params; -static OSSL_FUNC_deserializer_get_params_fn msblob2key_get_params; +static OSSL_FUNC_decoder_freectx_fn ms2key_freectx; +static OSSL_FUNC_decoder_gettable_params_fn ms2key_gettable_params; +static OSSL_FUNC_decoder_get_params_fn msblob2key_get_params; #ifndef OPENSSL_NO_RC4 -static OSSL_FUNC_deserializer_get_params_fn pvk2key_get_params; +static OSSL_FUNC_decoder_get_params_fn pvk2key_get_params; #endif -static OSSL_FUNC_deserializer_deserialize_fn msblob2key_deserialize; +static OSSL_FUNC_decoder_decode_fn msblob2key_decode; #ifndef OPENSSL_NO_RC4 -static OSSL_FUNC_deserializer_deserialize_fn pvk2key_deserialize; +static OSSL_FUNC_decoder_decode_fn pvk2key_decode; #endif -static OSSL_FUNC_deserializer_export_object_fn ms2key_export_object; +static OSSL_FUNC_decoder_export_object_fn ms2key_export_object; typedef void *(extract_key_fn)(EVP_PKEY *); typedef void (free_key_fn)(void *); @@ -51,7 +51,7 @@ struct keytype_desc_st { }; /* - * Context used for DER to key deserialization. + * Context used for DER to key decoding. */ struct ms2key_ctx_st { PROV_CTX *provctx; @@ -80,7 +80,7 @@ static void ms2key_freectx(void *vctx) static const OSSL_PARAM *ms2key_gettable_params(ossl_unused void *provctx) { static const OSSL_PARAM gettables[] = { - { OSSL_DESERIALIZER_PARAM_INPUT_TYPE, OSSL_PARAM_UTF8_PTR, NULL, 0, 0 }, + { OSSL_DECODER_PARAM_INPUT_TYPE, OSSL_PARAM_UTF8_PTR, NULL, 0, 0 }, OSSL_PARAM_END, }; @@ -91,7 +91,7 @@ static int msblob2key_get_params(OSSL_PARAM params[]) { OSSL_PARAM *p; - p = OSSL_PARAM_locate(params, OSSL_DESERIALIZER_PARAM_INPUT_TYPE); + p = OSSL_PARAM_locate(params, OSSL_DECODER_PARAM_INPUT_TYPE); if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, "MSBLOB")) return 0; @@ -103,7 +103,7 @@ static int pvk2key_get_params(OSSL_PARAM params[]) { OSSL_PARAM *p; - p = OSSL_PARAM_locate(params, OSSL_DESERIALIZER_PARAM_INPUT_TYPE); + p = OSSL_PARAM_locate(params, OSSL_DECODER_PARAM_INPUT_TYPE); if (p != NULL && !OSSL_PARAM_set_utf8_ptr(p, "PVK")) return 0; @@ -134,11 +134,11 @@ static int ms2key_post(struct ms2key_ctx_st *ctx, EVP_PKEY *pkey, OSSL_PARAM params[3]; params[0] = - OSSL_PARAM_construct_utf8_string(OSSL_DESERIALIZER_PARAM_DATA_TYPE, + OSSL_PARAM_construct_utf8_string(OSSL_DECODER_PARAM_DATA_TYPE, (char *)ctx->desc->name, 0); /* The address of the key becomes the octet string */ params[1] = - OSSL_PARAM_construct_octet_string(OSSL_DESERIALIZER_PARAM_REFERENCE, + OSSL_PARAM_construct_octet_string(OSSL_DECODER_PARAM_REFERENCE, &key, sizeof(key)); params[2] = OSSL_PARAM_construct_end(); @@ -149,10 +149,9 @@ static int ms2key_post(struct ms2key_ctx_st *ctx, EVP_PKEY *pkey, return ok; } -static int msblob2key_deserialize(void *vctx, OSSL_CORE_BIO *cin, - OSSL_CALLBACK *data_cb, void *data_cbarg, - OSSL_PASSPHRASE_CALLBACK *pw_cb, - void *pw_cbarg) +static int msblob2key_decode(void *vctx, OSSL_CORE_BIO *cin, + OS |