Commit 8dfa6cdc26 for openssl.org
commit 8dfa6cdc26a75589b129f453b5a5fa4807e4906f
Author: Neil Horman <nhorman@openssl.org>
Date: Tue Jan 20 12:19:12 2026 -0500
Convert SHA1_Update in the same manner as SHA256_Update
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29650)
diff --git a/crypto/sha/sha_local.h b/crypto/sha/sha_local.h
index 3879c57526..0543fddcb4 100644
--- a/crypto/sha/sha_local.h
+++ b/crypto/sha/sha_local.h
@@ -34,7 +34,8 @@
(void)HOST_l2c(ll, (s)); \
} while (0)
-#define HASH_UPDATE SHA1_Update
+#define HASH_UPDATE_THUNK
+#define HASH_UPDATE SHA1_Update_thunk
#define HASH_TRANSFORM SHA1_Transform
#define HASH_FINAL SHA1_Final
#define HASH_INIT SHA1_Init
@@ -49,6 +50,12 @@ void sha1_block_data_order(SHA_CTX *c, const void *p, size_t num);
#endif
#include "crypto/md32_common.h"
+#undef HASH_UPDATE_THUNK
+
+int SHA1_Update(SHA_CTX *c, const void *data, size_t len)
+{
+ return SHA1_Update_thunk((void *)c, (const unsigned char *)data, len);
+}
#define INIT_DATA_h0 0x67452301UL
#define INIT_DATA_h1 0xefcdab89UL
diff --git a/providers/implementations/digests/sha2_prov.c b/providers/implementations/digests/sha2_prov.c
index 0f8cdc929c..28bba27368 100644
--- a/providers/implementations/digests/sha2_prov.c
+++ b/providers/implementations/digests/sha2_prov.c
@@ -31,6 +31,7 @@
#define SHA2_FLAGS PROV_DIGEST_FLAG_ALGID_ABSENT
extern int SHA256_Update_thunk(void *ctx, const unsigned char *data, size_t sz);
+extern int SHA1_Update_thunk(void *ctx, const unsigned char *data, size_t sz);
/* Special set_params method for SSL3 */
static int sha1_set_ctx_params(void *vctx, const OSSL_PARAM params[])
@@ -281,7 +282,7 @@ static int SHA512_Deserialize(SHA512_CTX *c, const unsigned char *in,
/* ossl_sha1_functions */
IMPLEMENT_digest_functions_with_settable_ctx(
sha1, SHA_CTX, SHA_CBLOCK, SHA_DIGEST_LENGTH, SHA2_FLAGS,
- SHA1_Init, SHA1_Update, SHA1_Final,
+ SHA1_Init, SHA1_Update_thunk, SHA1_Final,
sha1_settable_ctx_params, sha1_set_ctx_params)
/* ossl_sha224_functions */