summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/sha/sha512.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/sha/sha512.c')
-rw-r--r--src/lib/libcrypto/sha/sha512.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/lib/libcrypto/sha/sha512.c b/src/lib/libcrypto/sha/sha512.c
index 14c4cbd4f3..ff9ca889e0 100644
--- a/src/lib/libcrypto/sha/sha512.c
+++ b/src/lib/libcrypto/sha/sha512.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha512.c,v 1.31 2023/04/12 04:40:39 jsing Exp $ */ 1/* $OpenBSD: sha512.c,v 1.32 2023/04/12 04:54:16 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -119,11 +119,6 @@ static const SHA_LONG64 K512[80] = {
119 119
120#if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) 120#if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
121# if defined(__x86_64) || defined(__x86_64__) 121# if defined(__x86_64) || defined(__x86_64__)
122# define ROTR(a, n) ({ SHA_LONG64 ret; \
123 asm ("rorq %1,%0" \
124 : "=r"(ret) \
125 : "J"(n),"0"(a) \
126 : "cc"); ret; })
127# define PULL64(x) ({ SHA_LONG64 ret=*((const SHA_LONG64 *)(&(x))); \ 122# define PULL64(x) ({ SHA_LONG64 ret=*((const SHA_LONG64 *)(&(x))); \
128 asm ("bswapq %0" \ 123 asm ("bswapq %0" \
129 : "=r"(ret) \ 124 : "=r"(ret) \
@@ -135,11 +130,6 @@ static const SHA_LONG64 K512[80] = {
135 : "=r"(lo),"=r"(hi) \ 130 : "=r"(lo),"=r"(hi) \
136 : "0"(lo),"1"(hi)); \ 131 : "0"(lo),"1"(hi)); \
137 ((SHA_LONG64)hi)<<32|lo; }) 132 ((SHA_LONG64)hi)<<32|lo; })
138# elif (defined(_ARCH_PPC) && defined(__64BIT__)) || defined(_ARCH_PPC64)
139# define ROTR(a, n) ({ SHA_LONG64 ret; \
140 asm ("rotrdi %0,%1,%2" \
141 : "=r"(ret) \
142 : "r"(a),"K"(n)); ret; })
143# endif 133# endif
144#endif 134#endif
145 135
@@ -152,9 +142,7 @@ static const SHA_LONG64 K512[80] = {
152#endif 142#endif
153#endif 143#endif
154 144
155#ifndef ROTR 145#define ROTR(x, s) crypto_ror_u64(x, s)
156#define ROTR(x, s) (((x)>>s) | (x)<<(64-s))
157#endif
158 146
159#define Sigma0(x) (ROTR((x),28) ^ ROTR((x),34) ^ ROTR((x),39)) 147#define Sigma0(x) (ROTR((x),28) ^ ROTR((x),34) ^ ROTR((x),39))
160#define Sigma1(x) (ROTR((x),14) ^ ROTR((x),18) ^ ROTR((x),41)) 148#define Sigma1(x) (ROTR((x),14) ^ ROTR((x),18) ^ ROTR((x),41))