Lines Matching refs:cipher

35     EVP_ASYM_CIPHER *cipher = NULL;  in evp_pkey_asym_cipher_init()  local
104 EVP_ASYM_CIPHER_free(cipher); in evp_pkey_asym_cipher_init()
109 cipher = EVP_ASYM_CIPHER_fetch(ctx->libctx, supported_ciph, in evp_pkey_asym_cipher_init()
111 if (cipher != NULL) in evp_pkey_asym_cipher_init()
112 tmp_prov = EVP_ASYM_CIPHER_get0_provider(cipher); in evp_pkey_asym_cipher_init()
116 cipher = in evp_pkey_asym_cipher_init()
119 if (cipher == NULL) in evp_pkey_asym_cipher_init()
123 if (cipher == NULL) in evp_pkey_asym_cipher_init()
147 EVP_ASYM_CIPHER_free(cipher); in evp_pkey_asym_cipher_init()
155 ctx->op.ciph.cipher = cipher; in evp_pkey_asym_cipher_init()
156 ctx->op.ciph.algctx = cipher->newctx(ossl_provider_ctx(cipher->prov)); in evp_pkey_asym_cipher_init()
163 desc = cipher->description != NULL ? cipher->description : ""; in evp_pkey_asym_cipher_init()
166 if (cipher->encrypt_init == NULL) { in evp_pkey_asym_cipher_init()
168 "%s encrypt_init:%s", cipher->type_name, desc); in evp_pkey_asym_cipher_init()
172 ret = cipher->encrypt_init(ctx->op.ciph.algctx, provkey, params); in evp_pkey_asym_cipher_init()
175 if (cipher->decrypt_init == NULL) { in evp_pkey_asym_cipher_init()
177 "%s decrypt_init:%s", cipher->type_name, desc); in evp_pkey_asym_cipher_init()
181 ret = cipher->decrypt_init(ctx->op.ciph.algctx, provkey, params); in evp_pkey_asym_cipher_init()
245 EVP_ASYM_CIPHER *cipher; in EVP_PKEY_encrypt() local
262 cipher = ctx->op.ciph.cipher; in EVP_PKEY_encrypt()
263 desc = cipher->description != NULL ? cipher->description : ""; in EVP_PKEY_encrypt()
265 ret = cipher->encrypt(ctx->op.ciph.algctx, out, outlen, (out == NULL ? 0 : *outlen), in, inlen); in EVP_PKEY_encrypt()
268 "%s encrypt:%s", cipher->type_name, desc); in EVP_PKEY_encrypt()
295 EVP_ASYM_CIPHER *cipher; in EVP_PKEY_decrypt() local
312 cipher = ctx->op.ciph.cipher; in EVP_PKEY_decrypt()
313 desc = cipher->description != NULL ? cipher->description : ""; in EVP_PKEY_decrypt()
315 ret = cipher->decrypt(ctx->op.ciph.algctx, out, outlen, (out == NULL ? 0 : *outlen), in, inlen); in EVP_PKEY_decrypt()
318 "%s decrypt:%s", cipher->type_name, desc); in EVP_PKEY_decrypt()
353 EVP_ASYM_CIPHER *cipher = OPENSSL_zalloc(sizeof(EVP_ASYM_CIPHER)); in evp_asym_cipher_new() local
355 if (cipher == NULL) in evp_asym_cipher_new()
358 if (!CRYPTO_NEW_REF(&cipher->refcnt, 1) in evp_asym_cipher_new()
360 CRYPTO_FREE_REF(&cipher->refcnt); in evp_asym_cipher_new()
361 OPENSSL_free(cipher); in evp_asym_cipher_new()
364 cipher->prov = prov; in evp_asym_cipher_new()
366 return cipher; in evp_asym_cipher_new()
374 EVP_ASYM_CIPHER *cipher = NULL; in evp_asym_cipher_from_algorithm() local
378 if ((cipher = evp_asym_cipher_new(prov)) == NULL) { in evp_asym_cipher_from_algorithm()
383 cipher->name_id = name_id; in evp_asym_cipher_from_algorithm()
384 if ((cipher->type_name = ossl_algorithm_get1_first_name(algodef)) == NULL) in evp_asym_cipher_from_algorithm()
386 cipher->description = algodef->algorithm_description; in evp_asym_cipher_from_algorithm()
391 if (cipher->newctx != NULL) in evp_asym_cipher_from_algorithm()
393 cipher->newctx = OSSL_FUNC_asym_cipher_newctx(fns); in evp_asym_cipher_from_algorithm()
397 if (cipher->encrypt_init != NULL) in evp_asym_cipher_from_algorithm()
399 cipher->encrypt_init = OSSL_FUNC_asym_cipher_encrypt_init(fns); in evp_asym_cipher_from_algorithm()
403 if (cipher->encrypt != NULL) in evp_asym_cipher_from_algorithm()
405 cipher->encrypt = OSSL_FUNC_asym_cipher_encrypt(fns); in evp_asym_cipher_from_algorithm()
409 if (cipher->decrypt_init != NULL) in evp_asym_cipher_from_algorithm()
411 cipher->decrypt_init = OSSL_FUNC_asym_cipher_decrypt_init(fns); in evp_asym_cipher_from_algorithm()
415 if (cipher->decrypt != NULL) in evp_asym_cipher_from_algorithm()
417 cipher->decrypt = OSSL_FUNC_asym_cipher_decrypt(fns); in evp_asym_cipher_from_algorithm()
421 if (cipher->freectx != NULL) in evp_asym_cipher_from_algorithm()
423 cipher->freectx = OSSL_FUNC_asym_cipher_freectx(fns); in evp_asym_cipher_from_algorithm()
427 if (cipher->dupctx != NULL) in evp_asym_cipher_from_algorithm()
429 cipher->dupctx = OSSL_FUNC_asym_cipher_dupctx(fns); in evp_asym_cipher_from_algorithm()
432 if (cipher->get_ctx_params != NULL) in evp_asym_cipher_from_algorithm()
434 cipher->get_ctx_params in evp_asym_cipher_from_algorithm()
439 if (cipher->gettable_ctx_params != NULL) in evp_asym_cipher_from_algorithm()
441 cipher->gettable_ctx_params in evp_asym_cipher_from_algorithm()
446 if (cipher->set_ctx_params != NULL) in evp_asym_cipher_from_algorithm()
448 cipher->set_ctx_params in evp_asym_cipher_from_algorithm()
453 if (cipher->settable_ctx_params != NULL) in evp_asym_cipher_from_algorithm()
455 cipher->settable_ctx_params in evp_asym_cipher_from_algorithm()
480 return cipher; in evp_asym_cipher_from_algorithm()
482 EVP_ASYM_CIPHER_free(cipher); in evp_asym_cipher_from_algorithm()
486 void EVP_ASYM_CIPHER_free(EVP_ASYM_CIPHER *cipher) in EVP_ASYM_CIPHER_free() argument
490 if (cipher == NULL) in EVP_ASYM_CIPHER_free()
492 CRYPTO_DOWN_REF(&cipher->refcnt, &i); in EVP_ASYM_CIPHER_free()
495 OPENSSL_free(cipher->type_name); in EVP_ASYM_CIPHER_free()
496 ossl_provider_free(cipher->prov); in EVP_ASYM_CIPHER_free()
497 CRYPTO_FREE_REF(&cipher->refcnt); in EVP_ASYM_CIPHER_free()
498 OPENSSL_free(cipher); in EVP_ASYM_CIPHER_free()
501 int EVP_ASYM_CIPHER_up_ref(EVP_ASYM_CIPHER *cipher) in EVP_ASYM_CIPHER_up_ref() argument
505 CRYPTO_UP_REF(&cipher->refcnt, &ref); in EVP_ASYM_CIPHER_up_ref()
509 OSSL_PROVIDER *EVP_ASYM_CIPHER_get0_provider(const EVP_ASYM_CIPHER *cipher) in EVP_ASYM_CIPHER_get0_provider() argument
511 return cipher->prov; in EVP_ASYM_CIPHER_get0_provider()
534 int EVP_ASYM_CIPHER_is_a(const EVP_ASYM_CIPHER *cipher, const char *name) in EVP_ASYM_CIPHER_is_a() argument
536 return evp_is_a(cipher->prov, cipher->name_id, NULL, name); in EVP_ASYM_CIPHER_is_a()
539 int evp_asym_cipher_get_number(const EVP_ASYM_CIPHER *cipher) in evp_asym_cipher_get_number() argument
541 return cipher->name_id; in evp_asym_cipher_get_number()
544 const char *EVP_ASYM_CIPHER_get0_name(const EVP_ASYM_CIPHER *cipher) in EVP_ASYM_CIPHER_get0_name() argument
546 return cipher->type_name; in EVP_ASYM_CIPHER_get0_name()
549 const char *EVP_ASYM_CIPHER_get0_description(const EVP_ASYM_CIPHER *cipher) in EVP_ASYM_CIPHER_get0_description() argument
551 return cipher->description; in EVP_ASYM_CIPHER_get0_description()
555 void (*fn)(EVP_ASYM_CIPHER *cipher, in EVP_ASYM_CIPHER_do_all_provided() argument
567 int EVP_ASYM_CIPHER_names_do_all(const EVP_ASYM_CIPHER *cipher, in EVP_ASYM_CIPHER_names_do_all() argument
571 if (cipher->prov != NULL) in EVP_ASYM_CIPHER_names_do_all()
572 return evp_names_do_all(cipher->prov, cipher->name_id, fn, data); in EVP_ASYM_CIPHER_names_do_all()