blob: 71daad19f7f9d52e898502b38f78ec90e56399b6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/* See LICENSE file for copyright and license details. */
#include "common.h"
#ifndef TEST
int
librecrypt_test_supported(const char *phrase, size_t len, int text, const char *settings)
{
const struct algorithm *algo;
size_t n;
/* For each chained algorithm*/
for (;;) {
/* Measure until next '>' */
for (n = 0u; settings[n]; n++)
if (settings[n] == LIBRECRYPT_ALGORITHM_LINK_DELIMITER)
break;
/* Identify algorithm */
algo = librecrypt_find_first_algorithm_(settings, n);
if (!algo)
return 0;
/* Check configuration and input support, and get hash size */
if (!(*algo->test_supported)(phrase, len, text, settings, n, &len))
return 0;
/* Return just process last chained algorithm */
if (!settings[n])
return 1;
/* Hashes are binary */
phrase = NULL;
text = 0;
/* Goto next algorithm */
settings = &settings[n]; /* conf */
settings++; /* '>' */
}
}
#else
int
main(void)
{
SET_UP_ALARM();
return 0;
}
#endif
/* TODO test */
|