Some patches needed to build the test-programs on MingW:
* 'struct tms' is not available on MingW. So don't define TIMES. * main() returns an int. * don't use deprecated BN_CTX_init(). Use BN_CTX_new() instead. * added header-guard to crypto/des/spr.h * include <openssl/pem.h> and <openssl/err.h> to surpress warnings. Patches attached. --gv
diff -u3 -Hb -r openssl-SNAP-20060713\crypto\bf\bf_opts.c crypto\bf\bf_opts.c --- openssl-SNAP-20060713\crypto\bf\bf_opts.c Fri Nov 28 13:00:09 2003 +++ crypto\bf\bf_opts.c Thu Jul 13 15:58:35 2006 @@ -59,7 +59,7 @@ /* define PART1, PART2, PART3 or PART4 to build only with a few of the options. * This is for machines with 64k code segment size restrictions. */ -#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) +#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) && !defined(__MINGW32__) #define TIMES #endif diff -u3 -Hb -r openssl-SNAP-20060713\crypto\bf\bfspeed.c crypto\bf\bfspeed.c --- openssl-SNAP-20060713\crypto\bf\bfspeed.c Fri Nov 28 13:00:09 2003 +++ crypto\bf\bfspeed.c Thu Jul 13 15:58:56 2006 @@ -59,7 +59,7 @@ /* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */ /* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */ -#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) +#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) && !defined(__MINGW32__) #define TIMES #endif diff -u3 -Hb -r openssl-SNAP-20060713\crypto\bn\divtest.c crypto\bn\divtest.c --- openssl-SNAP-20060713\crypto\bn\divtest.c Thu Nov 14 11:00:26 2002 +++ crypto\bn\divtest.c Thu Jul 13 14:52:53 2006 @@ -18,7 +18,7 @@ fflush(stdout); } -main() +int main() { BIGNUM *a=BN_new(), *b=BN_new(), *c=BN_new(), *d=BN_new(), *C=BN_new(), *D=BN_new(); @@ -38,4 +38,5 @@ else if (BN_cmp(c,C) != 0 || BN_cmp(c,C) != 0) bug("mismatch",a,b); } + return 0; } diff -u3 -Hb -r openssl-SNAP-20060713\crypto\bn\exp.c crypto\bn\exp.c --- openssl-SNAP-20060713\crypto\bn\exp.c Fri Jan 14 17:00:15 2000 +++ crypto\bn\exp.c Thu Jul 13 15:38:34 2006 @@ -8,11 +8,11 @@ #define NUM (8*8*8) #define MOD (8*8*8*8*8) -main(argc,argv) +int main(argc,argv) int argc; char *argv[]; { - BN_CTX ctx; + BN_CTX *ctx; BIGNUM a,b,c,r,rr,t,l; int j,i,size=SIZE,num=NUM,mod=MOD; char *start,*end; @@ -20,7 +20,7 @@ double d,md; BN_MONT_CTX_init(&mont); - BN_CTX_init(&ctx); + ctx = BN_CTX_new(); BN_init(&a); BN_init(&b); BN_init(&c); @@ -34,11 +34,11 @@ BN_rand(&b,size,1,0); BN_rand(&c,size,0,1); - BN_mod(&a,&a,&c,&ctx); + BN_mod(&a,&a,&c,ctx); ms_time_get(start); for (i=0; i<10; i++) - BN_MONT_CTX_set(&mont,&c,&ctx); + BN_MONT_CTX_set(&mont,&c,ctx); ms_time_get(end); md=ms_time_diff(start,end); @@ -47,7 +47,7 @@ { /* bn_mull(&r,&a,&b,&ctx); */ /* BN_sqr(&r,&a,&ctx); */ - BN_mod_exp_mont(&r,&a,&b,&c,&ctx,&mont); + BN_mod_exp_mont(&r,&a,&b,&c,ctx,&mont); } ms_time_get(end); d=ms_time_diff(start,end)/* *50/33 */; @@ -58,5 +58,5 @@ if (num <= 0) num=1; size*=2; } - + return 0; } diff -u3 -Hb -r openssl-SNAP-20060713\crypto\cast\cast_spd.c crypto\cast\cast_spd.c --- openssl-SNAP-20060713\crypto\cast\cast_spd.c Fri Nov 28 13:00:10 2003 +++ crypto\cast\cast_spd.c Thu Jul 13 14:56:00 2006 @@ -59,7 +59,7 @@ /* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */ /* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */ -#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) +#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) && !defined(__MINGW32__) #define TIMES #endif diff -u3 -Hb -r openssl-SNAP-20060713\crypto\cast\castopts.c crypto\cast\castopts.c --- openssl-SNAP-20060713\crypto\cast\castopts.c Fri Nov 28 13:00:10 2003 +++ crypto\cast\castopts.c Thu Jul 13 15:14:16 2006 @@ -59,7 +59,7 @@ /* define PART1, PART2, PART3 or PART4 to build only with a few of the options. * This is for machines with 64k code segment size restrictions. */ -#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) +#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(__MINGW32__) #define TIMES #endif @@ -100,6 +100,7 @@ #endif #include <openssl/cast.h> +#include "cast_s.h" #define CAST_DEFAULT_OPTIONS diff -u3 -Hb -r openssl-SNAP-20060713\crypto\des\des_opts.c crypto\des\des_opts.c --- openssl-SNAP-20060713\crypto\des\des_opts.c Fri Nov 28 13:00:10 2003 +++ crypto\des\des_opts.c Thu Jul 13 15:28:08 2006 @@ -59,7 +59,7 @@ /* define PART1, PART2, PART3 or PART4 to build only with a few of the options. * This is for machines with 64k code segment size restrictions. */ -#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) +#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX) && !defined(__MINGW32__) #define TIMES #endif @@ -418,7 +418,6 @@ int main(int argc, char **argv) { long count; - static unsigned char buf[BUFSIZE]; static DES_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0}; static DES_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12}; static DES_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34}; @@ -448,7 +447,7 @@ #ifndef SIGALRM fprintf(stderr,"First we calculate the approximate speed ...\n"); - DES_set_key_unchecked(&key,sch); + DES_set_key_unchecked(&key,&sch); count=10; do { long i; @@ -457,7 +456,7 @@ count*=2; Time_F(START); for (i=count; i; i--) - DES_encrypt1(data,&(sch[0]),DES_ENCRYPT); + DES_encrypt1(data,&sch,DES_ENCRYPT); d=Time_F(STOP); } while (d < 3.0); ca=count; diff -u3 -Hb -r openssl-SNAP-20060713\crypto\des\spr.h crypto\des\spr.h --- openssl-SNAP-20060713\crypto\des\spr.h Mon Mar 04 16:01:16 2002 +++ crypto\des\spr.h Thu Jul 13 15:24:07 2006 @@ -55,6 +55,8 @@ * copied and put under another distribution licence * [including the GNU Public Licence.] */ +#ifndef HEADER_SPR_H +#define HEADER_SPR_H OPENSSL_GLOBAL const DES_LONG DES_SPtrans[8][64]={ { @@ -202,3 +204,5 @@ 0x00000080L, 0x20820000L, 0x00820080L, 0x00000000L, 0x20000000L, 0x20800080L, 0x00020000L, 0x00820080L, }}; + +#endif /* HEADER_SPR_H */ diff -u3 -Hb -r openssl-SNAP-20060713\crypto\dh\p1024.c crypto\dh\p1024.c --- openssl-SNAP-20060713\crypto\dh\p1024.c Fri Apr 23 22:00:29 1999 +++ crypto\dh\p1024.c Thu Jul 13 15:31:06 2006 @@ -80,7 +80,7 @@ 0x9B,0x99,0x9B,0xB9,0xB7,0x87,0xE8,0xAB, }; -main() +int main() { DH *dh; @@ -89,4 +89,5 @@ dh->g=BN_new(); BN_set_word(dh->g,2); PEM_write_DHparams(stdout,dh); + return 0; } diff -u3 -Hb -r openssl-SNAP-20060713\crypto\dh\p192.c crypto\dh\p192.c --- openssl-SNAP-20060713\crypto\dh\p192.c Fri Apr 23 22:00:29 1999 +++ crypto\dh\p192.c Thu Jul 13 15:29:30 2006 @@ -68,7 +68,7 @@ 0xC7,0x16,0xE2,0x2D,0x09,0x44,0xB8,0x8B, }; -main() +int main() { DH *dh; @@ -77,4 +77,5 @@ dh->g=BN_new(); BN_set_word(dh->g,3); PEM_write_DHparams(stdout,dh); + return 0; } diff -u3 -Hb -r openssl-SNAP-20060713\crypto\dh\p512.c crypto\dh\p512.c --- openssl-SNAP-20060713\crypto\dh\p512.c Fri Apr 23 22:00:29 1999 +++ crypto\dh\p512.c Thu Jul 13 15:30:17 2006 @@ -73,7 +73,7 @@ 0xD8,0x00,0x3E,0x7C,0x47,0x74,0xE8,0x33, }; -main() +int main() { DH *dh; @@ -82,4 +82,5 @@ dh->g=BN_new(); BN_set_word(dh->g,2); PEM_write_DHparams(stdout,dh); + return 0; } diff -u3 -Hb -r openssl-SNAP-20060713\crypto\x509v3\v3conf.c crypto\x509v3\v3conf.c --- openssl-SNAP-20060713\crypto\x509v3\v3conf.c Thu Jan 02 18:15:30 2003 +++ crypto\x509v3\v3conf.c Thu Jul 13 15:53:50 2006 @@ -61,6 +61,7 @@ #include "cryptlib.h" #include <openssl/asn1.h> #include <openssl/conf.h> +#include <openssl/pem.h> #include <openssl/x509.h> #include <openssl/x509v3.h> @@ -95,7 +96,7 @@ fprintf(stderr, "Can't open certificate file %s\n", argv[1]); exit(1); } - cert = PEM_read_X509(inf, NULL, NULL); + cert = PEM_read_X509(inf, NULL, NULL, NULL); if(!cert) { fprintf(stderr, "Error reading certificate file %s\n", argv[1]); exit(1); diff -u3 -Hb -r openssl-SNAP-20060713\crypto\x509v3\v3prin.c crypto\x509v3\v3prin.c --- openssl-SNAP-20060713\crypto\x509v3\v3prin.c Fri Dec 08 19:01:23 2000 +++ crypto\x509v3\v3prin.c Thu Jul 13 15:54:48 2006 @@ -61,6 +61,8 @@ #include <stdio.h> #include <openssl/asn1.h> #include <openssl/conf.h> +#include <openssl/err.h> +#include <openssl/pem.h> #include <openssl/x509.h> #include <openssl/x509v3.h> @@ -80,7 +82,7 @@ fprintf(stderr, "Can't open %s\n", argv[1]); exit(1); } - if(!(cert = PEM_read_X509(inf, NULL, NULL))) { + if(!(cert = PEM_read_X509(inf, NULL, NULL, NULL))) { fprintf(stderr, "Can't read certificate %s\n", argv[1]); ERR_print_errors_fp(stderr); exit(1);