From df2cff23501b9c0657dd5ecf89f02c6635795e14 Mon Sep 17 00:00:00 2001 From: Conor Patrick Date: Fri, 26 Jul 2019 23:49:55 -0400 Subject: [PATCH] patch hmac final to use correct key --- fido2/crypto.h | 1 + targets/stm32l432/src/crypto.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/fido2/crypto.h b/fido2/crypto.h index 4fc54a2..e9e4433 100644 --- a/fido2/crypto.h +++ b/fido2/crypto.h @@ -38,6 +38,7 @@ 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_KEY2 ((uint8_t*)2) #define CRYPTO_TRANSPORT_KEY ((uint8_t*)1) #define CRYPTO_MASTER_KEY ((uint8_t*)0) diff --git a/targets/stm32l432/src/crypto.c b/targets/stm32l432/src/crypto.c index 31812d4..33fef68 100644 --- a/targets/stm32l432/src/crypto.c +++ b/targets/stm32l432/src/crypto.c @@ -157,6 +157,11 @@ void crypto_sha256_hmac_final(uint8_t * key, uint32_t klen, uint8_t * hmac) key = master_secret; klen = sizeof(master_secret)/2; } + else if (key == CRYPTO_TRANSPORT_KEY2) + { + key = transport_secret; + klen = 32; + } if(klen > 64)