builtin/receive-pack: avoid hard-coded constants for push certs
commitf6d27d2468ccf8e123f9bffde6466d673dba2317
authorbrian m. carlson <sandals@crustytoothpaste.net>
Wed, 2 May 2018 00:25:53 +0000 (2 00:25 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 2 May 2018 04:59:51 +0000 (2 13:59 +0900)
treee6eb115145535ec016c3fcde713ff96d00c0a567
parentde1d81d5af635aaa8269d54ee06d99c2b0b75c62
builtin/receive-pack: avoid hard-coded constants for push certs

Use the GIT_SHA1_RAWSZ and GIT_SHA1_HEXSZ macros instead of hard-coding
the constants 20 and 40.  Switch one use of 20 with a format specifier
for a hex value to use the hex constant instead, as the original appears
to have been a typo.

At this point, avoid converting the hard-coded use of SHA-1 to use
the_hash_algo.  SHA-1, even if not collision resistant, is secure in the
context in which it is used here, and the hash algorithm of the repo
need not match what is used here.  When we adopt a new hash algorithm,
we can simply adopt the new algorithm wholesale here, as the nonce is
opaque and its length and validity are entirely controlled by the
server.  Consequently, defer updating this code until that point.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/receive-pack.c