| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
/* |
|
2
|
|
|
|
|
|
|
* Copyright (C) the libgit2 contributors. All rights reserved. |
|
3
|
|
|
|
|
|
|
* |
|
4
|
|
|
|
|
|
|
* This file is part of libgit2, distributed under the GNU GPL v2 with |
|
5
|
|
|
|
|
|
|
* a Linking Exception. For full terms see the included COPYING file. |
|
6
|
|
|
|
|
|
|
*/ |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#include "builtin.h" |
|
9
|
|
|
|
|
|
|
|
|
10
|
87
|
|
|
|
|
|
int git_hash_sha256_global_init(void) |
|
11
|
|
|
|
|
|
|
{ |
|
12
|
87
|
|
|
|
|
|
return 0; |
|
13
|
|
|
|
|
|
|
} |
|
14
|
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
int git_hash_sha256_ctx_init(git_hash_sha256_ctx *ctx) |
|
16
|
|
|
|
|
|
|
{ |
|
17
|
0
|
|
|
|
|
|
return git_hash_sha256_init(ctx); |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
void git_hash_sha256_ctx_cleanup(git_hash_sha256_ctx *ctx) |
|
21
|
|
|
|
|
|
|
{ |
|
22
|
0
|
|
|
|
|
|
GIT_UNUSED(ctx); |
|
23
|
0
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
int git_hash_sha256_init(git_hash_sha256_ctx *ctx) |
|
26
|
|
|
|
|
|
|
{ |
|
27
|
0
|
0
|
|
|
|
|
GIT_ASSERT_ARG(ctx); |
|
28
|
0
|
0
|
|
|
|
|
if (SHA256Reset(&ctx->c)) { |
|
29
|
0
|
|
|
|
|
|
git_error_set(GIT_ERROR_SHA, "SHA256 error"); |
|
30
|
0
|
|
|
|
|
|
return -1; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
0
|
|
|
|
|
|
return 0; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
int git_hash_sha256_update(git_hash_sha256_ctx *ctx, const void *data, size_t len) |
|
36
|
|
|
|
|
|
|
{ |
|
37
|
0
|
0
|
|
|
|
|
GIT_ASSERT_ARG(ctx); |
|
38
|
0
|
0
|
|
|
|
|
if (SHA256Input(&ctx->c, data, len)) { |
|
39
|
0
|
|
|
|
|
|
git_error_set(GIT_ERROR_SHA, "SHA256 error"); |
|
40
|
0
|
|
|
|
|
|
return -1; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
0
|
|
|
|
|
|
return 0; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
int git_hash_sha256_final(unsigned char *out, git_hash_sha256_ctx *ctx) |
|
46
|
|
|
|
|
|
|
{ |
|
47
|
0
|
0
|
|
|
|
|
GIT_ASSERT_ARG(ctx); |
|
48
|
0
|
0
|
|
|
|
|
if (SHA256Result(&ctx->c, out)) { |
|
49
|
0
|
|
|
|
|
|
git_error_set(GIT_ERROR_SHA, "SHA256 error"); |
|
50
|
0
|
|
|
|
|
|
return -1; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
0
|
|
|
|
|
|
return 0; |
|
53
|
|
|
|
|
|
|
} |