diff options
| author | miod <> | 2014-04-23 18:40:39 +0000 |
|---|---|---|
| committer | miod <> | 2014-04-23 18:40:39 +0000 |
| commit | a28fe124044c46c1ef0661496be89dfe096f0f49 (patch) | |
| tree | e1e4b99a334105ef85f59fe57d8b382b9d71b773 /src/lib/libcrypto/modes/ctr128.c | |
| parent | 287a72ca448e0ba06625f1f8f375b1429a0c43d9 (diff) | |
| download | openbsd-a28fe124044c46c1ef0661496be89dfe096f0f49.tar.gz openbsd-a28fe124044c46c1ef0661496be89dfe096f0f49.tar.bz2 openbsd-a28fe124044c46c1ef0661496be89dfe096f0f49.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 '')
| -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 | } |
