Skip to content

Commit 0073f3c

Browse files
dcp unlock added around aes forcezero, adjust align macro check
1 parent 3c8bdaa commit 0073f3c

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

wolfcrypt/src/port/nxp/dcp_port.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@
3131
#include <wolfssl/wolfcrypt/sha.h>
3232
#include <wolfssl/wolfcrypt/sha256.h>
3333
#include <wolfssl/wolfcrypt/error-crypt.h>
34+
#ifdef NO_INLINE
35+
#include <wolfssl/wolfcrypt/misc.h>
36+
#else
37+
#define WOLFSSL_MISC_INCLUDED
38+
#include <wolfcrypt/src/misc.c>
39+
#endif
3440

3541
#if defined(__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) && defined(DCP_USE_DCACHE) && (DCP_USE_DCACHE == 1U)
3642
#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)));
209215

210216
void DCPAesFree(Aes *aes)
211217
{
218+
dcp_lock();
212219
ForceZero(aes_key_aligned, sizeof(aes_key_aligned));
220+
dcp_unlock();
213221
dcp_free(aes->handle.channel);
214222
aes->handle.channel = 0;
215223
}

wolfssl/wolfcrypt/blake2-impl.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040

4141
static WC_INLINE word32 load32( const void *src )
4242
{
43-
#if defined(LITTLE_ENDIAN_ORDER) && !defined(WOLFSSL_GENERAL_ALIGNMENT)
43+
#if defined(LITTLE_ENDIAN_ORDER) && \
44+
(!defined(WOLFSSL_GENERAL_ALIGNMENT) || (WOLFSSL_GENERAL_ALIGNMENT == 0))
4445
return *( const word32 * )( src );
4546
#else
4647
const byte *p = ( const byte * )src;
@@ -54,7 +55,8 @@ static WC_INLINE word32 load32( const void *src )
5455

5556
static WC_INLINE word64 load64( const void *src )
5657
{
57-
#if defined(LITTLE_ENDIAN_ORDER) && !defined(WOLFSSL_GENERAL_ALIGNMENT)
58+
#if defined(LITTLE_ENDIAN_ORDER) && \
59+
(!defined(WOLFSSL_GENERAL_ALIGNMENT) || (WOLFSSL_GENERAL_ALIGNMENT == 0))
5860
return *( const word64 * )( src );
5961
#else
6062
const byte *p = ( const byte * )src;
@@ -72,7 +74,8 @@ static WC_INLINE word64 load64( const void *src )
7274

7375
static WC_INLINE void store32( void *dst, word32 w )
7476
{
75-
#if defined(LITTLE_ENDIAN_ORDER) && !defined(WOLFSSL_GENERAL_ALIGNMENT)
77+
#if defined(LITTLE_ENDIAN_ORDER) && \
78+
(!defined(WOLFSSL_GENERAL_ALIGNMENT) || (WOLFSSL_GENERAL_ALIGNMENT == 0))
7679
*( word32 * )( dst ) = w;
7780
#else
7881
byte *p = ( byte * )dst;
@@ -85,7 +88,8 @@ static WC_INLINE void store32( void *dst, word32 w )
8588

8689
static WC_INLINE void store64( void *dst, word64 w )
8790
{
88-
#if defined(LITTLE_ENDIAN_ORDER) && !defined(WOLFSSL_GENERAL_ALIGNMENT)
91+
#if defined(LITTLE_ENDIAN_ORDER) && \
92+
(!defined(WOLFSSL_GENERAL_ALIGNMENT) || (WOLFSSL_GENERAL_ALIGNMENT == 0))
8993
*( word64 * )( dst ) = w;
9094
#else
9195
byte *p = ( byte * )dst;

0 commit comments

Comments
 (0)