- Lots of minimal changes to better support WINCE as a build target

This commit is contained in:
Paul Bakker 2011-11-18 14:26:47 +00:00
parent 33008eef64
commit cce9d77745
41 changed files with 392 additions and 161 deletions

View file

@ -22,6 +22,7 @@ Changes
So now there is a module that is controlled with POLARSSL_ASN1_PARSE_C. So now there is a module that is controlled with POLARSSL_ASN1_PARSE_C.
* Changed the defined key-length of DES ciphers in cipher.h to include the * Changed the defined key-length of DES ciphers in cipher.h to include the
parity bits, to prevent mistakes in copying data. (Closes ticket #33) parity bits, to prevent mistakes in copying data. (Closes ticket #33)
* Loads of minimal changes to better support WINCE as a build target
Bugfix Bugfix
* Fixed faulty HMAC-MD2 implementation. Found by dibac. (Closes * Fixed faulty HMAC-MD2 implementation. Found by dibac. (Closes

View file

@ -5,7 +5,7 @@
* *
* \author Adriaan de Jong <dejong@fox-it.com> * \author Adriaan de Jong <dejong@fox-it.com>
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -26,13 +26,12 @@
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#ifndef POLARSSL_CIPHER_WRAP_H
#define POLARSSL_CIPHER_WRAP_H
#include "config.h" #include "config.h"
#include "cipher.h" #include "cipher.h"
#ifndef POLARSSL_CIPHER_WRAP_H
#define POLARSSL_CIPHER_WRAP_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View file

@ -31,7 +31,7 @@
#ifndef POLARSSL_CONFIG_H #ifndef POLARSSL_CONFIG_H
#define POLARSSL_CONFIG_H #define POLARSSL_CONFIG_H
#ifndef _CRT_SECURE_NO_DEPRECATE #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
#define _CRT_SECURE_NO_DEPRECATE 1 #define _CRT_SECURE_NO_DEPRECATE 1
#endif #endif

View file

@ -3,7 +3,7 @@
* *
* \brief Debug functions * \brief Debug functions
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -24,8 +24,8 @@
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#ifndef SSL_DEBUG_H #ifndef POLARSSL_DEBUG_H
#define SSL_DEBUG_H #define POLARSSL_DEBUG_H
#include "config.h" #include "config.h"
#include "ssl.h" #include "ssl.h"

View file

@ -26,7 +26,6 @@
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#ifndef POLARSSL_MD_H #ifndef POLARSSL_MD_H
#define POLARSSL_MD_H #define POLARSSL_MD_H

View file

@ -5,7 +5,7 @@
* *
* \author Adriaan de Jong <dejong@fox-it.com> * \author Adriaan de Jong <dejong@fox-it.com>
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -26,13 +26,12 @@
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#ifndef POLARSSL_MD_WRAP_H
#define POLARSSL_MD_WRAP_H
#include "config.h" #include "config.h"
#include "md.h" #include "md.h"
#ifndef POLARSSL_MD_WRAP_H
#define POLARSSL_MD_WRAP_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View file

@ -1,9 +1,9 @@
/** /**
* \file net.h * \file net.h
* *
* \brief MD5 message digest algorithm (hash function) * \brief Network communication functions
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>

View file

@ -5,7 +5,7 @@
* *
* \author Adriaan de Jong <dejong@fox-it.com> * \author Adriaan de Jong <dejong@fox-it.com>
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -26,9 +26,8 @@
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#ifndef POLARSSL_PKCS11_H
#ifndef PKCS11_H_ #define POLARSSL_PKCS11_H
#define PKCS11_H_
#include "config.h" #include "config.h"
@ -124,4 +123,4 @@ int pkcs11_sign( pkcs11_context *ctx,
#endif /* POLARSSL_PKCS11_C */ #endif /* POLARSSL_PKCS11_C */
#endif /* PKCS11_H_ */ #endif /* POLARSSL_PKCS11_H */

View file

@ -52,7 +52,11 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#if defined(_WIN32_WCE)
#include <windows.h>
#else
#include <time.h> #include <time.h>
#endif
#if defined(POLARSSL_FS_IO) #if defined(POLARSSL_FS_IO)
#include <stdio.h> #include <stdio.h>
@ -2609,43 +2613,66 @@ int x509parse_crl_info( char *buf, size_t size, const char *prefix,
*/ */
int x509parse_time_expired( const x509_time *to ) int x509parse_time_expired( const x509_time *to )
{ {
int year, mon, day;
int hour, min, sec;
#if defined(_WIN32)
SYSTEMTIME st;
GetLocalTime(&st);
year = st.wYear;
mon = st.wMonth;
day = st.wDay;
hour = st.wHour;
min = st.wMinute;
sec = st.wSecond;
#else
struct tm *lt; struct tm *lt;
time_t tt; time_t tt;
tt = time( NULL ); tt = time( NULL );
lt = localtime( &tt ); lt = localtime( &tt );
if( lt->tm_year > to->year - 1900 ) year = lt->tm_year + 1900;
mon = lt->tm_mon + 1;
day = lt->tm_mday;
hour = lt->tm_hour;
min = lt->tm_min;
sec = lt->tm_sec;
#endif
if( year > to->year )
return( 1 ); return( 1 );
if( lt->tm_year == to->year - 1900 && if( year == to->year &&
lt->tm_mon > to->mon - 1 ) mon > to->mon )
return( 1 ); return( 1 );
if( lt->tm_year == to->year - 1900 && if( year == to->year &&
lt->tm_mon == to->mon - 1 && mon == to->mon &&
lt->tm_mday > to->day ) day > to->day )
return( 1 ); return( 1 );
if( lt->tm_year == to->year - 1900 && if( year == to->year &&
lt->tm_mon == to->mon - 1 && mon == to->mon &&
lt->tm_mday == to->day && day == to->day &&
lt->tm_hour > to->hour - 1) hour > to->hour )
return( 1 ); return( 1 );
if( lt->tm_year == to->year - 1900 && if( year == to->year &&
lt->tm_mon == to->mon - 1 && mon == to->mon &&
lt->tm_mday == to->day && day == to->day &&
lt->tm_hour == to->hour - 1 && hour == to->hour &&
lt->tm_min > to->min - 1 ) min > to->min )
return( 1 ); return( 1 );
if( lt->tm_year == to->year - 1900 && if( year == to->year &&
lt->tm_mon == to->mon - 1 && mon == to->mon &&
lt->tm_mday == to->day && day == to->day &&
lt->tm_hour == to->hour - 1 && hour == to->hour &&
lt->tm_min == to->min - 1 && min == to->min &&
lt->tm_sec > to->sec - 1 ) sec > to->sec )
return( 1 ); return( 1 );
return( 0 ); return( 0 );

View file

@ -1,7 +1,7 @@
/* /*
* AES-256 file encryption program * AES-256 file encryption program
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -29,7 +29,9 @@
#if defined(_WIN32) #if defined(_WIN32)
#include <windows.h> #include <windows.h>
#if !defined(_WIN32_WCE)
#include <io.h> #include <io.h>
#endif
#else #else
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
@ -55,8 +57,10 @@
"\n" "\n"
#if !defined(POLARSSL_AES_C) || !defined(POLARSSL_SHA2_C) #if !defined(POLARSSL_AES_C) || !defined(POLARSSL_SHA2_C)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_AES_C and/or POLARSSL_SHA2_C not defined.\n"); printf("POLARSSL_AES_C and/or POLARSSL_SHA2_C not defined.\n");
return( 0 ); return( 0 );
} }
@ -79,7 +83,9 @@ int main( int argc, char *argv[] )
aes_context aes_ctx; aes_context aes_ctx;
sha2_context sha_ctx; sha2_context sha_ctx;
#if defined(WIN32) #if defined(_WIN32_WCE)
long filesize, offset;
#elif defined(_WIN32)
LARGE_INTEGER li_size; LARGE_INTEGER li_size;
__int64 filesize, offset; __int64 filesize, offset;
#else #else
@ -93,7 +99,7 @@ int main( int argc, char *argv[] )
{ {
printf( USAGE ); printf( USAGE );
#if defined(WIN32) #if defined(_WIN32)
printf( "\n Press Enter to exit this program.\n" ); printf( "\n Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif
@ -162,7 +168,10 @@ int main( int argc, char *argv[] )
memset( argv[4], 0, strlen( argv[4] ) ); memset( argv[4], 0, strlen( argv[4] ) );
#if defined(WIN32) #if defined(_WIN32_WCE)
filesize = fseek( fin, 0L, SEEK_END );
#else
#if defined(_WIN32)
/* /*
* Support large files (> 2Gb) on Win32 * Support large files (> 2Gb) on Win32
*/ */
@ -184,6 +193,7 @@ int main( int argc, char *argv[] )
perror( "lseek" ); perror( "lseek" );
goto exit; goto exit;
} }
#endif
#endif #endif
if( fseek( fin, 0, SEEK_SET ) < 0 ) if( fseek( fin, 0, SEEK_SET ) < 0 )

View file

@ -2,7 +2,7 @@
* \brief Generic file encryption program using generic wrappers for configured * \brief Generic file encryption program using generic wrappers for configured
* security. * security.
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -30,7 +30,9 @@
#if defined(_WIN32) #if defined(_WIN32)
#include <windows.h> #include <windows.h>
#if !defined(_WIN32_WCE)
#include <io.h> #include <io.h>
#endif
#else #else
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
@ -56,8 +58,11 @@
"\n" "\n"
#if !defined(POLARSSL_CIPHER_C) || !defined(POLARSSL_MD_C) #if !defined(POLARSSL_CIPHER_C) || !defined(POLARSSL_MD_C)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_CIPHER_C and/or POLARSSL_MD_C not defined.\n"); printf("POLARSSL_CIPHER_C and/or POLARSSL_MD_C not defined.\n");
return( 0 ); return( 0 );
} }
@ -80,7 +85,9 @@ int main( int argc, char *argv[] )
const md_info_t *md_info; const md_info_t *md_info;
cipher_context_t cipher_ctx; cipher_context_t cipher_ctx;
md_context_t md_ctx; md_context_t md_ctx;
#if defined(WIN32) #if defined(_WIN32_WCE)
long filesize, offset;
#elif defined(_WIN32)
LARGE_INTEGER li_size; LARGE_INTEGER li_size;
__int64 filesize, offset; __int64 filesize, offset;
#else #else
@ -117,7 +124,7 @@ int main( int argc, char *argv[] )
list++; list++;
} }
#if defined(WIN32) #if defined(_WIN32)
printf( "\n Press Enter to exit this program.\n" ); printf( "\n Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif
@ -205,7 +212,10 @@ int main( int argc, char *argv[] )
memset( argv[6], 0, strlen( argv[6] ) ); memset( argv[6], 0, strlen( argv[6] ) );
#if defined(WIN32) #if defined(_WIN32_WCE)
filesize = fseek( fin, 0L, SEEK_END );
#else
#if defined(_WIN32)
/* /*
* Support large files (> 2Gb) on Win32 * Support large files (> 2Gb) on Win32
*/ */
@ -227,6 +237,7 @@ int main( int argc, char *argv[] )
perror( "lseek" ); perror( "lseek" );
goto exit; goto exit;
} }
#endif
#endif #endif
if( fseek( fin, 0, SEEK_SET ) < 0 ) if( fseek( fin, 0, SEEK_SET ) < 0 )

View file

@ -1,7 +1,7 @@
/* /*
* generic message digest layer demonstration program * generic message digest layer demonstration program
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -35,8 +35,11 @@
#include "polarssl/md.h" #include "polarssl/md.h"
#if !defined(POLARSSL_MD_C) #if !defined(POLARSSL_MD_C)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_MD_C not defined.\n"); printf("POLARSSL_MD_C not defined.\n");
return( 0 ); return( 0 );
} }
@ -172,7 +175,7 @@ int main( int argc, char *argv[] )
list++; list++;
} }
#ifdef WIN32 #if defined(_WIN32)
printf( "\n Press Enter to exit this program.\n" ); printf( "\n Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* Classic "Hello, world" demonstration program * Classic "Hello, world" demonstration program
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -34,18 +34,24 @@
#include "polarssl/md5.h" #include "polarssl/md5.h"
#if !defined(POLARSSL_MD5_C) #if !defined(POLARSSL_MD5_C)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_MD5_C not defined.\n"); printf("POLARSSL_MD5_C not defined.\n");
return( 0 ); return( 0 );
} }
#else #else
int main( void ) int main( int argc, char *argv[] )
{ {
int i; int i;
unsigned char digest[16]; unsigned char digest[16];
char str[] = "Hello, world!"; char str[] = "Hello, world!";
((void) argc);
((void) argv);
printf( "\n MD5('%s') = ", str ); printf( "\n MD5('%s') = ", str );
md5( (unsigned char *) str, 13, digest ); md5( (unsigned char *) str, 13, digest );
@ -55,7 +61,7 @@ int main( void )
printf( "\n\n" ); printf( "\n\n" );
#ifdef WIN32 #if defined(_WIN32)
printf( " Press Enter to exit this program.\n" ); printf( " Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* md5sum demonstration program * md5sum demonstration program
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -35,8 +35,11 @@
#include "polarssl/md5.h" #include "polarssl/md5.h"
#if !defined(POLARSSL_MD5_C) || !defined(POLARSSL_FS_IO) #if !defined(POLARSSL_MD5_C) || !defined(POLARSSL_FS_IO)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_MD5_C and/or POLARSSL_FS_IO not defined.\n"); printf("POLARSSL_MD5_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
} }
@ -151,7 +154,7 @@ int main( int argc, char *argv[] )
printf( "print mode: md5sum <file> <file> ...\n" ); printf( "print mode: md5sum <file> <file> ...\n" );
printf( "check mode: md5sum -c <checksum file>\n" ); printf( "check mode: md5sum -c <checksum file>\n" );
#ifdef WIN32 #if defined(_WIN32)
printf( "\n Press Enter to exit this program.\n" ); printf( "\n Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* sha1sum demonstration program * sha1sum demonstration program
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -35,8 +35,11 @@
#include "polarssl/sha1.h" #include "polarssl/sha1.h"
#if !defined(POLARSSL_SHA1_C) || !defined(POLARSSL_FS_IO) #if !defined(POLARSSL_SHA1_C) || !defined(POLARSSL_FS_IO)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_SHA1_C and/or POLARSSL_FS_IO not defined.\n"); printf("POLARSSL_SHA1_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
} }
@ -151,7 +154,7 @@ int main( int argc, char *argv[] )
printf( "print mode: sha1sum <file> <file> ...\n" ); printf( "print mode: sha1sum <file> <file> ...\n" );
printf( "check mode: sha1sum -c <checksum file>\n" ); printf( "check mode: sha1sum -c <checksum file>\n" );
#ifdef WIN32 #if defined(_WIN32)
printf( "\n Press Enter to exit this program.\n" ); printf( "\n Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* sha2sum demonstration program * sha2sum demonstration program
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -35,8 +35,11 @@
#include "polarssl/sha2.h" #include "polarssl/sha2.h"
#if !defined(POLARSSL_SHA2_C) || !defined(POLARSSL_FS_IO) #if !defined(POLARSSL_SHA2_C) || !defined(POLARSSL_FS_IO)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_SHA2_C and/or POLARSSL_FS_IO not defined.\n"); printf("POLARSSL_SHA2_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
} }
@ -151,7 +154,7 @@ int main( int argc, char *argv[] )
printf( "print mode: sha2sum <file> <file> ...\n" ); printf( "print mode: sha2sum <file> <file> ...\n" );
printf( "check mode: sha2sum -c <checksum file>\n" ); printf( "check mode: sha2sum -c <checksum file>\n" );
#ifdef WIN32 #if defined(_WIN32)
printf( "\n Press Enter to exit this program.\n" ); printf( "\n Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* Diffie-Hellman-Merkle key exchange (client side) * Diffie-Hellman-Merkle key exchange (client side)
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -46,15 +46,18 @@
!defined(POLARSSL_HAVEGE_C) || !defined(POLARSSL_NET_C) || \ !defined(POLARSSL_HAVEGE_C) || !defined(POLARSSL_NET_C) || \
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_SHA1_C) || \ !defined(POLARSSL_RSA_C) || !defined(POLARSSL_SHA1_C) || \
!defined(POLARSSL_FS_IO) !defined(POLARSSL_FS_IO)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_AES_C and/or POLARSSL_DHM_C and/or POLARSSL_HAVEGE_C " printf("POLARSSL_AES_C and/or POLARSSL_DHM_C and/or POLARSSL_HAVEGE_C "
"and/or POLARSSL_NET_C and/or POLARSSL_RSA_C and/or " "and/or POLARSSL_NET_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_SHA1_C and/or POLARSSL_FS_IO not defined.\n"); "POLARSSL_SHA1_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
} }
#else #else
int main( void ) int main( int argc, char *argv[] )
{ {
FILE *f; FILE *f;
@ -71,6 +74,9 @@ int main( void )
dhm_context dhm; dhm_context dhm;
aes_context aes; aes_context aes;
((void) argc);
((void) argv);
memset( &rsa, 0, sizeof( rsa ) ); memset( &rsa, 0, sizeof( rsa ) );
memset( &dhm, 0, sizeof( dhm ) ); memset( &dhm, 0, sizeof( dhm ) );
@ -260,7 +266,7 @@ exit:
rsa_free( &rsa ); rsa_free( &rsa );
dhm_free( &dhm ); dhm_free( &dhm );
#ifdef WIN32 #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* Diffie-Hellman-Merkle key exchange (prime generation) * Diffie-Hellman-Merkle key exchange (prime generation)
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -43,14 +43,17 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \
!defined(POLARSSL_FS_IO) !defined(POLARSSL_FS_IO)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or " printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or "
"POLARSSL_FS_IO not defined.\n"); "POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
} }
#else #else
int main( void ) int main( int argc, char *argv[] )
{ {
int ret = 1; int ret = 1;
@ -59,6 +62,9 @@ int main( void )
havege_state hs; havege_state hs;
FILE *fout; FILE *fout;
((void) argc);
((void) argv);
mpi_init( &G ); mpi_init( &P ); mpi_init( &Q ); mpi_init( &G ); mpi_init( &P ); mpi_init( &Q );
mpi_read_string( &G, 10, GENERATOR ); mpi_read_string( &G, 10, GENERATOR );
@ -128,7 +134,7 @@ exit:
printf( "\n ! Prime-number generation is not available.\n\n" ); printf( "\n ! Prime-number generation is not available.\n\n" );
#endif #endif
#ifdef WIN32 #if defined(_WIN32)
printf( " Press Enter to exit this program.\n" ); printf( " Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* Diffie-Hellman-Merkle key exchange (server side) * Diffie-Hellman-Merkle key exchange (server side)
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -46,15 +46,18 @@
!defined(POLARSSL_HAVEGE_C) || !defined(POLARSSL_NET_C) || \ !defined(POLARSSL_HAVEGE_C) || !defined(POLARSSL_NET_C) || \
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_SHA1_C) || \ !defined(POLARSSL_RSA_C) || !defined(POLARSSL_SHA1_C) || \
!defined(POLARSSL_FS_IO) !defined(POLARSSL_FS_IO)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_AES_C and/or POLARSSL_DHM_C and/or POLARSSL_HAVEGE_C " printf("POLARSSL_AES_C and/or POLARSSL_DHM_C and/or POLARSSL_HAVEGE_C "
"and/or POLARSSL_NET_C and/or POLARSSL_RSA_C and/or " "and/or POLARSSL_NET_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_SHA1_C and/or POLARSSL_FS_IO not defined.\n"); "POLARSSL_SHA1_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
} }
#else #else
int main( void ) int main( int argc, char *argv[] )
{ {
FILE *f; FILE *f;
@ -72,6 +75,9 @@ int main( void )
dhm_context dhm; dhm_context dhm;
aes_context aes; aes_context aes;
((void) argc);
((void) argv);
memset( &rsa, 0, sizeof( rsa ) ); memset( &rsa, 0, sizeof( rsa ) );
memset( &dhm, 0, sizeof( dhm ) ); memset( &dhm, 0, sizeof( dhm ) );
@ -263,7 +269,7 @@ exit:
rsa_free( &rsa ); rsa_free( &rsa );
dhm_free( &dhm ); dhm_free( &dhm );
#ifdef WIN32 #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* Key reading application * Key reading application
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -74,8 +74,11 @@ void my_debug( void *ctx, int level, const char *str )
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO) !defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or " printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n"); "POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
@ -213,7 +216,7 @@ exit:
rsa_free( &rsa ); rsa_free( &rsa );
#ifdef WIN32 #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* Simple MPI demonstration program * Simple MPI demonstration program
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -33,16 +33,22 @@
#include "polarssl/bignum.h" #include "polarssl/bignum.h"
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_FS_IO) #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_FS_IO)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_BIGNUM_C and/or POLARSSL_FS_IO not defined.\n"); printf("POLARSSL_BIGNUM_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
} }
#else #else
int main( void ) int main( int argc, char *argv[] )
{ {
mpi E, P, Q, N, H, D, X, Y, Z; mpi E, P, Q, N, H, D, X, Y, Z;
((void) argc);
((void) argv);
mpi_init( &E ); mpi_init( &P ); mpi_init( &Q ); mpi_init( &N ); mpi_init( &E ); mpi_init( &P ); mpi_init( &Q ); mpi_init( &N );
mpi_init( &H ); mpi_init( &D ); mpi_init( &X ); mpi_init( &Y ); mpi_init( &H ); mpi_init( &D ); mpi_init( &X ); mpi_init( &Y );
mpi_init( &Z ); mpi_init( &Z );
@ -85,7 +91,7 @@ int main( void )
mpi_free( &H ); mpi_free( &D ); mpi_free( &X ); mpi_free( &Y ); mpi_free( &H ); mpi_free( &D ); mpi_free( &X ); mpi_free( &Y );
mpi_free( &Z ); mpi_free( &Z );
#ifdef WIN32 #if defined(_WIN32)
printf( " Press Enter to exit this program.\n" ); printf( " Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* RSA simple decryption program * RSA simple decryption program
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -36,8 +36,11 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_FS_IO) !defined(POLARSSL_FS_IO)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or " printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_FS_IO not defined.\n"); "POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
@ -58,7 +61,7 @@ int main( int argc, char *argv[] )
{ {
printf( "usage: rsa_decrypt\n" ); printf( "usage: rsa_decrypt\n" );
#ifdef WIN32 #if defined(_WIN32)
printf( "\n" ); printf( "\n" );
#endif #endif
@ -140,7 +143,7 @@ int main( int argc, char *argv[] )
exit: exit:
#ifdef WIN32 #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* RSA simple data encryption program * RSA simple data encryption program
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -37,8 +37,11 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_HAVEGE_C) || !defined(POLARSSL_FS_IO) !defined(POLARSSL_HAVEGE_C) || !defined(POLARSSL_FS_IO)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or " printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_HAVEGE_C and/or POLARSSL_FS_IO not defined.\n"); "POLARSSL_HAVEGE_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
@ -62,7 +65,7 @@ int main( int argc, char *argv[] )
{ {
printf( "usage: rsa_encrypt <string of max 100 characters>\n" ); printf( "usage: rsa_encrypt <string of max 100 characters>\n" );
#ifdef WIN32 #if defined(_WIN32)
printf( "\n" ); printf( "\n" );
#endif #endif
@ -133,7 +136,7 @@ int main( int argc, char *argv[] )
exit: exit:
#ifdef WIN32 #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* Example RSA key generation program * Example RSA key generation program
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -42,15 +42,18 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_GENPRIME) || \ !defined(POLARSSL_RSA_C) || !defined(POLARSSL_GENPRIME) || \
!defined(POLARSSL_FS_IO) !defined(POLARSSL_FS_IO)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or " printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or "
"POLARSSL_RSA_C and/or POLARSSL_GENPRIME and/or " "POLARSSL_RSA_C and/or POLARSSL_GENPRIME and/or "
"POLARSSL_FS_IO not defined.\n"); "POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
} }
#else #else
int main( void ) int main( int argc, char *argv[] )
{ {
int ret; int ret;
rsa_context rsa; rsa_context rsa;
@ -58,6 +61,9 @@ int main( void )
FILE *fpub = NULL; FILE *fpub = NULL;
FILE *fpriv = NULL; FILE *fpriv = NULL;
((void) argc);
((void) argv);
printf( "\n . Seeding the random number generator..." ); printf( "\n . Seeding the random number generator..." );
fflush( stdout ); fflush( stdout );
@ -138,7 +144,7 @@ exit:
rsa_free( &rsa ); rsa_free( &rsa );
#ifdef WIN32 #if defined(_WIN32)
printf( " Press Enter to exit this program.\n" ); printf( " Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* RSA/SHA-1 signature creation program * RSA/SHA-1 signature creation program
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -37,8 +37,11 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_SHA1_C) || !defined(POLARSSL_FS_IO) !defined(POLARSSL_SHA1_C) || !defined(POLARSSL_FS_IO)
int main( void ) int 5ain( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or " printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_SHA1_C and/or POLARSSL_FS_IO not defined.\n"); "POLARSSL_SHA1_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
@ -59,7 +62,7 @@ int main( int argc, char *argv[] )
{ {
printf( "usage: rsa_sign <filename>\n" ); printf( "usage: rsa_sign <filename>\n" );
#ifdef WIN32 #if defined(_WIN32)
printf( "\n" ); printf( "\n" );
#endif #endif
@ -138,7 +141,7 @@ int main( int argc, char *argv[] )
exit: exit:
#ifdef WIN32 #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* RSASSA-PSS/SHA-1 signature creation program * RSASSA-PSS/SHA-1 signature creation program
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -45,8 +45,11 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_SHA1_C) || \ !defined(POLARSSL_RSA_C) || !defined(POLARSSL_SHA1_C) || \
!defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO) !defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or " printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or "
"POLARSSL_RSA_C and/or POLARSSL_SHA1_C and/or " "POLARSSL_RSA_C and/or POLARSSL_SHA1_C and/or "
"POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n"); "POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n");
@ -69,7 +72,7 @@ int main( int argc, char *argv[] )
{ {
printf( "usage: rsa_sign_pss <key_file> <filename>\n" ); printf( "usage: rsa_sign_pss <key_file> <filename>\n" );
#ifdef WIN32 #if defined(_WIN32)
printf( "\n" ); printf( "\n" );
#endif #endif
@ -133,7 +136,7 @@ int main( int argc, char *argv[] )
exit: exit:
#ifdef WIN32 #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* RSA/SHA-1 signature verification program * RSA/SHA-1 signature verification program
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -37,8 +37,11 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_SHA1_C) || !defined(POLARSSL_FS_IO) !defined(POLARSSL_SHA1_C) || !defined(POLARSSL_FS_IO)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or " printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_SHA1_C and/or POLARSSL_FS_IO not defined.\n"); "POLARSSL_SHA1_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
@ -58,7 +61,7 @@ int main( int argc, char *argv[] )
{ {
printf( "usage: rsa_verify <filename>\n" ); printf( "usage: rsa_verify <filename>\n" );
#ifdef WIN32 #if defined(_WIN32)
printf( "\n" ); printf( "\n" );
#endif #endif
@ -141,7 +144,7 @@ int main( int argc, char *argv[] )
exit: exit:
#ifdef WIN32 #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* RSASSA-PSS/SHA-1 signature verification program * RSASSA-PSS/SHA-1 signature verification program
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -45,8 +45,11 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_SHA1_C) || !defined(POLARSSL_X509_PARSE_C) || \ !defined(POLARSSL_SHA1_C) || !defined(POLARSSL_X509_PARSE_C) || \
!defined(POLARSSL_FS_IO) !defined(POLARSSL_FS_IO)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or " printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_SHA1_C and/or POLARSSL_X509_PARSE_C and/or " "POLARSSL_SHA1_C and/or POLARSSL_X509_PARSE_C and/or "
"POLARSSL_FS_IO not defined.\n"); "POLARSSL_FS_IO not defined.\n");
@ -68,7 +71,7 @@ int main( int argc, char *argv[] )
{ {
printf( "usage: rsa_verify_pss <key_file> <filename>\n" ); printf( "usage: rsa_verify_pss <key_file> <filename>\n" );
#ifdef WIN32 #if defined(_WIN32)
printf( "\n" ); printf( "\n" );
#endif #endif
@ -134,7 +137,7 @@ int main( int argc, char *argv[] )
exit: exit:
#ifdef WIN32 #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/** /**
* \brief Generate random data into a file * \brief Generate random data into a file
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -31,8 +31,11 @@
#include <stdio.h> #include <stdio.h>
#if !defined(POLARSSL_HAVEGE_C) #if !defined(POLARSSL_HAVEGE_C)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_HAVEGE_C not defined.\n"); printf("POLARSSL_HAVEGE_C not defined.\n");
return( 0 ); return( 0 );
} }

View file

@ -1,7 +1,7 @@
/* /*
* SSL client demonstration program * SSL client demonstration program
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -54,15 +54,18 @@ void my_debug( void *ctx, int level, const char *str )
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \
!defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \ !defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \
!defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C) !defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or " printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or "
"POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or " "POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or "
"POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n"); "POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n");
return( 0 ); return( 0 );
} }
#else #else
int main( void ) int main( int argc, char *argv[] )
{ {
int ret, len, server_fd; int ret, len, server_fd;
unsigned char buf[1024]; unsigned char buf[1024];
@ -70,6 +73,9 @@ int main( void )
ssl_context ssl; ssl_context ssl;
ssl_session ssn; ssl_session ssn;
((void) argc);
((void) argv);
/* /*
* 0. Initialize the RNG and the session data * 0. Initialize the RNG and the session data
*/ */
@ -182,7 +188,7 @@ exit:
memset( &ssl, 0, sizeof( ssl ) ); memset( &ssl, 0, sizeof( ssl ) );
#ifdef WIN32 #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* SSL client with certificate authentication * SSL client with certificate authentication
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -98,8 +98,11 @@ void my_debug( void *ctx, int level, const char *str )
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \
!defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \ !defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \
!defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C) !defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or " printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or "
"POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or " "POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or "
"POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n"); "POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n");
@ -458,7 +461,7 @@ exit:
memset( &ssl, 0, sizeof( ssl ) ); memset( &ssl, 0, sizeof( ssl ) );
#ifdef WIN32 #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* SSL server demonstration program using fork() for handling multiple clients * SSL server demonstration program using fork() for handling multiple clients
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -27,7 +27,7 @@
#define _CRT_SECURE_NO_DEPRECATE 1 #define _CRT_SECURE_NO_DEPRECATE 1
#endif #endif
#ifdef WIN32 #if defined(_WIN32)
#include <windows.h> #include <windows.h>
#endif #endif
@ -55,17 +55,23 @@
!defined(POLARSSL_HAVEGE_C) || !defined(POLARSSL_SSL_TLS_C) || \ !defined(POLARSSL_HAVEGE_C) || !defined(POLARSSL_SSL_TLS_C) || \
!defined(POLARSSL_SSL_SRV_C) || !defined(POLARSSL_NET_C) || \ !defined(POLARSSL_SSL_SRV_C) || !defined(POLARSSL_NET_C) || \
!defined(POLARSSL_RSA_C) !defined(POLARSSL_RSA_C)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_BIGNUM_C and/or POLARSSL_CERTS_C and/or POLARSSL_HAVEGE_C " printf("POLARSSL_BIGNUM_C and/or POLARSSL_CERTS_C and/or POLARSSL_HAVEGE_C "
"and/or POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_SRV_C and/or " "and/or POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_SRV_C and/or "
"POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n"); "POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n");
return( 0 ); return( 0 );
} }
#elif defined(WIN32) #elif defined(_WIN32)
int main( void ) int main( int argc, char *argv[] )
{ {
printf("WIN32 defined. This application requires fork() and signals " ((void) argc);
((void) argv);
printf("_WIN32 defined. This application requires fork() and signals "
"to work correctly.\n"); "to work correctly.\n");
return( 0 ); return( 0 );
} }
@ -192,7 +198,7 @@ static int my_set_session( ssl_context *ssl )
return( 0 ); return( 0 );
} }
int main( void ) int main( int argc, char *argv[] )
{ {
int ret, len, cnt = 0, pid; int ret, len, cnt = 0, pid;
int listen_fd; int listen_fd;
@ -205,6 +211,9 @@ int main( void )
x509_cert srvcert; x509_cert srvcert;
rsa_context rsa; rsa_context rsa;
((void) argc);
((void) argv);
signal( SIGCHLD, SIG_IGN ); signal( SIGCHLD, SIG_IGN );
/* /*
@ -450,7 +459,7 @@ exit:
memset( &ssl, 0, sizeof( ssl_context ) ); memset( &ssl, 0, sizeof( ssl_context ) );
#ifdef WIN32 #if defined(_WIN32)
printf( " Press Enter to exit this program.\n" ); printf( " Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* SSL client for SMTP servers * SSL client for SMTP servers
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -103,8 +103,11 @@ void my_debug( void *ctx, int level, const char *str )
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \
!defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \ !defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \
!defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C) !defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or " printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or "
"POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or " "POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or "
"POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n"); "POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n");
@ -789,7 +792,7 @@ exit:
memset( &ssl, 0, sizeof( ssl ) ); memset( &ssl, 0, sizeof( ssl ) );
#ifdef WIN32 #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* SSL server demonstration program * SSL server demonstration program
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -27,7 +27,7 @@
#define _CRT_SECURE_NO_DEPRECATE 1 #define _CRT_SECURE_NO_DEPRECATE 1
#endif #endif
#ifdef WIN32 #if defined(_WIN32)
#include <windows.h> #include <windows.h>
#endif #endif
@ -118,7 +118,7 @@ static int my_get_session( ssl_context *ssl )
prv = cur; prv = cur;
cur = cur->next; cur = cur->next;
if( ssl->timeout != 0 && t - prv->start > ssl->timeout ) if( ssl->timeout != 0 && (int) ( t - prv->start ) > ssl->timeout )
continue; continue;
if( ssl->session->ciphersuite != prv->ciphersuite || if( ssl->session->ciphersuite != prv->ciphersuite ||
@ -144,7 +144,7 @@ static int my_set_session( ssl_context *ssl )
while( cur != NULL ) while( cur != NULL )
{ {
if( ssl->timeout != 0 && t - cur->start > ssl->timeout ) if( ssl->timeout != 0 && (int) ( t - cur->start ) > ssl->timeout )
break; /* expired, reuse this slot */ break; /* expired, reuse this slot */
if( memcmp( ssl->session->id, cur->id, cur->length ) == 0 ) if( memcmp( ssl->session->id, cur->id, cur->length ) == 0 )
@ -174,15 +174,18 @@ static int my_set_session( ssl_context *ssl )
!defined(POLARSSL_HAVEGE_C) || !defined(POLARSSL_SSL_TLS_C) || \ !defined(POLARSSL_HAVEGE_C) || !defined(POLARSSL_SSL_TLS_C) || \
!defined(POLARSSL_SSL_SRV_C) || !defined(POLARSSL_NET_C) || \ !defined(POLARSSL_SSL_SRV_C) || !defined(POLARSSL_NET_C) || \
!defined(POLARSSL_RSA_C) !defined(POLARSSL_RSA_C)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_BIGNUM_C and/or POLARSSL_CERTS_C and/or POLARSSL_HAVEGE_C " printf("POLARSSL_BIGNUM_C and/or POLARSSL_CERTS_C and/or POLARSSL_HAVEGE_C "
"and/or POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_SRV_C and/or " "and/or POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_SRV_C and/or "
"POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n"); "POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n");
return( 0 ); return( 0 );
} }
#else #else
int main( void ) int main( int argc, char *argv[] )
{ {
int ret, len; int ret, len;
int listen_fd; int listen_fd;
@ -195,6 +198,9 @@ int main( void )
x509_cert srvcert; x509_cert srvcert;
rsa_context rsa; rsa_context rsa;
((void) argc);
((void) argv);
/* /*
* 1. Load the certificates and private RSA key * 1. Load the certificates and private RSA key
*/ */
@ -293,7 +299,24 @@ reset:
/* /*
* 3. Wait until a client connects * 3. Wait until a client connects
*/ */
#ifdef WIN32 #if defined(_WIN32_WCE)
{
SHELLEXECUTEINFO sei;
ZeroMemory( &sei, sizeof( SHELLEXECUTEINFO ) );
sei.cbSize = sizeof( SHELLEXECUTEINFO );
sei.fMask = 0;
sei.hwnd = 0;
sei.lpVerb = _T( "open" );
sei.lpFile = _T( "https://localhost:4433/" );
sei.lpParameters = NULL;
sei.lpDirectory = NULL;
sei.nShow = SW_SHOWNORMAL;
ShellExecuteEx( &sei );
}
#elif defined(_WIN32)
ShellExecute( NULL, "open", "https://localhost:4433/", ShellExecute( NULL, "open", "https://localhost:4433/",
NULL, NULL, SW_SHOWNORMAL ); NULL, NULL, SW_SHOWNORMAL );
#endif #endif
@ -419,7 +442,7 @@ exit:
memset( &ssl, 0, sizeof( ssl_context ) ); memset( &ssl, 0, sizeof( ssl_context ) );
#ifdef WIN32 #if defined(_WIN32)
printf( " Press Enter to exit this program.\n" ); printf( " Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* Benchmark demonstration program * Benchmark demonstration program
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -58,13 +58,16 @@ static int myrand( void *rng_state )
unsigned char buf[BUFSIZE]; unsigned char buf[BUFSIZE];
#if !defined(POLARSSL_TIMING_C) #if !defined(POLARSSL_TIMING_C)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_TIMING_C not defined.\n"); printf("POLARSSL_TIMING_C not defined.\n");
return( 0 ); return( 0 );
} }
#else #else
int main( void ) int main( int argc, char *argv[] )
{ {
int keysize; int keysize;
unsigned long i, j, tsc; unsigned long i, j, tsc;
@ -87,6 +90,9 @@ int main( void )
rsa_context rsa; rsa_context rsa;
#endif #endif
((void) argc);
((void) argv);
memset( buf, 0xAA, sizeof( buf ) ); memset( buf, 0xAA, sizeof( buf ) );
printf( "\n" ); printf( "\n" );
@ -363,7 +369,7 @@ int main( void )
printf( "\n" ); printf( "\n" );
#ifdef WIN32 #if defined(_WIN32)
printf( " Press Enter to exit this program.\n" ); printf( " Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* Self-test demonstration program * Self-test demonstration program
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -144,7 +144,7 @@ int main( int argc, char *argv[] )
if( v != 0 ) if( v != 0 )
{ {
printf( " [ All tests passed ]\n\n" ); printf( " [ All tests passed ]\n\n" );
#ifdef WIN32 #if defined(_WIN32)
printf( " Press Enter to exit this program.\n" ); printf( " Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* SSL certificate functionality tests * SSL certificate functionality tests
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -67,20 +67,26 @@ char *client_private_keys[MAX_CLIENT_CERTS] =
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO) !defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or " printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n"); "POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
} }
#else #else
int main( void ) int main( int argc, char *argv[] )
{ {
int ret, i; int ret, i;
x509_cert cacert; x509_cert cacert;
x509_crl crl; x509_crl crl;
char buf[10240]; char buf[10240];
((void) argc);
((void) argv);
memset( &cacert, 0, sizeof( x509_cert ) ); memset( &cacert, 0, sizeof( x509_cert ) );
memset( &crl, 0, sizeof( x509_crl ) ); memset( &crl, 0, sizeof( x509_crl ) );
@ -236,7 +242,7 @@ exit:
x509_free( &cacert ); x509_free( &cacert );
x509_crl_free( &crl ); x509_crl_free( &crl );
#ifdef WIN32 #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* SSL/TLS stress testing program * SSL/TLS stress testing program
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -127,8 +127,11 @@ void my_debug( void *ctx, int level, const char *str )
!defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_SRV_C) || \ !defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_SRV_C) || \
!defined(POLARSSL_SSL_CLI_C) || !defined(POLARSSL_NET_C) || \ !defined(POLARSSL_SSL_CLI_C) || !defined(POLARSSL_NET_C) || \
!defined(POLARSSL_RSA_C) !defined(POLARSSL_RSA_C)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or " printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or "
"POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_SRV_C and/or " "POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_SRV_C and/or "
"POLARSSL_SSL_CLI_C and/or POLARSSL_NET_C and/or " "POLARSSL_SSL_CLI_C and/or POLARSSL_NET_C and/or "
@ -584,7 +587,7 @@ int main( int argc, char *argv[] )
exit: exit:
#ifdef WIN32 #if defined(_WIN32)
printf( " Press Enter to exit this program.\n" ); printf( " Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

49
programs/wince_main.c Normal file
View file

@ -0,0 +1,49 @@
/*
* Windows CE console application entry point
*
* Copyright (C) 2006-2011, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
*
* All rights reserved.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#if defined(_WIN32_WCE)
#include <windows.h>
extern int main( int, const char ** );
int _tmain( int argc, _TCHAR* targv[] )
{
char **argv;
int i;
argv = ( char ** ) calloc( argc, sizeof( char * ) );
for ( i = 0; i < argc; i++ ) {
size_t len;
len = _tcslen( targv[i] ) + 1;
argv[i] = ( char * ) calloc( len, sizeof( char ) );
wcstombs( argv[i], targv[i], len );
}
return main( argc, argv );
}
#endif /* defined(_WIN32_WCE) */

View file

@ -1,7 +1,7 @@
/* /*
* Certificate reading application * Certificate reading application
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -83,8 +83,11 @@ void my_debug( void *ctx, int level, const char *str )
!defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \ !defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \
!defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C) || \ !defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO) !defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or " printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or "
"POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or " "POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or "
"POLARSSL_NET_C and/or POLARSSL_RSA_C and/or " "POLARSSL_NET_C and/or POLARSSL_RSA_C and/or "
@ -295,7 +298,7 @@ exit:
memset( &ssl, 0, sizeof( ssl ) ); memset( &ssl, 0, sizeof( ssl ) );
#ifdef WIN32 #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif

View file

@ -1,7 +1,7 @@
/* /*
* CRL reading application * CRL reading application
* *
* Copyright (C) 2006-2010, Brainspark B.V. * Copyright (C) 2006-2011, Brainspark B.V.
* *
* This file is part of PolarSSL (http://www.polarssl.org) * This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@ -65,8 +65,11 @@ void my_debug( void *ctx, int level, const char *str )
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \ #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO) !defined(POLARSSL_X509_PARSE_C) || !defined(POLARSSL_FS_IO)
int main( void ) int main( int argc, char *argv[] )
{ {
((void) argc);
((void) argv);
printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or " printf("POLARSSL_BIGNUM_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n"); "POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 ); return( 0 );
@ -156,7 +159,7 @@ int main( int argc, char *argv[] )
exit: exit:
x509_crl_free( &crl ); x509_crl_free( &crl );
#ifdef WIN32 #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar(); fflush( stdout ); getchar();
#endif #endif