forked from wolfSSL/wolfssl
Alignment fix
This commit is contained in:
@@ -399,8 +399,8 @@ static INLINE void wc_Chacha_wordtobyte(word32 output[CHACHA_CHUNK_WORDS],
|
|||||||
static void chacha_encrypt_avx(ChaCha* ctx, const byte* m, byte* c,
|
static void chacha_encrypt_avx(ChaCha* ctx, const byte* m, byte* c,
|
||||||
word32 bytes)
|
word32 bytes)
|
||||||
{
|
{
|
||||||
word32 X[4*CHACHA_CHUNK_WORDS]; /* used to make sure aligned */
|
ALIGN128 word32 X[4*CHACHA_CHUNK_WORDS]; /* used to make sure aligned */
|
||||||
word32 x[2*CHACHA_CHUNK_WORDS];
|
ALIGN128 word32 x[2*CHACHA_CHUNK_WORDS]; /* used to make sure aligned */
|
||||||
byte* output;
|
byte* output;
|
||||||
word32 i;
|
word32 i;
|
||||||
word32 cnt = 0;
|
word32 cnt = 0;
|
||||||
@@ -664,8 +664,8 @@ static void chacha_encrypt_avx(ChaCha* ctx, const byte* m, byte* c,
|
|||||||
static void chacha_encrypt_avx2(ChaCha* ctx, const byte* m, byte* c,
|
static void chacha_encrypt_avx2(ChaCha* ctx, const byte* m, byte* c,
|
||||||
word32 bytes)
|
word32 bytes)
|
||||||
{
|
{
|
||||||
word32 X[8*CHACHA_CHUNK_WORDS]; /* used to make sure aligned */
|
ALIGN256 word32 X[8*CHACHA_CHUNK_WORDS]; /* used to make sure aligned */
|
||||||
word32 x[4*CHACHA_CHUNK_WORDS];
|
ALIGN256 word32 x[4*CHACHA_CHUNK_WORDS]; /* used to make sure aligned */
|
||||||
byte* output;
|
byte* output;
|
||||||
word32 i;
|
word32 i;
|
||||||
word32 cnt = 0;
|
word32 cnt = 0;
|
||||||
|
@@ -521,6 +521,27 @@
|
|||||||
#define ALIGN32
|
#define ALIGN32
|
||||||
#endif
|
#endif
|
||||||
#endif /* !ALIGN32 */
|
#endif /* !ALIGN32 */
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#define ALIGN128 __attribute__ ( (aligned (128)))
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
/* disable align warning, we want alignment ! */
|
||||||
|
#pragma warning(disable: 4324)
|
||||||
|
#define ALIGN128 __declspec (align (128))
|
||||||
|
#else
|
||||||
|
#define ALIGN128
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#define ALIGN256 __attribute__ ( (aligned (256)))
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
/* disable align warning, we want alignment ! */
|
||||||
|
#pragma warning(disable: 4324)
|
||||||
|
#define ALIGN256 __declspec (align (256))
|
||||||
|
#else
|
||||||
|
#define ALIGN256
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#ifndef ALIGN16
|
#ifndef ALIGN16
|
||||||
#define ALIGN16
|
#define ALIGN16
|
||||||
@@ -528,6 +549,12 @@
|
|||||||
#ifndef ALIGN32
|
#ifndef ALIGN32
|
||||||
#define ALIGN32
|
#define ALIGN32
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef ALIGN128
|
||||||
|
#define ALIGN128
|
||||||
|
#endif
|
||||||
|
#ifndef ALIGN256
|
||||||
|
#define ALIGN256
|
||||||
|
#endif
|
||||||
#endif /* WOLFSSL_AESNI || WOLFSSL_ARMASM */
|
#endif /* WOLFSSL_AESNI || WOLFSSL_ARMASM */
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user