works. needs to add chaining

This commit is contained in:
merlokk 2019-01-24 19:21:31 +02:00
parent 45888c9a25
commit d713167ec4
2 changed files with 16 additions and 4 deletions

View File

@ -120,6 +120,9 @@ void nfc_process_iblock(uint8_t * buf, int len)
int selected;
uint8_t res[32];
CTAP_RESPONSE ctap_resp;
int status;
printf1(TAG_NFC,">> ");
dump_hex1(TAG_NFC, buf, len);
@ -173,24 +176,33 @@ void nfc_process_iblock(uint8_t * buf, int len)
case APDU_FIDO_U2F_VERSION:
printf1(TAG_NFC, "U2F 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);
printf1(TAG_NFC,"<< "); dump_hex1(TAG_NFC,res, 3 + 6);
break;
case APDU_FIDO_U2F_REGISTER:
printf1(TAG_NFC, "U2F Register command.\r\n");
break;
case APDU_FIDO_U2F_AUTHENTICATE:
printf1(TAG_NFC, "U2F Authenticate command.\r\n");
break;
case APDU_FIDO_EXCHANGE:
printf1(TAG_NFC, "FIDO2 Exchange command.\r\n");
case APDU_FIDO_NFCCTAP_MSG:
printf1(TAG_NFC, "FIDO2 CTAP message.\r\n");
ctap_response_init(&ctap_resp);
status = ctap_request(payload, plen, &ctap_resp);
printf1(TAG_NFC, "status: %d\r\n", status);
nfc_write_frame(ctap_resp.data, ctap_resp.length);
printf1(TAG_NFC, "<< "); dump_hex1(TAG_NFC, ctap_resp.data, ctap_resp.length);
break;
case APDU_INS_READ_BINARY:

View File

@ -47,7 +47,7 @@ typedef struct
#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_FIDO_NFCCTAP_MSG 0x10
#define APDU_INS_SELECT 0xA4
#define APDU_INS_READ_BINARY 0xB0