From e3d5af2816712f6e9bf58da03af29aff9289d020 Mon Sep 17 00:00:00 2001 From: miod Date: Mon, 28 Apr 2014 21:14:50 +0000 Subject: [PATCH] Remove WIN32, WIN64 and MINGW32 tentacles. Also check for _LP64 rather than __arch64__ (the former being more reliable than __LP64__ or __arch64__) to tell 64-bit int platforms apart from 32-bit int platforms. Loosely based upon a diff from Martijn van Duren on tech@ --- lib/libcrypto/aes/aes_x86core.c | 5 +---- lib/libcrypto/bn/asm/x86_64-gcc.c | 4 ---- lib/libcrypto/bn/bn_exp.c | 7 +------ lib/libcrypto/cast/cast_lcl.h | 5 ----- lib/libcrypto/des/enc_read.c | 8 -------- lib/libcrypto/des/enc_writ.c | 4 ---- lib/libcrypto/engine/eng_aesni.c | 4 ---- lib/libcrypto/engine/eng_padlock.c | 7 +------ lib/libcrypto/engine/eng_rsax.c | 4 ---- lib/libcrypto/modes/modes_lcl.h | 6 +----- lib/libcrypto/sha/sha.h | 5 +---- lib/libcrypto/srp/srp_lib.c | 4 +--- lib/libcrypto/ts/ts.h | 5 ----- lib/libcrypto/whrlpool/wp_block.c | 4 +--- lib/libssl/src/crypto/aes/aes_x86core.c | 5 +---- lib/libssl/src/crypto/bn/asm/x86_64-gcc.c | 4 ---- lib/libssl/src/crypto/bn/bn_exp.c | 7 +------ lib/libssl/src/crypto/cast/cast_lcl.h | 5 ----- lib/libssl/src/crypto/des/enc_read.c | 8 -------- lib/libssl/src/crypto/des/enc_writ.c | 4 ---- lib/libssl/src/crypto/engine/eng_aesni.c | 4 ---- lib/libssl/src/crypto/engine/eng_padlock.c | 7 +------ lib/libssl/src/crypto/engine/eng_rsax.c | 4 ---- lib/libssl/src/crypto/modes/modes_lcl.h | 6 +----- lib/libssl/src/crypto/sha/sha.h | 5 +---- lib/libssl/src/crypto/srp/srp_lib.c | 4 +--- lib/libssl/src/crypto/ts/ts.h | 5 ----- lib/libssl/src/crypto/whrlpool/wp_block.c | 4 +--- 28 files changed, 14 insertions(+), 130 deletions(-) diff --git a/lib/libcrypto/aes/aes_x86core.c b/lib/libcrypto/aes/aes_x86core.c index 295ea22bb46..8b3b29e28c6 100644 --- a/lib/libcrypto/aes/aes_x86core.c +++ b/lib/libcrypto/aes/aes_x86core.c @@ -79,10 +79,7 @@ prefetch256(const void *table) #undef GETU32 #define GETU32(p) (*((u32*)(p))) -#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) -typedef unsigned __int64 u64; -#define U64(C) C##UI64 -#elif defined(__arch64__) +#if defined(_LP64) typedef unsigned long u64; #define U64(C) C##UL #else diff --git a/lib/libcrypto/bn/asm/x86_64-gcc.c b/lib/libcrypto/bn/asm/x86_64-gcc.c index acb0b401181..6a7fa4aea95 100644 --- a/lib/libcrypto/bn/asm/x86_64-gcc.c +++ b/lib/libcrypto/bn/asm/x86_64-gcc.c @@ -55,11 +55,7 @@ * machine. */ -#ifdef _WIN64 -#define BN_ULONG unsigned long long -#else #define BN_ULONG unsigned long -#endif #undef mul #undef mul_add diff --git a/lib/libcrypto/bn/bn_exp.c b/lib/libcrypto/bn/bn_exp.c index 2047e1cc3f0..22ef643c02c 100644 --- a/lib/libcrypto/bn/bn_exp.c +++ b/lib/libcrypto/bn/bn_exp.c @@ -114,12 +114,7 @@ #include "bn_lcl.h" #include -#ifdef _WIN32 -# include -# ifndef alloca -# define alloca _alloca -# endif -#elif defined(__GNUC__) +#if defined(__GNUC__) # ifndef alloca # define alloca(s) __builtin_alloca((s)) # endif diff --git a/lib/libcrypto/cast/cast_lcl.h b/lib/libcrypto/cast/cast_lcl.h index ec14804fbbd..61facd09d8a 100644 --- a/lib/libcrypto/cast/cast_lcl.h +++ b/lib/libcrypto/cast/cast_lcl.h @@ -56,11 +56,6 @@ * [including the GNU Public Licence.] */ -#ifdef OPENSSL_SYS_WIN32 -#include -#endif - - #undef c2l #define c2l(c,l) (l =((unsigned long)(*((c)++))) , \ l|=((unsigned long)(*((c)++)))<< 8L, \ diff --git a/lib/libcrypto/des/enc_read.c b/lib/libcrypto/des/enc_read.c index 23ad458dcf6..e1ac04c5b39 100644 --- a/lib/libcrypto/des/enc_read.c +++ b/lib/libcrypto/des/enc_read.c @@ -150,11 +150,7 @@ int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched, /* first - get the length */ while (net_num < HDRSIZE) { -#ifndef OPENSSL_SYS_WIN32 i=read(fd,(void *)&(net[net_num]),HDRSIZE-net_num); -#else - i=_read(fd,(void *)&(net[net_num]),HDRSIZE-net_num); -#endif #ifdef EINTR if ((i == -1) && (errno == EINTR)) continue; #endif @@ -176,11 +172,7 @@ int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched, net_num=0; while (net_num < rnum) { -#ifndef OPENSSL_SYS_WIN32 i=read(fd,(void *)&(net[net_num]),rnum-net_num); -#else - i=_read(fd,(void *)&(net[net_num]),rnum-net_num); -#endif #ifdef EINTR if ((i == -1) && (errno == EINTR)) continue; #endif diff --git a/lib/libcrypto/des/enc_writ.c b/lib/libcrypto/des/enc_writ.c index 8f6b033c877..18562310eed 100644 --- a/lib/libcrypto/des/enc_writ.c +++ b/lib/libcrypto/des/enc_writ.c @@ -156,11 +156,7 @@ int DES_enc_write(int fd, const void *_buf, int len, { /* eay 26/08/92 I was not doing writing from where we * got up to. */ -#ifndef _WIN32 i=write(fd,(void *)&(outbuf[j]),outnum-j); -#else - i=_write(fd,(void *)&(outbuf[j]),outnum-j); -#endif if (i == -1) { #ifdef EINTR diff --git a/lib/libcrypto/engine/eng_aesni.c b/lib/libcrypto/engine/eng_aesni.c index 5fdb33bfded..d547d7f4656 100644 --- a/lib/libcrypto/engine/eng_aesni.c +++ b/lib/libcrypto/engine/eng_aesni.c @@ -309,11 +309,7 @@ static void aesni_ofb128_encrypt(const unsigned char *in, unsigned char *out, } /* ===== Engine "management" functions ===== */ -#if defined(_WIN32) -typedef unsigned __int64 IA32CAP; -#else typedef unsigned long long IA32CAP; -#endif /* Prepare the ENGINE structure for registration */ static int diff --git a/lib/libcrypto/engine/eng_padlock.c b/lib/libcrypto/engine/eng_padlock.c index c27181ba758..5a80b2b16da 100644 --- a/lib/libcrypto/engine/eng_padlock.c +++ b/lib/libcrypto/engine/eng_padlock.c @@ -129,12 +129,7 @@ void ENGINE_load_padlock (void) /* We do these includes here to avoid header problems on platforms that do not have the VIA padlock anyway... */ #include -#ifdef _WIN32 -# include -# ifndef alloca -# define alloca _alloca -# endif -#elif defined(__GNUC__) +#if defined(__GNUC__) # ifndef alloca # define alloca(s) __builtin_alloca(s) # endif diff --git a/lib/libcrypto/engine/eng_rsax.c b/lib/libcrypto/engine/eng_rsax.c index c0f6851601c..1b15b6f1a3f 100644 --- a/lib/libcrypto/engine/eng_rsax.c +++ b/lib/libcrypto/engine/eng_rsax.c @@ -217,11 +217,7 @@ static int e_rsax_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void)) #ifndef OPENSSL_NO_RSA -#ifdef _WIN32 -typedef unsigned __int64 UINT64; -#else typedef unsigned long long UINT64; -#endif typedef unsigned short UINT16; /* Table t is interleaved in the following manner: diff --git a/lib/libcrypto/modes/modes_lcl.h b/lib/libcrypto/modes/modes_lcl.h index 2fc81382734..68c0e355ad9 100644 --- a/lib/libcrypto/modes/modes_lcl.h +++ b/lib/libcrypto/modes/modes_lcl.h @@ -9,11 +9,7 @@ #include -#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) -typedef __int64 i64; -typedef unsigned __int64 u64; -#define U64(C) C##UI64 -#elif defined(__arch64__) +#if defined(_LP64) typedef long i64; typedef unsigned long u64; #define U64(C) C##UL diff --git a/lib/libcrypto/sha/sha.h b/lib/libcrypto/sha/sha.h index 435352c2080..c0c3c16c08a 100644 --- a/lib/libcrypto/sha/sha.h +++ b/lib/libcrypto/sha/sha.h @@ -154,10 +154,7 @@ void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); #define SHA512_CBLOCK (SHA_LBLOCK*8) /* SHA-512 treats input data as a * contiguous array of 64 bit * wide big-endian values. */ -#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) -#define SHA_LONG64 unsigned __int64 -#define U64(C) C##UI64 -#elif defined(__arch64__) +#if defined(_LP64) #define SHA_LONG64 unsigned long #define U64(C) C##UL #else diff --git a/lib/libcrypto/srp/srp_lib.c b/lib/libcrypto/srp/srp_lib.c index 8cc94f51db8..a3a67eda2e2 100644 --- a/lib/libcrypto/srp/srp_lib.c +++ b/lib/libcrypto/srp/srp_lib.c @@ -63,9 +63,7 @@ #include #if (BN_BYTES == 8) -# if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) -# define bn_pack4(a1,a2,a3,a4) ((a1##UI64<<48)|(a2##UI64<<32)|(a3##UI64<<16)|a4##UI64) -# elif defined(__arch64__) +# if defined(_LP64) # define bn_pack4(a1,a2,a3,a4) ((a1##UL<<48)|(a2##UL<<32)|(a3##UL<<16)|a4##UL) # else # define bn_pack4(a1,a2,a3,a4) ((a1##ULL<<48)|(a2##ULL<<32)|(a3##ULL<<16)|a4##ULL) diff --git a/lib/libcrypto/ts/ts.h b/lib/libcrypto/ts/ts.h index 3c5ab727db5..085e062b96c 100644 --- a/lib/libcrypto/ts/ts.h +++ b/lib/libcrypto/ts/ts.h @@ -89,11 +89,6 @@ extern "C" { #endif -#ifdef WIN32 -/* Under Win32 this is defined in wincrypt.h */ -#undef X509_NAME -#endif - #include #include diff --git a/lib/libcrypto/whrlpool/wp_block.c b/lib/libcrypto/whrlpool/wp_block.c index 11164e50f56..9c194f968b1 100644 --- a/lib/libcrypto/whrlpool/wp_block.c +++ b/lib/libcrypto/whrlpool/wp_block.c @@ -40,9 +40,7 @@ #include typedef unsigned char u8; -#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32) -typedef unsigned __int64 u64; -#elif defined(__arch64__) +#if defined(_LP64) typedef unsigned long u64; #else typedef unsigned long long u64; diff --git a/lib/libssl/src/crypto/aes/aes_x86core.c b/lib/libssl/src/crypto/aes/aes_x86core.c index 295ea22bb46..8b3b29e28c6 100644 --- a/lib/libssl/src/crypto/aes/aes_x86core.c +++ b/lib/libssl/src/crypto/aes/aes_x86core.c @@ -79,10 +79,7 @@ prefetch256(const void *table) #undef GETU32 #define GETU32(p) (*((u32*)(p))) -#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) -typedef unsigned __int64 u64; -#define U64(C) C##UI64 -#elif defined(__arch64__) +#if defined(_LP64) typedef unsigned long u64; #define U64(C) C##UL #else diff --git a/lib/libssl/src/crypto/bn/asm/x86_64-gcc.c b/lib/libssl/src/crypto/bn/asm/x86_64-gcc.c index acb0b401181..6a7fa4aea95 100644 --- a/lib/libssl/src/crypto/bn/asm/x86_64-gcc.c +++ b/lib/libssl/src/crypto/bn/asm/x86_64-gcc.c @@ -55,11 +55,7 @@ * machine. */ -#ifdef _WIN64 -#define BN_ULONG unsigned long long -#else #define BN_ULONG unsigned long -#endif #undef mul #undef mul_add diff --git a/lib/libssl/src/crypto/bn/bn_exp.c b/lib/libssl/src/crypto/bn/bn_exp.c index 2047e1cc3f0..22ef643c02c 100644 --- a/lib/libssl/src/crypto/bn/bn_exp.c +++ b/lib/libssl/src/crypto/bn/bn_exp.c @@ -114,12 +114,7 @@ #include "bn_lcl.h" #include -#ifdef _WIN32 -# include -# ifndef alloca -# define alloca _alloca -# endif -#elif defined(__GNUC__) +#if defined(__GNUC__) # ifndef alloca # define alloca(s) __builtin_alloca((s)) # endif diff --git a/lib/libssl/src/crypto/cast/cast_lcl.h b/lib/libssl/src/crypto/cast/cast_lcl.h index ec14804fbbd..61facd09d8a 100644 --- a/lib/libssl/src/crypto/cast/cast_lcl.h +++ b/lib/libssl/src/crypto/cast/cast_lcl.h @@ -56,11 +56,6 @@ * [including the GNU Public Licence.] */ -#ifdef OPENSSL_SYS_WIN32 -#include -#endif - - #undef c2l #define c2l(c,l) (l =((unsigned long)(*((c)++))) , \ l|=((unsigned long)(*((c)++)))<< 8L, \ diff --git a/lib/libssl/src/crypto/des/enc_read.c b/lib/libssl/src/crypto/des/enc_read.c index 23ad458dcf6..e1ac04c5b39 100644 --- a/lib/libssl/src/crypto/des/enc_read.c +++ b/lib/libssl/src/crypto/des/enc_read.c @@ -150,11 +150,7 @@ int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched, /* first - get the length */ while (net_num < HDRSIZE) { -#ifndef OPENSSL_SYS_WIN32 i=read(fd,(void *)&(net[net_num]),HDRSIZE-net_num); -#else - i=_read(fd,(void *)&(net[net_num]),HDRSIZE-net_num); -#endif #ifdef EINTR if ((i == -1) && (errno == EINTR)) continue; #endif @@ -176,11 +172,7 @@ int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched, net_num=0; while (net_num < rnum) { -#ifndef OPENSSL_SYS_WIN32 i=read(fd,(void *)&(net[net_num]),rnum-net_num); -#else - i=_read(fd,(void *)&(net[net_num]),rnum-net_num); -#endif #ifdef EINTR if ((i == -1) && (errno == EINTR)) continue; #endif diff --git a/lib/libssl/src/crypto/des/enc_writ.c b/lib/libssl/src/crypto/des/enc_writ.c index 8f6b033c877..18562310eed 100644 --- a/lib/libssl/src/crypto/des/enc_writ.c +++ b/lib/libssl/src/crypto/des/enc_writ.c @@ -156,11 +156,7 @@ int DES_enc_write(int fd, const void *_buf, int len, { /* eay 26/08/92 I was not doing writing from where we * got up to. */ -#ifndef _WIN32 i=write(fd,(void *)&(outbuf[j]),outnum-j); -#else - i=_write(fd,(void *)&(outbuf[j]),outnum-j); -#endif if (i == -1) { #ifdef EINTR diff --git a/lib/libssl/src/crypto/engine/eng_aesni.c b/lib/libssl/src/crypto/engine/eng_aesni.c index 5fdb33bfded..d547d7f4656 100644 --- a/lib/libssl/src/crypto/engine/eng_aesni.c +++ b/lib/libssl/src/crypto/engine/eng_aesni.c @@ -309,11 +309,7 @@ static void aesni_ofb128_encrypt(const unsigned char *in, unsigned char *out, } /* ===== Engine "management" functions ===== */ -#if defined(_WIN32) -typedef unsigned __int64 IA32CAP; -#else typedef unsigned long long IA32CAP; -#endif /* Prepare the ENGINE structure for registration */ static int diff --git a/lib/libssl/src/crypto/engine/eng_padlock.c b/lib/libssl/src/crypto/engine/eng_padlock.c index c27181ba758..5a80b2b16da 100644 --- a/lib/libssl/src/crypto/engine/eng_padlock.c +++ b/lib/libssl/src/crypto/engine/eng_padlock.c @@ -129,12 +129,7 @@ void ENGINE_load_padlock (void) /* We do these includes here to avoid header problems on platforms that do not have the VIA padlock anyway... */ #include -#ifdef _WIN32 -# include -# ifndef alloca -# define alloca _alloca -# endif -#elif defined(__GNUC__) +#if defined(__GNUC__) # ifndef alloca # define alloca(s) __builtin_alloca(s) # endif diff --git a/lib/libssl/src/crypto/engine/eng_rsax.c b/lib/libssl/src/crypto/engine/eng_rsax.c index c0f6851601c..1b15b6f1a3f 100644 --- a/lib/libssl/src/crypto/engine/eng_rsax.c +++ b/lib/libssl/src/crypto/engine/eng_rsax.c @@ -217,11 +217,7 @@ static int e_rsax_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void)) #ifndef OPENSSL_NO_RSA -#ifdef _WIN32 -typedef unsigned __int64 UINT64; -#else typedef unsigned long long UINT64; -#endif typedef unsigned short UINT16; /* Table t is interleaved in the following manner: diff --git a/lib/libssl/src/crypto/modes/modes_lcl.h b/lib/libssl/src/crypto/modes/modes_lcl.h index 2fc81382734..68c0e355ad9 100644 --- a/lib/libssl/src/crypto/modes/modes_lcl.h +++ b/lib/libssl/src/crypto/modes/modes_lcl.h @@ -9,11 +9,7 @@ #include -#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) -typedef __int64 i64; -typedef unsigned __int64 u64; -#define U64(C) C##UI64 -#elif defined(__arch64__) +#if defined(_LP64) typedef long i64; typedef unsigned long u64; #define U64(C) C##UL diff --git a/lib/libssl/src/crypto/sha/sha.h b/lib/libssl/src/crypto/sha/sha.h index 435352c2080..c0c3c16c08a 100644 --- a/lib/libssl/src/crypto/sha/sha.h +++ b/lib/libssl/src/crypto/sha/sha.h @@ -154,10 +154,7 @@ void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); #define SHA512_CBLOCK (SHA_LBLOCK*8) /* SHA-512 treats input data as a * contiguous array of 64 bit * wide big-endian values. */ -#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) -#define SHA_LONG64 unsigned __int64 -#define U64(C) C##UI64 -#elif defined(__arch64__) +#if defined(_LP64) #define SHA_LONG64 unsigned long #define U64(C) C##UL #else diff --git a/lib/libssl/src/crypto/srp/srp_lib.c b/lib/libssl/src/crypto/srp/srp_lib.c index 8cc94f51db8..a3a67eda2e2 100644 --- a/lib/libssl/src/crypto/srp/srp_lib.c +++ b/lib/libssl/src/crypto/srp/srp_lib.c @@ -63,9 +63,7 @@ #include #if (BN_BYTES == 8) -# if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) -# define bn_pack4(a1,a2,a3,a4) ((a1##UI64<<48)|(a2##UI64<<32)|(a3##UI64<<16)|a4##UI64) -# elif defined(__arch64__) +# if defined(_LP64) # define bn_pack4(a1,a2,a3,a4) ((a1##UL<<48)|(a2##UL<<32)|(a3##UL<<16)|a4##UL) # else # define bn_pack4(a1,a2,a3,a4) ((a1##ULL<<48)|(a2##ULL<<32)|(a3##ULL<<16)|a4##ULL) diff --git a/lib/libssl/src/crypto/ts/ts.h b/lib/libssl/src/crypto/ts/ts.h index 3c5ab727db5..085e062b96c 100644 --- a/lib/libssl/src/crypto/ts/ts.h +++ b/lib/libssl/src/crypto/ts/ts.h @@ -89,11 +89,6 @@ extern "C" { #endif -#ifdef WIN32 -/* Under Win32 this is defined in wincrypt.h */ -#undef X509_NAME -#endif - #include #include diff --git a/lib/libssl/src/crypto/whrlpool/wp_block.c b/lib/libssl/src/crypto/whrlpool/wp_block.c index 11164e50f56..9c194f968b1 100644 --- a/lib/libssl/src/crypto/whrlpool/wp_block.c +++ b/lib/libssl/src/crypto/whrlpool/wp_block.c @@ -40,9 +40,7 @@ #include typedef unsigned char u8; -#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32) -typedef unsigned __int64 u64; -#elif defined(__arch64__) +#if defined(_LP64) typedef unsigned long u64; #else typedef unsigned long long u64; -- 2.20.1