summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/bio_ok.c
diff options
context:
space:
mode:
authormiod <>2014-04-23 18:40:39 +0000
committermiod <>2014-04-23 18:40:39 +0000
commit7f5d17891e05458836147cd2b05889fde1e7be19 (patch)
treee1e4b99a334105ef85f59fe57d8b382b9d71b773 /src/lib/libcrypto/evp/bio_ok.c
parent909fa81274d3ab37a13fd6a376b38c3652c1ec4f (diff)
downloadopenbsd-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/evp/bio_ok.c')
-rw-r--r--src/lib/libcrypto/evp/bio_ok.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/libcrypto/evp/bio_ok.c b/src/lib/libcrypto/evp/bio_ok.c
index fdb742f554..09a762ffac 100644
--- a/src/lib/libcrypto/evp/bio_ok.c
+++ b/src/lib/libcrypto/evp/bio_ok.c
@@ -120,6 +120,7 @@
120#include <stdio.h> 120#include <stdio.h>
121#include <errno.h> 121#include <errno.h>
122#include <assert.h> 122#include <assert.h>
123#include <machine/endian.h>
123#include "cryptlib.h" 124#include "cryptlib.h"
124#include <openssl/buffer.h> 125#include <openssl/buffer.h>
125#include <openssl/bio.h> 126#include <openssl/bio.h>
@@ -463,9 +464,8 @@ static long ok_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
463 } 464 }
464 465
465static void longswap(void *_ptr, size_t len) 466static void longswap(void *_ptr, size_t len)
466{ const union { long one; char little; } is_endian = {1}; 467{
467 468 if (_BYTE_ORDER == _LITTLE_ENDIAN) {
468 if (is_endian.little) {
469 size_t i; 469 size_t i;
470 unsigned char *p=_ptr,c; 470 unsigned char *p=_ptr,c;
471 471