Blame SOURCES/git-2.38.1-core-crypto-hmac.patch

03c115
diff -ur a/builtin/receive-pack.c b/builtin/receive-pack.c
0b3640
--- a/builtin/receive-pack.c	2022-10-07 06:48:26.000000000 +0200
0b3640
+++ b/builtin/receive-pack.c	2022-11-21 16:34:02.417278135 +0100
0b3640
@@ -30,6 +30,8 @@
03c115
 #include "commit-reach.h"
03c115
 #include "worktree.h"
03c115
 #include "shallow.h"
03c115
+#include <openssl/hmac.h>	
03c115
+#include <openssl/evp.h>
03c115
 
03c115
 static const char * const receive_pack_usage[] = {
03c115
 	N_("git receive-pack <git-dir>"),
0b3640
@@ -528,43 +530,11 @@
03c115
 	return 0;
03c115
 }
03c115
 
03c115
-static void hmac_hash(unsigned char *out,
03c115
+static inline void hmac_hash(unsigned char *out,
03c115
 		      const char *key_in, size_t key_len,
03c115
 		      const char *text, size_t text_len)
03c115
 {
03c115
-	unsigned char key[GIT_MAX_BLKSZ];
03c115
-	unsigned char k_ipad[GIT_MAX_BLKSZ];
03c115
-	unsigned char k_opad[GIT_MAX_BLKSZ];
03c115
-	int i;
03c115
-	git_hash_ctx ctx;
03c115
-
03c115
-	/* RFC 2104 2. (1) */
03c115
-	memset(key, '\0', GIT_MAX_BLKSZ);
03c115
-	if (the_hash_algo->blksz < key_len) {
03c115
-		the_hash_algo->init_fn(&ctx;;
03c115
-		the_hash_algo->update_fn(&ctx, key_in, key_len);
03c115
-		the_hash_algo->final_fn(key, &ctx;;
03c115
-	} else {
03c115
-		memcpy(key, key_in, key_len);
03c115
-	}
03c115
-
03c115
-	/* RFC 2104 2. (2) & (5) */
03c115
-	for (i = 0; i < sizeof(key); i++) {
03c115
-		k_ipad[i] = key[i] ^ 0x36;
03c115
-		k_opad[i] = key[i] ^ 0x5c;
03c115
-	}
03c115
-
03c115
-	/* RFC 2104 2. (3) & (4) */
03c115
-	the_hash_algo->init_fn(&ctx;;
03c115
-	the_hash_algo->update_fn(&ctx, k_ipad, sizeof(k_ipad));
03c115
-	the_hash_algo->update_fn(&ctx, text, text_len);
03c115
-	the_hash_algo->final_fn(out, &ctx;;
03c115
-
03c115
-	/* RFC 2104 2. (6) & (7) */
03c115
-	the_hash_algo->init_fn(&ctx;;
03c115
-	the_hash_algo->update_fn(&ctx, k_opad, sizeof(k_opad));
03c115
-	the_hash_algo->update_fn(&ctx, out, the_hash_algo->rawsz);
03c115
-	the_hash_algo->final_fn(out, &ctx;;
03c115
+	HMAC(EVP_sha1(), key_in, key_len, text, text_len, out, NULL);
03c115
 }
03c115
 
03c115
 static char *prepare_push_cert_nonce(const char *path, timestamp_t stamp)
03c115
diff -ur a/Makefile b/Makefile
0b3640
--- a/Makefile	2022-10-07 06:48:26.000000000 +0200
0b3640
+++ b/Makefile	2022-11-21 16:35:56.986792752 +0100
0b3640
@@ -2008,6 +2008,8 @@
0b3640
 	EXTLIBS += -lcrypto -lssl
03c115
 endif
03c115
 
03c115
+EXTLIBS += -lcrypto
03c115
+
03c115
 ifneq ($(PROCFS_EXECUTABLE_PATH),)
03c115
 	procfs_executable_path_SQ = $(subst ','\'',$(PROCFS_EXECUTABLE_PATH))
03c115
 	BASIC_CFLAGS += '-DPROCFS_EXECUTABLE_PATH="$(procfs_executable_path_SQ)"'