summaryrefslogtreecommitdiff
path: root/lib/libcrypto/evp
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-04-23 18:40:40 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-04-23 18:40:40 +0000
commit3875d0a10d7b5fd8518c76bd2db80bdf8d3982dd (patch)
treeb28a87c1481905c76fc0f73fabdfcc75b37e4914 /lib/libcrypto/evp
parent0b2a337e321c021a3c86a5fb6ab13db875b7a4f8 (diff)
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 'lib/libcrypto/evp')
-rw-r--r--lib/libcrypto/evp/bio_ok.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libcrypto/evp/bio_ok.c b/lib/libcrypto/evp/bio_ok.c
index fdb742f5544..09a762ffacd 100644
--- a/lib/libcrypto/evp/bio_ok.c
+++ b/lib/libcrypto/evp/bio_ok.c
@@ -120,6 +120,7 @@
#include <stdio.h>
#include <errno.h>
#include <assert.h>
+#include <machine/endian.h>
#include "cryptlib.h"
#include <openssl/buffer.h>
#include <openssl/bio.h>
@@ -463,9 +464,8 @@ static long ok_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
}
static void longswap(void *_ptr, size_t len)
-{ const union { long one; char little; } is_endian = {1};
-
- if (is_endian.little) {
+{
+ if (_BYTE_ORDER == _LITTLE_ENDIAN) {
size_t i;
unsigned char *p=_ptr,c;