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/libssl/d1_pkt.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/libssl/d1_pkt.c')
-rw-r--r-- | src/lib/libssl/d1_pkt.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/lib/libssl/d1_pkt.c b/src/lib/libssl/d1_pkt.c index 80a4c076bf..7cfada4e6b 100644 --- a/src/lib/libssl/d1_pkt.c +++ b/src/lib/libssl/d1_pkt.c | |||
@@ -115,6 +115,7 @@ | |||
115 | 115 | ||
116 | #include <stdio.h> | 116 | #include <stdio.h> |
117 | #include <errno.h> | 117 | #include <errno.h> |
118 | #include <machine/endian.h> | ||
118 | #include "ssl_locl.h" | 119 | #include "ssl_locl.h" |
119 | #include <openssl/evp.h> | 120 | #include <openssl/evp.h> |
120 | #include <openssl/buffer.h> | 121 | #include <openssl/buffer.h> |
@@ -129,13 +130,9 @@ satsub64be(const unsigned char *v1, const unsigned char *v2) | |||
129 | 130 | ||
130 | if (sizeof(long) == 8) | 131 | if (sizeof(long) == 8) |
131 | do { | 132 | do { |
132 | const union { | ||
133 | long one; | ||
134 | char little; | ||
135 | } is_endian = {1}; | ||
136 | long l; | 133 | long l; |
137 | 134 | ||
138 | if (is_endian.little) | 135 | if (_BYTE_ORDER == _LITTLE_ENDIAN) |
139 | break; | 136 | break; |
140 | /* not reached on little-endians */ | 137 | /* not reached on little-endians */ |
141 | /* following test is redundant, because input is | 138 | /* following test is redundant, because input is |