diff options
Diffstat (limited to 'src/lib/libcrypto/sha/sha256.c')
-rw-r--r-- | src/lib/libcrypto/sha/sha256.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/libcrypto/sha/sha256.c b/src/lib/libcrypto/sha/sha256.c index 4eae074849..e767afde5a 100644 --- a/src/lib/libcrypto/sha/sha256.c +++ b/src/lib/libcrypto/sha/sha256.c | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | #include <stdlib.h> | 10 | #include <stdlib.h> |
11 | #include <string.h> | 11 | #include <string.h> |
12 | #include <machine/endian.h> | ||
12 | 13 | ||
13 | #include <openssl/crypto.h> | 14 | #include <openssl/crypto.h> |
14 | #include <openssl/sha.h> | 15 | #include <openssl/sha.h> |
@@ -206,14 +207,14 @@ static void sha256_block_data_order (SHA256_CTX *ctx, const void *in, size_t num | |||
206 | SHA_LONG X[16]; | 207 | SHA_LONG X[16]; |
207 | int i; | 208 | int i; |
208 | const unsigned char *data=in; | 209 | const unsigned char *data=in; |
209 | const union { long one; char little; } is_endian = {1}; | ||
210 | 210 | ||
211 | while (num--) { | 211 | while (num--) { |
212 | 212 | ||
213 | a = ctx->h[0]; b = ctx->h[1]; c = ctx->h[2]; d = ctx->h[3]; | 213 | a = ctx->h[0]; b = ctx->h[1]; c = ctx->h[2]; d = ctx->h[3]; |
214 | e = ctx->h[4]; f = ctx->h[5]; g = ctx->h[6]; h = ctx->h[7]; | 214 | e = ctx->h[4]; f = ctx->h[5]; g = ctx->h[6]; h = ctx->h[7]; |
215 | 215 | ||
216 | if (!is_endian.little && sizeof(SHA_LONG)==4 && ((size_t)in%4)==0) | 216 | if (_BYTE_ORDER != _LITTLE_ENDIAN && |
217 | sizeof(SHA_LONG)==4 && ((size_t)in%4)==0) | ||
217 | { | 218 | { |
218 | const SHA_LONG *W=(const SHA_LONG *)data; | 219 | const SHA_LONG *W=(const SHA_LONG *)data; |
219 | 220 | ||