blob: 406f5acec19469df8de6461832c9cec6adfa90ce (
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
|
/* See LICENSE file for copyright and license details. */
#include "common.h"
#ifndef TEST
const struct algorithm *
librecrypt_find_first_algorithm_(const char *settings, size_t len)
{
unsigned r, priority = 0;
const struct algorithm *algo, *found = NULL;
size_t i;
for (i = 0u;; i++) {
algo = &librecrypt_algorithms_[i];
if (IS_END_OF_ALGORITHMS(algo))
break;
r = (*algo->is_algorithm)(settings, len);
if (r > priority) {
priority = r;
found = algo;
}
}
return found;
}
#else
int
main(void)
{
SET_UP_ALARM();
return 0;
}
#endif
/* TODO test */
|