/home/dko/projects/mobilec/trunk/src/security/xyssl-0.7/programs/test/selftest.c

Go to the documentation of this file.
00001 /*
00002  *  Self-test demonstration program
00003  *
00004  *  Copyright (C) 2006-2007  Christophe Devine
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Lesser General Public
00008  *  License, version 2.1 as published by the Free Software Foundation.
00009  *
00010  *  This library is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *  Lesser General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU Lesser General Public
00016  *  License along with this library; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00018  *  MA  02110-1301  USA
00019  */
00020 
00021 #ifndef _CRT_SECURE_NO_DEPRECATE
00022 #define _CRT_SECURE_NO_DEPRECATE 1
00023 #endif
00024 
00025 #include <string.h>
00026 #include <stdio.h>
00027 
00028 #include "xyssl/md2.h"
00029 #include "xyssl/md4.h"
00030 #include "xyssl/md5.h"
00031 #include "xyssl/sha1.h"
00032 #include "xyssl/sha2.h"
00033 #include "xyssl/arc4.h"
00034 #include "xyssl/des.h"
00035 #include "xyssl/aes.h"
00036 #include "xyssl/bignum.h"
00037 #include "xyssl/base64.h"
00038 #include "xyssl/rsa.h"
00039 #include "xyssl/x509.h"
00040 
00041 int main( int argc, char *argv[] )
00042 {
00043     int ret, v;
00044 
00045     if( argc == 2 && strcmp( argv[1], "-quiet" ) == 0 )
00046         v = 0;
00047     else
00048     {
00049         v = 1;
00050         printf( "\n" );
00051     }
00052 
00053     if( ( ret =    md2_self_test( v ) ) == 0 &&
00054         ( ret =    md4_self_test( v ) ) == 0 &&
00055         ( ret =    md5_self_test( v ) ) == 0 &&
00056         ( ret =   sha1_self_test( v ) ) == 0 &&
00057         ( ret =   sha2_self_test( v ) ) == 0 &&
00058         ( ret =   arc4_self_test( v ) ) == 0 &&
00059         ( ret =    des_self_test( v ) ) == 0 &&
00060         ( ret =    aes_self_test( v ) ) == 0 &&
00061         ( ret =    mpi_self_test( v ) ) == 0 &&
00062         ( ret = base64_self_test( v ) ) == 0 &&
00063         ( ret =    rsa_self_test( v ) ) == 0 &&
00064         ( ret =   x509_self_test( v ) ) == 0 )
00065     {
00066         if( v != 0 )
00067             printf( "  [ All tests passed ]\n" );
00068     }
00069 
00070     if( v != 0 )
00071     {
00072         printf( "\n" );
00073 #ifdef WIN32
00074         printf( "  Press Enter to exit this program.\n" );
00075         fflush( stdout ); getchar();
00076 #endif
00077     }
00078 
00079     return( ret );
00080 }

Generated on Fri May 16 14:49:55 2008 for Mobile-C by  doxygen 1.5.4