| line |
true |
false |
branch |
|
36
|
134 |
0 |
if (name_len == 0 || name_len >= sizeof nm) return NULL; |
|
|
0 |
134 |
if (name_len == 0 || name_len >= sizeof nm) return NULL; |
|
40
|
721 |
134 |
for (k = 0; k < name_len; k++) { |
|
42
|
719 |
2 |
if (c == '-' || c == '_') continue; |
|
|
1 |
718 |
if (c == '-' || c == '_') continue; |
|
47
|
391 |
1 |
for (i = 0; i < HA_COUNT; i++) { |
|
48
|
133 |
258 |
if (strcmp(nm, HASH_ALGOS[i].name) == 0) |
|
57
|
272 |
0 |
if ((int)id < 0 || (int)id >= HA_COUNT) return NULL; |
|
|
0 |
272 |
if ((int)id < 0 || (int)id >= HA_COUNT) return NULL; |
|
68
|
6 |
3 |
if (name_len == 3 && memcmp(name, "hex", 3) == 0) { |
|
|
1 |
5 |
if (name_len == 3 && memcmp(name, "hex", 3) == 0) { |
|
71
|
5 |
3 |
if (name_len == 3 && memcmp(name, "HEX", 3) == 0) { |
|
|
1 |
4 |
if (name_len == 3 && memcmp(name, "HEX", 3) == 0) { |
|
74
|
2 |
5 |
if (name_len == 6 && (memcmp(name, "base64", 6) == 0 |
|
|
0 |
2 |
if (name_len == 6 && (memcmp(name, "base64", 6) == 0 |
|
75
|
0 |
0 |
|| memcmp(name, "BASE64", 6) == 0)) { |
|
78
|
1 |
4 |
if (name_len == 9 && (memcmp(name, "base64url", 9) == 0 |
|
|
0 |
1 |
if (name_len == 9 && (memcmp(name, "base64url", 9) == 0 |
|
79
|
0 |
0 |
|| memcmp(name, "BASE64URL", 9) == 0)) { |
|
82
|
4 |
0 |
if (name_len == 3 && (memcmp(name, "raw", 3) == 0 |
|
|
1 |
3 |
if (name_len == 3 && (memcmp(name, "raw", 3) == 0 |
|
83
|
0 |
1 |
|| memcmp(name, "RAW", 3) == 0)) { |
|
96
|
1 |
108 |
const char *t = upper ? hi : lo; |
|
98
|
2820 |
109 |
for (i = 0; i < n; i++) { |
|
112
|
1 |
2 |
const char *a = urlsafe ? url : std; |
|
114
|
30 |
3 |
while (i + 3 <= n) { |
|
124
|
3 |
0 |
if (i < n) { |
|
126
|
3 |
0 |
if (i + 1 < n) t |= (unsigned)in[i+1] << 8; |
|
129
|
3 |
0 |
if (i + 1 < n) { |
|
131
|
2 |
1 |
if (!urlsafe) out[o++] = '='; |
|
132
|
0 |
0 |
} else if (!urlsafe) { |
|
153
|
2 |
0 |
return full * 4 + (tail == 0 ? 0 : tail + 1); /* unpadded */ |
|
215
|
97 |
0 |
if (!r || n < 1) return -1; |
|
|
0 |
97 |
if (!r || n < 1) return -1; |
|
222
|
0 |
97 |
if (!r->algos) return -1; |
|
224
|
115 |
97 |
for (i = 0; i < n; i++) { |
|
226
|
115 |
0 |
if ((int)id < 0 || (int)id >= HA_COUNT) { |
|
|
0 |
115 |
if ((int)id < 0 || (int)id >= HA_COUNT) { |
|
246
|
10 |
0 |
if (!r || !r->algos) return -1; |
|
|
0 |
10 |
if (!r || !r->algos) return -1; |
|
249
|
12 |
10 |
for (i = 0; i < r->count; i++) { |
|
251
|
0 |
12 |
if (!info->hmac_able) return -1; |
|
254
|
12 |
10 |
for (i = 0; i < r->count; i++) { |
|
262
|
1 |
11 |
if (key_len > B) { |
|
273
|
32 |
1 |
for (j = info->digest_size; j < B; j++) k_prime[j] = 0; |
|
276
|
593 |
11 |
for (j = key_len; j < B; j++) k_prime[j] = 0; |
|
280
|
768 |
12 |
for (j = 0; j < B; j++) { |
|
300
|
163 |
0 |
if (!r || !r->algos || len == 0) return; |
|
|
163 |
0 |
if (!r || !r->algos || len == 0) return; |
|
|
0 |
163 |
if (!r || !r->algos || len == 0) return; |
|
301
|
187 |
163 |
for (i = 0; i < r->count; i++) { |
|
316
|
97 |
0 |
if (!r || !r->algos) return -1; |
|
|
0 |
97 |
if (!r || !r->algos) return -1; |
|
324
|
115 |
97 |
for (i = 0; i < r->count; i++) { |
|
330
|
0 |
97 |
if (!res) return -1; |
|
331
|
97 |
0 |
blob = (char *)malloc(total_bytes ? total_bytes : 1); |
|
332
|
0 |
97 |
if (!blob) { free(res); return -1; } |
|
335
|
115 |
97 |
for (i = 0; i < r->count; i++) { |
|
344
|
12 |
103 |
if (a->hmac_mode) { |
|
390
|
0 |
97 |
if (!r) return; |