blob: fad8bd9745b2d1591e30659af9fe9e1d7624dc78 (
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
57
58
59
|
/* 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, prefix;
int has_next;
for (;;) {
has_next = 0;
for (n = 0u; settings[n]; n++) {
if (settings[n] == LIBRECRYPT_ALGORITHM_LINK_DELIMITER) {
has_next = 1;
break;
}
}
algo = librecrypt_find_first_algorithm_(settings, n);
if (!algo)
return 0;
prefix = (*algo->get_prefix)(settings, n);
if (has_next && prefix < n)
return 0;
if (!(*algo->test_supported)(phrase, len, text, settings, prefix))
return 0;
if (!has_next)
return 1;
phrase = NULL;
len = algo->hash_size;
text = 0;
settings = &settings[n];
settings++;
}
}
#else
int
main(void)
{
SET_UP_ALARM();
return 0;
}
#endif
/* TODO test */
|