struct decoder_pkey_data_st {
OSSL_LIB_CTX *libctx;
char *propq;
+ int selection;
STACK_OF(EVP_KEYMGMT) *keymgmts;
char *object_type; /* recorded object data type, may be NULL */
import_data.keymgmt = keymgmt;
import_data.keydata = NULL;
- import_data.selection = OSSL_KEYMGMT_SELECT_ALL;
+ import_data.selection = data->selection;
/*
* No need to check for errors here, the value of
process_data->object = (void **)pkey;
process_data->libctx = libctx;
+ process_data->selection = ctx->selection;
/* First, find all keymgmts to form goals */
EVP_KEYMGMT_do_all_provided(libctx, collect_keymgmt,
struct der2key_ctx_st {
PROV_CTX *provctx;
const struct keytype_desc_st *desc;
+ /* The selection that is passed to der2key_decode() */
+ int selection;
/* Flag used to signal that a failure is fatal */
unsigned int flag_fatal : 1;
};
const unsigned char *derp;
long der_len = 0;
void *key = NULL;
- int orig_selection = selection;
int ok = 0;
+ ctx->selection = selection;
/*
* The caller is allowed to specify 0 as a selection mark, to have the
* structure and key type guessed. For type-specific structures, this
} else if (ctx->desc->d2i_private_key != NULL) {
key = ctx->desc->d2i_private_key(NULL, &derp, der_len);
}
- if (key == NULL && orig_selection != 0)
+ if (key == NULL && ctx->selection != 0)
goto next;
}
if (key == NULL && (selection & OSSL_KEYMGMT_SELECT_PUBLIC_KEY) != 0) {
key = ctx->desc->d2i_PUBKEY(NULL, &derp, der_len);
else
key = ctx->desc->d2i_public_key(NULL, &derp, der_len);
- if (key == NULL && orig_selection != 0)
+ if (key == NULL && ctx->selection != 0)
goto next;
}
if (key == NULL && (selection & OSSL_KEYMGMT_SELECT_ALL_PARAMETERS) != 0) {
derp = der;
if (ctx->desc->d2i_key_params != NULL)
key = ctx->desc->d2i_key_params(NULL, &derp, der_len);
- if (key == NULL && orig_selection != 0)
+ if (key == NULL && ctx->selection != 0)
goto next;
}
/* The contents of the reference is the address to our object */
keydata = *(void **)reference;
- return export(keydata, OSSL_KEYMGMT_SELECT_ALL,
- export_cb, export_cbarg);
+ return export(keydata, ctx->selection, export_cb, export_cbarg);
}
return 0;
}
struct msblob2key_ctx_st {
PROV_CTX *provctx;
const struct keytype_desc_st *desc;
+ /* The selection that is passed to msblob2key_decode() */
+ int selection;
};
static struct msblob2key_ctx_st *
if (!ok)
goto next;
+ ctx->selection = selection;
ok = 0; /* Assume that we fail */
if ((isdss && ctx->desc->type != EVP_PKEY_DSA)
/* The contents of the reference is the address to our object */
keydata = *(void **)reference;
- return export(keydata, OSSL_KEYMGMT_SELECT_ALL,
- export_cb, export_cbarg);
+ return export(keydata, ctx->selection, export_cb, export_cbarg);
}
return 0;
}
struct pvk2key_ctx_st {
PROV_CTX *provctx;
const struct keytype_desc_st *desc;
+ /* The selection that is passed to der2key_decode() */
+ int selection;
};
static struct pvk2key_ctx_st *
void *key = NULL;
int ok = 0;
+ ctx->selection = selection;
+
if ((selection == 0
|| (selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0)
&& ctx->desc->read_private_key != NULL) {
/* The contents of the reference is the address to our object */
keydata = *(void **)reference;
- return export(keydata, OSSL_KEYMGMT_SELECT_ALL,
- export_cb, export_cbarg);
+ return export(keydata, ctx->selection, export_cb, export_cbarg);
}
return 0;
}