diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib/libcrypto/sha/sha512.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/libcrypto/sha/sha512.c b/src/lib/libcrypto/sha/sha512.c index c92f18e418..49afaa05c2 100644 --- a/src/lib/libcrypto/sha/sha512.c +++ b/src/lib/libcrypto/sha/sha512.c | |||
@@ -43,6 +43,7 @@ | |||
43 | */ | 43 | */ |
44 | #include <stdlib.h> | 44 | #include <stdlib.h> |
45 | #include <string.h> | 45 | #include <string.h> |
46 | #include <machine/endian.h> | ||
46 | 47 | ||
47 | #include <openssl/crypto.h> | 48 | #include <openssl/crypto.h> |
48 | #include <openssl/sha.h> | 49 | #include <openssl/sha.h> |
@@ -108,7 +109,7 @@ int SHA512_Final (unsigned char *md, SHA512_CTX *c) | |||
108 | sha512_block_data_order (c,p,1); | 109 | sha512_block_data_order (c,p,1); |
109 | 110 | ||
110 | memset (p+n,0,sizeof(c->u)-16-n); | 111 | memset (p+n,0,sizeof(c->u)-16-n); |
111 | #ifdef B_ENDIAN | 112 | #if _BYTE_ORDER == _BIG_ENDIAN |
112 | c->u.d[SHA_LBLOCK-2] = c->Nh; | 113 | c->u.d[SHA_LBLOCK-2] = c->Nh; |
113 | c->u.d[SHA_LBLOCK-1] = c->Nl; | 114 | c->u.d[SHA_LBLOCK-1] = c->Nl; |
114 | #else | 115 | #else |
@@ -437,7 +438,7 @@ static void sha512_block_data_order (SHA512_CTX *ctx, const void *in, size_t num | |||
437 | 438 | ||
438 | for (i=0;i<16;i++) | 439 | for (i=0;i<16;i++) |
439 | { | 440 | { |
440 | #ifdef B_ENDIAN | 441 | #if _BYTE_ORDER == _BIG_ENDIAN |
441 | T1 = X[i] = W[i]; | 442 | T1 = X[i] = W[i]; |
442 | #else | 443 | #else |
443 | T1 = X[i] = PULL64(W[i]); | 444 | T1 = X[i] = PULL64(W[i]); |
@@ -492,7 +493,7 @@ static void sha512_block_data_order (SHA512_CTX *ctx, const void *in, size_t num | |||
492 | a = ctx->h[0]; b = ctx->h[1]; c = ctx->h[2]; d = ctx->h[3]; | 493 | a = ctx->h[0]; b = ctx->h[1]; c = ctx->h[2]; d = ctx->h[3]; |
493 | e = ctx->h[4]; f = ctx->h[5]; g = ctx->h[6]; h = ctx->h[7]; | 494 | e = ctx->h[4]; f = ctx->h[5]; g = ctx->h[6]; h = ctx->h[7]; |
494 | 495 | ||
495 | #ifdef B_ENDIAN | 496 | #if _BYTE_ORDER == _BIG_ENDIAN |
496 | T1 = X[0] = W[0]; ROUND_00_15(0,a,b,c,d,e,f,g,h); | 497 | T1 = X[0] = W[0]; ROUND_00_15(0,a,b,c,d,e,f,g,h); |
497 | T1 = X[1] = W[1]; ROUND_00_15(1,h,a,b,c,d,e,f,g); | 498 | T1 = X[1] = W[1]; ROUND_00_15(1,h,a,b,c,d,e,f,g); |
498 | T1 = X[2] = W[2]; ROUND_00_15(2,g,h,a,b,c,d,e,f); | 499 | T1 = X[2] = W[2]; ROUND_00_15(2,g,h,a,b,c,d,e,f); |