Lines Matching refs:ctx
40 typedef int check_key_fn(void *, struct der2key_ctx_st *ctx);
41 typedef void adjust_key_fn(void *, struct der2key_ctx_st *ctx);
101 long input_der_len, struct der2key_ctx_st *ctx,
110 && OBJ_obj2nid(alg->algorithm) == ctx->desc->evp_type)
111 key = key_from_pkcs8(p8inf, PROV_LIBCTX_OF(ctx->provctx), NULL);
126 struct der2key_ctx_st *ctx = OPENSSL_zalloc(sizeof(*ctx));
128 if (ctx != NULL) {
129 ctx->provctx = provctx;
130 ctx->desc = desc;
132 return ctx;
137 struct der2key_ctx_st *ctx = vctx;
139 OPENSSL_free(ctx);
180 struct der2key_ctx_st *ctx = vctx;
187 ctx->selection = selection;
197 selection = ctx->desc->selection_mask;
198 if ((selection & ctx->desc->selection_mask) == 0) {
203 ok = ossl_read_der(ctx->provctx, cin, &der, &der_len);
212 if (ctx->desc->d2i_PKCS8 != NULL) {
213 key = ctx->desc->d2i_PKCS8(NULL, &derp, der_len, ctx);
214 if (ctx->flag_fatal) {
218 } else if (ctx->desc->d2i_private_key != NULL) {
219 key = ctx->desc->d2i_private_key(NULL, &derp, der_len);
221 if (key == NULL && ctx->selection != 0) {
228 if (ctx->desc->d2i_PUBKEY != NULL)
229 key = ctx->desc->d2i_PUBKEY(NULL, &derp, der_len);
230 else if (ctx->desc->d2i_public_key != NULL)
231 key = ctx->desc->d2i_public_key(NULL, &derp, der_len);
232 if (key == NULL && ctx->selection != 0) {
239 if (ctx->desc->d2i_key_params != NULL)
240 key = ctx->desc->d2i_key_params(NULL, &derp, der_len);
241 if (key == NULL && ctx->selection != 0) {
259 && ctx->desc->check_key != NULL
260 && !ctx->desc->check_key(key, ctx)) {
261 ctx->desc->free_key(key);
265 if (key != NULL && ctx->desc->adjust_key != NULL)
266 ctx->desc->adjust_key(key, ctx);
291 (char *)ctx->desc->keytype_name,
303 ctx->desc->free_key(key);
313 struct der2key_ctx_st *ctx = vctx;
315 ossl_prov_get_keymgmt_export(ctx->desc->fns);
322 return export(keydata, ctx->selection, export_cb, export_cbarg);
336 struct der2key_ctx_st *ctx)
338 return der2key_decode_p8(der, der_len, ctx,
346 static void dh_adjust(void *key, struct der2key_ctx_st *ctx)
348 ossl_dh_set0_libctx(key, PROV_LIBCTX_OF(ctx->provctx));
371 struct der2key_ctx_st *ctx)
373 return der2key_decode_p8(der, der_len, ctx,
381 static void dsa_adjust(void *key, struct der2key_ctx_st *ctx)
383 ossl_dsa_set0_libctx(key, PROV_LIBCTX_OF(ctx->provctx));
396 struct der2key_ctx_st *ctx)
398 return der2key_decode_p8(der, der_len, ctx,
405 static int ec_check(void *key, struct der2key_ctx_st *ctx)
411 return sm2 == (ctx->desc->evp_type == EVP_PKEY_SM2);
414 static void ec_adjust(void *key, struct der2key_ctx_st *ctx)
416 ossl_ec_key_set0_libctx(key, PROV_LIBCTX_OF(ctx->provctx));
425 struct der2key_ctx_st *ctx)
427 return der2key_decode_p8(der, der_len, ctx,
431 static void ecx_key_adjust(void *key, struct der2key_ctx_st *ctx)
433 ossl_ecx_key_set0_libctx(key, PROV_LIBCTX_OF(ctx->provctx));
483 struct der2key_ctx_st *ctx)
485 return der2key_decode_p8(der, der_len, ctx,
504 struct der2key_ctx_st *ctx)
506 return der2key_decode_p8(der, der_len, ctx,
513 static int rsa_check(void *key, struct der2key_ctx_st *ctx)
517 return ctx->desc->evp_type == EVP_PKEY_RSA;
519 return ctx->desc->evp_type == EVP_PKEY_RSA_PSS;
526 static void rsa_adjust(void *key, struct der2key_ctx_st *ctx)
528 ossl_rsa_set0_libctx(key, PROV_LIBCTX_OF(ctx->provctx));