Allow emulation routine to setup an emulated object
to be used instead of trying to read a file. This will be used with the ECC code. git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4901 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
e642436fc6
commit
137a7282ad
|
@ -365,6 +365,8 @@ struct sc_pkcs15_object {
|
|||
|
||||
/* Object type specific data */
|
||||
void *data;
|
||||
/* emulated object pointer */
|
||||
void *emulated;
|
||||
|
||||
struct sc_pkcs15_df *df; /* can be NULL, if object is 'floating' */
|
||||
struct sc_pkcs15_object *next, *prev; /* used only internally */
|
||||
|
|
|
@ -462,8 +462,15 @@ __pkcs15_create_pubkey_object(struct pkcs15_fw_data *fw_data,
|
|||
if (pubkey->flags & SC_PKCS15_CO_FLAG_PRIVATE) /* is the key private? */
|
||||
p15_key = NULL; /* will read key when needed */
|
||||
else {
|
||||
if ((rv = sc_pkcs15_read_pubkey(fw_data->p15_card, pubkey, &p15_key)) < 0)
|
||||
p15_key = NULL;
|
||||
/* if emulation already created pubkey use it */
|
||||
if (pubkey->emulated && (fw_data->p15_card->flags & SC_PKCS15_CARD_FLAG_EMULATED)) {
|
||||
p15_key = (struct sc_pkcs15_pubkey *) pubkey->emulated;
|
||||
sc_debug(context, SC_LOG_DEBUG_NORMAL, "Using emulated pubkey %p", p15_key);
|
||||
}
|
||||
else {
|
||||
if ((rv = sc_pkcs15_read_pubkey(fw_data->p15_card, pubkey, &p15_key)) < 0)
|
||||
p15_key = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Public key object */
|
||||
|
|
Loading…
Reference in New Issue