From 018a4d394cd84c65b0a70e615ff53bfedff2c644 Mon Sep 17 00:00:00 2001 From: Conor Patrick Date: Mon, 16 Sep 2019 17:00:30 +0800 Subject: [PATCH] add get_version command to hid --- fido2/ctaphid.c | 15 +++++++++++++++ fido2/ctaphid.h | 1 + 2 files changed, 16 insertions(+) diff --git a/fido2/ctaphid.c b/fido2/ctaphid.c index 4ba3f09..3e34516 100644 --- a/fido2/ctaphid.c +++ b/fido2/ctaphid.c @@ -729,6 +729,21 @@ uint8_t ctaphid_handle_packet(uint8_t * pkt_raw) ctaphid_write(&wb, NULL, 0); is_busy = 0; break; + + case CTAPHID_GETVERSION: + printf1(TAG_HID,"CTAPHID_GETVERSION\n"); + ctap_response_init(&ctap_resp); + ctaphid_write_buffer_init(&wb); + wb.cid = cid; + wb.cmd = CTAPHID_GETVERSION; + wb.bcnt = 3; + ctap_buffer[0] = SOLO_VERSION_MAJ; + ctap_buffer[1] = SOLO_VERSION_MIN; + ctap_buffer[2] = SOLO_VERSION_PATCH; + ctaphid_write(&wb, &ctap_buffer, 3); + ctaphid_write(&wb, NULL, 0); + is_busy = 0; + break; #endif default: diff --git a/fido2/ctaphid.h b/fido2/ctaphid.h index 135260b..dbde70d 100644 --- a/fido2/ctaphid.h +++ b/fido2/ctaphid.h @@ -28,6 +28,7 @@ #define CTAPHID_ENTERBOOT (TYPE_INIT | 0x51) #define CTAPHID_ENTERSTBOOT (TYPE_INIT | 0x52) #define CTAPHID_GETRNG (TYPE_INIT | 0x60) +#define CTAPHID_GETVERSION (TYPE_INIT | 0x61) // reserved for debug, not implemented except for HACKER and DEBUG_LEVEl > 0 #define CTAPHID_PROBE (TYPE_INIT | 0x70)