Skip to content

Commit 164e716

Browse files
bk2204gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5be1f00 commit 164e716

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

cache.h

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,6 @@
1616
#include "sha1-array.h"
1717
#include "repository.h"
1818

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-
4419
#include <zlib.h>
4520
typedef struct git_zstream {
4621
z_stream z;

hash.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,31 @@
1515
#include "block-sha1/sha1.h"
1616
#endif
1717

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+
1843
/*
1944
* Note that these constants are suitable for indexing the hash_algos array and
2045
* comparing against each other, but are otherwise arbitrary, so they should not

0 commit comments

Comments
 (0)