diff options
-rw-r--r-- | src/lib/libcrypto/md32_common.h | 5 | ||||
-rw-r--r-- | src/lib/libcrypto/sha/sha512.c | 8 | ||||
-rw-r--r-- | src/lib/libcrypto/whrlpool/wp_block.c | 10 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/md32_common.h | 5 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/sha/sha512.c | 8 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/whrlpool/wp_block.c | 10 |
6 files changed, 2 insertions, 44 deletions
diff --git a/src/lib/libcrypto/md32_common.h b/src/lib/libcrypto/md32_common.h index bfb610e802..5276abfadc 100644 --- a/src/lib/libcrypto/md32_common.h +++ b/src/lib/libcrypto/md32_common.h | |||
@@ -199,7 +199,6 @@ | |||
199 | # if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) | 199 | # if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) |
200 | # if ((defined(__i386) || defined(__i386__)) && !defined(I386_ONLY)) || \ | 200 | # if ((defined(__i386) || defined(__i386__)) && !defined(I386_ONLY)) || \ |
201 | (defined(__x86_64) || defined(__x86_64__)) | 201 | (defined(__x86_64) || defined(__x86_64__)) |
202 | # if !defined(B_ENDIAN) | ||
203 | /* | 202 | /* |
204 | * This gives ~30-40% performance improvement in SHA-256 compiled | 203 | * This gives ~30-40% performance improvement in SHA-256 compiled |
205 | * with gcc [on P4]. Well, first macro to be frank. We can pull | 204 | * with gcc [on P4]. Well, first macro to be frank. We can pull |
@@ -212,7 +211,6 @@ | |||
212 | # define HOST_l2c(l,c) ({ unsigned int r=(l); \ | 211 | # define HOST_l2c(l,c) ({ unsigned int r=(l); \ |
213 | asm ("bswapl %0":"=r"(r):"0"(r)); \ | 212 | asm ("bswapl %0":"=r"(r):"0"(r)); \ |
214 | *((unsigned int *)(c))=r; (c)+=4; r; }) | 213 | *((unsigned int *)(c))=r; (c)+=4; r; }) |
215 | # endif | ||
216 | # endif | 214 | # endif |
217 | # endif | 215 | # endif |
218 | #endif | 216 | #endif |
@@ -251,11 +249,8 @@ | |||
251 | # endif | 249 | # endif |
252 | #endif | 250 | #endif |
253 | #if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) | 251 | #if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) |
254 | # ifndef B_ENDIAN | ||
255 | /* See comment in DATA_ORDER_IS_BIG_ENDIAN section. */ | ||
256 | # define HOST_c2l(c,l) ((l)=*((const unsigned int *)(c)), (c)+=4, l) | 252 | # define HOST_c2l(c,l) ((l)=*((const unsigned int *)(c)), (c)+=4, l) |
257 | # define HOST_l2c(l,c) (*((unsigned int *)(c))=(l), (c)+=4, l) | 253 | # define HOST_l2c(l,c) (*((unsigned int *)(c))=(l), (c)+=4, l) |
258 | # endif | ||
259 | #endif | 254 | #endif |
260 | 255 | ||
261 | #ifndef HOST_c2l | 256 | #ifndef HOST_c2l |
diff --git a/src/lib/libcrypto/sha/sha512.c b/src/lib/libcrypto/sha/sha512.c index 50c229ddeb..32bfecbf9b 100644 --- a/src/lib/libcrypto/sha/sha512.c +++ b/src/lib/libcrypto/sha/sha512.c | |||
@@ -318,13 +318,11 @@ static const SHA_LONG64 K512[80] = { | |||
318 | : "=r"(ret) \ | 318 | : "=r"(ret) \ |
319 | : "J"(n),"0"(a) \ | 319 | : "J"(n),"0"(a) \ |
320 | : "cc"); ret; }) | 320 | : "cc"); ret; }) |
321 | # if !defined(B_ENDIAN) | ||
322 | # define PULL64(x) ({ SHA_LONG64 ret=*((const SHA_LONG64 *)(&(x))); \ | 321 | # define PULL64(x) ({ SHA_LONG64 ret=*((const SHA_LONG64 *)(&(x))); \ |
323 | asm ("bswapq %0" \ | 322 | asm ("bswapq %0" \ |
324 | : "=r"(ret) \ | 323 | : "=r"(ret) \ |
325 | : "0"(ret)); ret; }) | 324 | : "0"(ret)); ret; }) |
326 | # endif | 325 | # elif (defined(__i386) || defined(__i386__)) |
327 | # elif (defined(__i386) || defined(__i386__)) && !defined(B_ENDIAN) | ||
328 | # if defined(I386_ONLY) | 326 | # if defined(I386_ONLY) |
329 | # define PULL64(x) ({ const unsigned int *p=(const unsigned int *)(&(x));\ | 327 | # define PULL64(x) ({ const unsigned int *p=(const unsigned int *)(&(x));\ |
330 | unsigned int hi=p[0],lo=p[1]; \ | 328 | unsigned int hi=p[0],lo=p[1]; \ |
@@ -421,11 +419,7 @@ static void sha512_block_data_order (SHA512_CTX *ctx, const void *in, size_t num | |||
421 | 419 | ||
422 | for (i=0;i<16;i++,F--) | 420 | for (i=0;i<16;i++,F--) |
423 | { | 421 | { |
424 | #ifdef B_ENDIAN | ||
425 | T = W[i]; | ||
426 | #else | ||
427 | T = PULL64(W[i]); | 422 | T = PULL64(W[i]); |
428 | #endif | ||
429 | F[0] = A; | 423 | F[0] = A; |
430 | F[4] = E; | 424 | F[4] = E; |
431 | F[8] = T; | 425 | F[8] = T; |
diff --git a/src/lib/libcrypto/whrlpool/wp_block.c b/src/lib/libcrypto/whrlpool/wp_block.c index 824ed1827c..ce977083ad 100644 --- a/src/lib/libcrypto/whrlpool/wp_block.c +++ b/src/lib/libcrypto/whrlpool/wp_block.c | |||
@@ -84,18 +84,8 @@ typedef unsigned long long u64; | |||
84 | # endif | 84 | # endif |
85 | #elif defined(__GNUC__) && __GNUC__>=2 | 85 | #elif defined(__GNUC__) && __GNUC__>=2 |
86 | # if defined(__x86_64) || defined(__x86_64__) | 86 | # if defined(__x86_64) || defined(__x86_64__) |
87 | # if defined(L_ENDIAN) | ||
88 | # define ROTATE(a,n) ({ u64 ret; asm ("rolq %1,%0" \ | 87 | # define ROTATE(a,n) ({ u64 ret; asm ("rolq %1,%0" \ |
89 | : "=r"(ret) : "J"(n),"0"(a) : "cc"); ret; }) | 88 | : "=r"(ret) : "J"(n),"0"(a) : "cc"); ret; }) |
90 | # elif defined(B_ENDIAN) | ||
91 | /* Most will argue that x86_64 is always little-endian. Well, | ||
92 | * yes, but then we have stratus.com who has modified gcc to | ||
93 | * "emulate" big-endian on x86. Is there evidence that they | ||
94 | * [or somebody else] won't do same for x86_64? Naturally no. | ||
95 | * And this line is waiting ready for that brave soul:-) */ | ||
96 | # define ROTATE(a,n) ({ u64 ret; asm ("rorq %1,%0" \ | ||
97 | : "=r"(ret) : "J"(n),"0"(a) : "cc"); ret; }) | ||
98 | # endif | ||
99 | # elif defined(__ia64) || defined(__ia64__) | 89 | # elif defined(__ia64) || defined(__ia64__) |
100 | # if defined(L_ENDIAN) | 90 | # if defined(L_ENDIAN) |
101 | # define ROTATE(a,n) ({ u64 ret; asm ("shrp %0=%1,%1,%2" \ | 91 | # define ROTATE(a,n) ({ u64 ret; asm ("shrp %0=%1,%1,%2" \ |
diff --git a/src/lib/libssl/src/crypto/md32_common.h b/src/lib/libssl/src/crypto/md32_common.h index bfb610e802..5276abfadc 100644 --- a/src/lib/libssl/src/crypto/md32_common.h +++ b/src/lib/libssl/src/crypto/md32_common.h | |||
@@ -199,7 +199,6 @@ | |||
199 | # if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) | 199 | # if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) |
200 | # if ((defined(__i386) || defined(__i386__)) && !defined(I386_ONLY)) || \ | 200 | # if ((defined(__i386) || defined(__i386__)) && !defined(I386_ONLY)) || \ |
201 | (defined(__x86_64) || defined(__x86_64__)) | 201 | (defined(__x86_64) || defined(__x86_64__)) |
202 | # if !defined(B_ENDIAN) | ||
203 | /* | 202 | /* |
204 | * This gives ~30-40% performance improvement in SHA-256 compiled | 203 | * This gives ~30-40% performance improvement in SHA-256 compiled |
205 | * with gcc [on P4]. Well, first macro to be frank. We can pull | 204 | * with gcc [on P4]. Well, first macro to be frank. We can pull |
@@ -212,7 +211,6 @@ | |||
212 | # define HOST_l2c(l,c) ({ unsigned int r=(l); \ | 211 | # define HOST_l2c(l,c) ({ unsigned int r=(l); \ |
213 | asm ("bswapl %0":"=r"(r):"0"(r)); \ | 212 | asm ("bswapl %0":"=r"(r):"0"(r)); \ |
214 | *((unsigned int *)(c))=r; (c)+=4; r; }) | 213 | *((unsigned int *)(c))=r; (c)+=4; r; }) |
215 | # endif | ||
216 | # endif | 214 | # endif |
217 | # endif | 215 | # endif |
218 | #endif | 216 | #endif |
@@ -251,11 +249,8 @@ | |||
251 | # endif | 249 | # endif |
252 | #endif | 250 | #endif |
253 | #if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) | 251 | #if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) |
254 | # ifndef B_ENDIAN | ||
255 | /* See comment in DATA_ORDER_IS_BIG_ENDIAN section. */ | ||
256 | # define HOST_c2l(c,l) ((l)=*((const unsigned int *)(c)), (c)+=4, l) | 252 | # define HOST_c2l(c,l) ((l)=*((const unsigned int *)(c)), (c)+=4, l) |
257 | # define HOST_l2c(l,c) (*((unsigned int *)(c))=(l), (c)+=4, l) | 253 | # define HOST_l2c(l,c) (*((unsigned int *)(c))=(l), (c)+=4, l) |
258 | # endif | ||
259 | #endif | 254 | #endif |
260 | 255 | ||
261 | #ifndef HOST_c2l | 256 | #ifndef HOST_c2l |
diff --git a/src/lib/libssl/src/crypto/sha/sha512.c b/src/lib/libssl/src/crypto/sha/sha512.c index 50c229ddeb..32bfecbf9b 100644 --- a/src/lib/libssl/src/crypto/sha/sha512.c +++ b/src/lib/libssl/src/crypto/sha/sha512.c | |||
@@ -318,13 +318,11 @@ static const SHA_LONG64 K512[80] = { | |||
318 | : "=r"(ret) \ | 318 | : "=r"(ret) \ |
319 | : "J"(n),"0"(a) \ | 319 | : "J"(n),"0"(a) \ |
320 | : "cc"); ret; }) | 320 | : "cc"); ret; }) |
321 | # if !defined(B_ENDIAN) | ||
322 | # define PULL64(x) ({ SHA_LONG64 ret=*((const SHA_LONG64 *)(&(x))); \ | 321 | # define PULL64(x) ({ SHA_LONG64 ret=*((const SHA_LONG64 *)(&(x))); \ |
323 | asm ("bswapq %0" \ | 322 | asm ("bswapq %0" \ |
324 | : "=r"(ret) \ | 323 | : "=r"(ret) \ |
325 | : "0"(ret)); ret; }) | 324 | : "0"(ret)); ret; }) |
326 | # endif | 325 | # elif (defined(__i386) || defined(__i386__)) |
327 | # elif (defined(__i386) || defined(__i386__)) && !defined(B_ENDIAN) | ||
328 | # if defined(I386_ONLY) | 326 | # if defined(I386_ONLY) |
329 | # define PULL64(x) ({ const unsigned int *p=(const unsigned int *)(&(x));\ | 327 | # define PULL64(x) ({ const unsigned int *p=(const unsigned int *)(&(x));\ |
330 | unsigned int hi=p[0],lo=p[1]; \ | 328 | unsigned int hi=p[0],lo=p[1]; \ |
@@ -421,11 +419,7 @@ static void sha512_block_data_order (SHA512_CTX *ctx, const void *in, size_t num | |||
421 | 419 | ||
422 | for (i=0;i<16;i++,F--) | 420 | for (i=0;i<16;i++,F--) |
423 | { | 421 | { |
424 | #ifdef B_ENDIAN | ||
425 | T = W[i]; | ||
426 | #else | ||
427 | T = PULL64(W[i]); | 422 | T = PULL64(W[i]); |
428 | #endif | ||
429 | F[0] = A; | 423 | F[0] = A; |
430 | F[4] = E; | 424 | F[4] = E; |
431 | F[8] = T; | 425 | F[8] = T; |
diff --git a/src/lib/libssl/src/crypto/whrlpool/wp_block.c b/src/lib/libssl/src/crypto/whrlpool/wp_block.c index 824ed1827c..ce977083ad 100644 --- a/src/lib/libssl/src/crypto/whrlpool/wp_block.c +++ b/src/lib/libssl/src/crypto/whrlpool/wp_block.c | |||
@@ -84,18 +84,8 @@ typedef unsigned long long u64; | |||
84 | # endif | 84 | # endif |
85 | #elif defined(__GNUC__) && __GNUC__>=2 | 85 | #elif defined(__GNUC__) && __GNUC__>=2 |
86 | # if defined(__x86_64) || defined(__x86_64__) | 86 | # if defined(__x86_64) || defined(__x86_64__) |
87 | # if defined(L_ENDIAN) | ||
88 | # define ROTATE(a,n) ({ u64 ret; asm ("rolq %1,%0" \ | 87 | # define ROTATE(a,n) ({ u64 ret; asm ("rolq %1,%0" \ |
89 | : "=r"(ret) : "J"(n),"0"(a) : "cc"); ret; }) | 88 | : "=r"(ret) : "J"(n),"0"(a) : "cc"); ret; }) |
90 | # elif defined(B_ENDIAN) | ||
91 | /* Most will argue that x86_64 is always little-endian. Well, | ||
92 | * yes, but then we have stratus.com who has modified gcc to | ||
93 | * "emulate" big-endian on x86. Is there evidence that they | ||
94 | * [or somebody else] won't do same for x86_64? Naturally no. | ||
95 | * And this line is waiting ready for that brave soul:-) */ | ||
96 | # define ROTATE(a,n) ({ u64 ret; asm ("rorq %1,%0" \ | ||
97 | : "=r"(ret) : "J"(n),"0"(a) : "cc"); ret; }) | ||
98 | # endif | ||
99 | # elif defined(__ia64) || defined(__ia64__) | 89 | # elif defined(__ia64) || defined(__ia64__) |
100 | # if defined(L_ENDIAN) | 90 | # if defined(L_ENDIAN) |
101 | # define ROTATE(a,n) ({ u64 ret; asm ("shrp %0=%1,%1,%2" \ | 91 | # define ROTATE(a,n) ({ u64 ret; asm ("shrp %0=%1,%1,%2" \ |