summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-12-04 11:19:09 -0800
committerJunio C Hamano <gitster@pobox.com>2015-12-04 11:19:10 -0800
commit4672123fe5cb629d2a261245fd0a2e003ef35ea3 (patch)
tree9707f636c82566e86ed31a190d9127f157ec5b18 /cache.h
parentfd13a2ecfbda734a54e22695e0219e89682bdd22 (diff)
parent001fd7a90b5851f62e700510729a5e09706f9b63 (diff)
downloadgit-4672123fe5cb629d2a261245fd0a2e003ef35ea3.tar.gz
Merge branch 'ad/sha1-update-chunked'
Apple's common crypto implementation of SHA1_Update() does not take more than 4GB at a time, and we now have a compile-time workaround for it. * ad/sha1-update-chunked: sha1: allow limiting the size of the data passed to SHA1_Update() sha1: provide another level of indirection for the SHA-1 functions
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h28
1 files changed, 23 insertions, 5 deletions
diff --git a/cache.h b/cache.h
index 736abc03a4..2a9e90285e 100644
--- a/cache.h
+++ b/cache.h
@@ -11,11 +11,29 @@
#include "string-list.h"
#include SHA1_HEADER
-#ifndef git_SHA_CTX
-#define git_SHA_CTX SHA_CTX
-#define git_SHA1_Init SHA1_Init
-#define git_SHA1_Update SHA1_Update
-#define git_SHA1_Final SHA1_Final
+#ifndef platform_SHA_CTX
+/*
+ * platform's underlying implementation of SHA-1; could be OpenSSL,
+ * blk_SHA, Apple CommonCrypto, etc... Note that including
+ * SHA1_HEADER may have already defined platform_SHA_CTX for our
+ * own implementations like block-sha1 and ppc-sha1, so we list
+ * the default for OpenSSL compatible SHA-1 implementations here.
+ */
+#define platform_SHA_CTX SHA_CTX
+#define platform_SHA1_Init SHA1_Init
+#define platform_SHA1_Update SHA1_Update
+#define platform_SHA1_Final SHA1_Final
+#endif
+
+#define git_SHA_CTX platform_SHA_CTX
+#define git_SHA1_Init platform_SHA1_Init
+#define git_SHA1_Update platform_SHA1_Update
+#define git_SHA1_Final platform_SHA1_Final
+
+#ifdef SHA1_MAX_BLOCK_SIZE
+#include "compat/sha1-chunked.h"
+#undef git_SHA1_Update
+#define git_SHA1_Update git_SHA1_Update_Chunked
#endif
#include <zlib.h>