aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/receive-pack.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-02-10 10:18:30 -0800
committerJunio C Hamano <gitster@pobox.com>2025-02-10 10:18:31 -0800
commit246569bf83f2a586268d26559c7d6ea54c9316b6 (patch)
tree29bdf8fd459a337adef85012b88d6ed71830a147 /builtin/receive-pack.c
parentMerge branch 'jt/gitlab-ci-base-fix' (diff)
parentglobal: adapt callers to use generic hash context helpers (diff)
downloadgit-246569bf83f2a586268d26559c7d6ea54c9316b6.tar.gz
git-246569bf83f2a586268d26559c7d6ea54c9316b6.zip
Merge branch 'ps/hash-cleanup'
Further code clean-up on the use of hash functions. Now the context object knows what hash function it is working with. * ps/hash-cleanup: global: adapt callers to use generic hash context helpers hash: provide generic wrappers to update hash contexts hash: stop typedeffing the hash context hash: convert hashing context to a structure
Diffstat (limited to 'builtin/receive-pack.c')
-rw-r--r--builtin/receive-pack.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index b7ea774609..129305700c 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -566,14 +566,14 @@ static void hmac_hash(unsigned char *out,
unsigned char k_ipad[GIT_MAX_BLKSZ];
unsigned char k_opad[GIT_MAX_BLKSZ];
int i;
- git_hash_ctx ctx;
+ struct git_hash_ctx ctx;
/* RFC 2104 2. (1) */
memset(key, '\0', GIT_MAX_BLKSZ);
if (the_hash_algo->blksz < key_len) {
the_hash_algo->init_fn(&ctx);
- the_hash_algo->update_fn(&ctx, key_in, key_len);
- the_hash_algo->final_fn(key, &ctx);
+ git_hash_update(&ctx, key_in, key_len);
+ git_hash_final(key, &ctx);
} else {
memcpy(key, key_in, key_len);
}
@@ -586,15 +586,15 @@ static void hmac_hash(unsigned char *out,
/* RFC 2104 2. (3) & (4) */
the_hash_algo->init_fn(&ctx);
- the_hash_algo->update_fn(&ctx, k_ipad, sizeof(k_ipad));
- the_hash_algo->update_fn(&ctx, text, text_len);
- the_hash_algo->final_fn(out, &ctx);
+ git_hash_update(&ctx, k_ipad, sizeof(k_ipad));
+ git_hash_update(&ctx, text, text_len);
+ git_hash_final(out, &ctx);
/* RFC 2104 2. (6) & (7) */
the_hash_algo->init_fn(&ctx);
- the_hash_algo->update_fn(&ctx, k_opad, sizeof(k_opad));
- the_hash_algo->update_fn(&ctx, out, the_hash_algo->rawsz);
- the_hash_algo->final_fn(out, &ctx);
+ git_hash_update(&ctx, k_opad, sizeof(k_opad));
+ git_hash_update(&ctx, out, the_hash_algo->rawsz);
+ git_hash_final(out, &ctx);
}
static char *prepare_push_cert_nonce(const char *path, timestamp_t stamp)