]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Convert SHA1_Update in the same manner as SHA256_Update
authorNeil Horman <nhorman@openssl.org>
Tue, 20 Jan 2026 17:19:12 +0000 (12:19 -0500)
committerPauli <paul.dale@oracle.com>
Wed, 21 Jan 2026 22:40:35 +0000 (09:40 +1100)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29650)

crypto/sha/sha_local.h
providers/implementations/digests/sha2_prov.c

index 3879c57526ca4bc43a11da3de84600e9844238ce..0543fddcb4459afe482100383903957afacbb152 100644 (file)
@@ -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
index 0f8cdc929c9b9f4389280d22cc5e9ce90f20a059..28bba273688e9b300072a0fe07bab218a4a44d03 100644 (file)
@@ -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 */