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.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/lib/libcrypto/sha/sha512.c b/src/lib/libcrypto/sha/sha512.c
index 7a2a40d3df..43d25eb119 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.42 2024/06/01 07:36:16 tb Exp $ */ 1/* $OpenBSD: sha512.c,v 1.43 2025/02/14 12:01:58 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 *
@@ -69,11 +69,10 @@
69/* Ensure that SHA_LONG64 and uint64_t are equivalent. */ 69/* Ensure that SHA_LONG64 and uint64_t are equivalent. */
70CTASSERT(sizeof(SHA_LONG64) == sizeof(uint64_t)); 70CTASSERT(sizeof(SHA_LONG64) == sizeof(uint64_t));
71 71
72#ifdef SHA512_ASM
73void sha512_block_data_order(SHA512_CTX *ctx, const void *in, size_t num); 72void sha512_block_data_order(SHA512_CTX *ctx, const void *in, size_t num);
74#endif 73void sha512_block_generic(SHA512_CTX *ctx, const void *in, size_t num);
75 74
76#ifndef SHA512_ASM 75#ifndef HAVE_SHA512_BLOCK_GENERIC
77static const SHA_LONG64 K512[80] = { 76static const SHA_LONG64 K512[80] = {
78 U64(0x428a2f98d728ae22), U64(0x7137449123ef65cd), 77 U64(0x428a2f98d728ae22), U64(0x7137449123ef65cd),
79 U64(0xb5c0fbcfec4d3b2f), U64(0xe9b5dba58189dbbc), 78 U64(0xb5c0fbcfec4d3b2f), U64(0xe9b5dba58189dbbc),
@@ -182,8 +181,8 @@ sha512_round(SHA_LONG64 *a, SHA_LONG64 *b, SHA_LONG64 *c, SHA_LONG64 *d,
182 *a = T1 + T2; 181 *a = T1 + T2;
183} 182}
184 183
185static void 184void
186sha512_block_data_order(SHA512_CTX *ctx, const void *_in, size_t num) 185sha512_block_generic(SHA512_CTX *ctx, const void *_in, size_t num)
187{ 186{
188 const uint8_t *in = _in; 187 const uint8_t *in = _in;
189 const SHA_LONG64 *in64; 188 const SHA_LONG64 *in64;
@@ -304,8 +303,15 @@ sha512_block_data_order(SHA512_CTX *ctx, const void *_in, size_t num)
304 ctx->h[7] += h; 303 ctx->h[7] += h;
305 } 304 }
306} 305}
306#endif
307 307
308#endif /* SHA512_ASM */ 308#ifndef HAVE_SHA512_BLOCK_DATA_ORDER
309void
310sha512_block_data_order(SHA512_CTX *ctx, const void *_in, size_t num)
311{
312 sha512_block_generic(ctx, _in, num);
313}
314#endif
309 315
310int 316int
311SHA384_Init(SHA512_CTX *c) 317SHA384_Init(SHA512_CTX *c)