[pkg-opensc-commit] [opensc] 13/50: md: use GUID without frame
Eric Dorland
eric at moszumanska.debian.org
Sat May 28 03:35:46 UTC 2016
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository opensc.
commit 89a5b5893b79c2313e23127e2f561d417e976246
Author: Viktor Tarasov <viktor.tarasov at gmail.com>
Date: Fri Apr 8 09:53:10 2016 +0200
md: use GUID without frame
---
src/libopensc/aux-data.c | 10 +++++++---
src/minidriver/minidriver.c | 2 +-
src/tools/pkcs15-tool.c | 4 ++--
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/libopensc/aux-data.c b/src/libopensc/aux-data.c
index 78fd94b..b6bda71 100644
--- a/src/libopensc/aux-data.c
+++ b/src/libopensc/aux-data.c
@@ -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);
diff --git a/src/minidriver/minidriver.c b/src/minidriver/minidriver.c
index 45a04c5..44ba667 100644
--- a/src/minidriver/minidriver.c
+++ b/src/minidriver/minidriver.c
@@ -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;
diff --git a/src/tools/pkcs15-tool.c b/src/tools/pkcs15-tool.c
index 595b141..5b66320 100644
--- a/src/tools/pkcs15-tool.c
+++ b/src/tools/pkcs15-tool.c
@@ -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);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/opensc.git
More information about the pkg-opensc-commit
mailing list