Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Ericsson <ae@op5.se>2010-04-14 22:41:57 +0400
committerAndreas Ericsson <ae@op5.se>2010-04-14 22:44:22 +0400
commit5dddf7c855f9c8e43954a99a6f85c098dfc7ed41 (patch)
treeb92ae7738d06508c5fbfd1f2d08fb5190343ffc8 /src/hash.c
parentd15e94c0d4eb0fe06dd1e25d7e9e3c4940417f56 (diff)
Add block-sha1 in favour of the mozilla routines
Since block-sha1 from git.git has such excellent performance, we can also get rid of the openssl dependency. It's rather simple to add it back later as an optional extra, but we really needn't bother to pull in the entire ssl library and have to deal with linking issues now that we have the portable and, performance-wise, truly excellent block-sha1 code to fall back on. Since this requires a slight revamp of the build rules anyway, we take the opportunity to fix including EXTRA_OBJS in the final build as well. The block-sha1 code was originally implemented for git.git by Linus Torvalds <torvalds@linux-foundation.org> and was later polished by Nicolas Pitre <nico@cam.org>. Signed-off-by: Andreas Ericsson <ae@op5.se>
Diffstat (limited to 'src/hash.c')
-rw-r--r--src/hash.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/hash.c b/src/hash.c
index 0051f0975..784b10b4b 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -25,10 +25,10 @@
#include "common.h"
#include "hash.h"
-#include SHA1_HEADER
+#include "sha1.h"
struct git_hash_ctx {
- SHA_CTX c;
+ git_SHA_CTX c;
};
git_hash_ctx *git_hash_new_ctx(void)
@@ -38,7 +38,7 @@ git_hash_ctx *git_hash_new_ctx(void)
if (!ctx)
return NULL;
- SHA1_Init(&ctx->c);
+ git_SHA1_Init(&ctx->c);
return ctx;
}
@@ -51,37 +51,37 @@ void git_hash_free_ctx(git_hash_ctx *ctx)
void git_hash_init(git_hash_ctx *ctx)
{
assert(ctx);
- SHA1_Init(&ctx->c);
+ git_SHA1_Init(&ctx->c);
}
void git_hash_update(git_hash_ctx *ctx, const void *data, size_t len)
{
assert(ctx);
- SHA1_Update(&ctx->c, data, len);
+ git_SHA1_Update(&ctx->c, data, len);
}
void git_hash_final(git_oid *out, git_hash_ctx *ctx)
{
assert(ctx);
- SHA1_Final(out->id, &ctx->c);
+ git_SHA1_Final(out->id, &ctx->c);
}
void git_hash_buf(git_oid *out, const void *data, size_t len)
{
- SHA_CTX c;
+ git_SHA_CTX c;
- SHA1_Init(&c);
- SHA1_Update(&c, data, len);
- SHA1_Final(out->id, &c);
+ git_SHA1_Init(&c);
+ git_SHA1_Update(&c, data, len);
+ git_SHA1_Final(out->id, &c);
}
void git_hash_vec(git_oid *out, git_buf_vec *vec, size_t n)
{
- SHA_CTX c;
+ git_SHA_CTX c;
size_t i;
- SHA1_Init(&c);
+ git_SHA1_Init(&c);
for (i = 0; i < n; i++)
- SHA1_Update(&c, vec[i].data, vec[i].len);
- SHA1_Final(out->id, &c);
+ git_SHA1_Update(&c, vec[i].data, vec[i].len);
+ git_SHA1_Final(out->id, &c);
}