From d57444e65f65b00f92604d6ba9ec33accea7cc44 Mon Sep 17 00:00:00 2001 From: miod Date: Wed, 7 May 2014 22:05:48 +0000 Subject: [PATCH] Get __STRICT_ALIGNMENT from and decide upon it, rather than defining it for not (i386 and amd64 (and sometimes s390)) only. Compile-time tests remain compile-time tests, and runtime-test remain runtime-test instead of being converted to compile-time tests, per matthew@'s explicit demand (rationale: this makes sure the compiler checks your code even if you won't run it). No functional change except on s390 (which we don't run on) and vax (which we run on, but noone cares about) ok matthew@ --- lib/libcrypto/modes/cbc128.c | 13 +++++++------ lib/libcrypto/modes/ccm128.c | 8 ++++---- lib/libcrypto/modes/cfb128.c | 4 ++-- lib/libcrypto/modes/ctr128.c | 2 +- lib/libcrypto/modes/gcm128.c | 6 +++--- lib/libcrypto/modes/modes_lcl.h | 12 ++---------- lib/libcrypto/modes/ofb128.c | 2 +- lib/libcrypto/modes/xts128.c | 9 +++++---- lib/libcrypto/sha/sha512.c | 5 +---- lib/libssl/src/crypto/modes/cbc128.c | 13 +++++++------ lib/libssl/src/crypto/modes/ccm128.c | 8 ++++---- lib/libssl/src/crypto/modes/cfb128.c | 4 ++-- lib/libssl/src/crypto/modes/ctr128.c | 2 +- lib/libssl/src/crypto/modes/gcm128.c | 6 +++--- lib/libssl/src/crypto/modes/modes_lcl.h | 12 ++---------- lib/libssl/src/crypto/modes/ofb128.c | 2 +- lib/libssl/src/crypto/modes/xts128.c | 9 +++++---- lib/libssl/src/crypto/sha/sha512.c | 5 +---- 18 files changed, 52 insertions(+), 70 deletions(-) diff --git a/lib/libcrypto/modes/cbc128.c b/lib/libcrypto/modes/cbc128.c index 0e54f75470b..e4920a93ac2 100644 --- a/lib/libcrypto/modes/cbc128.c +++ b/lib/libcrypto/modes/cbc128.c @@ -59,8 +59,11 @@ #endif #include -#ifndef STRICT_ALIGNMENT -# define STRICT_ALIGNMENT 0 +#undef STRICT_ALIGNMENT +#ifdef __STRICT_ALIGNMENT +#define STRICT_ALIGNMENT 1 +#else +#define STRICT_ALIGNMENT 0 #endif void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, @@ -136,8 +139,7 @@ void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, in += 16; out += 16; } - } - else if (16%sizeof(size_t) == 0) { /* always true */ + } else if (16%sizeof(size_t) == 0) { /* always true */ while (len>=16) { size_t *out_t=(size_t *)out, *iv_t=(size_t *)iv; @@ -166,8 +168,7 @@ void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, in += 16; out += 16; } - } - else if (16%sizeof(size_t) == 0) { /* always true */ + } else if (16%sizeof(size_t) == 0) { /* always true */ while (len>=16) { size_t c, *out_t=(size_t *)out, *ivec_t=(size_t *)ivec; const size_t *in_t=(const size_t *)in; diff --git a/lib/libcrypto/modes/ccm128.c b/lib/libcrypto/modes/ccm128.c index 3ce11d0d984..13bc7adf31d 100644 --- a/lib/libcrypto/modes/ccm128.c +++ b/lib/libcrypto/modes/ccm128.c @@ -197,7 +197,7 @@ int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, if (ctx->blocks > (U64(1)<<61)) return -2; /* too much data */ while (len>=16) { -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT union { u64 u[2]; u8 c[16]; } temp; memcpy (temp.c,inp,16); @@ -210,7 +210,7 @@ int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, (*block)(ctx->cmac.c,ctx->cmac.c,key); (*block)(ctx->nonce.c,scratch.c,key); ctr64_inc(ctx->nonce.c); -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT temp.u[0] ^= scratch.u[0]; temp.u[1] ^= scratch.u[1]; memcpy(out,temp.c,16); @@ -268,12 +268,12 @@ int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, if (n!=len) return -1; while (len>=16) { -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT union { u64 u[2]; u8 c[16]; } temp; #endif (*block)(ctx->nonce.c,scratch.c,key); ctr64_inc(ctx->nonce.c); -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT memcpy (temp.c,inp,16); ctx->cmac.u[0] ^= (scratch.u[0] ^= temp.u[0]); ctx->cmac.u[1] ^= (scratch.u[1] ^= temp.u[1]); diff --git a/lib/libcrypto/modes/cfb128.c b/lib/libcrypto/modes/cfb128.c index 4e6f5d35e13..731cb2864aa 100644 --- a/lib/libcrypto/modes/cfb128.c +++ b/lib/libcrypto/modes/cfb128.c @@ -83,7 +83,7 @@ void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, --len; n = (n+1) % 16; } -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT if (((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) != 0) break; #endif @@ -128,7 +128,7 @@ void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, --len; n = (n+1) % 16; } -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT if (((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) != 0) break; #endif diff --git a/lib/libcrypto/modes/ctr128.c b/lib/libcrypto/modes/ctr128.c index 96af854f8a0..ab45e0bd7a0 100644 --- a/lib/libcrypto/modes/ctr128.c +++ b/lib/libcrypto/modes/ctr128.c @@ -133,7 +133,7 @@ void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, n = (n+1) % 16; } -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT if (((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) != 0) break; #endif diff --git a/lib/libcrypto/modes/gcm128.c b/lib/libcrypto/modes/gcm128.c index 92b7f4f3c8a..f3bcb7dd6e1 100644 --- a/lib/libcrypto/modes/gcm128.c +++ b/lib/libcrypto/modes/gcm128.c @@ -60,7 +60,7 @@ #endif #include -#if defined(BSWAP4) && defined(STRICT_ALIGNMENT) +#if defined(BSWAP4) && defined(__STRICT_ALIGNMENT) /* redefine, because alignment is ensured */ #undef GETU32 #define GETU32(p) BSWAP4(*(const u32 *)(p)) @@ -935,7 +935,7 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, return 0; } } -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT if (((size_t)in|(size_t)out)%sizeof(size_t) != 0) break; #endif @@ -1113,7 +1113,7 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, return 0; } } -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT if (((size_t)in|(size_t)out)%sizeof(size_t) != 0) break; #endif diff --git a/lib/libcrypto/modes/modes_lcl.h b/lib/libcrypto/modes/modes_lcl.h index 68c0e355ad9..a53333df3d7 100644 --- a/lib/libcrypto/modes/modes_lcl.h +++ b/lib/libcrypto/modes/modes_lcl.h @@ -22,14 +22,6 @@ typedef unsigned long long u64; typedef unsigned int u32; typedef unsigned char u8; -#define STRICT_ALIGNMENT 1 -#if defined(__i386) || defined(__i386__) || \ - defined(__x86_64) || defined(__x86_64__) || \ - defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64) || \ - defined(__s390__) || defined(__s390x__) -# undef STRICT_ALIGNMENT -#endif - #if !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) #if defined(__GNUC__) && __GNUC__>=2 # if defined(__x86_64) || defined(__x86_64__) @@ -47,7 +39,7 @@ typedef unsigned char u8; # define BSWAP4(x) ({ u32 ret=(x); \ asm ("bswapl %0" \ : "+r"(ret)); ret; }) -# elif (defined(__arm__) || defined(__arm)) && !defined(STRICT_ALIGNMENT) +# elif (defined(__arm__) || defined(__arm)) && !defined(__STRICT_ALIGNMENT) # define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \ asm ("rev %0,%0; rev %1,%1" \ : "+r"(hi),"+r"(lo)); \ @@ -60,7 +52,7 @@ typedef unsigned char u8; #endif #endif -#if defined(BSWAP4) && !defined(STRICT_ALIGNMENT) +#if defined(BSWAP4) && !defined(__STRICT_ALIGNMENT) #define GETU32(p) BSWAP4(*(const u32 *)(p)) #define PUTU32(p,v) *(u32 *)(p) = BSWAP4(v) #else diff --git a/lib/libcrypto/modes/ofb128.c b/lib/libcrypto/modes/ofb128.c index 01c01702c4f..147c80c5498 100644 --- a/lib/libcrypto/modes/ofb128.c +++ b/lib/libcrypto/modes/ofb128.c @@ -82,7 +82,7 @@ void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, --len; n = (n+1) % 16; } -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT if (((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) != 0) break; #endif diff --git a/lib/libcrypto/modes/xts128.c b/lib/libcrypto/modes/xts128.c index de23de457d8..9dcd16885d4 100644 --- a/lib/libcrypto/modes/xts128.c +++ b/lib/libcrypto/modes/xts128.c @@ -47,6 +47,7 @@ * ==================================================================== */ +#include #include #include "modes_lcl.h" #include @@ -74,7 +75,7 @@ int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], if (!enc && (len%16)) len-=16; while (len>=16) { -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT memcpy(scratch.c,inp,16); scratch.u[0] ^= tweak.u[0]; scratch.u[1] ^= tweak.u[1]; @@ -83,7 +84,7 @@ int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], scratch.u[1] = ((u64*)inp)[1]^tweak.u[1]; #endif (*ctx->block1)(scratch.c,scratch.c,ctx->key1); -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT scratch.u[0] ^= tweak.u[0]; scratch.u[1] ^= tweak.u[1]; memcpy(out,scratch.c,16); @@ -152,7 +153,7 @@ int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], } tweak1.c[0] ^= (u8)(0x87&(0-c)); } -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT memcpy(scratch.c,inp,16); scratch.u[0] ^= tweak1.u[0]; scratch.u[1] ^= tweak1.u[1]; @@ -172,7 +173,7 @@ int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], scratch.u[0] ^= tweak.u[0]; scratch.u[1] ^= tweak.u[1]; (*ctx->block1)(scratch.c,scratch.c,ctx->key1); -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT scratch.u[0] ^= tweak.u[0]; scratch.u[1] ^= tweak.u[1]; memcpy (out,scratch.c,16); diff --git a/lib/libcrypto/sha/sha512.c b/lib/libcrypto/sha/sha512.c index d8fa933cde2..e05718d0a83 100644 --- a/lib/libcrypto/sha/sha512.c +++ b/lib/libcrypto/sha/sha512.c @@ -53,10 +53,7 @@ const char SHA512_version[]="SHA-512" OPENSSL_VERSION_PTEXT; -#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \ - defined(__x86_64) || defined(_M_AMD64) || defined(_M_X64) || \ - defined(__s390__) || defined(__s390x__) || \ - defined(SHA512_ASM) +#if !defined(__STRICT_ALIGNMENT) || defined(SHA512_ASM) #define SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA #endif diff --git a/lib/libssl/src/crypto/modes/cbc128.c b/lib/libssl/src/crypto/modes/cbc128.c index 0e54f75470b..e4920a93ac2 100644 --- a/lib/libssl/src/crypto/modes/cbc128.c +++ b/lib/libssl/src/crypto/modes/cbc128.c @@ -59,8 +59,11 @@ #endif #include -#ifndef STRICT_ALIGNMENT -# define STRICT_ALIGNMENT 0 +#undef STRICT_ALIGNMENT +#ifdef __STRICT_ALIGNMENT +#define STRICT_ALIGNMENT 1 +#else +#define STRICT_ALIGNMENT 0 #endif void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out, @@ -136,8 +139,7 @@ void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, in += 16; out += 16; } - } - else if (16%sizeof(size_t) == 0) { /* always true */ + } else if (16%sizeof(size_t) == 0) { /* always true */ while (len>=16) { size_t *out_t=(size_t *)out, *iv_t=(size_t *)iv; @@ -166,8 +168,7 @@ void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out, in += 16; out += 16; } - } - else if (16%sizeof(size_t) == 0) { /* always true */ + } else if (16%sizeof(size_t) == 0) { /* always true */ while (len>=16) { size_t c, *out_t=(size_t *)out, *ivec_t=(size_t *)ivec; const size_t *in_t=(const size_t *)in; diff --git a/lib/libssl/src/crypto/modes/ccm128.c b/lib/libssl/src/crypto/modes/ccm128.c index 3ce11d0d984..13bc7adf31d 100644 --- a/lib/libssl/src/crypto/modes/ccm128.c +++ b/lib/libssl/src/crypto/modes/ccm128.c @@ -197,7 +197,7 @@ int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, if (ctx->blocks > (U64(1)<<61)) return -2; /* too much data */ while (len>=16) { -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT union { u64 u[2]; u8 c[16]; } temp; memcpy (temp.c,inp,16); @@ -210,7 +210,7 @@ int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, (*block)(ctx->cmac.c,ctx->cmac.c,key); (*block)(ctx->nonce.c,scratch.c,key); ctr64_inc(ctx->nonce.c); -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT temp.u[0] ^= scratch.u[0]; temp.u[1] ^= scratch.u[1]; memcpy(out,temp.c,16); @@ -268,12 +268,12 @@ int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, if (n!=len) return -1; while (len>=16) { -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT union { u64 u[2]; u8 c[16]; } temp; #endif (*block)(ctx->nonce.c,scratch.c,key); ctr64_inc(ctx->nonce.c); -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT memcpy (temp.c,inp,16); ctx->cmac.u[0] ^= (scratch.u[0] ^= temp.u[0]); ctx->cmac.u[1] ^= (scratch.u[1] ^= temp.u[1]); diff --git a/lib/libssl/src/crypto/modes/cfb128.c b/lib/libssl/src/crypto/modes/cfb128.c index 4e6f5d35e13..731cb2864aa 100644 --- a/lib/libssl/src/crypto/modes/cfb128.c +++ b/lib/libssl/src/crypto/modes/cfb128.c @@ -83,7 +83,7 @@ void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, --len; n = (n+1) % 16; } -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT if (((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) != 0) break; #endif @@ -128,7 +128,7 @@ void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out, --len; n = (n+1) % 16; } -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT if (((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) != 0) break; #endif diff --git a/lib/libssl/src/crypto/modes/ctr128.c b/lib/libssl/src/crypto/modes/ctr128.c index 96af854f8a0..ab45e0bd7a0 100644 --- a/lib/libssl/src/crypto/modes/ctr128.c +++ b/lib/libssl/src/crypto/modes/ctr128.c @@ -133,7 +133,7 @@ void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out, n = (n+1) % 16; } -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT if (((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) != 0) break; #endif diff --git a/lib/libssl/src/crypto/modes/gcm128.c b/lib/libssl/src/crypto/modes/gcm128.c index 92b7f4f3c8a..f3bcb7dd6e1 100644 --- a/lib/libssl/src/crypto/modes/gcm128.c +++ b/lib/libssl/src/crypto/modes/gcm128.c @@ -60,7 +60,7 @@ #endif #include -#if defined(BSWAP4) && defined(STRICT_ALIGNMENT) +#if defined(BSWAP4) && defined(__STRICT_ALIGNMENT) /* redefine, because alignment is ensured */ #undef GETU32 #define GETU32(p) BSWAP4(*(const u32 *)(p)) @@ -935,7 +935,7 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx, return 0; } } -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT if (((size_t)in|(size_t)out)%sizeof(size_t) != 0) break; #endif @@ -1113,7 +1113,7 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx, return 0; } } -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT if (((size_t)in|(size_t)out)%sizeof(size_t) != 0) break; #endif diff --git a/lib/libssl/src/crypto/modes/modes_lcl.h b/lib/libssl/src/crypto/modes/modes_lcl.h index 68c0e355ad9..a53333df3d7 100644 --- a/lib/libssl/src/crypto/modes/modes_lcl.h +++ b/lib/libssl/src/crypto/modes/modes_lcl.h @@ -22,14 +22,6 @@ typedef unsigned long long u64; typedef unsigned int u32; typedef unsigned char u8; -#define STRICT_ALIGNMENT 1 -#if defined(__i386) || defined(__i386__) || \ - defined(__x86_64) || defined(__x86_64__) || \ - defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64) || \ - defined(__s390__) || defined(__s390x__) -# undef STRICT_ALIGNMENT -#endif - #if !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) #if defined(__GNUC__) && __GNUC__>=2 # if defined(__x86_64) || defined(__x86_64__) @@ -47,7 +39,7 @@ typedef unsigned char u8; # define BSWAP4(x) ({ u32 ret=(x); \ asm ("bswapl %0" \ : "+r"(ret)); ret; }) -# elif (defined(__arm__) || defined(__arm)) && !defined(STRICT_ALIGNMENT) +# elif (defined(__arm__) || defined(__arm)) && !defined(__STRICT_ALIGNMENT) # define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \ asm ("rev %0,%0; rev %1,%1" \ : "+r"(hi),"+r"(lo)); \ @@ -60,7 +52,7 @@ typedef unsigned char u8; #endif #endif -#if defined(BSWAP4) && !defined(STRICT_ALIGNMENT) +#if defined(BSWAP4) && !defined(__STRICT_ALIGNMENT) #define GETU32(p) BSWAP4(*(const u32 *)(p)) #define PUTU32(p,v) *(u32 *)(p) = BSWAP4(v) #else diff --git a/lib/libssl/src/crypto/modes/ofb128.c b/lib/libssl/src/crypto/modes/ofb128.c index 01c01702c4f..147c80c5498 100644 --- a/lib/libssl/src/crypto/modes/ofb128.c +++ b/lib/libssl/src/crypto/modes/ofb128.c @@ -82,7 +82,7 @@ void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out, --len; n = (n+1) % 16; } -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT if (((size_t)in|(size_t)out|(size_t)ivec)%sizeof(size_t) != 0) break; #endif diff --git a/lib/libssl/src/crypto/modes/xts128.c b/lib/libssl/src/crypto/modes/xts128.c index de23de457d8..9dcd16885d4 100644 --- a/lib/libssl/src/crypto/modes/xts128.c +++ b/lib/libssl/src/crypto/modes/xts128.c @@ -47,6 +47,7 @@ * ==================================================================== */ +#include #include #include "modes_lcl.h" #include @@ -74,7 +75,7 @@ int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], if (!enc && (len%16)) len-=16; while (len>=16) { -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT memcpy(scratch.c,inp,16); scratch.u[0] ^= tweak.u[0]; scratch.u[1] ^= tweak.u[1]; @@ -83,7 +84,7 @@ int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], scratch.u[1] = ((u64*)inp)[1]^tweak.u[1]; #endif (*ctx->block1)(scratch.c,scratch.c,ctx->key1); -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT scratch.u[0] ^= tweak.u[0]; scratch.u[1] ^= tweak.u[1]; memcpy(out,scratch.c,16); @@ -152,7 +153,7 @@ int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], } tweak1.c[0] ^= (u8)(0x87&(0-c)); } -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT memcpy(scratch.c,inp,16); scratch.u[0] ^= tweak1.u[0]; scratch.u[1] ^= tweak1.u[1]; @@ -172,7 +173,7 @@ int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16], scratch.u[0] ^= tweak.u[0]; scratch.u[1] ^= tweak.u[1]; (*ctx->block1)(scratch.c,scratch.c,ctx->key1); -#if defined(STRICT_ALIGNMENT) +#ifdef __STRICT_ALIGNMENT scratch.u[0] ^= tweak.u[0]; scratch.u[1] ^= tweak.u[1]; memcpy (out,scratch.c,16); diff --git a/lib/libssl/src/crypto/sha/sha512.c b/lib/libssl/src/crypto/sha/sha512.c index d8fa933cde2..e05718d0a83 100644 --- a/lib/libssl/src/crypto/sha/sha512.c +++ b/lib/libssl/src/crypto/sha/sha512.c @@ -53,10 +53,7 @@ const char SHA512_version[]="SHA-512" OPENSSL_VERSION_PTEXT; -#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \ - defined(__x86_64) || defined(_M_AMD64) || defined(_M_X64) || \ - defined(__s390__) || defined(__s390x__) || \ - defined(SHA512_ASM) +#if !defined(__STRICT_ALIGNMENT) || defined(SHA512_ASM) #define SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA #endif -- 2.20.1