brian m. carlson | f18f816 | 2017-03-11 22:28:18 +0000 | [diff] [blame] | 1 | #ifndef HASH_H |
| 2 | #define HASH_H |
| 3 | |
brian m. carlson | f50e766 | 2017-11-12 21:28:52 +0000 | [diff] [blame] | 4 | #include "git-compat-util.h" |
Jeff King | 3fa6f2a | 2020-12-04 13:51:39 -0500 | [diff] [blame] | 5 | #include "repository.h" |
brian m. carlson | f50e766 | 2017-11-12 21:28:52 +0000 | [diff] [blame] | 6 | |
brian m. carlson | f18f816 | 2017-03-11 22:28:18 +0000 | [diff] [blame] | 7 | #if defined(SHA1_PPC) |
| 8 | #include "ppc/sha1.h" |
| 9 | #elif defined(SHA1_APPLE) |
| 10 | #include <CommonCrypto/CommonDigest.h> |
| 11 | #elif defined(SHA1_OPENSSL) |
| 12 | #include <openssl/sha.h> |
Jeff King | 8325e43 | 2017-03-16 18:09:12 -0400 | [diff] [blame] | 13 | #elif defined(SHA1_DC) |
Takashi Iwai | 36f048c | 2017-08-15 14:04:16 +0200 | [diff] [blame] | 14 | #include "sha1dc_git.h" |
brian m. carlson | f18f816 | 2017-03-11 22:28:18 +0000 | [diff] [blame] | 15 | #else /* SHA1_BLK */ |
| 16 | #include "block-sha1/sha1.h" |
| 17 | #endif |
| 18 | |
brian m. carlson | 27dc04c | 2018-11-14 04:09:37 +0000 | [diff] [blame] | 19 | #if defined(SHA256_GCRYPT) |
brian m. carlson | 768e30e | 2020-02-22 20:17:27 +0000 | [diff] [blame] | 20 | #define SHA256_NEEDS_CLONE_HELPER |
brian m. carlson | 27dc04c | 2018-11-14 04:09:37 +0000 | [diff] [blame] | 21 | #include "sha256/gcrypt.h" |
brian m. carlson | 4b4e291 | 2018-11-14 04:09:38 +0000 | [diff] [blame] | 22 | #elif defined(SHA256_OPENSSL) |
| 23 | #include <openssl/sha.h> |
brian m. carlson | 27dc04c | 2018-11-14 04:09:37 +0000 | [diff] [blame] | 24 | #else |
brian m. carlson | 13eeedb | 2018-11-14 04:09:36 +0000 | [diff] [blame] | 25 | #include "sha256/block/sha256.h" |
brian m. carlson | 27dc04c | 2018-11-14 04:09:37 +0000 | [diff] [blame] | 26 | #endif |
brian m. carlson | 13eeedb | 2018-11-14 04:09:36 +0000 | [diff] [blame] | 27 | |
brian m. carlson | 164e716 | 2018-02-01 02:18:37 +0000 | [diff] [blame] | 28 | #ifndef platform_SHA_CTX |
| 29 | /* |
| 30 | * platform's underlying implementation of SHA-1; could be OpenSSL, |
brian m. carlson | b212c0c | 2018-02-08 02:48:58 +0000 | [diff] [blame] | 31 | * blk_SHA, Apple CommonCrypto, etc... Note that the relevant |
| 32 | * SHA-1 header may have already defined platform_SHA_CTX for our |
brian m. carlson | 164e716 | 2018-02-01 02:18:37 +0000 | [diff] [blame] | 33 | * own implementations like block-sha1 and ppc-sha1, so we list |
| 34 | * the default for OpenSSL compatible SHA-1 implementations here. |
| 35 | */ |
| 36 | #define platform_SHA_CTX SHA_CTX |
| 37 | #define platform_SHA1_Init SHA1_Init |
| 38 | #define platform_SHA1_Update SHA1_Update |
| 39 | #define platform_SHA1_Final SHA1_Final |
| 40 | #endif |
| 41 | |
| 42 | #define git_SHA_CTX platform_SHA_CTX |
| 43 | #define git_SHA1_Init platform_SHA1_Init |
| 44 | #define git_SHA1_Update platform_SHA1_Update |
| 45 | #define git_SHA1_Final platform_SHA1_Final |
| 46 | |
brian m. carlson | 13eeedb | 2018-11-14 04:09:36 +0000 | [diff] [blame] | 47 | #ifndef platform_SHA256_CTX |
| 48 | #define platform_SHA256_CTX SHA256_CTX |
| 49 | #define platform_SHA256_Init SHA256_Init |
| 50 | #define platform_SHA256_Update SHA256_Update |
| 51 | #define platform_SHA256_Final SHA256_Final |
| 52 | #endif |
| 53 | |
| 54 | #define git_SHA256_CTX platform_SHA256_CTX |
| 55 | #define git_SHA256_Init platform_SHA256_Init |
| 56 | #define git_SHA256_Update platform_SHA256_Update |
| 57 | #define git_SHA256_Final platform_SHA256_Final |
| 58 | |
brian m. carlson | 768e30e | 2020-02-22 20:17:27 +0000 | [diff] [blame] | 59 | #ifdef platform_SHA256_Clone |
| 60 | #define git_SHA256_Clone platform_SHA256_Clone |
| 61 | #endif |
| 62 | |
brian m. carlson | 164e716 | 2018-02-01 02:18:37 +0000 | [diff] [blame] | 63 | #ifdef SHA1_MAX_BLOCK_SIZE |
| 64 | #include "compat/sha1-chunked.h" |
| 65 | #undef git_SHA1_Update |
| 66 | #define git_SHA1_Update git_SHA1_Update_Chunked |
| 67 | #endif |
| 68 | |
brian m. carlson | 768e30e | 2020-02-22 20:17:27 +0000 | [diff] [blame] | 69 | static inline void git_SHA1_Clone(git_SHA_CTX *dst, const git_SHA_CTX *src) |
| 70 | { |
| 71 | memcpy(dst, src, sizeof(*dst)); |
| 72 | } |
| 73 | |
| 74 | #ifndef SHA256_NEEDS_CLONE_HELPER |
| 75 | static inline void git_SHA256_Clone(git_SHA256_CTX *dst, const git_SHA256_CTX *src) |
| 76 | { |
| 77 | memcpy(dst, src, sizeof(*dst)); |
| 78 | } |
| 79 | #endif |
| 80 | |
brian m. carlson | f50e766 | 2017-11-12 21:28:52 +0000 | [diff] [blame] | 81 | /* |
| 82 | * Note that these constants are suitable for indexing the hash_algos array and |
| 83 | * comparing against each other, but are otherwise arbitrary, so they should not |
| 84 | * be exposed to the user or serialized to disk. To know whether a |
| 85 | * git_hash_algo struct points to some usable hash function, test the format_id |
| 86 | * field for being non-zero. Use the name field for user-visible situations and |
| 87 | * the format_id field for fixed-length fields on disk. |
| 88 | */ |
| 89 | /* An unknown hash function. */ |
| 90 | #define GIT_HASH_UNKNOWN 0 |
| 91 | /* SHA-1 */ |
| 92 | #define GIT_HASH_SHA1 1 |
brian m. carlson | 13eeedb | 2018-11-14 04:09:36 +0000 | [diff] [blame] | 93 | /* SHA-256 */ |
| 94 | #define GIT_HASH_SHA256 2 |
brian m. carlson | f50e766 | 2017-11-12 21:28:52 +0000 | [diff] [blame] | 95 | /* Number of algorithms supported (including unknown). */ |
brian m. carlson | 13eeedb | 2018-11-14 04:09:36 +0000 | [diff] [blame] | 96 | #define GIT_HASH_NALGOS (GIT_HASH_SHA256 + 1) |
brian m. carlson | f50e766 | 2017-11-12 21:28:52 +0000 | [diff] [blame] | 97 | |
Han-Wen Nienhuys | 27f3796 | 2021-08-30 14:57:37 +0000 | [diff] [blame] | 98 | /* "sha1", big-endian */ |
| 99 | #define GIT_SHA1_FORMAT_ID 0x73686131 |
| 100 | |
brian m. carlson | ab795f0 | 2021-04-26 01:02:52 +0000 | [diff] [blame] | 101 | /* The length in bytes and in hex digits of an object name (SHA-1 value). */ |
| 102 | #define GIT_SHA1_RAWSZ 20 |
| 103 | #define GIT_SHA1_HEXSZ (2 * GIT_SHA1_RAWSZ) |
| 104 | /* The block size of SHA-1. */ |
| 105 | #define GIT_SHA1_BLKSZ 64 |
| 106 | |
Han-Wen Nienhuys | 27f3796 | 2021-08-30 14:57:37 +0000 | [diff] [blame] | 107 | /* "s256", big-endian */ |
| 108 | #define GIT_SHA256_FORMAT_ID 0x73323536 |
| 109 | |
brian m. carlson | ab795f0 | 2021-04-26 01:02:52 +0000 | [diff] [blame] | 110 | /* The length in bytes and in hex digits of an object name (SHA-256 value). */ |
| 111 | #define GIT_SHA256_RAWSZ 32 |
| 112 | #define GIT_SHA256_HEXSZ (2 * GIT_SHA256_RAWSZ) |
| 113 | /* The block size of SHA-256. */ |
| 114 | #define GIT_SHA256_BLKSZ 64 |
| 115 | |
| 116 | /* The length in byte and in hex digits of the largest possible hash value. */ |
| 117 | #define GIT_MAX_RAWSZ GIT_SHA256_RAWSZ |
| 118 | #define GIT_MAX_HEXSZ GIT_SHA256_HEXSZ |
| 119 | /* The largest possible block size for any supported hash. */ |
| 120 | #define GIT_MAX_BLKSZ GIT_SHA256_BLKSZ |
| 121 | |
| 122 | struct object_id { |
| 123 | unsigned char hash[GIT_MAX_RAWSZ]; |
René Scharfe | 8bcda98 | 2021-08-14 22:00:38 +0200 | [diff] [blame] | 124 | int algo; /* XXX requires 4-byte alignment */ |
brian m. carlson | ab795f0 | 2021-04-26 01:02:52 +0000 | [diff] [blame] | 125 | }; |
| 126 | |
brian m. carlson | ac73ced | 2018-02-01 02:18:38 +0000 | [diff] [blame] | 127 | /* A suitably aligned type for stack allocations of hash contexts. */ |
| 128 | union git_hash_ctx { |
| 129 | git_SHA_CTX sha1; |
brian m. carlson | 13eeedb | 2018-11-14 04:09:36 +0000 | [diff] [blame] | 130 | git_SHA256_CTX sha256; |
brian m. carlson | ac73ced | 2018-02-01 02:18:38 +0000 | [diff] [blame] | 131 | }; |
| 132 | typedef union git_hash_ctx git_hash_ctx; |
| 133 | |
| 134 | typedef void (*git_hash_init_fn)(git_hash_ctx *ctx); |
brian m. carlson | 768e30e | 2020-02-22 20:17:27 +0000 | [diff] [blame] | 135 | typedef void (*git_hash_clone_fn)(git_hash_ctx *dst, const git_hash_ctx *src); |
brian m. carlson | ac73ced | 2018-02-01 02:18:38 +0000 | [diff] [blame] | 136 | typedef void (*git_hash_update_fn)(git_hash_ctx *ctx, const void *in, size_t len); |
| 137 | typedef void (*git_hash_final_fn)(unsigned char *hash, git_hash_ctx *ctx); |
brian m. carlson | ab795f0 | 2021-04-26 01:02:52 +0000 | [diff] [blame] | 138 | typedef void (*git_hash_final_oid_fn)(struct object_id *oid, git_hash_ctx *ctx); |
brian m. carlson | f50e766 | 2017-11-12 21:28:52 +0000 | [diff] [blame] | 139 | |
| 140 | struct git_hash_algo { |
| 141 | /* |
| 142 | * The name of the algorithm, as appears in the config file and in |
| 143 | * messages. |
| 144 | */ |
| 145 | const char *name; |
| 146 | |
| 147 | /* A four-byte version identifier, used in pack indices. */ |
| 148 | uint32_t format_id; |
| 149 | |
brian m. carlson | f50e766 | 2017-11-12 21:28:52 +0000 | [diff] [blame] | 150 | /* The length of the hash in binary. */ |
| 151 | size_t rawsz; |
| 152 | |
| 153 | /* The length of the hash in hex characters. */ |
| 154 | size_t hexsz; |
| 155 | |
brian m. carlson | a2ce0a7 | 2018-11-14 04:09:33 +0000 | [diff] [blame] | 156 | /* The block size of the hash. */ |
| 157 | size_t blksz; |
| 158 | |
brian m. carlson | f50e766 | 2017-11-12 21:28:52 +0000 | [diff] [blame] | 159 | /* The hash initialization function. */ |
| 160 | git_hash_init_fn init_fn; |
| 161 | |
brian m. carlson | 768e30e | 2020-02-22 20:17:27 +0000 | [diff] [blame] | 162 | /* The hash context cloning function. */ |
| 163 | git_hash_clone_fn clone_fn; |
| 164 | |
brian m. carlson | f50e766 | 2017-11-12 21:28:52 +0000 | [diff] [blame] | 165 | /* The hash update function. */ |
| 166 | git_hash_update_fn update_fn; |
| 167 | |
| 168 | /* The hash finalization function. */ |
| 169 | git_hash_final_fn final_fn; |
| 170 | |
brian m. carlson | ab795f0 | 2021-04-26 01:02:52 +0000 | [diff] [blame] | 171 | /* The hash finalization function for object IDs. */ |
| 172 | git_hash_final_oid_fn final_oid_fn; |
| 173 | |
brian m. carlson | f50e766 | 2017-11-12 21:28:52 +0000 | [diff] [blame] | 174 | /* The OID of the empty tree. */ |
| 175 | const struct object_id *empty_tree; |
| 176 | |
| 177 | /* The OID of the empty blob. */ |
| 178 | const struct object_id *empty_blob; |
brian m. carlson | 1422844 | 2021-04-26 01:02:56 +0000 | [diff] [blame] | 179 | |
| 180 | /* The all-zeros OID. */ |
| 181 | const struct object_id *null_oid; |
brian m. carlson | f50e766 | 2017-11-12 21:28:52 +0000 | [diff] [blame] | 182 | }; |
| 183 | extern const struct git_hash_algo hash_algos[GIT_HASH_NALGOS]; |
| 184 | |
brian m. carlson | 2f90b9d | 2018-10-22 02:43:32 +0000 | [diff] [blame] | 185 | /* |
| 186 | * Return a GIT_HASH_* constant based on the name. Returns GIT_HASH_UNKNOWN if |
| 187 | * the name doesn't match a known algorithm. |
| 188 | */ |
| 189 | int hash_algo_by_name(const char *name); |
| 190 | /* Identical, except based on the format ID. */ |
| 191 | int hash_algo_by_id(uint32_t format_id); |
brian m. carlson | 9539978 | 2019-02-19 00:05:17 +0000 | [diff] [blame] | 192 | /* Identical, except based on the length. */ |
| 193 | int hash_algo_by_length(int len); |
brian m. carlson | 2f90b9d | 2018-10-22 02:43:32 +0000 | [diff] [blame] | 194 | /* Identical, except for a pointer to struct git_hash_algo. */ |
| 195 | static inline int hash_algo_by_ptr(const struct git_hash_algo *p) |
| 196 | { |
| 197 | return p - hash_algos; |
| 198 | } |
| 199 | |
Jeff King | c0566d7 | 2019-06-20 03:41:45 -0400 | [diff] [blame] | 200 | #define the_hash_algo the_repository->hash_algo |
| 201 | |
brian m. carlson | 1422844 | 2021-04-26 01:02:56 +0000 | [diff] [blame] | 202 | const struct object_id *null_oid(void); |
Jeff King | 3fa6f2a | 2020-12-04 13:51:39 -0500 | [diff] [blame] | 203 | |
brian m. carlson | 5a6dce7 | 2021-04-26 01:02:55 +0000 | [diff] [blame] | 204 | static inline int hashcmp_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop) |
Jeff King | 3fa6f2a | 2020-12-04 13:51:39 -0500 | [diff] [blame] | 205 | { |
| 206 | /* |
| 207 | * Teach the compiler that there are only two possibilities of hash size |
| 208 | * here, so that it can optimize for this case as much as possible. |
| 209 | */ |
brian m. carlson | 5a6dce7 | 2021-04-26 01:02:55 +0000 | [diff] [blame] | 210 | if (algop->rawsz == GIT_MAX_RAWSZ) |
Jeff King | 3fa6f2a | 2020-12-04 13:51:39 -0500 | [diff] [blame] | 211 | return memcmp(sha1, sha2, GIT_MAX_RAWSZ); |
| 212 | return memcmp(sha1, sha2, GIT_SHA1_RAWSZ); |
| 213 | } |
| 214 | |
brian m. carlson | 5a6dce7 | 2021-04-26 01:02:55 +0000 | [diff] [blame] | 215 | static inline int hashcmp(const unsigned char *sha1, const unsigned char *sha2) |
Jeff King | 3fa6f2a | 2020-12-04 13:51:39 -0500 | [diff] [blame] | 216 | { |
brian m. carlson | 5a6dce7 | 2021-04-26 01:02:55 +0000 | [diff] [blame] | 217 | return hashcmp_algop(sha1, sha2, the_hash_algo); |
Jeff King | 3fa6f2a | 2020-12-04 13:51:39 -0500 | [diff] [blame] | 218 | } |
| 219 | |
brian m. carlson | 5a6dce7 | 2021-04-26 01:02:55 +0000 | [diff] [blame] | 220 | static inline int oidcmp(const struct object_id *oid1, const struct object_id *oid2) |
| 221 | { |
| 222 | const struct git_hash_algo *algop; |
| 223 | if (!oid1->algo) |
| 224 | algop = the_hash_algo; |
| 225 | else |
| 226 | algop = &hash_algos[oid1->algo]; |
| 227 | return hashcmp_algop(oid1->hash, oid2->hash, algop); |
| 228 | } |
| 229 | |
| 230 | static inline int hasheq_algop(const unsigned char *sha1, const unsigned char *sha2, const struct git_hash_algo *algop) |
Jeff King | 3fa6f2a | 2020-12-04 13:51:39 -0500 | [diff] [blame] | 231 | { |
| 232 | /* |
| 233 | * We write this here instead of deferring to hashcmp so that the |
| 234 | * compiler can properly inline it and avoid calling memcmp. |
| 235 | */ |
brian m. carlson | 5a6dce7 | 2021-04-26 01:02:55 +0000 | [diff] [blame] | 236 | if (algop->rawsz == GIT_MAX_RAWSZ) |
Jeff King | 3fa6f2a | 2020-12-04 13:51:39 -0500 | [diff] [blame] | 237 | return !memcmp(sha1, sha2, GIT_MAX_RAWSZ); |
| 238 | return !memcmp(sha1, sha2, GIT_SHA1_RAWSZ); |
| 239 | } |
| 240 | |
brian m. carlson | 5a6dce7 | 2021-04-26 01:02:55 +0000 | [diff] [blame] | 241 | static inline int hasheq(const unsigned char *sha1, const unsigned char *sha2) |
| 242 | { |
| 243 | return hasheq_algop(sha1, sha2, the_hash_algo); |
| 244 | } |
| 245 | |
Jeff King | 3fa6f2a | 2020-12-04 13:51:39 -0500 | [diff] [blame] | 246 | static inline int oideq(const struct object_id *oid1, const struct object_id *oid2) |
| 247 | { |
brian m. carlson | 5a6dce7 | 2021-04-26 01:02:55 +0000 | [diff] [blame] | 248 | const struct git_hash_algo *algop; |
| 249 | if (!oid1->algo) |
| 250 | algop = the_hash_algo; |
| 251 | else |
| 252 | algop = &hash_algos[oid1->algo]; |
| 253 | return hasheq_algop(oid1->hash, oid2->hash, algop); |
Jeff King | 3fa6f2a | 2020-12-04 13:51:39 -0500 | [diff] [blame] | 254 | } |
| 255 | |
| 256 | static inline int is_null_oid(const struct object_id *oid) |
| 257 | { |
brian m. carlson | 1422844 | 2021-04-26 01:02:56 +0000 | [diff] [blame] | 258 | return oideq(oid, null_oid()); |
Jeff King | 3fa6f2a | 2020-12-04 13:51:39 -0500 | [diff] [blame] | 259 | } |
| 260 | |
| 261 | static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src) |
| 262 | { |
| 263 | memcpy(sha_dst, sha_src, the_hash_algo->rawsz); |
| 264 | } |
| 265 | |
| 266 | static inline void oidcpy(struct object_id *dst, const struct object_id *src) |
| 267 | { |
| 268 | memcpy(dst->hash, src->hash, GIT_MAX_RAWSZ); |
brian m. carlson | 5a6dce7 | 2021-04-26 01:02:55 +0000 | [diff] [blame] | 269 | dst->algo = src->algo; |
Jeff King | 3fa6f2a | 2020-12-04 13:51:39 -0500 | [diff] [blame] | 270 | } |
| 271 | |
Matheus Tavares | 3d20ed2 | 2021-05-17 16:49:03 -0300 | [diff] [blame] | 272 | /* Like oidcpy() but zero-pads the unused bytes in dst's hash array. */ |
| 273 | static inline void oidcpy_with_padding(struct object_id *dst, |
Eric Wong | 90e07f0 | 2021-07-07 23:10:18 +0000 | [diff] [blame] | 274 | const struct object_id *src) |
Matheus Tavares | 3d20ed2 | 2021-05-17 16:49:03 -0300 | [diff] [blame] | 275 | { |
| 276 | size_t hashsz; |
| 277 | |
| 278 | if (!src->algo) |
| 279 | hashsz = the_hash_algo->rawsz; |
| 280 | else |
| 281 | hashsz = hash_algos[src->algo].rawsz; |
| 282 | |
| 283 | memcpy(dst->hash, src->hash, hashsz); |
| 284 | memset(dst->hash + hashsz, 0, GIT_MAX_RAWSZ - hashsz); |
| 285 | dst->algo = src->algo; |
| 286 | } |
| 287 | |
Jeff King | 3fa6f2a | 2020-12-04 13:51:39 -0500 | [diff] [blame] | 288 | static inline struct object_id *oiddup(const struct object_id *src) |
| 289 | { |
| 290 | struct object_id *dst = xmalloc(sizeof(struct object_id)); |
| 291 | oidcpy(dst, src); |
| 292 | return dst; |
| 293 | } |
| 294 | |
| 295 | static inline void hashclr(unsigned char *hash) |
| 296 | { |
| 297 | memset(hash, 0, the_hash_algo->rawsz); |
| 298 | } |
| 299 | |
| 300 | static inline void oidclr(struct object_id *oid) |
| 301 | { |
| 302 | memset(oid->hash, 0, GIT_MAX_RAWSZ); |
brian m. carlson | 5a6dce7 | 2021-04-26 01:02:55 +0000 | [diff] [blame] | 303 | oid->algo = hash_algo_by_ptr(the_hash_algo); |
Jeff King | 3fa6f2a | 2020-12-04 13:51:39 -0500 | [diff] [blame] | 304 | } |
| 305 | |
| 306 | static inline void oidread(struct object_id *oid, const unsigned char *hash) |
| 307 | { |
| 308 | memcpy(oid->hash, hash, the_hash_algo->rawsz); |
brian m. carlson | 5a6dce7 | 2021-04-26 01:02:55 +0000 | [diff] [blame] | 309 | oid->algo = hash_algo_by_ptr(the_hash_algo); |
Jeff King | 3fa6f2a | 2020-12-04 13:51:39 -0500 | [diff] [blame] | 310 | } |
| 311 | |
| 312 | static inline int is_empty_blob_sha1(const unsigned char *sha1) |
| 313 | { |
| 314 | return hasheq(sha1, the_hash_algo->empty_blob->hash); |
| 315 | } |
| 316 | |
| 317 | static inline int is_empty_blob_oid(const struct object_id *oid) |
| 318 | { |
| 319 | return oideq(oid, the_hash_algo->empty_blob); |
| 320 | } |
| 321 | |
| 322 | static inline int is_empty_tree_sha1(const unsigned char *sha1) |
| 323 | { |
| 324 | return hasheq(sha1, the_hash_algo->empty_tree->hash); |
| 325 | } |
| 326 | |
| 327 | static inline int is_empty_tree_oid(const struct object_id *oid) |
| 328 | { |
| 329 | return oideq(oid, the_hash_algo->empty_tree); |
| 330 | } |
| 331 | |
brian m. carlson | 5a6dce7 | 2021-04-26 01:02:55 +0000 | [diff] [blame] | 332 | static inline void oid_set_algo(struct object_id *oid, const struct git_hash_algo *algop) |
| 333 | { |
| 334 | oid->algo = hash_algo_by_ptr(algop); |
| 335 | } |
| 336 | |
Jeff King | 3fa6f2a | 2020-12-04 13:51:39 -0500 | [diff] [blame] | 337 | const char *empty_tree_oid_hex(void); |
| 338 | const char *empty_blob_oid_hex(void); |
| 339 | |
brian m. carlson | f18f816 | 2017-03-11 22:28:18 +0000 | [diff] [blame] | 340 | #endif |