md: use GUID without frame
This commit is contained in:
parent
5c0a37c53d
commit
89a5b5893b
|
@ -142,6 +142,10 @@ sc_aux_data_get_md_guid(struct sc_context *ctx, struct sc_auxiliary_data *aux_da
|
|||
|
||||
cmap_record = &aux_data->data.cmap_record;
|
||||
|
||||
/* Ignore silently request of '{}' frame is output buffer is too small */
|
||||
if (!flags && *out_size < strlen((char *)cmap_record->guid) + 2)
|
||||
flags = 1;
|
||||
|
||||
*guid = '\0';
|
||||
if (!flags)
|
||||
strcpy(guid, "{");
|
||||
|
@ -149,8 +153,10 @@ sc_aux_data_get_md_guid(struct sc_context *ctx, struct sc_auxiliary_data *aux_da
|
|||
if (!flags)
|
||||
strlcat(guid, "}", sizeof(guid));
|
||||
|
||||
if (*out_size < strlen(guid))
|
||||
if (*out_size < strlen(guid)) {
|
||||
sc_log(ctx, "aux-data: buffer too small: out_size:%i < guid-length:%i", *out_size, strlen(guid));
|
||||
LOG_FUNC_RETURN(ctx, SC_ERROR_BUFFER_TOO_SMALL);
|
||||
}
|
||||
|
||||
memset(out, 0, *out_size);
|
||||
memcpy(out, guid, strlen(guid));
|
||||
|
@ -165,8 +171,6 @@ int
|
|||
sc_aux_data_get_md_flags(struct sc_context *ctx, struct sc_auxiliary_data *aux_data,
|
||||
unsigned char *flags)
|
||||
{
|
||||
struct sc_md_cmap_record *cmap_record = NULL;
|
||||
|
||||
LOG_FUNC_CALLED(ctx);
|
||||
if(!aux_data || !flags)
|
||||
LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_ARGUMENTS);
|
||||
|
|
|
@ -566,7 +566,7 @@ md_contguid_get_guid_from_card(PCARD_DATA pCardData, struct sc_pkcs15_object *pr
|
|||
size_t guid_len = MAX_CONTAINER_NAME_LEN+1;
|
||||
|
||||
vs = (VENDOR_SPECIFIC*) pCardData->pvVendorSpecific;
|
||||
rv = sc_pkcs15_get_object_guid(vs->p15card, prkey, 0, (unsigned char*) szGuid, &guid_len);
|
||||
rv = sc_pkcs15_get_object_guid(vs->p15card, prkey, 1, (unsigned char*) szGuid, &guid_len);
|
||||
if (rv) {
|
||||
logprintf(pCardData, 2, "md_contguid_get_guid_from_card(): error %d\n", rv);
|
||||
return SCARD_F_INTERNAL_ERROR;
|
||||
|
|
|
@ -560,7 +560,7 @@ static void print_prkey_info(const struct sc_pkcs15_object *obj)
|
|||
printf("\tID : %s\n", sc_pkcs15_print_id(&prkey->id));
|
||||
|
||||
guid_len = sizeof(guid);
|
||||
if (!sc_pkcs15_get_object_guid(p15card, obj, 0, guid, &guid_len)) {
|
||||
if (!sc_pkcs15_get_object_guid(p15card, obj, 1, guid, &guid_len)) {
|
||||
printf("\tMD:guid : ");
|
||||
if (strlen((char *)guid) == guid_len) {
|
||||
printf("%s\n", (char *)guid);
|
||||
|
@ -778,7 +778,7 @@ static void print_skey_info(const struct sc_pkcs15_object *obj)
|
|||
printf("\tPath : %s\n", sc_print_path(&skey->path));
|
||||
|
||||
guid_len = sizeof(guid);
|
||||
if (!sc_pkcs15_get_object_guid(p15card, obj, 0, guid, &guid_len)) {
|
||||
if (!sc_pkcs15_get_object_guid(p15card, obj, 1, guid, &guid_len)) {
|
||||
printf("\tGUID : %s\n", (char *)guid);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue