Skip to content

Commit

Permalink
Merge branch 'cb/avoid-colliding-with-netbsd-hmac'
Browse files Browse the repository at this point in the history
The <stdlib.h> header on NetBSD brings in its own definition of
hmac() function (eek), which conflicts with our own and unrelated
function with the same name.  Our function has been renamed to work
around the issue.

* cb/avoid-colliding-with-netbsd-hmac:
  builtin/receive-pack: avoid generic function name hmac()
  • Loading branch information
gitster committed May 8, 2020
2 parents 4c2941a + 3013118 commit b9bcd76
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions builtin/receive-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ static int copy_to_sideband(int in, int out, void *arg)
return 0;
}

static void hmac(unsigned char *out,
static void hmac_hash(unsigned char *out,
const char *key_in, size_t key_len,
const char *text, size_t text_len)
{
Expand Down Expand Up @@ -463,10 +463,10 @@ static char *prepare_push_cert_nonce(const char *path, timestamp_t stamp)
unsigned char hash[GIT_MAX_RAWSZ];

strbuf_addf(&buf, "%s:%"PRItime, path, stamp);
hmac(hash, buf.buf, buf.len, cert_nonce_seed, strlen(cert_nonce_seed));
hmac_hash(hash, buf.buf, buf.len, cert_nonce_seed, strlen(cert_nonce_seed));
strbuf_release(&buf);

/* RFC 2104 5. HMAC-SHA1-80 */
/* RFC 2104 5. HMAC-SHA1 or HMAC-SHA256 */
strbuf_addf(&buf, "%"PRItime"-%.*s", stamp, (int)the_hash_algo->hexsz, hash_to_hex(hash));
return strbuf_detach(&buf, NULL);
}
Expand Down

0 comments on commit b9bcd76

Please sign in to comment.