Skip to content

Commit b9bcd76

Browse files
committed
Merge branch 'cb/avoid-colliding-with-netbsd-hmac'
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()
2 parents 4c2941a + 3013118 commit b9bcd76

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

builtin/receive-pack.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ static int copy_to_sideband(int in, int out, void *arg)
418418
return 0;
419419
}
420420

421-
static void hmac(unsigned char *out,
421+
static void hmac_hash(unsigned char *out,
422422
const char *key_in, size_t key_len,
423423
const char *text, size_t text_len)
424424
{
@@ -463,10 +463,10 @@ static char *prepare_push_cert_nonce(const char *path, timestamp_t stamp)
463463
unsigned char hash[GIT_MAX_RAWSZ];
464464

465465
strbuf_addf(&buf, "%s:%"PRItime, path, stamp);
466-
hmac(hash, buf.buf, buf.len, cert_nonce_seed, strlen(cert_nonce_seed));
466+
hmac_hash(hash, buf.buf, buf.len, cert_nonce_seed, strlen(cert_nonce_seed));
467467
strbuf_release(&buf);
468468

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

0 commit comments

Comments
 (0)