From: atousa.p@gmail.com Date: Thu, 05 Nov 2015 06:38:41 GMT Subject: [PATCH v4 1/3] Provide another level of abstraction for the SHA1 utilities. Message-ID: <1446705523-30701-1-git-send-email-apahlevan@ieee.org> In-Reply-To: From: Atousa Pahlevan Duprat The git source uses git_SHA1_Update() and friends to call into the code that computes the hashes. This is can then be mapped directly to an implementation that computes the hash, such as platform_SHA1_Update(); or as we will do in a subsequent patch, it can be mapped to something more complex that will in turn call into the platform's SHA implementation. Signed-off-by: Atousa Pahlevan Duprat --- cache.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/cache.h b/cache.h index a9aaa03..a934a2e 100644 --- a/cache.h +++ b/cache.h @@ -12,10 +12,21 @@ #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 + +/* platform's underlying implementation of SHA1, could be OpenSSL, + blk_SHA, Apple CommonCrypto, etc... */ +#define platform_SHA_CTX SHA_CTX +#define platform_SHA1_Init SHA1_Init +#define platform_SHA1_Update SHA1_Update +#define platform_SHA1_Final SHA1_Final + +/* git may call platform's underlying implementation of SHA1 directly, + or may call it through a wrapper */ +#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 + #endif #include -- 2.4.9 (Apple Git-60)