fix compilation errors

This commit is contained in:
Conor Patrick 2019-02-26 13:27:25 -05:00
parent 1a6895ca25
commit 57930aaa13
4 changed files with 11 additions and 8 deletions

View File

@ -10,6 +10,7 @@
#include "crypto.h" #include "crypto.h"
#include "log.h" #include "log.h"
#include "device.h" #include "device.h"
#include "apdu.h"
#include "wallet.h" #include "wallet.h"
#ifdef ENABLE_U2F_EXTENSIONS #ifdef ENABLE_U2F_EXTENSIONS
#include "extensions.h" #include "extensions.h"
@ -42,7 +43,7 @@ void u2f_request_ex(APDU_HEADER *req, uint8_t *payload, uint32_t len, CTAP_RESPO
goto end; goto end;
} }
#ifdef ENABLE_U2F_EXTENSIONS #ifdef ENABLE_U2F_EXTENSIONS
rcode = extend_u2f(req, len); rcode = extend_u2f(req, len); // FIXME
#endif #endif
if (rcode != U2F_SW_NO_ERROR && rcode != U2F_SW_CONDITIONS_NOT_SATISFIED) // If the extension didn't do anything... if (rcode != U2F_SW_NO_ERROR && rcode != U2F_SW_CONDITIONS_NOT_SATISFIED) // If the extension didn't do anything...
{ {
@ -59,7 +60,7 @@ void u2f_request_ex(APDU_HEADER *req, uint8_t *payload, uint32_t len, CTAP_RESPO
{ {
timestamp(); timestamp();
rcode = u2f_register((struct u2f_register_request*)req->payload, fromNFC); rcode = u2f_register((struct u2f_register_request*)payload, fromNFC);
printf1(TAG_TIME,"u2f_register time: %d ms\n", timestamp()); printf1(TAG_TIME,"u2f_register time: %d ms\n", timestamp());
} }
@ -67,7 +68,7 @@ void u2f_request_ex(APDU_HEADER *req, uint8_t *payload, uint32_t len, CTAP_RESPO
case U2F_AUTHENTICATE: case U2F_AUTHENTICATE:
printf1(TAG_U2F, "U2F_AUTHENTICATE\n"); printf1(TAG_U2F, "U2F_AUTHENTICATE\n");
timestamp(); timestamp();
rcode = u2f_authenticate((struct u2f_authenticate_request*)req->payload, req->p1, fromNFC); rcode = u2f_authenticate((struct u2f_authenticate_request*)payload, req->p1, fromNFC);
printf1(TAG_TIME,"u2f_authenticate time: %d ms\n", timestamp()); printf1(TAG_TIME,"u2f_authenticate time: %d ms\n", timestamp());
break; break;
case U2F_VERSION: case U2F_VERSION:
@ -253,7 +254,7 @@ static int16_t u2f_authenticate(struct u2f_authenticate_request * req, uint8_t c
crypto_sha256_update(req->app, 32); crypto_sha256_update(req->app, 32);
crypto_sha256_update(&up, 1); crypto_sha256_update(&up, 1);
crypto_sha256_update(vcount, 4); crypto_sha256_update(hash, 4);
crypto_sha256_update(req->chal, 32); crypto_sha256_update(req->chal, 32);
crypto_sha256_final(hash); crypto_sha256_final(hash);
@ -292,12 +293,11 @@ static int16_t u2f_register(struct u2f_register_request * req, bool fromNFC)
return U2F_SW_CONDITIONS_NOT_SATISFIED; return U2F_SW_CONDITIONS_NOT_SATISFIED;
} }
} }
uint32_t t1 = millis();
if ( u2f_new_keypair(&key_handle, req->app, pubkey) == -1) if ( u2f_new_keypair(&key_handle, req->app, pubkey) == -1)
{ {
return U2F_SW_INSUFFICIENT_MEMORY; return U2F_SW_INSUFFICIENT_MEMORY;
} }
printf1(TAG_NFC, "keygen time: %d ms\r\n", millis()-t1);
crypto_sha256_init(); crypto_sha256_init();
crypto_sha256_update(i,1); crypto_sha256_update(i,1);

View File

@ -6,7 +6,7 @@ AR=$(PREFIX)arm-none-eabi-ar
DRIVER_LIBS := lib/stm32l4xx_hal_pcd.c lib/stm32l4xx_hal_pcd_ex.c lib/stm32l4xx_ll_gpio.c \ DRIVER_LIBS := lib/stm32l4xx_hal_pcd.c lib/stm32l4xx_hal_pcd_ex.c lib/stm32l4xx_ll_gpio.c \
lib/stm32l4xx_ll_rcc.c lib/stm32l4xx_ll_rng.c lib/stm32l4xx_ll_tim.c \ lib/stm32l4xx_ll_rcc.c lib/stm32l4xx_ll_rng.c lib/stm32l4xx_ll_tim.c \
lib/stm32l4xx_ll_usb.c lib/stm32l4xx_ll_utils.c lib/stm32l4xx_ll_pwr.c \ lib/stm32l4xx_ll_usb.c lib/stm32l4xx_ll_utils.c lib/stm32l4xx_ll_pwr.c \
lib/stm32l4xx_ll_usart.c lib/stm32l4xx_ll_usart.c lib/stm32l4xx_ll_spi.c
USB_LIB := lib/usbd/usbd_cdc.c lib/usbd/usbd_cdc_if.c lib/usbd/usbd_composite.c \ USB_LIB := lib/usbd/usbd_cdc.c lib/usbd/usbd_cdc_if.c lib/usbd/usbd_composite.c \
lib/usbd/usbd_conf.c lib/usbd/usbd_core.c lib/usbd/usbd_ioreq.c \ lib/usbd/usbd_conf.c lib/usbd/usbd_core.c lib/usbd/usbd_ioreq.c \

View File

@ -219,6 +219,7 @@ int ams_state_is_valid(uint8_t regval)
void ams_print_int0(uint8_t int0) void ams_print_int0(uint8_t int0)
{ {
#if DEBUG_LEVEL
uint32_t tag = (TAG_NFC)|(TAG_NO_TAG); uint32_t tag = (TAG_NFC)|(TAG_NO_TAG);
printf1(TAG_NFC," "); printf1(TAG_NFC," ");
if (int0 & AMS_INT_XRF) if (int0 & AMS_INT_XRF)
@ -239,10 +240,12 @@ void ams_print_int0(uint8_t int0)
printf1(tag," INIT"); printf1(tag," INIT");
printf1(tag,"\r\n"); printf1(tag,"\r\n");
#endif
} }
void ams_print_int1(uint8_t int0) void ams_print_int1(uint8_t int0)
{ {
#if DEBUG_LEVEL
uint32_t tag = (TAG_NFC)|(TAG_NO_TAG); uint32_t tag = (TAG_NFC)|(TAG_NO_TAG);
printf1(TAG_NFC," "); printf1(TAG_NFC," ");
if (int0 & AMS_INT_ACC_ERR) if (int0 & AMS_INT_ACC_ERR)
@ -263,6 +266,7 @@ void ams_print_int1(uint8_t int0)
printf1(tag," RXS"); printf1(tag," RXS");
printf1(tag,"\r\n"); printf1(tag,"\r\n");
#endif
} }

View File

@ -804,7 +804,6 @@ void init_debug_uart(void)
LL_USART_Enable(USART1); LL_USART_Enable(USART1);
} }
#endif
void init_gpio(void) void init_gpio(void)
{ {