diff --git a/wolfcrypt/src/port/maxim/max3266x.c b/wolfcrypt/src/port/maxim/max3266x.c index 5370337cf9..62954917b5 100644 --- a/wolfcrypt/src/port/maxim/max3266x.c +++ b/wolfcrypt/src/port/maxim/max3266x.c @@ -25,10 +25,7 @@ #include -#warning "Inside max3266x.c" #if defined(WOLFSSL_MAX32665) || defined(WOLFSSL_MAX32666) -#warning "Inside max3266x.c define" - #ifdef NO_INLINE #include @@ -91,10 +88,14 @@ int wc_MXC_TPU_Init(void) int wc_MXC_TPU_Shutdown(void) { /* Shutdown the TPU device */ - if(MXC_TPU_Shutdown(MXC_SYS_PERIPH_CLOCK_TRNG) != EXIT_SUCCESS){ - WOLFSSL_MSG("Device did not shutdown"); - return RNG_FAILURE_E; - } + #if defined(WOLFSSL_MAX32665_OLD) || defined(WOLFSSL_MAX32666_OLD) + MXC_TPU_Shutdown(); /* Is a void return in older SDK */ + #else + if(MXC_TPU_Shutdown(MXC_SYS_PERIPH_CLOCK_TRNG) != EXIT_SUCCESS){ + WOLFSSL_MSG("Device did not shutdown"); + return RNG_FAILURE_E; + } + #endif return EXIT_SUCCESS; } diff --git a/wolfssl/wolfcrypt/port/maxim/max3266x.h b/wolfssl/wolfcrypt/port/maxim/max3266x.h index 9d64d9e3da..2cb6d98bb8 100644 --- a/wolfssl/wolfcrypt/port/maxim/max3266x.h +++ b/wolfssl/wolfcrypt/port/maxim/max3266x.h @@ -42,7 +42,7 @@ #if defined(WOLFSSL_MAX32665) || defined(WOLFSSL_MAX32666) #if defined(WOLFSSL_MAX32665_OLD) || defined(WOLFSSL_MAX32666_OLD) - #if !defined(MAX3266X_RTC) + #if defined(MAX3266X_RTC) #error Cannot use RTC Code with older sdk #endif #endif @@ -58,11 +58,13 @@ #define MAX3266X_MATH #endif +#if defined(WOLFSSL_MAX32665_OLD) || defined(WOLFSSL_MAX32666_OLD) - - -#if defined(WOLFSSL_MAX32665_OLD) || (WOLFSSL_MAX32666_OLD) /* Support for older SDK Maxim provides */ + #define TARGET MAX32665 + #define TARGET_REV 0x4131 + #include "mxc_sys.h" + #if defined(MAX3266X_RNG) #include "trng.h" /* Provides TRNG Drivers */ #endif @@ -74,10 +76,6 @@ #define MXC_TPU_CIPHER_AES192 TPU_CIPHER_AES192 #define MXC_TPU_CIPHER_AES256 TPU_CIPHER_AES256 - #define MXC_AES_KEY_128_LEN MXC_AES_KEY_128_LEN - #define MXC_AES_KEY_192_LEN MXC_AES_KEY_192_LEN - #define MXC_AES_KEY_256_LEN MXC_AES_KEY_256_LEN - #define MXC_TPU_MODE_TYPE tpu_modesel_t #define MXC_TPU_MODE_ECB TPU_MODE_ECB #define MXC_TPU_MODE_CBC TPU_MODE_CBC @@ -86,8 +84,8 @@ /* AES Functions */ #define MXC_TPU_Cipher_Config TPU_Cipher_Config - #define MXC_TPU_Cipher_AES_Encrypt TPU_Cipher_AES_Encrypt - #define MXC_TPU_Cipher_AES_Decrypt TPU_Cipher_AES_Decrypt + #define MXC_TPU_Cipher_AES_Encrypt TPU_AES_Encrypt + #define MXC_TPU_Cipher_AES_Decrypt TPU_AES_Decrypt #endif #if defined(MAX3266X_SHA) @@ -109,7 +107,7 @@ #include "maa.h" /* Provides Drivers for math acceleration for */ /* ECDSA and RSA Acceleration */ /* MAA Defines */ - #define MXC_TPU_MAA_TYPE mxc_tpu_maa_clcsel_t + #define MXC_TPU_MAA_TYPE tpu_maa_clcsel_t #define WC_MXC_TPU_MAA_EXP 0b0000 #define WC_MXC_TPU_MAA_SQ 0b0010 #define WC_MXC_TPU_MAA_MUL 0b0100 @@ -127,11 +125,11 @@ /* TPU Functions */ #define MXC_TPU_Init SYS_TPU_Init - #define MXC_TPU_Shutdown SYS_TPU_Shutdown + #define MXC_TPU_Shutdown TPU_Shutdown #define MXC_SYS_PERIPH_CLOCK_TPU SYS_PERIPH_CLOCK_TPU - #define MXC_SYS_PERIPH_CLOCK_TPU MXC_SYS_PERIPH_CLOCK_TPU - #define MXC_SYS_PERIPH_CLOCK_TRNG MXC_SYS_PERIPH_CLOCK_TRNG + #define MXC_SYS_PERIPH_CLOCK_TPU SYS_PERIPH_CLOCK_TPU + #define MXC_SYS_PERIPH_CLOCK_TRNG SYS_PERIPH_CLOCK_TRNG #define MXC_TRNG MXC_TRNG @@ -184,12 +182,6 @@ i #error Not Implemented with old SDK #define MXC_SECS_PER_DAY (24 * MXC_SECS_PER_HR) #endif -#include "mxc_errors.h" /* ERROR Codes */ -#include "mxc_device.h" -#include "board.h" -#include "max32665.h" - - /* Variable Definitions */ #ifdef __cplusplus @@ -278,4 +270,4 @@ i #error Not Implemented with old SDK #endif #endif /* WOLFSSL_MAX32665 || WOLFSSL_MAX32666 */ -#endif /* _WOLFPORT_MAX3266X_H_ */ +#endif /* _WOLFPORT_MAX3266X_H_ */ \ No newline at end of file