Lines Matching refs:ctx

20 static int evp_kem_init(EVP_PKEY_CTX *ctx, int operation,
31 if (ctx == NULL || ctx->keytype == NULL) {
36 evp_pkey_ctx_free_old_ops(ctx);
37 ctx->operation = operation;
39 if (ctx->pkey == NULL) {
45 * Try to derive the supported kem from |ctx->keymgmt|.
47 if (!ossl_assert(ctx->pkey->keymgmt == NULL
48 || ctx->pkey->keymgmt == ctx->keymgmt)) {
52 supported_kem = evp_keymgmt_util_query_operation_name(ctx->keymgmt,
67 * as |ctx->keymgmt|
70 * kem, and try to export |ctx->pkey| to that keymgmt (when this
71 * keymgmt happens to be the same as |ctx->keymgmt|, the export is
91 kem = EVP_KEM_fetch(ctx->libctx, supported_kem, ctx->propquery);
96 tmp_prov = EVP_KEYMGMT_get0_provider(ctx->keymgmt);
98 supported_kem, ctx->propquery);
113 * |ctx->pkey|, but from the provider of the kem method, using the
115 * With the keymgmt we found (if we did), we try to export |ctx->pkey|
118 * export it if |tmp_keymgmt| is different from |ctx->pkey|'s keymgmt)
122 EVP_KEYMGMT_get0_name(ctx->keymgmt),
123 ctx->propquery);
125 provkey = evp_pkey_export_to_provider(ctx->pkey, ctx->libctx,
126 &tmp_keymgmt, ctx->propquery);
137 ctx->op.encap.kem = kem;
138 ctx->op.encap.algctx = kem->newctx(ossl_provider_ctx(kem->prov));
139 if (ctx->op.encap.algctx == NULL) {
152 ret = kem->encapsulate_init(ctx->op.encap.algctx, provkey, params);
160 ret = kem->decapsulate_init(ctx->op.encap.algctx, provkey, params);
174 evp_pkey_ctx_free_old_ops(ctx);
175 ctx->operation = EVP_PKEY_OP_UNDEFINED;
181 int EVP_PKEY_encapsulate_init(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[])
183 return evp_kem_init(ctx, EVP_PKEY_OP_ENCAPSULATE, params);
186 int EVP_PKEY_encapsulate(EVP_PKEY_CTX *ctx,
190 if (ctx == NULL)
193 if (ctx->operation != EVP_PKEY_OP_ENCAPSULATE) {
198 if (ctx->op.encap.algctx == NULL) {
206 return ctx->op.encap.kem->encapsulate(ctx->op.encap.algctx,
210 int EVP_PKEY_decapsulate_init(EVP_PKEY_CTX *ctx, const OSSL_PARAM params[])
212 return evp_kem_init(ctx, EVP_PKEY_OP_DECAPSULATE, params);
215 int EVP_PKEY_decapsulate(EVP_PKEY_CTX *ctx,
219 if (ctx == NULL
224 if (ctx->operation != EVP_PKEY_OP_DECAPSULATE) {
229 if (ctx->op.encap.algctx == NULL) {
233 return ctx->op.encap.kem->decapsulate(ctx->op.encap.algctx,
404 EVP_KEM *EVP_KEM_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
407 return evp_generic_fetch(ctx, OSSL_OP_KEM, algorithm, properties,