pkcs15: in 'pkcs15_object' data: new attr. 'md_flags'
also change name of 'guid' attribute for 'md_guid' These attributes are used to parse and generate the minidriver CMAP records
This commit is contained in:
parent
db9e4c9039
commit
00faad3af6
|
@ -1801,8 +1801,8 @@ void sc_pkcs15_free_object(struct sc_pkcs15_object *obj)
|
|||
free(obj->data);
|
||||
}
|
||||
|
||||
if (obj->guid != NULL)
|
||||
free(obj->guid);
|
||||
if (obj->md_guid != NULL)
|
||||
free(obj->md_guid);
|
||||
|
||||
sc_pkcs15_free_object_content(obj);
|
||||
|
||||
|
@ -2556,14 +2556,14 @@ sc_pkcs15_get_guid(struct sc_pkcs15_card *p15card, const struct sc_pkcs15_object
|
|||
if (p15card->ops.get_guid)
|
||||
return p15card->ops.get_guid(p15card, obj, out, out_size);
|
||||
|
||||
if (obj->guid) {
|
||||
if (out_size < strlen(obj->guid))
|
||||
if (obj->md_guid) {
|
||||
if (out_size < strlen(obj->md_guid))
|
||||
return SC_ERROR_BUFFER_TOO_SMALL;
|
||||
memset(out, 0, out_size);
|
||||
|
||||
if (out_size > strlen(obj->guid))
|
||||
out_size = strlen(obj->guid);
|
||||
memcpy(out, obj->guid, out_size);
|
||||
if (out_size > strlen(obj->md_guid))
|
||||
out_size = strlen(obj->md_guid);
|
||||
memcpy(out, obj->md_guid, out_size);
|
||||
|
||||
return SC_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -511,7 +511,8 @@ struct sc_pkcs15_object {
|
|||
struct sc_pkcs15_der content;
|
||||
|
||||
/* Used by minidriver and its on-card support */
|
||||
char *guid;
|
||||
char *md_guid;
|
||||
unsigned md_flags;
|
||||
};
|
||||
typedef struct sc_pkcs15_object sc_pkcs15_object_t;
|
||||
|
||||
|
|
|
@ -1296,10 +1296,10 @@ sc_pkcs15init_generate_key(struct sc_pkcs15_card *p15card, struct sc_profile *pr
|
|||
|
||||
key_info = (struct sc_pkcs15_prkey_info *) object->data;
|
||||
if (keygen_args->prkey_args.guid) {
|
||||
object->guid = strdup(keygen_args->prkey_args.guid);
|
||||
if (!object->guid)
|
||||
object->md_guid = strdup(keygen_args->prkey_args.guid);
|
||||
if (!object->md_guid)
|
||||
LOG_TEST_RET(ctx, SC_ERROR_OUT_OF_MEMORY, "Cannot allocate guid");
|
||||
sc_log(ctx, "new key GUID: '%s'", object->guid);
|
||||
sc_log(ctx, "new key GUID: '%s'", object->md_guid);
|
||||
}
|
||||
|
||||
/* Set up the PuKDF info. The public key will be filled in
|
||||
|
@ -1430,10 +1430,10 @@ sc_pkcs15init_store_private_key(struct sc_pkcs15_card *p15card, struct sc_profil
|
|||
LOG_TEST_RET(ctx, r, "Failed to add new private key PKCS#15 object");
|
||||
|
||||
if (keyargs->guid) {
|
||||
object->guid = strdup(keyargs->guid);
|
||||
if (!object->guid)
|
||||
object->md_guid = strdup(keyargs->guid);
|
||||
if (!object->md_guid)
|
||||
LOG_TEST_RET(ctx, SC_ERROR_OUT_OF_MEMORY, "Cannot allocate guid");
|
||||
sc_log(ctx, "new key GUID: '%s'", object->guid);
|
||||
sc_log(ctx, "new key GUID: '%s'", object->md_guid);
|
||||
}
|
||||
|
||||
if (!r && profile->ops->emu_store_data) {
|
||||
|
|
Loading…
Reference in New Issue