deps/libgit2/src/util/hash/builtin.c

filter: Statementstmt 8.0% 2 / 25 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 5.4% 2 / 37 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« deps/libgit2/src/libgit2/commit_graph.c ↑ Summary deps/libgit2/deps/pcre/pcre_newline.c »
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 ▶ GIT_ASSERT_ARG(ctx);
Branch: 1 branch
BranchTrueFalseTotal
GIT_ASSERT_ARG(ctx); 0 0 0
28 0 ▶ if (SHA256Reset(&ctx->c)) {
Branch: 1 branch
BranchTrueFalseTotal
if (SHA256Reset(&ctx->c)) { 0 0 0
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 ▶ GIT_ASSERT_ARG(ctx);
Branch: 1 branch
BranchTrueFalseTotal
GIT_ASSERT_ARG(ctx); 0 0 0
38 0 ▶ if (SHA256Input(&ctx->c, data, len)) {
Branch: 1 branch
BranchTrueFalseTotal
if (SHA256Input(&ctx->c, data, len)) { 0 0 0
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 ▶ GIT_ASSERT_ARG(ctx);
Branch: 1 branch
BranchTrueFalseTotal
GIT_ASSERT_ARG(ctx); 0 0 0
48 0 ▶ if (SHA256Result(&ctx->c, out)) {
Branch: 1 branch
BranchTrueFalseTotal
if (SHA256Result(&ctx->c, out)) { 0 0 0
49 0 git_error_set(GIT_ERROR_SHA, "SHA256 error");
50 0 return -1;
51 }
52 0 return 0;
53 }
« deps/libgit2/src/libgit2/commit_graph.c ↑ Summary deps/libgit2/deps/pcre/pcre_newline.c »