/* * Copyright (C) 1998,1999,2000,2002 Nikos Mavroyanopoulos * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "../include/mutils/mcrypt.h" #include #include #include /* Prints plaintext and ciphertext in hex for all the algorithms */ #define ALGORITHMS_DIR "../modules/algorithms/.libs" #define MODES_DIR "../modules/modes/.libs" /* #define ALGORITHMS_DIR NULL * #define MODES_DIR NULL */ #define TEXT "a small text, just to test the implementation" int main() { MCRYPT td, td2; int i, t, imax; int j, jmax, ivsize; int x = 0, siz; char **names; char **modes; char *text; unsigned char *IV; unsigned char *key; int keysize; names = mcrypt_list_algorithms (ALGORITHMS_DIR, &jmax); modes = mcrypt_list_modes (MODES_DIR, &imax); if (names==NULL || modes==NULL) { fprintf(stderr, "Error getting algorithms/modes\n"); exit(1); } for (j=0;j0) { IV = calloc( 1, ivsize); if (IV==NULL) exit(1); for (t=0;t0) free(IV); } } printf("\n"); } mcrypt_free_p(names, jmax); mcrypt_free_p(modes, imax); if (x>0) fprintf(stderr, "\nProbably some of the algorithms listed above failed. " "Try not to use these algorithms, and file a bug report to mcrypt-dev@lists.hellug.gr\n\n"); return x; }