From c482524b78a20aa77687c917990827037fde0786 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Fri, 1 Sep 2017 15:32:55 -0600 Subject: [PATCH] big endian testing and packing Aes struct --- wolfcrypt/src/aes.c | 6 ++++++ wolfssl/wolfcrypt/aes.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c index 9e0dbd133..f94a1fba5 100755 --- a/wolfcrypt/src/aes.c +++ b/wolfcrypt/src/aes.c @@ -8100,6 +8100,9 @@ int wc_AesXtsEncryptSector(Aes* tweak, Aes* aes, byte* out, const byte* in, byte i[AES_BLOCK_SIZE]; XMEMSET(i, 0, AES_BLOCK_SIZE); +#ifdef BIG_ENDIAN_ORDER + sector = ByteReverseWord64(sector); +#endif pt = (byte*)§or; XMEMCPY(i, pt, sizeof(word64)); @@ -8127,6 +8130,9 @@ int wc_AesXtsDecryptSector(Aes* tweak, Aes* aes, byte* out, const byte* in, word byte i[AES_BLOCK_SIZE]; XMEMSET(i, 0, AES_BLOCK_SIZE); +#ifdef BIG_ENDIAN_ORDER + sector = ByteReverseWord64(sector); +#endif pt = (byte*)§or; XMEMCPY(i, pt, sizeof(word64)); diff --git a/wolfssl/wolfcrypt/aes.h b/wolfssl/wolfcrypt/aes.h index 89892a774..7ba85f0a2 100755 --- a/wolfssl/wolfcrypt/aes.h +++ b/wolfssl/wolfcrypt/aes.h @@ -110,11 +110,11 @@ typedef struct Aes { word32 key_init[8]; word32 kup; #endif + void* heap; /* memory hint to use */ #ifdef WOLFSSL_AES_XTS byte type; /* adds the ability to do a sanity check on key for * encrypt/decrypt */ #endif - void* heap; /* memory hint to use */ } Aes;