summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2012-10-23 13:43:28 -0700
committerVicent Martí <vicent@github.com>2012-10-23 13:43:28 -0700
commit81e7b10a15d8a28bc0407d61a0e6ddc27e23647c (patch)
tree1eb4ce9a6a18cf7a4829434bd580acb0b7d17d68 /src
parent5b67d145d8f465ed0c7ed9c07d331aae29c2713b (diff)
parent7205a4d94cdead95c397505292a31b4854039825 (diff)
downloadlibgit2-81e7b10a15d8a28bc0407d61a0e6ddc27e23647c.tar.gz
Merge pull request #1012 from carlosmn/libcrypto-sha
Use libcrypto's SHA-1 implementation when linking to it
Diffstat (limited to 'src')
-rw-r--r--src/sha1.h7
-rw-r--r--src/sha1/sha1.c (renamed from src/sha1.c)0
2 files changed, 7 insertions, 0 deletions
diff --git a/src/sha1.h b/src/sha1.h
index f0a16f2cf..41e8abad6 100644
--- a/src/sha1.h
+++ b/src/sha1.h
@@ -8,12 +8,17 @@
#ifndef INCLUDE_sha1_h__
#define INCLUDE_sha1_h__
+#ifdef OPENSSL_SHA
+# include <openssl/sha.h>
+
+#else
typedef struct {
unsigned long long size;
unsigned int H[5];
unsigned int W[16];
} blk_SHA_CTX;
+
void git__blk_SHA1_Init(blk_SHA_CTX *ctx);
void git__blk_SHA1_Update(blk_SHA_CTX *ctx, const void *dataIn, size_t len);
void git__blk_SHA1_Final(unsigned char hashout[20], blk_SHA_CTX *ctx);
@@ -23,4 +28,6 @@ void git__blk_SHA1_Final(unsigned char hashout[20], blk_SHA_CTX *ctx);
#define SHA1_Update git__blk_SHA1_Update
#define SHA1_Final git__blk_SHA1_Final
+#endif // OPENSSL_SHA
+
#endif
diff --git a/src/sha1.c b/src/sha1/sha1.c
index 8aaedeb8f..8aaedeb8f 100644
--- a/src/sha1.c
+++ b/src/sha1/sha1.c