From cce9d77745532ecbfd764393f606f4597c41d0e5 Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Fri, 18 Nov 2011 14:26:47 +0000
Subject: [PATCH] - Lots of minimal changes to better support WINCE as a build
target
---
ChangeLog | 1 +
include/polarssl/cipher_wrap.h | 7 ++--
include/polarssl/config.h | 2 +-
include/polarssl/debug.h | 6 +--
include/polarssl/md.h | 1 -
include/polarssl/md_wrap.h | 7 ++--
include/polarssl/net.h | 4 +-
include/polarssl/pkcs11.h | 9 ++---
library/x509parse.c | 69 +++++++++++++++++++++++-----------
programs/aes/aescrypt2.c | 20 +++++++---
programs/aes/crypt_and_hash.c | 21 ++++++++---
programs/hash/generic_sum.c | 9 +++--
programs/hash/hello.c | 14 +++++--
programs/hash/md5sum.c | 9 +++--
programs/hash/sha1sum.c | 9 +++--
programs/hash/sha2sum.c | 9 +++--
programs/pkey/dh_client.c | 14 +++++--
programs/pkey/dh_genprime.c | 14 +++++--
programs/pkey/dh_server.c | 14 +++++--
programs/pkey/key_app.c | 9 +++--
programs/pkey/mpi_demo.c | 14 +++++--
programs/pkey/rsa_decrypt.c | 11 ++++--
programs/pkey/rsa_encrypt.c | 11 ++++--
programs/pkey/rsa_genkey.c | 14 +++++--
programs/pkey/rsa_sign.c | 11 ++++--
programs/pkey/rsa_sign_pss.c | 11 ++++--
programs/pkey/rsa_verify.c | 11 ++++--
programs/pkey/rsa_verify_pss.c | 11 ++++--
programs/random/gen_random.c | 7 +++-
programs/ssl/ssl_client1.c | 14 +++++--
programs/ssl/ssl_client2.c | 9 +++--
programs/ssl/ssl_fork_server.c | 25 ++++++++----
programs/ssl/ssl_mail_client.c | 9 +++--
programs/ssl/ssl_server.c | 39 +++++++++++++++----
programs/test/benchmark.c | 14 +++++--
programs/test/selftest.c | 4 +-
programs/test/ssl_cert_test.c | 14 +++++--
programs/test/ssl_test.c | 9 +++--
programs/wince_main.c | 49 ++++++++++++++++++++++++
programs/x509/cert_app.c | 9 +++--
programs/x509/crl_app.c | 9 +++--
41 files changed, 392 insertions(+), 161 deletions(-)
create mode 100644 programs/wince_main.c
diff --git a/ChangeLog b/ChangeLog
index 1355b38fc..3d1c577d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,7 @@ Changes
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
parity bits, to prevent mistakes in copying data. (Closes ticket #33)
+ * Loads of minimal changes to better support WINCE as a build target
Bugfix
* Fixed faulty HMAC-MD2 implementation. Found by dibac. (Closes
diff --git a/include/polarssl/cipher_wrap.h b/include/polarssl/cipher_wrap.h
index 1638c246e..5df81743b 100644
--- a/include/polarssl/cipher_wrap.h
+++ b/include/polarssl/cipher_wrap.h
@@ -5,7 +5,7 @@
*
* \author Adriaan de Jong
*
- * Copyright (C) 2006-2010, Brainspark B.V.
+ * Copyright (C) 2006-2011, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker
@@ -26,13 +26,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifndef POLARSSL_CIPHER_WRAP_H
+#define POLARSSL_CIPHER_WRAP_H
#include "config.h"
#include "cipher.h"
-#ifndef POLARSSL_CIPHER_WRAP_H
-#define POLARSSL_CIPHER_WRAP_H
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/include/polarssl/config.h b/include/polarssl/config.h
index 06ee29119..48b2661b3 100644
--- a/include/polarssl/config.h
+++ b/include/polarssl/config.h
@@ -31,7 +31,7 @@
#ifndef 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
#endif
diff --git a/include/polarssl/debug.h b/include/polarssl/debug.h
index 263c9399a..4fb378228 100644
--- a/include/polarssl/debug.h
+++ b/include/polarssl/debug.h
@@ -3,7 +3,7 @@
*
* \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)
* Lead Maintainer: Paul Bakker
@@ -24,8 +24,8 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef SSL_DEBUG_H
-#define SSL_DEBUG_H
+#ifndef POLARSSL_DEBUG_H
+#define POLARSSL_DEBUG_H
#include "config.h"
#include "ssl.h"
diff --git a/include/polarssl/md.h b/include/polarssl/md.h
index eca86469d..f62ef2038 100644
--- a/include/polarssl/md.h
+++ b/include/polarssl/md.h
@@ -26,7 +26,6 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
#ifndef POLARSSL_MD_H
#define POLARSSL_MD_H
diff --git a/include/polarssl/md_wrap.h b/include/polarssl/md_wrap.h
index b6640bdfe..46849d033 100644
--- a/include/polarssl/md_wrap.h
+++ b/include/polarssl/md_wrap.h
@@ -5,7 +5,7 @@
*
* \author Adriaan de Jong
*
- * Copyright (C) 2006-2010, Brainspark B.V.
+ * Copyright (C) 2006-2011, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker
@@ -26,13 +26,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifndef POLARSSL_MD_WRAP_H
+#define POLARSSL_MD_WRAP_H
#include "config.h"
#include "md.h"
-#ifndef POLARSSL_MD_WRAP_H
-#define POLARSSL_MD_WRAP_H
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/include/polarssl/net.h b/include/polarssl/net.h
index c02dbd286..89e3a00bb 100644
--- a/include/polarssl/net.h
+++ b/include/polarssl/net.h
@@ -1,9 +1,9 @@
/**
* \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)
* Lead Maintainer: Paul Bakker
diff --git a/include/polarssl/pkcs11.h b/include/polarssl/pkcs11.h
index 07da0de16..a65a72e81 100644
--- a/include/polarssl/pkcs11.h
+++ b/include/polarssl/pkcs11.h
@@ -5,7 +5,7 @@
*
* \author Adriaan de Jong
*
- * Copyright (C) 2006-2010, Brainspark B.V.
+ * Copyright (C) 2006-2011, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker
@@ -26,9 +26,8 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
-#ifndef PKCS11_H_
-#define PKCS11_H_
+#ifndef POLARSSL_PKCS11_H
+#define POLARSSL_PKCS11_H
#include "config.h"
@@ -124,4 +123,4 @@ int pkcs11_sign( pkcs11_context *ctx,
#endif /* POLARSSL_PKCS11_C */
-#endif /* PKCS11_H_ */
+#endif /* POLARSSL_PKCS11_H */
diff --git a/library/x509parse.c b/library/x509parse.c
index ceb3db2eb..631fe5530 100644
--- a/library/x509parse.c
+++ b/library/x509parse.c
@@ -52,7 +52,11 @@
#include
#include
+#if defined(_WIN32_WCE)
+#include
+#else
#include
+#endif
#if defined(POLARSSL_FS_IO)
#include
@@ -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 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;
time_t tt;
tt = time( NULL );
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 );
- if( lt->tm_year == to->year - 1900 &&
- lt->tm_mon > to->mon - 1 )
+ if( year == to->year &&
+ mon > to->mon )
return( 1 );
- if( lt->tm_year == to->year - 1900 &&
- lt->tm_mon == to->mon - 1 &&
- lt->tm_mday > to->day )
+ if( year == to->year &&
+ mon == to->mon &&
+ day > to->day )
return( 1 );
- if( lt->tm_year == to->year - 1900 &&
- lt->tm_mon == to->mon - 1 &&
- lt->tm_mday == to->day &&
- lt->tm_hour > to->hour - 1)
+ if( year == to->year &&
+ mon == to->mon &&
+ day == to->day &&
+ hour > to->hour )
return( 1 );
- if( lt->tm_year == to->year - 1900 &&
- lt->tm_mon == to->mon - 1 &&
- lt->tm_mday == to->day &&
- lt->tm_hour == to->hour - 1 &&
- lt->tm_min > to->min - 1 )
+ if( year == to->year &&
+ mon == to->mon &&
+ day == to->day &&
+ hour == to->hour &&
+ min > to->min )
return( 1 );
- if( lt->tm_year == to->year - 1900 &&
- lt->tm_mon == to->mon - 1 &&
- lt->tm_mday == to->day &&
- lt->tm_hour == to->hour - 1 &&
- lt->tm_min == to->min - 1 &&
- lt->tm_sec > to->sec - 1 )
+ if( year == to->year &&
+ mon == to->mon &&
+ day == to->day &&
+ hour == to->hour &&
+ min == to->min &&
+ sec > to->sec )
return( 1 );
return( 0 );
diff --git a/programs/aes/aescrypt2.c b/programs/aes/aescrypt2.c
index 272fd4f7f..1bc657414 100644
--- a/programs/aes/aescrypt2.c
+++ b/programs/aes/aescrypt2.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -29,7 +29,9 @@
#if defined(_WIN32)
#include
+#if !defined(_WIN32_WCE)
#include
+#endif
#else
#include
#include
@@ -55,8 +57,10 @@
"\n"
#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");
return( 0 );
}
@@ -79,7 +83,9 @@ int main( int argc, char *argv[] )
aes_context aes_ctx;
sha2_context sha_ctx;
-#if defined(WIN32)
+#if defined(_WIN32_WCE)
+ long filesize, offset;
+#elif defined(_WIN32)
LARGE_INTEGER li_size;
__int64 filesize, offset;
#else
@@ -93,7 +99,7 @@ int main( int argc, char *argv[] )
{
printf( USAGE );
-#if defined(WIN32)
+#if defined(_WIN32)
printf( "\n Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
@@ -162,7 +168,10 @@ int main( int argc, char *argv[] )
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
*/
@@ -184,6 +193,7 @@ int main( int argc, char *argv[] )
perror( "lseek" );
goto exit;
}
+#endif
#endif
if( fseek( fin, 0, SEEK_SET ) < 0 )
diff --git a/programs/aes/crypt_and_hash.c b/programs/aes/crypt_and_hash.c
index 7a0e45497..9fa0fb16c 100644
--- a/programs/aes/crypt_and_hash.c
+++ b/programs/aes/crypt_and_hash.c
@@ -2,7 +2,7 @@
* \brief Generic file encryption program using generic wrappers for configured
* 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)
* Lead Maintainer: Paul Bakker
@@ -30,7 +30,9 @@
#if defined(_WIN32)
#include
+#if !defined(_WIN32_WCE)
#include
+#endif
#else
#include
#include
@@ -56,8 +58,11 @@
"\n"
#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");
return( 0 );
}
@@ -80,7 +85,9 @@ int main( int argc, char *argv[] )
const md_info_t *md_info;
cipher_context_t cipher_ctx;
md_context_t md_ctx;
-#if defined(WIN32)
+#if defined(_WIN32_WCE)
+ long filesize, offset;
+#elif defined(_WIN32)
LARGE_INTEGER li_size;
__int64 filesize, offset;
#else
@@ -117,7 +124,7 @@ int main( int argc, char *argv[] )
list++;
}
-#if defined(WIN32)
+#if defined(_WIN32)
printf( "\n Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
@@ -205,7 +212,10 @@ int main( int argc, char *argv[] )
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
*/
@@ -227,6 +237,7 @@ int main( int argc, char *argv[] )
perror( "lseek" );
goto exit;
}
+#endif
#endif
if( fseek( fin, 0, SEEK_SET ) < 0 )
diff --git a/programs/hash/generic_sum.c b/programs/hash/generic_sum.c
index 04e1c0457..10692a98f 100644
--- a/programs/hash/generic_sum.c
+++ b/programs/hash/generic_sum.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -35,8 +35,11 @@
#include "polarssl/md.h"
#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");
return( 0 );
}
@@ -172,7 +175,7 @@ int main( int argc, char *argv[] )
list++;
}
-#ifdef WIN32
+#if defined(_WIN32)
printf( "\n Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/hash/hello.c b/programs/hash/hello.c
index d40c69500..d4c362fb1 100644
--- a/programs/hash/hello.c
+++ b/programs/hash/hello.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -34,18 +34,24 @@
#include "polarssl/md5.h"
#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");
return( 0 );
}
#else
-int main( void )
+int main( int argc, char *argv[] )
{
int i;
unsigned char digest[16];
char str[] = "Hello, world!";
+ ((void) argc);
+ ((void) argv);
+
printf( "\n MD5('%s') = ", str );
md5( (unsigned char *) str, 13, digest );
@@ -55,7 +61,7 @@ int main( void )
printf( "\n\n" );
-#ifdef WIN32
+#if defined(_WIN32)
printf( " Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/hash/md5sum.c b/programs/hash/md5sum.c
index fb7283cc8..1ca7e879f 100644
--- a/programs/hash/md5sum.c
+++ b/programs/hash/md5sum.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -35,8 +35,11 @@
#include "polarssl/md5.h"
#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");
return( 0 );
}
@@ -151,7 +154,7 @@ int main( int argc, char *argv[] )
printf( "print mode: md5sum ...\n" );
printf( "check mode: md5sum -c \n" );
-#ifdef WIN32
+#if defined(_WIN32)
printf( "\n Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/hash/sha1sum.c b/programs/hash/sha1sum.c
index 155bfbfa1..92f840662 100644
--- a/programs/hash/sha1sum.c
+++ b/programs/hash/sha1sum.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -35,8 +35,11 @@
#include "polarssl/sha1.h"
#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");
return( 0 );
}
@@ -151,7 +154,7 @@ int main( int argc, char *argv[] )
printf( "print mode: sha1sum ...\n" );
printf( "check mode: sha1sum -c \n" );
-#ifdef WIN32
+#if defined(_WIN32)
printf( "\n Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/hash/sha2sum.c b/programs/hash/sha2sum.c
index 52939e487..83124cf3c 100644
--- a/programs/hash/sha2sum.c
+++ b/programs/hash/sha2sum.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -35,8 +35,11 @@
#include "polarssl/sha2.h"
#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");
return( 0 );
}
@@ -151,7 +154,7 @@ int main( int argc, char *argv[] )
printf( "print mode: sha2sum ...\n" );
printf( "check mode: sha2sum -c \n" );
-#ifdef WIN32
+#if defined(_WIN32)
printf( "\n Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/pkey/dh_client.c b/programs/pkey/dh_client.c
index f85f028ce..ab7b9a6cc 100644
--- a/programs/pkey/dh_client.c
+++ b/programs/pkey/dh_client.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -46,15 +46,18 @@
!defined(POLARSSL_HAVEGE_C) || !defined(POLARSSL_NET_C) || \
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_SHA1_C) || \
!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 "
"and/or POLARSSL_NET_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_SHA1_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 );
}
#else
-int main( void )
+int main( int argc, char *argv[] )
{
FILE *f;
@@ -71,6 +74,9 @@ int main( void )
dhm_context dhm;
aes_context aes;
+ ((void) argc);
+ ((void) argv);
+
memset( &rsa, 0, sizeof( rsa ) );
memset( &dhm, 0, sizeof( dhm ) );
@@ -260,7 +266,7 @@ exit:
rsa_free( &rsa );
dhm_free( &dhm );
-#ifdef WIN32
+#if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/pkey/dh_genprime.c b/programs/pkey/dh_genprime.c
index 410139e31..f6ae03fb4 100644
--- a/programs/pkey/dh_genprime.c
+++ b/programs/pkey/dh_genprime.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -43,14 +43,17 @@
#if !defined(POLARSSL_BIGNUM_C) || !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_HAVEGE_C and/or "
"POLARSSL_FS_IO not defined.\n");
return( 0 );
}
#else
-int main( void )
+int main( int argc, char *argv[] )
{
int ret = 1;
@@ -59,6 +62,9 @@ int main( void )
havege_state hs;
FILE *fout;
+ ((void) argc);
+ ((void) argv);
+
mpi_init( &G ); mpi_init( &P ); mpi_init( &Q );
mpi_read_string( &G, 10, GENERATOR );
@@ -128,7 +134,7 @@ exit:
printf( "\n ! Prime-number generation is not available.\n\n" );
#endif
-#ifdef WIN32
+#if defined(_WIN32)
printf( " Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/pkey/dh_server.c b/programs/pkey/dh_server.c
index 2554b90fa..de2ce970d 100644
--- a/programs/pkey/dh_server.c
+++ b/programs/pkey/dh_server.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -46,15 +46,18 @@
!defined(POLARSSL_HAVEGE_C) || !defined(POLARSSL_NET_C) || \
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_SHA1_C) || \
!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 "
"and/or POLARSSL_NET_C and/or POLARSSL_RSA_C and/or "
"POLARSSL_SHA1_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 );
}
#else
-int main( void )
+int main( int argc, char *argv[] )
{
FILE *f;
@@ -72,6 +75,9 @@ int main( void )
dhm_context dhm;
aes_context aes;
+ ((void) argc);
+ ((void) argv);
+
memset( &rsa, 0, sizeof( rsa ) );
memset( &dhm, 0, sizeof( dhm ) );
@@ -263,7 +269,7 @@ exit:
rsa_free( &rsa );
dhm_free( &dhm );
-#ifdef WIN32
+#if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/pkey/key_app.c b/programs/pkey/key_app.c
index 00a5effb0..7d4a1d9cf 100644
--- a/programs/pkey/key_app.c
+++ b/programs/pkey/key_app.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -74,8 +74,11 @@ void my_debug( void *ctx, int level, const char *str )
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!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 "
"POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 );
@@ -213,7 +216,7 @@ exit:
rsa_free( &rsa );
-#ifdef WIN32
+#if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/pkey/mpi_demo.c b/programs/pkey/mpi_demo.c
index 509a4c9f1..f393f1d49 100644
--- a/programs/pkey/mpi_demo.c
+++ b/programs/pkey/mpi_demo.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -33,16 +33,22 @@
#include "polarssl/bignum.h"
#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");
return( 0 );
}
#else
-int main( void )
+int main( int argc, char *argv[] )
{
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( &H ); mpi_init( &D ); mpi_init( &X ); mpi_init( &Y );
mpi_init( &Z );
@@ -85,7 +91,7 @@ int main( void )
mpi_free( &H ); mpi_free( &D ); mpi_free( &X ); mpi_free( &Y );
mpi_free( &Z );
-#ifdef WIN32
+#if defined(_WIN32)
printf( " Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/pkey/rsa_decrypt.c b/programs/pkey/rsa_decrypt.c
index 384ae926c..9e594f82f 100644
--- a/programs/pkey/rsa_decrypt.c
+++ b/programs/pkey/rsa_decrypt.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -36,8 +36,11 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_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 "
"POLARSSL_FS_IO not defined.\n");
return( 0 );
@@ -58,7 +61,7 @@ int main( int argc, char *argv[] )
{
printf( "usage: rsa_decrypt\n" );
-#ifdef WIN32
+#if defined(_WIN32)
printf( "\n" );
#endif
@@ -140,7 +143,7 @@ int main( int argc, char *argv[] )
exit:
-#ifdef WIN32
+#if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/pkey/rsa_encrypt.c b/programs/pkey/rsa_encrypt.c
index 97243ccbd..0b54a17ae 100644
--- a/programs/pkey/rsa_encrypt.c
+++ b/programs/pkey/rsa_encrypt.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -37,8 +37,11 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!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 "
"POLARSSL_HAVEGE_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 );
@@ -62,7 +65,7 @@ int main( int argc, char *argv[] )
{
printf( "usage: rsa_encrypt \n" );
-#ifdef WIN32
+#if defined(_WIN32)
printf( "\n" );
#endif
@@ -133,7 +136,7 @@ int main( int argc, char *argv[] )
exit:
-#ifdef WIN32
+#if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/pkey/rsa_genkey.c b/programs/pkey/rsa_genkey.c
index 0e90ffcca..d7158b4c0 100644
--- a/programs/pkey/rsa_genkey.c
+++ b/programs/pkey/rsa_genkey.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -42,15 +42,18 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_GENPRIME) || \
!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 "
"POLARSSL_RSA_C and/or POLARSSL_GENPRIME and/or "
"POLARSSL_FS_IO not defined.\n");
return( 0 );
}
#else
-int main( void )
+int main( int argc, char *argv[] )
{
int ret;
rsa_context rsa;
@@ -58,6 +61,9 @@ int main( void )
FILE *fpub = NULL;
FILE *fpriv = NULL;
+ ((void) argc);
+ ((void) argv);
+
printf( "\n . Seeding the random number generator..." );
fflush( stdout );
@@ -138,7 +144,7 @@ exit:
rsa_free( &rsa );
-#ifdef WIN32
+#if defined(_WIN32)
printf( " Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/pkey/rsa_sign.c b/programs/pkey/rsa_sign.c
index 1fc13bd97..76d0eff50 100644
--- a/programs/pkey/rsa_sign.c
+++ b/programs/pkey/rsa_sign.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -37,8 +37,11 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!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 "
"POLARSSL_SHA1_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 );
@@ -59,7 +62,7 @@ int main( int argc, char *argv[] )
{
printf( "usage: rsa_sign \n" );
-#ifdef WIN32
+#if defined(_WIN32)
printf( "\n" );
#endif
@@ -138,7 +141,7 @@ int main( int argc, char *argv[] )
exit:
-#ifdef WIN32
+#if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/pkey/rsa_sign_pss.c b/programs/pkey/rsa_sign_pss.c
index 29de8b6c7..e33cead25 100644
--- a/programs/pkey/rsa_sign_pss.c
+++ b/programs/pkey/rsa_sign_pss.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -45,8 +45,11 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \
!defined(POLARSSL_RSA_C) || !defined(POLARSSL_SHA1_C) || \
!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 "
"POLARSSL_RSA_C and/or POLARSSL_SHA1_C and/or "
"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 \n" );
-#ifdef WIN32
+#if defined(_WIN32)
printf( "\n" );
#endif
@@ -133,7 +136,7 @@ int main( int argc, char *argv[] )
exit:
-#ifdef WIN32
+#if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/pkey/rsa_verify.c b/programs/pkey/rsa_verify.c
index dbe5f84e2..cd29ef8be 100644
--- a/programs/pkey/rsa_verify.c
+++ b/programs/pkey/rsa_verify.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -37,8 +37,11 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!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 "
"POLARSSL_SHA1_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 );
@@ -58,7 +61,7 @@ int main( int argc, char *argv[] )
{
printf( "usage: rsa_verify \n" );
-#ifdef WIN32
+#if defined(_WIN32)
printf( "\n" );
#endif
@@ -141,7 +144,7 @@ int main( int argc, char *argv[] )
exit:
-#ifdef WIN32
+#if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/pkey/rsa_verify_pss.c b/programs/pkey/rsa_verify_pss.c
index 31cd0df7e..3c9087714 100644
--- a/programs/pkey/rsa_verify_pss.c
+++ b/programs/pkey/rsa_verify_pss.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -45,8 +45,11 @@
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!defined(POLARSSL_SHA1_C) || !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 "
"POLARSSL_SHA1_C and/or POLARSSL_X509_PARSE_C and/or "
"POLARSSL_FS_IO not defined.\n");
@@ -68,7 +71,7 @@ int main( int argc, char *argv[] )
{
printf( "usage: rsa_verify_pss \n" );
-#ifdef WIN32
+#if defined(_WIN32)
printf( "\n" );
#endif
@@ -134,7 +137,7 @@ int main( int argc, char *argv[] )
exit:
-#ifdef WIN32
+#if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/random/gen_random.c b/programs/random/gen_random.c
index 696df3a5e..6a7aa3ae6 100644
--- a/programs/random/gen_random.c
+++ b/programs/random/gen_random.c
@@ -1,7 +1,7 @@
/**
* \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)
* Lead Maintainer: Paul Bakker
@@ -31,8 +31,11 @@
#include
#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");
return( 0 );
}
diff --git a/programs/ssl/ssl_client1.c b/programs/ssl/ssl_client1.c
index 2ffe30c40..b57fe8db6 100644
--- a/programs/ssl/ssl_client1.c
+++ b/programs/ssl/ssl_client1.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -54,15 +54,18 @@ void my_debug( void *ctx, int level, const char *str )
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \
!defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_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 "
"POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or "
"POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n");
return( 0 );
}
#else
-int main( void )
+int main( int argc, char *argv[] )
{
int ret, len, server_fd;
unsigned char buf[1024];
@@ -70,6 +73,9 @@ int main( void )
ssl_context ssl;
ssl_session ssn;
+ ((void) argc);
+ ((void) argv);
+
/*
* 0. Initialize the RNG and the session data
*/
@@ -182,7 +188,7 @@ exit:
memset( &ssl, 0, sizeof( ssl ) );
-#ifdef WIN32
+#if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c
index 2eb8cbccd..de0af258a 100644
--- a/programs/ssl/ssl_client2.c
+++ b/programs/ssl/ssl_client2.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -98,8 +98,11 @@ void my_debug( void *ctx, int level, const char *str )
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \
!defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_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 "
"POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or "
"POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n");
@@ -458,7 +461,7 @@ exit:
memset( &ssl, 0, sizeof( ssl ) );
-#ifdef WIN32
+#if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/ssl/ssl_fork_server.c b/programs/ssl/ssl_fork_server.c
index e14da8b2c..411eac15d 100644
--- a/programs/ssl/ssl_fork_server.c
+++ b/programs/ssl/ssl_fork_server.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -27,7 +27,7 @@
#define _CRT_SECURE_NO_DEPRECATE 1
#endif
-#ifdef WIN32
+#if defined(_WIN32)
#include
#endif
@@ -55,17 +55,23 @@
!defined(POLARSSL_HAVEGE_C) || !defined(POLARSSL_SSL_TLS_C) || \
!defined(POLARSSL_SSL_SRV_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_CERTS_C and/or POLARSSL_HAVEGE_C "
"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");
return( 0 );
}
-#elif defined(WIN32)
-int main( void )
+#elif defined(_WIN32)
+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");
return( 0 );
}
@@ -192,7 +198,7 @@ static int my_set_session( ssl_context *ssl )
return( 0 );
}
-int main( void )
+int main( int argc, char *argv[] )
{
int ret, len, cnt = 0, pid;
int listen_fd;
@@ -205,6 +211,9 @@ int main( void )
x509_cert srvcert;
rsa_context rsa;
+ ((void) argc);
+ ((void) argv);
+
signal( SIGCHLD, SIG_IGN );
/*
@@ -450,7 +459,7 @@ exit:
memset( &ssl, 0, sizeof( ssl_context ) );
-#ifdef WIN32
+#if defined(_WIN32)
printf( " Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/ssl/ssl_mail_client.c b/programs/ssl/ssl_mail_client.c
index 2adff52c9..8034a2478 100644
--- a/programs/ssl/ssl_mail_client.c
+++ b/programs/ssl/ssl_mail_client.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -103,8 +103,11 @@ void my_debug( void *ctx, int level, const char *str )
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) || \
!defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_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 "
"POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or "
"POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n");
@@ -789,7 +792,7 @@ exit:
memset( &ssl, 0, sizeof( ssl ) );
-#ifdef WIN32
+#if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/ssl/ssl_server.c b/programs/ssl/ssl_server.c
index 6f427ddca..1c6fec280 100644
--- a/programs/ssl/ssl_server.c
+++ b/programs/ssl/ssl_server.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -27,7 +27,7 @@
#define _CRT_SECURE_NO_DEPRECATE 1
#endif
-#ifdef WIN32
+#if defined(_WIN32)
#include
#endif
@@ -118,7 +118,7 @@ static int my_get_session( ssl_context *ssl )
prv = cur;
cur = cur->next;
- if( ssl->timeout != 0 && t - prv->start > ssl->timeout )
+ if( ssl->timeout != 0 && (int) ( t - prv->start ) > ssl->timeout )
continue;
if( ssl->session->ciphersuite != prv->ciphersuite ||
@@ -144,7 +144,7 @@ static int my_set_session( ssl_context *ssl )
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 */
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_SSL_SRV_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_CERTS_C and/or POLARSSL_HAVEGE_C "
"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");
return( 0 );
}
#else
-int main( void )
+int main( int argc, char *argv[] )
{
int ret, len;
int listen_fd;
@@ -195,6 +198,9 @@ int main( void )
x509_cert srvcert;
rsa_context rsa;
+ ((void) argc);
+ ((void) argv);
+
/*
* 1. Load the certificates and private RSA key
*/
@@ -293,7 +299,24 @@ reset:
/*
* 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/",
NULL, NULL, SW_SHOWNORMAL );
#endif
@@ -419,7 +442,7 @@ exit:
memset( &ssl, 0, sizeof( ssl_context ) );
-#ifdef WIN32
+#if defined(_WIN32)
printf( " Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/test/benchmark.c b/programs/test/benchmark.c
index db4511e5a..091a9cf89 100644
--- a/programs/test/benchmark.c
+++ b/programs/test/benchmark.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -58,13 +58,16 @@ static int myrand( void *rng_state )
unsigned char buf[BUFSIZE];
#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");
return( 0 );
}
#else
-int main( void )
+int main( int argc, char *argv[] )
{
int keysize;
unsigned long i, j, tsc;
@@ -87,6 +90,9 @@ int main( void )
rsa_context rsa;
#endif
+ ((void) argc);
+ ((void) argv);
+
memset( buf, 0xAA, sizeof( buf ) );
printf( "\n" );
@@ -363,7 +369,7 @@ int main( void )
printf( "\n" );
-#ifdef WIN32
+#if defined(_WIN32)
printf( " Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/test/selftest.c b/programs/test/selftest.c
index 508d39df9..c3cebebcc 100644
--- a/programs/test/selftest.c
+++ b/programs/test/selftest.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -144,7 +144,7 @@ int main( int argc, char *argv[] )
if( v != 0 )
{
printf( " [ All tests passed ]\n\n" );
-#ifdef WIN32
+#if defined(_WIN32)
printf( " Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/test/ssl_cert_test.c b/programs/test/ssl_cert_test.c
index 1e5126b2b..57ea32c8f 100644
--- a/programs/test/ssl_cert_test.c
+++ b/programs/test/ssl_cert_test.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -67,20 +67,26 @@ char *client_private_keys[MAX_CLIENT_CERTS] =
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!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 "
"POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 );
}
#else
-int main( void )
+int main( int argc, char *argv[] )
{
int ret, i;
x509_cert cacert;
x509_crl crl;
char buf[10240];
+ ((void) argc);
+ ((void) argv);
+
memset( &cacert, 0, sizeof( x509_cert ) );
memset( &crl, 0, sizeof( x509_crl ) );
@@ -236,7 +242,7 @@ exit:
x509_free( &cacert );
x509_crl_free( &crl );
-#ifdef WIN32
+#if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/test/ssl_test.c b/programs/test/ssl_test.c
index 643b1e1a6..683963c98 100644
--- a/programs/test/ssl_test.c
+++ b/programs/test/ssl_test.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -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_CLI_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 "
"POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_SRV_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:
-#ifdef WIN32
+#if defined(_WIN32)
printf( " Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/wince_main.c b/programs/wince_main.c
new file mode 100644
index 000000000..946569e00
--- /dev/null
+++ b/programs/wince_main.c
@@ -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
+ *
+ * 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
+
+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) */
diff --git a/programs/x509/cert_app.c b/programs/x509/cert_app.c
index 1ded9dd78..fca8bc691 100644
--- a/programs/x509/cert_app.c
+++ b/programs/x509/cert_app.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -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_NET_C) || !defined(POLARSSL_RSA_C) || \
!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 "
"POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or "
"POLARSSL_NET_C and/or POLARSSL_RSA_C and/or "
@@ -295,7 +298,7 @@ exit:
memset( &ssl, 0, sizeof( ssl ) );
-#ifdef WIN32
+#if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif
diff --git a/programs/x509/crl_app.c b/programs/x509/crl_app.c
index b5c6c7981..fae42173f 100644
--- a/programs/x509/crl_app.c
+++ b/programs/x509/crl_app.c
@@ -1,7 +1,7 @@
/*
* 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)
* Lead Maintainer: Paul Bakker
@@ -65,8 +65,11 @@ void my_debug( void *ctx, int level, const char *str )
#if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_RSA_C) || \
!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 "
"POLARSSL_X509_PARSE_C and/or POLARSSL_FS_IO not defined.\n");
return( 0 );
@@ -156,7 +159,7 @@ int main( int argc, char *argv[] )
exit:
x509_crl_free( &crl );
-#ifdef WIN32
+#if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" );
fflush( stdout ); getchar();
#endif