diff options
author | miod <> | 2014-05-07 22:05:48 +0000 |
---|---|---|
committer | miod <> | 2014-05-07 22:05:48 +0000 |
commit | 55b870bc0442258199f29518a1c056569c6cff35 (patch) | |
tree | deb34c5a4686fe5f3219b9c2cc98fdf18af20a2d /src/lib/libcrypto/modes/modes_lcl.h | |
parent | 6e694fdc39d16d30d31406ef82c6b069d9d005d9 (diff) | |
download | openbsd-55b870bc0442258199f29518a1c056569c6cff35.tar.gz openbsd-55b870bc0442258199f29518a1c056569c6cff35.tar.bz2 openbsd-55b870bc0442258199f29518a1c056569c6cff35.zip |
Get __STRICT_ALIGNMENT from <machine/endian.h> 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@
Diffstat (limited to 'src/lib/libcrypto/modes/modes_lcl.h')
-rw-r--r-- | src/lib/libcrypto/modes/modes_lcl.h | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/lib/libcrypto/modes/modes_lcl.h b/src/lib/libcrypto/modes/modes_lcl.h index 68c0e355ad..a53333df3d 100644 --- a/src/lib/libcrypto/modes/modes_lcl.h +++ b/src/lib/libcrypto/modes/modes_lcl.h | |||
@@ -22,14 +22,6 @@ typedef unsigned long long u64; | |||
22 | typedef unsigned int u32; | 22 | typedef unsigned int u32; |
23 | typedef unsigned char u8; | 23 | typedef unsigned char u8; |
24 | 24 | ||
25 | #define STRICT_ALIGNMENT 1 | ||
26 | #if defined(__i386) || defined(__i386__) || \ | ||
27 | defined(__x86_64) || defined(__x86_64__) || \ | ||
28 | defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64) || \ | ||
29 | defined(__s390__) || defined(__s390x__) | ||
30 | # undef STRICT_ALIGNMENT | ||
31 | #endif | ||
32 | |||
33 | #if !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) | 25 | #if !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) |
34 | #if defined(__GNUC__) && __GNUC__>=2 | 26 | #if defined(__GNUC__) && __GNUC__>=2 |
35 | # if defined(__x86_64) || defined(__x86_64__) | 27 | # if defined(__x86_64) || defined(__x86_64__) |
@@ -47,7 +39,7 @@ typedef unsigned char u8; | |||
47 | # define BSWAP4(x) ({ u32 ret=(x); \ | 39 | # define BSWAP4(x) ({ u32 ret=(x); \ |
48 | asm ("bswapl %0" \ | 40 | asm ("bswapl %0" \ |
49 | : "+r"(ret)); ret; }) | 41 | : "+r"(ret)); ret; }) |
50 | # elif (defined(__arm__) || defined(__arm)) && !defined(STRICT_ALIGNMENT) | 42 | # elif (defined(__arm__) || defined(__arm)) && !defined(__STRICT_ALIGNMENT) |
51 | # define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \ | 43 | # define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \ |
52 | asm ("rev %0,%0; rev %1,%1" \ | 44 | asm ("rev %0,%0; rev %1,%1" \ |
53 | : "+r"(hi),"+r"(lo)); \ | 45 | : "+r"(hi),"+r"(lo)); \ |
@@ -60,7 +52,7 @@ typedef unsigned char u8; | |||
60 | #endif | 52 | #endif |
61 | #endif | 53 | #endif |
62 | 54 | ||
63 | #if defined(BSWAP4) && !defined(STRICT_ALIGNMENT) | 55 | #if defined(BSWAP4) && !defined(__STRICT_ALIGNMENT) |
64 | #define GETU32(p) BSWAP4(*(const u32 *)(p)) | 56 | #define GETU32(p) BSWAP4(*(const u32 *)(p)) |
65 | #define PUTU32(p,v) *(u32 *)(p) = BSWAP4(v) | 57 | #define PUTU32(p,v) *(u32 *)(p) = BSWAP4(v) |
66 | #else | 58 | #else |