hash: move SHA-1 macros to hash.h
Most of the other code dealing with SHA-1 and other hashes is located in hash.h, which is in turn loaded by cache.h. Move the SHA-1 macros to hash.h as well, so we can use them in additional hash-related items in the future. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
Feb 1, 2018 at 02:18 UTC
164e716330a65dc6770cace76110375a20c45dea
2 files changed
+25
-25
cache.h
-25
@@ -16,31 +16,6 @@
16
#include "sha1-array.h"
17
#include "repository.h"
18
19
-#ifndef platform_SHA_CTX
20
-/*
21
- * platform's underlying implementation of SHA-1; could be OpenSSL,
22
- * blk_SHA, Apple CommonCrypto, etc... Note that including
23
- * SHA1_HEADER may have already defined platform_SHA_CTX for our
24
- * own implementations like block-sha1 and ppc-sha1, so we list
25
- * the default for OpenSSL compatible SHA-1 implementations here.
26
- */
27
-#define platform_SHA_CTX SHA_CTX
28
-#define platform_SHA1_Init SHA1_Init
29
-#define platform_SHA1_Update SHA1_Update
30
-#define platform_SHA1_Final SHA1_Final
31
-#endif
32
-
33
-#define git_SHA_CTX platform_SHA_CTX
34
-#define git_SHA1_Init platform_SHA1_Init
35
-#define git_SHA1_Update platform_SHA1_Update
36
-#define git_SHA1_Final platform_SHA1_Final
37
-
38
-#ifdef SHA1_MAX_BLOCK_SIZE
39
-#include "compat/sha1-chunked.h"
40
-#undef git_SHA1_Update
41
-#define git_SHA1_Update git_SHA1_Update_Chunked
42
-#endif
43
-
19
#include <zlib.h>
20
typedef struct git_zstream {
21
z_stream z;
hash.h
+25
@@ -15,6 +15,31 @@
15
#include "block-sha1/sha1.h"
16
#endif
17
18
+#ifndef platform_SHA_CTX
19
+/*
20
+ * platform's underlying implementation of SHA-1; could be OpenSSL,
21
+ * blk_SHA, Apple CommonCrypto, etc... Note that including
22
+ * SHA1_HEADER may have already defined platform_SHA_CTX for our
23
+ * own implementations like block-sha1 and ppc-sha1, so we list
24
+ * the default for OpenSSL compatible SHA-1 implementations here.
25
+ */
26
+#define platform_SHA_CTX SHA_CTX
27
+#define platform_SHA1_Init SHA1_Init
28
+#define platform_SHA1_Update SHA1_Update
29
+#define platform_SHA1_Final SHA1_Final
30
+#endif
31
+
32
+#define git_SHA_CTX platform_SHA_CTX
33
+#define git_SHA1_Init platform_SHA1_Init
34
+#define git_SHA1_Update platform_SHA1_Update
35
+#define git_SHA1_Final platform_SHA1_Final
36
+
37
+#ifdef SHA1_MAX_BLOCK_SIZE
38
+#include "compat/sha1-chunked.h"
39
+#undef git_SHA1_Update
40
+#define git_SHA1_Update git_SHA1_Update_Chunked
41
+#endif
42
+
43
/*
44
* Note that these constants are suitable for indexing the hash_algos array and
45
* comparing against each other, but are otherwise arbitrary, so they should not