1 |
nmav |
1.1 |
#include "../lib/mcrypt.h" |
2 |
|
|
#include <stdio.h> |
3 |
|
|
#include <stdlib.h> |
4 |
|
|
|
5 |
|
|
/* Prints plaintext and ciphertext in hex for all the algorithms */ |
6 |
|
|
|
7 |
|
|
#define ALGORITHMS_DIR "../modules/algorithms/.libs" |
8 |
|
|
/* #define MODES_DIR "../modules/modes/.libs" */ |
9 |
|
|
#define MODES_DIR NULL |
10 |
|
|
|
11 |
|
|
int main() |
12 |
|
|
{ |
13 |
|
|
MCRYPT td; |
14 |
|
|
int i, imax; |
15 |
|
|
int j, jmax; |
16 |
|
|
int x = 0; |
17 |
|
|
char **names; |
18 |
|
|
char **modes; |
19 |
|
|
|
20 |
|
|
names = mcrypt_list_algorithms (ALGORITHMS_DIR, &jmax); |
21 |
|
|
modes = mcrypt_list_modes (MODES_DIR, &imax); |
22 |
|
|
|
23 |
|
|
|
24 |
|
|
for (j=0;j<jmax;j++) { |
25 |
|
|
printf( "Algorithm: %s... ", names[j]); |
26 |
|
|
if (mcrypt_module_self_test( names[j], ALGORITHMS_DIR)==0) { |
27 |
|
|
printf( "ok\n"); |
28 |
|
|
} else { |
29 |
|
|
x=1; |
30 |
|
|
printf( "\n"); |
31 |
|
|
} |
32 |
|
|
|
33 |
|
|
printf( "\tworks in: "); |
34 |
|
|
for (i=0;i<imax;i++) { |
35 |
|
|
td = mcrypt_module_open(names[j], ALGORITHMS_DIR, modes[i], MODES_DIR); |
36 |
|
|
if (td!=MCRYPT_FAILED) { |
37 |
|
|
printf( "%s ", modes[i]); |
38 |
|
|
mcrypt_module_close(td); |
39 |
|
|
} |
40 |
|
|
} |
41 |
|
|
printf("\n"); |
42 |
|
|
|
43 |
|
|
} |
44 |
|
|
|
45 |
|
|
if (x>0) fprintf(stderr, "\nProbably some of the algorithms listed above failed. " |
46 |
|
|
"Try not to use these algorithms, and file a bug report to mcrypt-dev@argeas.cs-net.gr\n\n"); |
47 |
|
|
return x; |
48 |
|
|
} |