diff options
author | miod <> | 2014-04-23 18:40:39 +0000 |
---|---|---|
committer | miod <> | 2014-04-23 18:40:39 +0000 |
commit | 7f5d17891e05458836147cd2b05889fde1e7be19 (patch) | |
tree | e1e4b99a334105ef85f59fe57d8b382b9d71b773 /src/lib/libcrypto/modes/ctr128.c | |
parent | 909fa81274d3ab37a13fd6a376b38c3652c1ec4f (diff) | |
download | openbsd-7f5d17891e05458836147cd2b05889fde1e7be19.tar.gz openbsd-7f5d17891e05458836147cd2b05889fde1e7be19.tar.bz2 openbsd-7f5d17891e05458836147cd2b05889fde1e7be19.zip |
Figure out endianness at compile-time, using _BYTE_ORDER from
<machine/endian.h>, rather than writing 1 to a 32-bit variable and checking
whether the first byte is nonzero.
tweaks and ok matthew@; ok beck@ tedu@
Diffstat (limited to 'src/lib/libcrypto/modes/ctr128.c')
-rw-r--r-- | src/lib/libcrypto/modes/ctr128.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/libcrypto/modes/ctr128.c b/src/lib/libcrypto/modes/ctr128.c index ee642c5863..96af854f8a 100644 --- a/src/lib/libcrypto/modes/ctr128.c +++ b/src/lib/libcrypto/modes/ctr128.c | |||
@@ -77,11 +77,12 @@ static void ctr128_inc(unsigned char *counter) { | |||
77 | } | 77 | } |
78 | 78 | ||
79 | #if !defined(OPENSSL_SMALL_FOOTPRINT) | 79 | #if !defined(OPENSSL_SMALL_FOOTPRINT) |
80 | static void ctr128_inc_aligned(unsigned char *counter) { | 80 | static void |
81 | ctr128_inc_aligned(unsigned char *counter) | ||
82 | { | ||
81 | size_t *data,c,n; | 83 | size_t *data,c,n; |
82 | const union { long one; char little; } is_endian = {1}; | ||
83 | 84 | ||
84 | if (is_endian.little) { | 85 | if (_BYTE_ORDER == _LITTLE_ENDIAN) { |
85 | ctr128_inc(counter); | 86 | ctr128_inc(counter); |
86 | return; | 87 | return; |
87 | } | 88 | } |