diff --git a/wolfcrypt/src/port/nxp/dcp_port.c b/wolfcrypt/src/port/nxp/dcp_port.c index 7162be509a..eed9e8297f 100644 --- a/wolfcrypt/src/port/nxp/dcp_port.c +++ b/wolfcrypt/src/port/nxp/dcp_port.c @@ -31,6 +31,12 @@ #include #include #include +#ifdef NO_INLINE + #include +#else + #define WOLFSSL_MISC_INCLUDED + #include +#endif #if defined(__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) && defined(DCP_USE_DCACHE) && (DCP_USE_DCACHE == 1U) #error "DCACHE not supported by this driver. Please undefine DCP_USE_DCACHE." @@ -209,7 +215,9 @@ static unsigned char aes_key_aligned[16] __attribute__((aligned(0x10))); void DCPAesFree(Aes *aes) { + dcp_lock(); ForceZero(aes_key_aligned, sizeof(aes_key_aligned)); + dcp_unlock(); dcp_free(aes->handle.channel); aes->handle.channel = 0; } diff --git a/wolfssl/wolfcrypt/blake2-impl.h b/wolfssl/wolfcrypt/blake2-impl.h index 21b8e3fc5c..63fd8eef59 100644 --- a/wolfssl/wolfcrypt/blake2-impl.h +++ b/wolfssl/wolfcrypt/blake2-impl.h @@ -40,7 +40,8 @@ static WC_INLINE word32 load32( const void *src ) { -#if defined(LITTLE_ENDIAN_ORDER) && !defined(WOLFSSL_GENERAL_ALIGNMENT) +#if defined(LITTLE_ENDIAN_ORDER) && \ + (!defined(WOLFSSL_GENERAL_ALIGNMENT) || (WOLFSSL_GENERAL_ALIGNMENT == 0)) return *( const word32 * )( src ); #else const byte *p = ( const byte * )src; @@ -54,7 +55,8 @@ static WC_INLINE word32 load32( const void *src ) static WC_INLINE word64 load64( const void *src ) { -#if defined(LITTLE_ENDIAN_ORDER) && !defined(WOLFSSL_GENERAL_ALIGNMENT) +#if defined(LITTLE_ENDIAN_ORDER) && \ + (!defined(WOLFSSL_GENERAL_ALIGNMENT) || (WOLFSSL_GENERAL_ALIGNMENT == 0)) return *( const word64 * )( src ); #else const byte *p = ( const byte * )src; @@ -72,7 +74,8 @@ static WC_INLINE word64 load64( const void *src ) static WC_INLINE void store32( void *dst, word32 w ) { -#if defined(LITTLE_ENDIAN_ORDER) && !defined(WOLFSSL_GENERAL_ALIGNMENT) +#if defined(LITTLE_ENDIAN_ORDER) && \ + (!defined(WOLFSSL_GENERAL_ALIGNMENT) || (WOLFSSL_GENERAL_ALIGNMENT == 0)) *( word32 * )( dst ) = w; #else byte *p = ( byte * )dst; @@ -85,7 +88,8 @@ static WC_INLINE void store32( void *dst, word32 w ) static WC_INLINE void store64( void *dst, word64 w ) { -#if defined(LITTLE_ENDIAN_ORDER) && !defined(WOLFSSL_GENERAL_ALIGNMENT) +#if defined(LITTLE_ENDIAN_ORDER) && \ + (!defined(WOLFSSL_GENERAL_ALIGNMENT) || (WOLFSSL_GENERAL_ALIGNMENT == 0)) *( word64 * )( dst ) = w; #else byte *p = ( byte * )dst;