dcp unlock added around aes forcezero, adjust align macro check

This commit is contained in:
JacobBarthelmeh
2026-05-21 09:34:28 -07:00
parent 3c8bdaafc3
commit 0073f3c879
2 changed files with 16 additions and 4 deletions
+8
View File
@@ -31,6 +31,12 @@
#include <wolfssl/wolfcrypt/sha.h>
#include <wolfssl/wolfcrypt/sha256.h>
#include <wolfssl/wolfcrypt/error-crypt.h>
#ifdef NO_INLINE
#include <wolfssl/wolfcrypt/misc.h>
#else
#define WOLFSSL_MISC_INCLUDED
#include <wolfcrypt/src/misc.c>
#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;
}
+8 -4
View File
@@ -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;