refactor, bugfix, add more pin command support

This commit is contained in:
Conor Patrick
2018-05-21 21:57:35 -04:00
parent 8020e868f9
commit 5bac402118
4 changed files with 211 additions and 118 deletions

10
ctap.h
View File

@@ -100,7 +100,7 @@
#define ALLOW_LIST_MAX_SIZE 20
#define NEW_PIN_ENC_MAX_SIZE 256
#define NEW_PIN_ENC_MAX_SIZE 256 // includes NULL terminator
typedef struct
{
@@ -208,7 +208,9 @@ typedef struct
} keyAgreement;
uint8_t keyAgreementPresent;
uint8_t pinAuth[16];
uint8_t pinAuthPresent;
uint8_t newPinEnc[NEW_PIN_ENC_MAX_SIZE];
int newPinEncSize;
uint8_t pinHashEnc[16];
uint8_t pinHashEncPresent;
int getKeyAgreement;
@@ -221,6 +223,12 @@ uint8_t ctap_handle_packet(uint8_t * pkt_raw, int length, CTAP_RESPONSE * resp);
// Run ctap related power-up procedures (init pinToken, generate shared secret)
void ctap_init();
void ctap_update_pin(uint8_t * pin, int len);
uint8_t ctap_decrement_pin_attempts();
int8_t ctap_leftover_pin_attempts();
void ctap_reset_pin_attempts();
// Test for user presence
// Return 1 for user is present, 0 user not present
extern int ctap_user_presence_test();