summaryrefslogtreecommitdiff
path: root/src/lib/libssl/d1_pkt.c
diff options
context:
space:
mode:
authormiod <>2014-04-23 18:40:39 +0000
committermiod <>2014-04-23 18:40:39 +0000
commita28fe124044c46c1ef0661496be89dfe096f0f49 (patch)
treee1e4b99a334105ef85f59fe57d8b382b9d71b773 /src/lib/libssl/d1_pkt.c
parent287a72ca448e0ba06625f1f8f375b1429a0c43d9 (diff)
downloadopenbsd-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/libssl/d1_pkt.c7
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