fix compile warnings, add flash locking
This commit is contained in:
@@ -49,8 +49,8 @@ void generate_private_key(uint8_t * data, int len, uint8_t * data2, int len2, ui
|
||||
void crypto_ecc256_make_key_pair(uint8_t * pubkey, uint8_t * privkey);
|
||||
void crypto_ecc256_shared_secret(const uint8_t * pubkey, const uint8_t * privkey, uint8_t * shared_secret);
|
||||
|
||||
#define CRYPTO_TRANSPORT_KEY NULL
|
||||
#define CRYPTO_MASTER_KEY NULL
|
||||
#define CRYPTO_TRANSPORT_KEY ((uint8_t*)1)
|
||||
#define CRYPTO_MASTER_KEY ((uint8_t*)0)
|
||||
|
||||
void crypto_aes256_init(uint8_t * key, uint8_t * nonce);
|
||||
void crypto_aes256_reset_iv(uint8_t * nonce);
|
||||
@@ -66,6 +66,7 @@ void crypto_load_master_secret(uint8_t * key);
|
||||
extern const uint8_t attestation_cert_der[];
|
||||
extern const uint16_t attestation_cert_der_size;
|
||||
|
||||
|
||||
extern const uint8_t attestation_key[];
|
||||
extern const uint16_t attestation_key_size;
|
||||
|
||||
#endif
|
||||
|
@@ -269,12 +269,12 @@ static int ctap_generate_cose_key(CborEncoder * cose_key, uint8_t * hmac_input,
|
||||
void make_auth_tag(uint8_t * nonce, CTAP_userEntity * user, uint32_t count, uint8_t * tag)
|
||||
{
|
||||
uint8_t hashbuf[32];
|
||||
crypto_sha256_hmac_init(NULL, 0, hashbuf);
|
||||
crypto_sha256_hmac_init(CRYPTO_TRANSPORT_KEY, 0, hashbuf);
|
||||
crypto_sha256_update(nonce, CREDENTIAL_NONCE_SIZE);
|
||||
crypto_sha256_update(user->id, user->id_size);
|
||||
crypto_sha256_update(user->name, strnlen((const char*)user->name, USER_NAME_LIMIT));
|
||||
crypto_sha256_update((uint8_t*)&count, 4);
|
||||
crypto_sha256_hmac_final(NULL,0,hashbuf);
|
||||
crypto_sha256_hmac_final(CRYPTO_TRANSPORT_KEY,0,hashbuf);
|
||||
|
||||
memmove(tag, hashbuf, CREDENTIAL_TAG_SIZE);
|
||||
}
|
||||
|
@@ -28,6 +28,8 @@ void device_init();
|
||||
|
||||
uint32_t millis();
|
||||
|
||||
void delay(uint32_t ms);
|
||||
|
||||
// HID message size in bytes
|
||||
#define HID_MESSAGE_SIZE 64
|
||||
|
||||
|
18
fido2/main.c
18
fido2/main.c
@@ -36,12 +36,8 @@
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
int count = 0;
|
||||
uint32_t t1 = 0;
|
||||
uint32_t t2 = 0;
|
||||
uint32_t accum = 0;
|
||||
uint32_t dt = 0;
|
||||
uint8_t hidmsg[64];
|
||||
uint32_t t1 = 0;
|
||||
|
||||
set_logging_mask(
|
||||
/*0*/
|
||||
@@ -51,11 +47,11 @@ int main(int argc, char * argv[])
|
||||
// TAG_WALLET |
|
||||
TAG_STOR |
|
||||
// TAG_CP |
|
||||
TAG_CTAP|
|
||||
// TAG_CTAP|
|
||||
// TAG_HID|
|
||||
/*TAG_U2F|*/
|
||||
// TAG_PARSE |
|
||||
//TAG_TIME|
|
||||
// TAG_TIME|
|
||||
// TAG_DUMP|
|
||||
TAG_GREEN|
|
||||
TAG_RED|
|
||||
@@ -89,24 +85,18 @@ int main(int argc, char * argv[])
|
||||
|
||||
if (usbhid_recv(hidmsg) > 0)
|
||||
{
|
||||
t2 = millis();
|
||||
ctaphid_handle_packet(hidmsg);
|
||||
accum += millis() - t2;
|
||||
// printf1(TAG_TIME,"accum: %d\n", (uint32_t)accum);
|
||||
// printf1(TAG_TIME,"dt: %d\n", t2 - dt);
|
||||
dt = t2;
|
||||
memset(hidmsg, 0, sizeof(hidmsg));
|
||||
}
|
||||
else
|
||||
{
|
||||
/*main_loop_delay();*/
|
||||
}
|
||||
ctaphid_check_timeouts();
|
||||
}
|
||||
|
||||
// Should never get here
|
||||
usbhid_close();
|
||||
printf("done\n");
|
||||
printf1(TAG_GREEN, "done\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -124,7 +124,7 @@ int main(int argc, char * argv[])
|
||||
|
||||
// Should never get here
|
||||
usbhid_close();
|
||||
printf("done\n");
|
||||
printf1(TAG_GREEN, "done\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user