From 4f775cf782e69f7565f9b0f96383e183cc514274 Mon Sep 17 00:00:00 2001 From: Aveen Ismail Date: Tue, 28 Nov 2023 13:49:13 +0100 Subject: [PATCH] Fix debug message output --- lib/util.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/util.c b/lib/util.c index 4832eded..f4175a3d 100644 --- a/lib/util.c +++ b/lib/util.c @@ -1417,9 +1417,9 @@ uint32_t ykpiv_util_slot_object(uint8_t slot) { ptr += lrc_len; // move to after value bytes break; default: - fprintf(stderr, "Unknown cert tag. Treating this as a raw certificate\n"); + DBG("Unknown cert tag. Treating this as a raw certificate"); if (*certdata_len < buf_len) { - fprintf(stderr, "Buffer too small\n"); + DBG("Buffer too small"); *certdata_len = 0; return YKPIV_SIZE_ERROR; } @@ -1440,17 +1440,18 @@ uint32_t ykpiv_util_slot_object(uint8_t slot) { zs.next_out = (Bytef *) certdata; if (inflateInit2(&zs, MAX_WBITS | 16) != Z_OK) { - fprintf(stderr, "Failed to initialize certificate decompression.\n"); + + DBG("Failed to initialize certificate decompression"); *certdata_len = 0; return YKPIV_INVALID_OBJECT; } if (inflate(&zs, Z_FINISH) != Z_STREAM_END) { - fprintf(stderr, "Failed to decompress certificate.\n"); + DBG("Failed to decompress certificate"); *certdata_len = 0; return YKPIV_INVALID_OBJECT; } if (inflateEnd(&zs) != Z_OK) { - fprintf(stderr, "Failed to finish certificate decompression.\n"); + DBG("Failed to finish certificate decompression"); *certdata_len = 0; return YKPIV_INVALID_OBJECT; }