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

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

Generated on Tue Jul 1 15:29:59 2008 for Mobile-C by  doxygen 1.5.4