diff --git a/client/src/cmdhffido.c b/client/src/cmdhffido.c index 818dc6f35..91c1a85b3 100644 --- a/client/src/cmdhffido.c +++ b/client/src/cmdhffido.c @@ -312,8 +312,8 @@ static int cmd_hf_fido_register(const char *cmd) { int derp = 67 + keyHandleLen; int derLen = (buf[derp + 2] << 8) + buf[derp + 3] + 4; if (verbose2) { - PrintAndLogEx(INFO, "DER certificate[%d]:"); - PrintAndLogEx(INFO, "------------------DER-------------------", derLen); + PrintAndLogEx(INFO, "DER certificate[%d]:", derLen); + PrintAndLogEx(INFO, "------------------DER-------------------"); PrintAndLogEx(INFO, "%s", sprint_hex(buf + derp, derLen)); PrintAndLogEx(INFO, "----------------DER---------------------"); } else { diff --git a/client/src/emv/dump.c b/client/src/emv/dump.c index edf60d34d..137fc5bdb 100644 --- a/client/src/emv/dump.c +++ b/client/src/emv/dump.c @@ -23,23 +23,13 @@ # define PRINT_INDENT(level) {for (int myi = 0; myi < (level); myi++) fprintf(f, " ");} #endif -void dump_buffer_simple(const unsigned char *ptr, size_t len, FILE *f) { - int i; - - if (!f) - f = stdout; - - for (i = 0; i < len; i ++) - fprintf(f, "%s%02hhX", i ? " " : "", ptr[i]); -} - void dump_buffer(const unsigned char *ptr, size_t len, FILE *f, int level) { - int i, j; + int j; if (!f) f = stdout; - for (i = 0; i < len; i += 16) { + for (int i = 0; i < len; i += 16) { PRINT_INDENT(level); fprintf(f, "\t%02x:", i); for (j = 0; j < 16; j++) { diff --git a/client/src/emv/dump.h b/client/src/emv/dump.h index 5a71b9519..3a67c0855 100644 --- a/client/src/emv/dump.h +++ b/client/src/emv/dump.h @@ -20,7 +20,6 @@ #include // FILE -void dump_buffer_simple(const unsigned char *ptr, size_t len, FILE *f); void dump_buffer(const unsigned char *ptr, size_t len, FILE *f, int level); void dump_buffer_tab(const unsigned char *ptr, size_t len, FILE *f, int tabs); diff --git a/client/src/fido/fidocore.c b/client/src/fido/fidocore.c index 3cddbc5a9..26fa30dc4 100644 --- a/client/src/fido/fidocore.c +++ b/client/src/fido/fidocore.c @@ -274,7 +274,7 @@ int FIDOCheckDERAndGetKey(uint8_t *der, size_t derLen, bool verbose, uint8_t *pu } if (verbose) - PrintAndLogEx(NORMAL, "------------------DER-------------------"); + PrintAndLogEx(INFO, "------------------DER-------------------"); mbedtls_x509_crt_free(&cert); mbedtls_x509_crt_free(&cacert); @@ -366,8 +366,8 @@ static int FIDO2CheckSignature(json_t *root, uint8_t *publickey, uint8_t *sign, int res = ecdsa_asn1_get_signature(sign, signLen, rval, sval); if (!res) { if (verbose) { - PrintAndLogEx(NORMAL, " r: %s", sprint_hex(rval, 32)); - PrintAndLogEx(NORMAL, " s: %s", sprint_hex(sval, 32)); + PrintAndLogEx(INFO, " r: %s", sprint_hex(rval, 32)); + PrintAndLogEx(INFO, " s: %s", sprint_hex(sval, 32)); } uint8_t clientDataHash[32] = {0}; @@ -488,9 +488,9 @@ int FIDO2MakeCredentionalParseRes(json_t *root, uint8_t *data, size_t dataLen, b if (showCBOR) { PrintAndLogEx(INFO, "COSE structure:"); - PrintAndLogEx(NORMAL, "---------------- CBOR ------------------"); + PrintAndLogEx(INFO, "---------------- CBOR ------------------"); TinyCborPrintFIDOPackage(fido2COSEKey, true, &ubuf[55 + cridlen], cplen); - PrintAndLogEx(NORMAL, "---------------- CBOR ------------------"); + PrintAndLogEx(INFO, "---------------- CBOR ------------------"); } res = COSEGetECDSAKey(&ubuf[55 + cridlen], cplen, verbose, coseKey); @@ -542,11 +542,12 @@ int FIDO2MakeCredentionalParseRes(json_t *root, uint8_t *data, size_t dataLen, b res = CborGetArrayBinStringValue(&mapsmt, der, sizeof(der), &derLen); cbor_check(res); if (verbose2) { - PrintAndLogEx(NORMAL, "DER certificate[%zu]:\n------------------DER-------------------", derLen); - dump_buffer_simple((const unsigned char *)der, derLen, NULL); - PrintAndLogEx(NORMAL, "\n----------------DER---------------------"); + PrintAndLogEx(INFO, "DER certificate[%zu]:", derLen); + PrintAndLogEx(INFO, "------------------DER-------------------"); + PrintAndLogEx(INFO, "%s", sprint_hex(der, derLen)); + PrintAndLogEx(INFO, "----------------DER---------------------"); } else { - PrintAndLogEx(NORMAL, "DER [%zu]: %s...", derLen, sprint_hex(der, MIN(derLen, 16))); + PrintAndLogEx(INFO, "DER [%zu]: %s...", derLen, sprint_hex(der, MIN(derLen, 16))); } JsonSaveBufAsHexCompact(root, "$.AppData.DER", der, derLen); } @@ -558,9 +559,9 @@ int FIDO2MakeCredentionalParseRes(json_t *root, uint8_t *data, size_t dataLen, b // print DER certificate in TLV view if (showDERTLV) { - PrintAndLogEx(NORMAL, "----------------DER TLV-----------------"); + PrintAndLogEx(INFO, "----------------DER TLV-----------------"); asn1_print(der, derLen, " "); - PrintAndLogEx(NORMAL, "----------------DER TLV-----------------"); + PrintAndLogEx(INFO, "----------------DER TLV-----------------"); } FIDOCheckDERAndGetKey(der, derLen, verbose, public_key, sizeof(public_key)); JsonSaveBufAsHexCompact(root, "$.AppData.DERPublicKey", public_key, sizeof(public_key));