Skip to content

Commit

Permalink
receive-pack::hmac_sha1(): copy the entire SHA-1 hash out
Browse files Browse the repository at this point in the history
clang gives the following warning:

builtin/receive-pack.c:327:35: error: sizeof on array function
parameter will return size of 'unsigned char *' instead of 'unsigned
char [20]' [-Werror,-Wsizeof-array-argument]
        git_SHA1_Update(&ctx, out, sizeof(out));
                                         ^
builtin/receive-pack.c:292:37: note: declared here
static void hmac_sha1(unsigned char out[20],
                                   ^
Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Brian Gernhardt authored and Junio C Hamano committed Sep 25, 2014
1 parent 5732373 commit 6f5ef44
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions builtin/receive-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ static int copy_to_sideband(int in, int out, void *arg)

#define HMAC_BLOCK_SIZE 64

static void hmac_sha1(unsigned char out[20],
static void hmac_sha1(unsigned char *out,
const char *key_in, size_t key_len,
const char *text, size_t text_len)
{
Expand Down Expand Up @@ -323,7 +323,7 @@ static void hmac_sha1(unsigned char out[20],
/* RFC 2104 2. (6) & (7) */
git_SHA1_Init(&ctx);
git_SHA1_Update(&ctx, k_opad, sizeof(k_opad));
git_SHA1_Update(&ctx, out, sizeof(out));
git_SHA1_Update(&ctx, out, 20);
git_SHA1_Final(out, &ctx);
}

Expand Down

0 comments on commit 6f5ef44

Please sign in to comment.