SELECT works as expected and U2F GetVersion command done

This commit is contained in:
merlokk 2019-01-24 18:19:23 +02:00
parent ad9186c13b
commit d02206ba09
2 changed files with 31 additions and 5 deletions

View File

@ -154,17 +154,39 @@ void nfc_process_iblock(uint8_t * buf, int len)
// block = !block; // block = !block;
// NFC_STATE.block_num = block; // NFC_STATE.block_num = block;
res[0] = NFC_CMD_IBLOCK | (buf[0] & 3); res[0] = NFC_CMD_IBLOCK | (buf[0] & 3);
res[1] = APDU_STATUS_SUCCESS >> 8; memcpy(&res[1], (uint8_t *)"U2F_V2", 6);
res[2] = APDU_STATUS_SUCCESS & 0xff; res[7] = APDU_STATUS_SUCCESS >> 8;
nfc_write_frame(res, 3); res[8] = APDU_STATUS_SUCCESS & 0xff;
printf1(TAG_NFC,"<< "); dump_hex1(TAG_NFC,res, 3); nfc_write_frame(res, 3 + 6);
printf1(TAG_NFC,"<< "); dump_hex1(TAG_NFC,res, 3 + 6);
} }
else else
{ {
printf1(TAG_NFC, "NOT selected\r\n"); res[0] = NFC_CMD_IBLOCK | (buf[0] & 3);
res[1] = 0x6a;
res[2] = 0x82;
nfc_write_frame(res, 3);
printf1(TAG_NFC, "NOT selected\r\n"); dump_hex1(TAG_NFC,res, 3);
} }
} }
break; break;
case APDU_FIDO_U2F_VERSION:
printf1(TAG_NFC, "GetVersion command.\r\n");
res[0] = NFC_CMD_IBLOCK | (buf[0] & 3);
memcpy(&res[1], (uint8_t *)"U2F_V2", 6);
res[7] = APDU_STATUS_SUCCESS >> 8;
res[8] = APDU_STATUS_SUCCESS & 0xff;
nfc_write_frame(res, 3 + 6);
printf1(TAG_NFC, "<< "); dump_hex1(TAG_NFC,res, 3 + 6);
break;
case APDU_FIDO_U2F_REGISTER:
break;
case APDU_FIDO_U2F_AUTHENTICATE:
break;
case APDU_INS_READ_BINARY: case APDU_INS_READ_BINARY:

View File

@ -44,6 +44,10 @@ typedef struct
#define NFC_SBLOCK_DESELECT 0x32 #define NFC_SBLOCK_DESELECT 0x32
#define NFC_SBLOCK_WTX 0xf2 #define NFC_SBLOCK_WTX 0xf2
#define APDU_FIDO_U2F_REGISTER 0x01
#define APDU_FIDO_U2F_AUTHENTICATE 0x02
#define APDU_FIDO_U2F_VERSION 0x03
#define APDU_FIDO_EXCHANGE 0x10
#define APDU_INS_SELECT 0xA4 #define APDU_INS_SELECT 0xA4
#define APDU_INS_READ_BINARY 0xB0 #define APDU_INS_READ_BINARY 0xB0