text and increasing a buffer

This commit is contained in:
iceman1001 2023-07-24 03:15:14 +02:00
commit 10504ae4fd
2 changed files with 18 additions and 14 deletions

View file

@ -415,7 +415,7 @@ static bool read_bench_data(statelist_t *test_candidates) {
// read 4 bytes of data ? // read 4 bytes of data ?
bytes_read = fread(&nonces_to_bruteforce, 1, sizeof(uint32_t), benchfile); bytes_read = fread(&nonces_to_bruteforce, 1, sizeof(uint32_t), benchfile);
if (bytes_read != sizeof(uint32_t)) { if (bytes_read != sizeof(uint32_t) || (nonces_to_bruteforce >= 256)) {
fclose(benchfile); fclose(benchfile);
return false; return false;
} }

View file

@ -78,33 +78,36 @@ static int CmdHFFidoInfo(const char *Cmd) {
uint8_t buf[APDU_RES_LEN] = {0}; uint8_t buf[APDU_RES_LEN] = {0};
size_t len = 0; size_t len = 0;
uint16_t sw = 0; uint16_t sw = 0;
int res = FIDOSelect(true, true, buf, sizeof(buf), &len, &sw);
int res = FIDOSelect(true, true, buf, sizeof(buf), &len, &sw);
if (res) { if (res) {
DropField(); DropField();
return res; return res;
} }
if (sw != ISO7816_OK) { if (sw != ISO7816_OK) {
if (sw) if (sw) {
PrintAndLogEx(INFO, "Not a FIDO card! APDU response: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff)); PrintAndLogEx(INFO, "Not a FIDO card. APDU response: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
else } else {
PrintAndLogEx(ERR, "APDU exchange error. Card returns 0x0000."); PrintAndLogEx(ERR, "APDU exchange error. Card returns 0x0000");
}
DropField(); DropField();
return PM3_SUCCESS; return PM3_SUCCESS;
} }
if (!strncmp((char *)buf, "U2F_V2", 7)) { if (strncmp((char *)buf, "U2F_V2", 7) == 0) {
if (!strncmp((char *)buf, "FIDO_2_0", 8)) { if (strncmp((char *)buf, "FIDO_2_0", 8) == 0) {
PrintAndLogEx(INFO, "FIDO2 authenticator detected. Version... " _YELLOW_("%.*s"), (int)len, buf); PrintAndLogEx(INFO, "FIDO2 authenticator");
PrintAndLogEx(INFO, "Version... " _YELLOW_("%.*s"), (int)len, buf);
} else { } else {
PrintAndLogEx(INFO, "FIDO authenticator detected (not standard U2F)."); PrintAndLogEx(INFO, "FIDO authenticator (not standard U2F)");
PrintAndLogEx(INFO, "Non U2F authenticator version:"); PrintAndLogEx(INFO, "Non U2F authenticator");
PrintAndLogEx(INFO, "version... ");
print_buffer((const unsigned char *)buf, len, 1); print_buffer((const unsigned char *)buf, len, 1);
} }
} else { } else {
PrintAndLogEx(INFO, "FIDO U2F authenticator detected. Version... " _YELLOW_("%.*s"), (int)len, buf); PrintAndLogEx(INFO, "FIDO U2F authenticator detected");
PrintAndLogEx(INFO, "Version... " _YELLOW_("%.*s"), (int)len, buf);
} }
res = FIDO2GetInfo(buf, sizeof(buf), &len, &sw); res = FIDO2GetInfo(buf, sizeof(buf), &len, &sw);
@ -112,6 +115,7 @@ static int CmdHFFidoInfo(const char *Cmd) {
if (res) { if (res) {
return res; return res;
} }
if (sw != ISO7816_OK) { if (sw != ISO7816_OK) {
PrintAndLogEx(ERR, "FIDO2 version doesn't exist (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff)); PrintAndLogEx(ERR, "FIDO2 version doesn't exist (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
return PM3_SUCCESS; return PM3_SUCCESS;
@ -441,7 +445,7 @@ static int CmdHFFidoAuthenticate(const char *cmd) {
controlByte = 0x07; controlByte = 0x07;
uint8_t data[512] = {0}; uint8_t data[512] = {0};
uint8_t hdata[250] = {0}; uint8_t hdata[256] = {0};
bool public_key_loaded = false; bool public_key_loaded = false;
uint8_t public_key[65] = {0}; uint8_t public_key[65] = {0};
int hdatalen = 0; int hdatalen = 0;