Lines Matching full:decoder
12 #include <openssl/decoder.h>
18 #include "crypto/decoder.h"
22 * Decoder can have multiple names, separated with colons in a name string
29 OSSL_DECODER *decoder = NULL; in ossl_decoder_new() local
31 if ((decoder = OPENSSL_zalloc(sizeof(*decoder))) == NULL in ossl_decoder_new()
32 || (decoder->base.lock = CRYPTO_THREAD_lock_new()) == NULL) { in ossl_decoder_new()
33 OSSL_DECODER_free(decoder); in ossl_decoder_new()
38 decoder->base.refcnt = 1; in ossl_decoder_new()
40 return decoder; in ossl_decoder_new()
43 int OSSL_DECODER_up_ref(OSSL_DECODER *decoder) in OSSL_DECODER_up_ref() argument
47 CRYPTO_UP_REF(&decoder->base.refcnt, &ref, decoder->base.lock); in OSSL_DECODER_up_ref()
51 void OSSL_DECODER_free(OSSL_DECODER *decoder) in OSSL_DECODER_free() argument
55 if (decoder == NULL) in OSSL_DECODER_free()
58 CRYPTO_DOWN_REF(&decoder->base.refcnt, &ref, decoder->base.lock); in OSSL_DECODER_free()
61 OPENSSL_free(decoder->base.name); in OSSL_DECODER_free()
62 ossl_property_free(decoder->base.parsed_propdef); in OSSL_DECODER_free()
63 ossl_provider_free(decoder->base.prov); in OSSL_DECODER_free()
64 CRYPTO_THREAD_lock_free(decoder->base.lock); in OSSL_DECODER_free()
65 OPENSSL_free(decoder); in OSSL_DECODER_free()
68 /* Permanent decoder method store, constructor and destructor */
100 * Generic routines to fetch / create DECODER methods with
104 /* Temporary decoder method store, constructor and destructor */
120 /* Get the permanent decoder store */
149 /* Get decoder methods from a store, or put one in */
219 /* Create and populate a decoder method */
223 OSSL_DECODER *decoder = NULL; in ossl_decoder_from_algorithm() local
227 if ((decoder = ossl_decoder_new()) == NULL) in ossl_decoder_from_algorithm()
229 decoder->base.id = id; in ossl_decoder_from_algorithm()
230 if ((decoder->base.name = ossl_algorithm_get1_first_name(algodef)) == NULL) { in ossl_decoder_from_algorithm()
231 OSSL_DECODER_free(decoder); in ossl_decoder_from_algorithm()
234 decoder->base.algodef = algodef; in ossl_decoder_from_algorithm()
235 if ((decoder->base.parsed_propdef in ossl_decoder_from_algorithm()
237 OSSL_DECODER_free(decoder); in ossl_decoder_from_algorithm()
244 if (decoder->newctx == NULL) in ossl_decoder_from_algorithm()
245 decoder->newctx = OSSL_FUNC_decoder_newctx(fns); in ossl_decoder_from_algorithm()
248 if (decoder->freectx == NULL) in ossl_decoder_from_algorithm()
249 decoder->freectx = OSSL_FUNC_decoder_freectx(fns); in ossl_decoder_from_algorithm()
252 if (decoder->get_params == NULL) in ossl_decoder_from_algorithm()
253 decoder->get_params = in ossl_decoder_from_algorithm()
257 if (decoder->gettable_params == NULL) in ossl_decoder_from_algorithm()
258 decoder->gettable_params = in ossl_decoder_from_algorithm()
262 if (decoder->set_ctx_params == NULL) in ossl_decoder_from_algorithm()
263 decoder->set_ctx_params = in ossl_decoder_from_algorithm()
267 if (decoder->settable_ctx_params == NULL) in ossl_decoder_from_algorithm()
268 decoder->settable_ctx_params = in ossl_decoder_from_algorithm()
272 if (decoder->does_selection == NULL) in ossl_decoder_from_algorithm()
273 decoder->does_selection = in ossl_decoder_from_algorithm()
277 if (decoder->decode == NULL) in ossl_decoder_from_algorithm()
278 decoder->decode = OSSL_FUNC_decoder_decode(fns); in ossl_decoder_from_algorithm()
281 if (decoder->export_object == NULL) in ossl_decoder_from_algorithm()
282 decoder->export_object = OSSL_FUNC_decoder_export_object(fns); in ossl_decoder_from_algorithm()
291 if (!((decoder->newctx == NULL && decoder->freectx == NULL) in ossl_decoder_from_algorithm()
292 || (decoder->newctx != NULL && decoder->freectx != NULL)) in ossl_decoder_from_algorithm()
293 || decoder->decode == NULL) { in ossl_decoder_from_algorithm()
294 OSSL_DECODER_free(decoder); in ossl_decoder_from_algorithm()
300 OSSL_DECODER_free(decoder); in ossl_decoder_from_algorithm()
304 decoder->base.prov = prov; in ossl_decoder_from_algorithm()
305 return decoder; in ossl_decoder_from_algorithm()
499 const OSSL_PROVIDER *OSSL_DECODER_get0_provider(const OSSL_DECODER *decoder) in OSSL_DECODER_get0_provider() argument
501 if (!ossl_assert(decoder != NULL)) { in OSSL_DECODER_get0_provider()
506 return decoder->base.prov; in OSSL_DECODER_get0_provider()
509 const char *OSSL_DECODER_get0_properties(const OSSL_DECODER *decoder) in OSSL_DECODER_get0_properties() argument
511 if (!ossl_assert(decoder != NULL)) { in OSSL_DECODER_get0_properties()
516 return decoder->base.algodef->property_definition; in OSSL_DECODER_get0_properties()
520 ossl_decoder_parsed_properties(const OSSL_DECODER *decoder) in ossl_decoder_parsed_properties() argument
522 if (!ossl_assert(decoder != NULL)) { in ossl_decoder_parsed_properties()
527 return decoder->base.parsed_propdef; in ossl_decoder_parsed_properties()
530 int ossl_decoder_get_number(const OSSL_DECODER *decoder) in ossl_decoder_get_number() argument
532 if (!ossl_assert(decoder != NULL)) { in ossl_decoder_get_number()
537 return decoder->base.id; in ossl_decoder_get_number()
540 const char *OSSL_DECODER_get0_name(const OSSL_DECODER *decoder) in OSSL_DECODER_get0_name() argument
542 return decoder->base.name; in OSSL_DECODER_get0_name()
545 const char *OSSL_DECODER_get0_description(const OSSL_DECODER *decoder) in OSSL_DECODER_get0_description() argument
547 return decoder->base.algodef->algorithm_description; in OSSL_DECODER_get0_description()
550 int OSSL_DECODER_is_a(const OSSL_DECODER *decoder, const char *name) in OSSL_DECODER_is_a() argument
552 if (decoder->base.prov != NULL) { in OSSL_DECODER_is_a()
553 OSSL_LIB_CTX *libctx = ossl_provider_libctx(decoder->base.prov); in OSSL_DECODER_is_a()
556 return ossl_namemap_name2num(namemap, name) == decoder->base.id; in OSSL_DECODER_is_a()
562 void (*user_fn)(OSSL_DECODER *decoder, void *arg);
574 void (*user_fn)(OSSL_DECODER *decoder, in OSSL_DECODER_do_all_provided() argument
593 int OSSL_DECODER_names_do_all(const OSSL_DECODER *decoder, in OSSL_DECODER_names_do_all() argument
597 if (decoder == NULL) in OSSL_DECODER_names_do_all()
600 if (decoder->base.prov != NULL) { in OSSL_DECODER_names_do_all()
601 OSSL_LIB_CTX *libctx = ossl_provider_libctx(decoder->base.prov); in OSSL_DECODER_names_do_all()
604 return ossl_namemap_doall_names(namemap, decoder->base.id, fn, data); in OSSL_DECODER_names_do_all()
611 OSSL_DECODER_gettable_params(OSSL_DECODER *decoder) in OSSL_DECODER_gettable_params() argument
613 if (decoder != NULL && decoder->gettable_params != NULL) { in OSSL_DECODER_gettable_params()
614 void *provctx = ossl_provider_ctx(OSSL_DECODER_get0_provider(decoder)); in OSSL_DECODER_gettable_params()
616 return decoder->gettable_params(provctx); in OSSL_DECODER_gettable_params()
621 int OSSL_DECODER_get_params(OSSL_DECODER *decoder, OSSL_PARAM params[]) in OSSL_DECODER_get_params() argument
623 if (decoder != NULL && decoder->get_params != NULL) in OSSL_DECODER_get_params()
624 return decoder->get_params(params); in OSSL_DECODER_get_params()
629 OSSL_DECODER_settable_ctx_params(OSSL_DECODER *decoder) in OSSL_DECODER_settable_ctx_params() argument
631 if (decoder != NULL && decoder->settable_ctx_params != NULL) { in OSSL_DECODER_settable_ctx_params()
632 void *provctx = ossl_provider_ctx(OSSL_DECODER_get0_provider(decoder)); in OSSL_DECODER_settable_ctx_params()
634 return decoder->settable_ctx_params(provctx); in OSSL_DECODER_settable_ctx_params()
640 * Decoder context support
644 * |encoder| value NULL is valid, and signifies that there is no decoder.
646 * Functions that want to verify if there is a decoder can do so with
678 OSSL_DECODER *decoder = in OSSL_DECODER_CTX_set_params() local
683 if (decoderctx == NULL || decoder->set_ctx_params == NULL) in OSSL_DECODER_CTX_set_params()
685 if (!decoder->set_ctx_params(decoderctx, params)) in OSSL_DECODER_CTX_set_params()