Commit 37f8a34d authored by Christophe Fergeau's avatar Christophe Fergeau

hex_dump: Remove unused arguments

hex_dump() callers can theoretically provide the destination buffer
for the hexdump'ed string, but nothing in libcacard uses that feature.
This commit removes it.
Signed-off-by: default avatarChristophe Fergeau <cfergeau@redhat.com>
parent b6e3ecad
......@@ -1081,7 +1081,7 @@ cac_aca_get_acr_response_extended(VCard *card, int Le, unsigned char *acrid)
r = vcard_response_new(card, buffer, buffer_len, Le,
VCARD7816_STATUS_SUCCESS);
g_debug("%s: response bytes: %s", __func__,
hex_dump(buffer, buffer_len, NULL, 0));
hex_dump(buffer, buffer_len));
g_free(buffer);
return r;
}
......@@ -1163,7 +1163,7 @@ cac_aca_get_applet_acr_response_simpletlv(VCard *card, int Le,
/* Prepare the SimpleTLV structures */
properties = cac_aca_get_properties(&properties_len);
if (coid != NULL) {
g_debug("%s: Called. COID = %s", __func__, hex_dump(coid, 2, NULL, 0));
g_debug("%s: Called. COID = %s", __func__, hex_dump(coid, 2));
/* getting the table for Card Object ID (2B) */
acr_len = 1; // returns exactly one element if found
......@@ -1199,7 +1199,7 @@ cac_aca_get_applet_acr_response_simpletlv(VCard *card, int Le,
r = vcard_response_new(card, acr_buffer, acr_buffer_len, Le,
VCARD7816_STATUS_SUCCESS);
g_debug("%s: response bytes: %s", __func__,
hex_dump(acr_buffer, acr_buffer_len, NULL, 0));
hex_dump(acr_buffer, acr_buffer_len));
failure:
g_free(list);
......@@ -1293,7 +1293,7 @@ cac_aca_get_applet_acr_response_extended(VCard *card, int Le,
r = vcard_response_new(card, buffer, buffer_len, Le,
VCARD7816_STATUS_SUCCESS);
g_debug("%s: response bytes: %s", __func__,
hex_dump(buffer, buffer_len, NULL, 0));
hex_dump(buffer, buffer_len));
failure:
g_free(buffer);
return r;
......@@ -1427,7 +1427,7 @@ cac_aca_get_service_response_extended(VCard *card, int Le,
r = vcard_response_new(card, buffer, buffer_len, Le,
VCARD7816_STATUS_SUCCESS);
g_debug("%s: response bytes: %s", __func__,
hex_dump(buffer, buffer_len, NULL, 0));
hex_dump(buffer, buffer_len));
g_free(buffer);
return r;
}
......
......@@ -964,7 +964,7 @@ cac_new_pki_applet_private(int i, const unsigned char *cert,
goto failure;
}
g_debug("%s: applet_private->tag_buffer = %s", __func__,
hex_dump(applet_private->tag_buffer, applet_private->tag_buffer_len, NULL, 0));
hex_dump(applet_private->tag_buffer, applet_private->tag_buffer_len));
/* Value buffer */
/* Ex:
......@@ -981,7 +981,7 @@ cac_new_pki_applet_private(int i, const unsigned char *cert,
goto failure;
}
g_debug("%s: applet_private->val_buffer = %s", __func__,
hex_dump(applet_private->val_buffer, applet_private->val_buffer_len, NULL, 0));
hex_dump(applet_private->val_buffer, applet_private->val_buffer_len));
/* Inject Object ID */
object_id[1] = i;
......@@ -1681,7 +1681,7 @@ cac_new_ccc_applet_private(int cert_count)
if (applet_private->tag_buffer_len == 0)
goto failure;
g_debug("%s: applet_private->tag_buffer = %s", __func__,
hex_dump(applet_private->tag_buffer, applet_private->tag_buffer_len, NULL, 0));
hex_dump(applet_private->tag_buffer, applet_private->tag_buffer_len));
/* Value buffer */
/* Ex:
......@@ -1723,7 +1723,7 @@ cac_new_ccc_applet_private(int cert_count)
if (applet_private->val_buffer_len == 0)
goto failure;
g_debug("%s: applet_private->val_buffer = %s", __func__,
hex_dump(applet_private->val_buffer, applet_private->val_buffer_len, NULL, 0));
hex_dump(applet_private->val_buffer, applet_private->val_buffer_len));
/* Inject Object ID */
tv_object[0].value.value = object_id;
......
......@@ -52,29 +52,20 @@ lebytes2ushort(const unsigned char *buf)
static char hexdump_buffer[5*MAX_STATIC_BYTES];
/*
* Creates printable representation in hexadecimal format of the data
* provided in the buf buffer. If out buffer is provided, the data
* will be written into it. Otherwise, static buffer will be used, which
* provided in the buf buffer. A static buffer will be used, which
* can hold up to 1024 bytes (longer will get truncated).
*/
char *
hex_dump(unsigned char *buf, size_t buflen, unsigned char **out, size_t outlen)
hex_dump(unsigned char *buf, size_t buflen)
{
char *p, *start;
size_t i, expect_len = buflen*5;
size_t i;
if (buflen <= 0)
return NULL;
if (out == NULL) {
start = hexdump_buffer;
buflen = MIN(buflen, MAX_STATIC_BYTES);
} else {
if (outlen < expect_len) {
/* too short output buffer */
return NULL;
}
start = (char *) *out;
}
start = hexdump_buffer;
buflen = MIN(buflen, MAX_STATIC_BYTES);
p = start;
for (i = 0; i < buflen; i++) {
......
......@@ -29,7 +29,6 @@
unsigned char *ushort2lebytes(unsigned char *buf, unsigned short x);
unsigned short lebytes2ushort(const unsigned char *buf);
char *hex_dump(unsigned char *buf, size_t buflen,
unsigned char **out, size_t outlen);
char *hex_dump(unsigned char *buf, size_t buflen);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment