From 114fc18c33e7f2a5f29852874f0344c36a5d0b96 Mon Sep 17 00:00:00 2001 From: toddouska Date: Thu, 30 Apr 2015 17:10:33 -0700 Subject: [PATCH] add alignment to benchmark key/iv --- wolfcrypt/benchmark/benchmark.c | 4 ++-- wolfssl/wolfcrypt/settings.h | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/benchmark/benchmark.c b/wolfcrypt/benchmark/benchmark.c index 5295e2470..66c905f9b 100644 --- a/wolfcrypt/benchmark/benchmark.c +++ b/wolfcrypt/benchmark/benchmark.c @@ -208,14 +208,14 @@ static int OpenNitroxDevice(int dma_mode,int dev_id) #endif -static const byte key[] = +static const XGEN_ALIGN byte key[] = { 0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef, 0xfe,0xde,0xba,0x98,0x76,0x54,0x32,0x10, 0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67 }; -static const byte iv[] = +static const XGEN_ALIGN byte iv[] = { 0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef, 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index 23c19486d..8148c40a2 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -732,6 +732,18 @@ #endif #endif +#if defined(WOLFSSL_GENERAL_ALIGNMENT) && (WOLFSSL_GENERAL_ALIGNMENT > 0) + #if defined(_MSC_VER) + #define XGEN_ALIGN __declspec(align(WOLFSSL_GENERAL_ALIGNMENT)) + #elif defined(__GNUC__) + #define XGEN_ALIGN __attribute__((aligned(WOLFSSL_GENERAL_ALIGNMENT))) + #else + #define XGEN_ALIGN + #endif +#else + #define XGEN_ALIGN +#endif + #ifdef HAVE_CRL /* not widely supported yet */ #undef NO_SKID