Lines Matching refs:keymgmt
22 EVP_KEYMGMT *keymgmt = NULL; in keymgmt_new() local
24 if ((keymgmt = OPENSSL_zalloc(sizeof(*keymgmt))) == NULL) in keymgmt_new()
26 if (!CRYPTO_NEW_REF(&keymgmt->refcnt, 1)) { in keymgmt_new()
27 EVP_KEYMGMT_free(keymgmt); in keymgmt_new()
30 return keymgmt; in keymgmt_new()
43 static int get_legacy_alg_type_from_keymgmt(const EVP_KEYMGMT *keymgmt) in get_legacy_alg_type_from_keymgmt() argument
47 EVP_KEYMGMT_names_do_all(keymgmt, help_get_legacy_alg_type_from_keymgmt, in get_legacy_alg_type_from_keymgmt()
58 EVP_KEYMGMT *keymgmt = NULL; in keymgmt_from_algorithm() local
65 if ((keymgmt = keymgmt_new()) == NULL) in keymgmt_from_algorithm()
68 keymgmt->name_id = name_id; in keymgmt_from_algorithm()
69 if ((keymgmt->type_name = ossl_algorithm_get1_first_name(algodef)) == NULL) { in keymgmt_from_algorithm()
70 EVP_KEYMGMT_free(keymgmt); in keymgmt_from_algorithm()
73 keymgmt->description = algodef->algorithm_description; in keymgmt_from_algorithm()
78 if (keymgmt->new == NULL) in keymgmt_from_algorithm()
79 keymgmt->new = OSSL_FUNC_keymgmt_new(fns); in keymgmt_from_algorithm()
82 if (keymgmt->gen_init == NULL) in keymgmt_from_algorithm()
83 keymgmt->gen_init = OSSL_FUNC_keymgmt_gen_init(fns); in keymgmt_from_algorithm()
86 if (keymgmt->gen_set_template == NULL) in keymgmt_from_algorithm()
87 keymgmt->gen_set_template = in keymgmt_from_algorithm()
91 if (keymgmt->gen_set_params == NULL) { in keymgmt_from_algorithm()
93 keymgmt->gen_set_params = in keymgmt_from_algorithm()
98 if (keymgmt->gen_settable_params == NULL) { in keymgmt_from_algorithm()
100 keymgmt->gen_settable_params = in keymgmt_from_algorithm()
105 if (keymgmt->gen_get_params == NULL) { in keymgmt_from_algorithm()
107 keymgmt->gen_get_params = in keymgmt_from_algorithm()
112 if (keymgmt->gen_gettable_params == NULL) { in keymgmt_from_algorithm()
114 keymgmt->gen_gettable_params = in keymgmt_from_algorithm()
119 if (keymgmt->gen == NULL) in keymgmt_from_algorithm()
120 keymgmt->gen = OSSL_FUNC_keymgmt_gen(fns); in keymgmt_from_algorithm()
123 if (keymgmt->gen_cleanup == NULL) in keymgmt_from_algorithm()
124 keymgmt->gen_cleanup = OSSL_FUNC_keymgmt_gen_cleanup(fns); in keymgmt_from_algorithm()
127 if (keymgmt->free == NULL) in keymgmt_from_algorithm()
128 keymgmt->free = OSSL_FUNC_keymgmt_free(fns); in keymgmt_from_algorithm()
131 if (keymgmt->load == NULL) in keymgmt_from_algorithm()
132 keymgmt->load = OSSL_FUNC_keymgmt_load(fns); in keymgmt_from_algorithm()
135 if (keymgmt->get_params == NULL) { in keymgmt_from_algorithm()
137 keymgmt->get_params = OSSL_FUNC_keymgmt_get_params(fns); in keymgmt_from_algorithm()
141 if (keymgmt->gettable_params == NULL) { in keymgmt_from_algorithm()
143 keymgmt->gettable_params = in keymgmt_from_algorithm()
148 if (keymgmt->set_params == NULL) { in keymgmt_from_algorithm()
150 keymgmt->set_params = OSSL_FUNC_keymgmt_set_params(fns); in keymgmt_from_algorithm()
154 if (keymgmt->settable_params == NULL) { in keymgmt_from_algorithm()
156 keymgmt->settable_params = in keymgmt_from_algorithm()
161 if (keymgmt->query_operation_name == NULL) in keymgmt_from_algorithm()
162 keymgmt->query_operation_name = in keymgmt_from_algorithm()
166 if (keymgmt->has == NULL) in keymgmt_from_algorithm()
167 keymgmt->has = OSSL_FUNC_keymgmt_has(fns); in keymgmt_from_algorithm()
170 if (keymgmt->dup == NULL) in keymgmt_from_algorithm()
171 keymgmt->dup = OSSL_FUNC_keymgmt_dup(fns); in keymgmt_from_algorithm()
174 if (keymgmt->validate == NULL) in keymgmt_from_algorithm()
175 keymgmt->validate = OSSL_FUNC_keymgmt_validate(fns); in keymgmt_from_algorithm()
178 if (keymgmt->match == NULL) in keymgmt_from_algorithm()
179 keymgmt->match = OSSL_FUNC_keymgmt_match(fns); in keymgmt_from_algorithm()
182 if (keymgmt->import == NULL) { in keymgmt_from_algorithm()
184 keymgmt->import = OSSL_FUNC_keymgmt_import(fns); in keymgmt_from_algorithm()
188 if (keymgmt->import_types == NULL) { in keymgmt_from_algorithm()
192 keymgmt->import_types = OSSL_FUNC_keymgmt_import_types(fns); in keymgmt_from_algorithm()
196 if (keymgmt->import_types_ex == NULL) { in keymgmt_from_algorithm()
200 keymgmt->import_types_ex = OSSL_FUNC_keymgmt_import_types_ex(fns); in keymgmt_from_algorithm()
204 if (keymgmt->export == NULL) { in keymgmt_from_algorithm()
206 keymgmt->export = OSSL_FUNC_keymgmt_export(fns); in keymgmt_from_algorithm()
210 if (keymgmt->export_types == NULL) { in keymgmt_from_algorithm()
214 keymgmt->export_types = OSSL_FUNC_keymgmt_export_types(fns); in keymgmt_from_algorithm()
218 if (keymgmt->export_types_ex == NULL) { in keymgmt_from_algorithm()
222 keymgmt->export_types_ex = OSSL_FUNC_keymgmt_export_types_ex(fns); in keymgmt_from_algorithm()
235 if (keymgmt->free == NULL in keymgmt_from_algorithm()
236 || (keymgmt->new == NULL in keymgmt_from_algorithm()
237 && keymgmt->gen == NULL in keymgmt_from_algorithm()
238 && keymgmt->load == NULL) in keymgmt_from_algorithm()
239 || keymgmt->has == NULL in keymgmt_from_algorithm()
246 || (keymgmt->gen != NULL in keymgmt_from_algorithm()
247 && (keymgmt->gen_init == NULL in keymgmt_from_algorithm()
248 || keymgmt->gen_cleanup == NULL))) { in keymgmt_from_algorithm()
249 EVP_KEYMGMT_free(keymgmt); in keymgmt_from_algorithm()
253 keymgmt->prov = prov; in keymgmt_from_algorithm()
258 keymgmt->legacy_alg = get_legacy_alg_type_from_keymgmt(keymgmt); in keymgmt_from_algorithm()
261 return keymgmt; in keymgmt_from_algorithm()
284 int EVP_KEYMGMT_up_ref(EVP_KEYMGMT *keymgmt) in EVP_KEYMGMT_up_ref() argument
288 CRYPTO_UP_REF(&keymgmt->refcnt, &ref); in EVP_KEYMGMT_up_ref()
292 void EVP_KEYMGMT_free(EVP_KEYMGMT *keymgmt) in EVP_KEYMGMT_free() argument
296 if (keymgmt == NULL) in EVP_KEYMGMT_free()
299 CRYPTO_DOWN_REF(&keymgmt->refcnt, &ref); in EVP_KEYMGMT_free()
302 OPENSSL_free(keymgmt->type_name); in EVP_KEYMGMT_free()
303 ossl_provider_free(keymgmt->prov); in EVP_KEYMGMT_free()
304 CRYPTO_FREE_REF(&keymgmt->refcnt); in EVP_KEYMGMT_free()
305 OPENSSL_free(keymgmt); in EVP_KEYMGMT_free()
308 const OSSL_PROVIDER *EVP_KEYMGMT_get0_provider(const EVP_KEYMGMT *keymgmt) in EVP_KEYMGMT_get0_provider() argument
310 return keymgmt->prov; in EVP_KEYMGMT_get0_provider()
313 int evp_keymgmt_get_number(const EVP_KEYMGMT *keymgmt) in evp_keymgmt_get_number() argument
315 return keymgmt->name_id; in evp_keymgmt_get_number()
318 int evp_keymgmt_get_legacy_alg(const EVP_KEYMGMT *keymgmt) in evp_keymgmt_get_legacy_alg() argument
320 return keymgmt->legacy_alg; in evp_keymgmt_get_legacy_alg()
323 const char *EVP_KEYMGMT_get0_description(const EVP_KEYMGMT *keymgmt) in EVP_KEYMGMT_get0_description() argument
325 return keymgmt->description; in EVP_KEYMGMT_get0_description()
328 const char *EVP_KEYMGMT_get0_name(const EVP_KEYMGMT *keymgmt) in EVP_KEYMGMT_get0_name() argument
330 return keymgmt->type_name; in EVP_KEYMGMT_get0_name()
333 int EVP_KEYMGMT_is_a(const EVP_KEYMGMT *keymgmt, const char *name) in EVP_KEYMGMT_is_a() argument
335 return keymgmt != NULL in EVP_KEYMGMT_is_a()
336 && evp_is_a(keymgmt->prov, keymgmt->name_id, NULL, name); in EVP_KEYMGMT_is_a()
340 void (*fn)(EVP_KEYMGMT *keymgmt, void *arg), in EVP_KEYMGMT_do_all_provided() argument
350 int EVP_KEYMGMT_names_do_all(const EVP_KEYMGMT *keymgmt, in EVP_KEYMGMT_names_do_all() argument
354 if (keymgmt->prov != NULL) in EVP_KEYMGMT_names_do_all()
355 return evp_names_do_all(keymgmt->prov, keymgmt->name_id, fn, data); in EVP_KEYMGMT_names_do_all()
363 void *evp_keymgmt_newdata(const EVP_KEYMGMT *keymgmt) in evp_keymgmt_newdata() argument
365 void *provctx = ossl_provider_ctx(EVP_KEYMGMT_get0_provider(keymgmt)); in evp_keymgmt_newdata()
372 if (keymgmt->new == NULL) in evp_keymgmt_newdata()
374 return keymgmt->new(provctx); in evp_keymgmt_newdata()
377 void evp_keymgmt_freedata(const EVP_KEYMGMT *keymgmt, void *keydata) in evp_keymgmt_freedata() argument
380 keymgmt->free(keydata); in evp_keymgmt_freedata()
383 void *evp_keymgmt_gen_init(const EVP_KEYMGMT *keymgmt, int selection, in evp_keymgmt_gen_init() argument
386 void *provctx = ossl_provider_ctx(EVP_KEYMGMT_get0_provider(keymgmt)); in evp_keymgmt_gen_init()
388 if (keymgmt->gen_init == NULL) in evp_keymgmt_gen_init()
390 return keymgmt->gen_init(provctx, selection, params); in evp_keymgmt_gen_init()
393 int evp_keymgmt_gen_set_template(const EVP_KEYMGMT *keymgmt, void *genctx, in evp_keymgmt_gen_set_template() argument
402 if (keymgmt->gen_set_template == NULL) in evp_keymgmt_gen_set_template()
404 return keymgmt->gen_set_template(genctx, templ); in evp_keymgmt_gen_set_template()
407 int evp_keymgmt_gen_set_params(const EVP_KEYMGMT *keymgmt, void *genctx, in evp_keymgmt_gen_set_params() argument
410 if (keymgmt->gen_set_params == NULL) in evp_keymgmt_gen_set_params()
412 return keymgmt->gen_set_params(genctx, params); in evp_keymgmt_gen_set_params()
415 const OSSL_PARAM *EVP_KEYMGMT_gen_settable_params(const EVP_KEYMGMT *keymgmt) in EVP_KEYMGMT_gen_settable_params() argument
417 void *provctx = ossl_provider_ctx(EVP_KEYMGMT_get0_provider(keymgmt)); in EVP_KEYMGMT_gen_settable_params()
419 if (keymgmt->gen_settable_params == NULL) in EVP_KEYMGMT_gen_settable_params()
421 return keymgmt->gen_settable_params(NULL, provctx); in EVP_KEYMGMT_gen_settable_params()
424 int evp_keymgmt_gen_get_params(const EVP_KEYMGMT *keymgmt, void *genctx, in evp_keymgmt_gen_get_params() argument
427 if (keymgmt->gen_get_params == NULL) in evp_keymgmt_gen_get_params()
429 return keymgmt->gen_get_params(genctx, params); in evp_keymgmt_gen_get_params()
432 const OSSL_PARAM *EVP_KEYMGMT_gen_gettable_params(const EVP_KEYMGMT *keymgmt) in EVP_KEYMGMT_gen_gettable_params() argument
434 void *provctx = ossl_provider_ctx(EVP_KEYMGMT_get0_provider(keymgmt)); in EVP_KEYMGMT_gen_gettable_params()
436 if (keymgmt->gen_gettable_params == NULL) in EVP_KEYMGMT_gen_gettable_params()
438 return keymgmt->gen_gettable_params(NULL, provctx); in EVP_KEYMGMT_gen_gettable_params()
441 void *evp_keymgmt_gen(const EVP_KEYMGMT *keymgmt, void *genctx, in evp_keymgmt_gen() argument
444 if (keymgmt->gen == NULL) in evp_keymgmt_gen()
446 return keymgmt->gen(genctx, cb, cbarg); in evp_keymgmt_gen()
449 void evp_keymgmt_gen_cleanup(const EVP_KEYMGMT *keymgmt, void *genctx) in evp_keymgmt_gen_cleanup() argument
451 if (keymgmt->gen_cleanup != NULL) in evp_keymgmt_gen_cleanup()
452 keymgmt->gen_cleanup(genctx); in evp_keymgmt_gen_cleanup()
455 int evp_keymgmt_has_load(const EVP_KEYMGMT *keymgmt) in evp_keymgmt_has_load() argument
457 return keymgmt != NULL && keymgmt->load != NULL; in evp_keymgmt_has_load()
460 void *evp_keymgmt_load(const EVP_KEYMGMT *keymgmt, in evp_keymgmt_load() argument
463 if (evp_keymgmt_has_load(keymgmt)) in evp_keymgmt_load()
464 return keymgmt->load(objref, objref_sz); in evp_keymgmt_load()
468 int evp_keymgmt_get_params(const EVP_KEYMGMT *keymgmt, void *keydata, in evp_keymgmt_get_params() argument
471 if (keymgmt->get_params == NULL) in evp_keymgmt_get_params()
473 return keymgmt->get_params(keydata, params); in evp_keymgmt_get_params()
476 const OSSL_PARAM *EVP_KEYMGMT_gettable_params(const EVP_KEYMGMT *keymgmt) in EVP_KEYMGMT_gettable_params() argument
478 void *provctx = ossl_provider_ctx(EVP_KEYMGMT_get0_provider(keymgmt)); in EVP_KEYMGMT_gettable_params()
480 if (keymgmt->gettable_params == NULL) in EVP_KEYMGMT_gettable_params()
482 return keymgmt->gettable_params(provctx); in EVP_KEYMGMT_gettable_params()
485 int evp_keymgmt_set_params(const EVP_KEYMGMT *keymgmt, void *keydata, in evp_keymgmt_set_params() argument
488 if (keymgmt->set_params == NULL) in evp_keymgmt_set_params()
490 return keymgmt->set_params(keydata, params); in evp_keymgmt_set_params()
493 const OSSL_PARAM *EVP_KEYMGMT_settable_params(const EVP_KEYMGMT *keymgmt) in EVP_KEYMGMT_settable_params() argument
495 void *provctx = ossl_provider_ctx(EVP_KEYMGMT_get0_provider(keymgmt)); in EVP_KEYMGMT_settable_params()
497 if (keymgmt->settable_params == NULL) in EVP_KEYMGMT_settable_params()
499 return keymgmt->settable_params(provctx); in EVP_KEYMGMT_settable_params()
502 int evp_keymgmt_has(const EVP_KEYMGMT *keymgmt, void *keydata, int selection) in evp_keymgmt_has() argument
505 return keymgmt->has(keydata, selection); in evp_keymgmt_has()
508 int evp_keymgmt_validate(const EVP_KEYMGMT *keymgmt, void *keydata, in evp_keymgmt_validate() argument
512 if (keymgmt->validate == NULL) in evp_keymgmt_validate()
514 return keymgmt->validate(keydata, selection, checktype); in evp_keymgmt_validate()
517 int evp_keymgmt_match(const EVP_KEYMGMT *keymgmt, in evp_keymgmt_match() argument
522 if (keymgmt->match == NULL) in evp_keymgmt_match()
524 return keymgmt->match(keydata1, keydata2, selection); in evp_keymgmt_match()
527 int evp_keymgmt_import(const EVP_KEYMGMT *keymgmt, void *keydata, in evp_keymgmt_import() argument
530 if (keymgmt->import == NULL) in evp_keymgmt_import()
532 return keymgmt->import(keydata, selection, params); in evp_keymgmt_import()
535 const OSSL_PARAM *evp_keymgmt_import_types(const EVP_KEYMGMT *keymgmt, in evp_keymgmt_import_types() argument
538 void *provctx = ossl_provider_ctx(EVP_KEYMGMT_get0_provider(keymgmt)); in evp_keymgmt_import_types()
540 if (keymgmt->import_types_ex != NULL) in evp_keymgmt_import_types()
541 return keymgmt->import_types_ex(provctx, selection); in evp_keymgmt_import_types()
542 if (keymgmt->import_types == NULL) in evp_keymgmt_import_types()
544 return keymgmt->import_types(selection); in evp_keymgmt_import_types()
547 int evp_keymgmt_export(const EVP_KEYMGMT *keymgmt, void *keydata, in evp_keymgmt_export() argument
550 if (keymgmt->export == NULL) in evp_keymgmt_export()
552 return keymgmt->export(keydata, selection, param_cb, cbarg); in evp_keymgmt_export()
555 const OSSL_PARAM *evp_keymgmt_export_types(const EVP_KEYMGMT *keymgmt, in evp_keymgmt_export_types() argument
558 void *provctx = ossl_provider_ctx(EVP_KEYMGMT_get0_provider(keymgmt)); in evp_keymgmt_export_types()
560 if (keymgmt->export_types_ex != NULL) in evp_keymgmt_export_types()
561 return keymgmt->export_types_ex(provctx, selection); in evp_keymgmt_export_types()
562 if (keymgmt->export_types == NULL) in evp_keymgmt_export_types()
564 return keymgmt->export_types(selection); in evp_keymgmt_export_types()
567 void *evp_keymgmt_dup(const EVP_KEYMGMT *keymgmt, const void *keydata_from, in evp_keymgmt_dup() argument
571 if (keymgmt->dup == NULL) in evp_keymgmt_dup()
573 return keymgmt->dup(keydata_from, selection); in evp_keymgmt_dup()