OSSL_DECODER_INSTANCE *to_obj_inst = NULL;
OSSL_DECODER_CLEANUP *old_cleanup = NULL;
void *old_construct_data = NULL;
- int ok = 0;
+ int ok = 0, expect_evp_pkey = 0;
/* Setup for this session, so only if not already done */
if (ctx->_.file.decoderctx == NULL) {
goto err;
}
+ expect_evp_pkey = (ctx->expected_type == 0
+ || ctx->expected_type == OSSL_STORE_INFO_PARAMS
+ || ctx->expected_type == OSSL_STORE_INFO_PUBKEY
+ || ctx->expected_type == OSSL_STORE_INFO_PKEY);
+
/* Make sure the input type is set */
if (!OSSL_DECODER_CTX_set_input_type(ctx->_.file.decoderctx,
ctx->_.file.input_type)) {
* Since we're setting up our own constructor, we don't need to care
* more than that...
*/
- if (!ossl_decoder_ctx_setup_for_pkey(ctx->_.file.decoderctx,
- &dummy, NULL,
- libctx, ctx->_.file.propq)
+ if ((expect_evp_pkey
+ && !ossl_decoder_ctx_setup_for_pkey(ctx->_.file.decoderctx,
+ &dummy, NULL,
+ libctx, ctx->_.file.propq))
|| !OSSL_DECODER_CTX_add_extra(ctx->_.file.decoderctx,
libctx, ctx->_.file.propq)) {
ERR_raise(ERR_LIB_PROV, ERR_R_OSSL_DECODER_LIB);