summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/sha/sha512.c37
1 files changed, 1 insertions, 36 deletions
diff --git a/src/lib/libcrypto/sha/sha512.c b/src/lib/libcrypto/sha/sha512.c
index 980d50d656..d79e2879d2 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.24 2023/03/29 05:27:02 jsing Exp $ */ 1/* $OpenBSD: sha512.c,v 1.25 2023/04/11 10:21:02 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 *
@@ -62,41 +62,6 @@
62#include <openssl/sha.h> 62#include <openssl/sha.h>
63 63
64#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA512) 64#if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA512)
65/*
66 * IMPLEMENTATION NOTES.
67 *
68 * As you might have noticed 32-bit hash algorithms:
69 *
70 * - permit SHA_LONG to be wider than 32-bit (case on CRAY);
71 * - optimized versions implement two transform functions: one operating
72 * on [aligned] data in host byte order and one - on data in input
73 * stream byte order;
74 * - share common byte-order neutral collector and padding function
75 * implementations, ../md32_common.h;
76 *
77 * Neither of the above applies to this SHA-512 implementations. Reasons
78 * [in reverse order] are:
79 *
80 * - it's the only 64-bit hash algorithm for the moment of this writing,
81 * there is no need for common collector/padding implementation [yet];
82 * - by supporting only one transform function [which operates on
83 * *aligned* data in input stream byte order, big-endian in this case]
84 * we minimize burden of maintenance in two ways: a) collector/padding
85 * function is simpler; b) only one transform function to stare at;
86 * - SHA_LONG64 is required to be exactly 64-bit in order to be able to
87 * apply a number of optimizations to mitigate potential performance
88 * penalties caused by previous design decision;
89 *
90 * Caveat lector.
91 *
92 * Implementation relies on the fact that "long long" is 64-bit on
93 * both 32- and 64-bit platforms. If some compiler vendor comes up
94 * with 128-bit long long, adjustment to sha.h would be required.
95 * As this implementation relies on 64-bit integer type, it's totally
96 * inappropriate for platforms which don't support it, most notably
97 * 16-bit platforms.
98 * <appro@fy.chalmers.se>
99 */
100 65
101#if !defined(__STRICT_ALIGNMENT) || defined(SHA512_ASM) 66#if !defined(__STRICT_ALIGNMENT) || defined(SHA512_ASM)
102#define SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA 67#define SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA