summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/sha/sha512.c
diff options
context:
space:
mode:
authormiod <>2014-04-23 19:09:49 +0000
committermiod <>2014-04-23 19:09:49 +0000
commitba54475bcdd808f5501d943b18017bccbabd7bf5 (patch)
tree2f0bbc95834194b0eb3a2e2149c853e29107e563 /src/lib/libcrypto/sha/sha512.c
parent7386fc3d9177d598eb0bcef6e82db575c9472048 (diff)
downloadopenbsd-ba54475bcdd808f5501d943b18017bccbabd7bf5.tar.gz
openbsd-ba54475bcdd808f5501d943b18017bccbabd7bf5.tar.bz2
openbsd-ba54475bcdd808f5501d943b18017bccbabd7bf5.zip
Unifdef -UPEDANTIC. ok beck@ tedu@
Diffstat (limited to 'src/lib/libcrypto/sha/sha512.c')
-rw-r--r--src/lib/libcrypto/sha/sha512.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/src/lib/libcrypto/sha/sha512.c b/src/lib/libcrypto/sha/sha512.c
index 49afaa05c2..ca7991a9ca 100644
--- a/src/lib/libcrypto/sha/sha512.c
+++ b/src/lib/libcrypto/sha/sha512.c
@@ -311,21 +311,20 @@ static const SHA_LONG64 K512[80] = {
311 U64(0x4cc5d4becb3e42b6),U64(0x597f299cfc657e2a), 311 U64(0x4cc5d4becb3e42b6),U64(0x597f299cfc657e2a),
312 U64(0x5fcb6fab3ad6faec),U64(0x6c44198c4a475817) }; 312 U64(0x5fcb6fab3ad6faec),U64(0x6c44198c4a475817) };
313 313
314#ifndef PEDANTIC 314#if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
315# if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) 315# if defined(__x86_64) || defined(__x86_64__)
316# if defined(__x86_64) || defined(__x86_64__) 316# define ROTR(a,n) ({ SHA_LONG64 ret; \
317# define ROTR(a,n) ({ SHA_LONG64 ret; \
318 asm ("rorq %1,%0" \ 317 asm ("rorq %1,%0" \
319 : "=r"(ret) \ 318 : "=r"(ret) \
320 : "J"(n),"0"(a) \ 319 : "J"(n),"0"(a) \
321 : "cc"); ret; }) 320 : "cc"); ret; })
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# elif (defined(__i386) || defined(__i386__)) 325# elif (defined(__i386) || defined(__i386__))
327# if defined(I386_ONLY) 326# if defined(I386_ONLY)
328# define PULL64(x) ({ const unsigned int *p=(const unsigned int *)(&(x));\ 327# define PULL64(x) ({ const unsigned int *p=(const unsigned int *)(&(x));\
329 unsigned int hi=p[0],lo=p[1]; \ 328 unsigned int hi=p[0],lo=p[1]; \
330 asm("xchgb %%ah,%%al;xchgb %%dh,%%dl;"\ 329 asm("xchgb %%ah,%%al;xchgb %%dh,%%dl;"\
331 "roll $16,%%eax; roll $16,%%edx; "\ 330 "roll $16,%%eax; roll $16,%%edx; "\
@@ -333,20 +332,19 @@ static const SHA_LONG64 K512[80] = {
333 : "=a"(lo),"=d"(hi) \ 332 : "=a"(lo),"=d"(hi) \
334 : "0"(lo),"1"(hi) : "cc"); \ 333 : "0"(lo),"1"(hi) : "cc"); \
335 ((SHA_LONG64)hi)<<32|lo; }) 334 ((SHA_LONG64)hi)<<32|lo; })
336# else 335# else
337# define PULL64(x) ({ const unsigned int *p=(const unsigned int *)(&(x));\ 336# define PULL64(x) ({ const unsigned int *p=(const unsigned int *)(&(x));\
338 unsigned int hi=p[0],lo=p[1]; \ 337 unsigned int hi=p[0],lo=p[1]; \
339 asm ("bswapl %0; bswapl %1;" \ 338 asm ("bswapl %0; bswapl %1;" \
340 : "=r"(lo),"=r"(hi) \ 339 : "=r"(lo),"=r"(hi) \
341 : "0"(lo),"1"(hi)); \ 340 : "0"(lo),"1"(hi)); \
342 ((SHA_LONG64)hi)<<32|lo; }) 341 ((SHA_LONG64)hi)<<32|lo; })
343# endif 342# endif
344# elif (defined(_ARCH_PPC) && defined(__64BIT__)) || defined(_ARCH_PPC64) 343# elif (defined(_ARCH_PPC) && defined(__64BIT__)) || defined(_ARCH_PPC64)
345# define ROTR(a,n) ({ SHA_LONG64 ret; \ 344# define ROTR(a,n) ({ SHA_LONG64 ret; \
346 asm ("rotrdi %0,%1,%2" \ 345 asm ("rotrdi %0,%1,%2" \
347 : "=r"(ret) \ 346 : "=r"(ret) \
348 : "r"(a),"K"(n)); ret; }) 347 : "r"(a),"K"(n)); ret; })
349# endif
350# endif 348# endif
351#endif 349#endif
352 350
@@ -560,10 +558,4 @@ static void sha512_block_data_order (SHA512_CTX *ctx, const void *in, size_t num
560 558
561#endif /* SHA512_ASM */ 559#endif /* SHA512_ASM */
562 560
563#else /* !OPENSSL_NO_SHA512 */
564
565#if defined(PEDANTIC) || defined(__DECC) || defined(OPENSSL_SYS_MACOSX)
566static void *dummy=&dummy;
567#endif
568
569#endif /* !OPENSSL_NO_SHA512 */ 561#endif /* !OPENSSL_NO_SHA512 */