From 8c4bfd825a720f9f893dd48f3128b6811dcb3772 Mon Sep 17 00:00:00 2001 From: David Garske Date: Wed, 21 Mar 2018 08:58:26 -0700 Subject: [PATCH] Support for building the ATECC508A without `WOLFSSL_ATMEL` defined, which enables features specific to Atmel Studio Framework (ASF) and an embedded target. This allows for building with `WOLFSSL_ATECC508A` defined on other targets such as Linux. --- wolfcrypt/src/port/atmel/atmel.c | 10 ++++++++-- wolfcrypt/src/wc_port.c | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/wolfcrypt/src/port/atmel/atmel.c b/wolfcrypt/src/port/atmel/atmel.c index 66beac6fa..8fb2c59f5 100644 --- a/wolfcrypt/src/port/atmel/atmel.c +++ b/wolfcrypt/src/port/atmel/atmel.c @@ -25,18 +25,20 @@ #include -#ifdef WOLFSSL_ATMEL +#if defined(WOLFSSL_ATMEL) || defined(WOLFSSL_ATECC508A) #include #include #include #include +#ifdef WOLFSSL_ATMEL #define Aes Aes_Remap #define Gmac Gmac_Remap #include "asf.h" #undef Aes #undef Gmac +#endif /* WOLFSSL_ATMEL */ #include @@ -102,16 +104,20 @@ int atmel_get_random_block(unsigned char* output, unsigned int sz) return atmel_get_random_number((uint32_t)sz, (uint8_t*)output); } +#ifdef WOLFSSL_ATMEL extern struct rtc_module *_rtc_instance[RTC_INST_NUM]; +#endif long atmel_get_curr_time_and_date(long* tm) { (void)tm; +#ifdef WOLFSSL_ATMEL /* Get current time */ //struct rtc_calendar_time rtcTime; //rtc_calendar_get_time(_rtc_instance[0], &rtcTime); /* Convert rtc_calendar_time to seconds since UTC */ +#endif return 0; } @@ -241,4 +247,4 @@ void atmel_init(void) } } -#endif /* WOLFSSL_ATMEL */ +#endif /* WOLFSSL_ATMEL || WOLFSSL_ATECC508A */ \ No newline at end of file diff --git a/wolfcrypt/src/wc_port.c b/wolfcrypt/src/wc_port.c index acbd675db..7ebf8610d 100644 --- a/wolfcrypt/src/wc_port.c +++ b/wolfcrypt/src/wc_port.c @@ -46,7 +46,7 @@ #include #endif -#ifdef WOLFSSL_ATMEL +#if defined(WOLFSSL_ATMEL) || defined(WOLFSSL_ATECC508A) #include #endif @@ -129,7 +129,7 @@ int wolfCrypt_Init(void) } #endif - #ifdef WOLFSSL_ATMEL + #if defined(WOLFSSL_ATMEL) || defined(WOLFSSL_ATECC508A) atmel_init(); #endif