Hello tech,
I got a bit bored, so I decided to help in the springcleaning of libssl.
I removed some seemingly harmless WIN32 defines.
According to grep there's still some WIN32 named functions and defines
left, but I didn't dare to touch those.
I couldn't test this diff because I got the following error, which seem
unrelated to this patch:
/usr/src/lib/libssl/ssl/../../libssl/src/ssl/s3_lib.c: In function
'ssl3_clear':
/usr/src/lib/libssl/ssl/../../libssl/src/ssl/s3_lib.c:2881: error:
'struct ssl3_state_st' has no member named 'is_probably_safari'
/usr/src/lib/libssl/ssl/../../libssl/src/ssl/s3_lib.c: In function
'ssl3_choose_cipher':
/usr/src/lib/libssl/ssl/../../libssl/src/ssl/s3_lib.c:3805: error:
'struct ssl3_state_st' has no member named 'is_probably_safari'
*** Error 1 in ssl (<bsd.lib.mk>:40 's3_lib.o': @cc -O2 -pipe -g -Wall
-Werror -DTERMIOS -DANSI_SOURCE -DOPENSSL_NO_RC5 -DOPENSSL_NO_KRB5 -I...)
*** Error 1 in /usr/src/lib/libssl (<bsd.subdir.mk>:48 'all')
Sincerely,
Martijn van Duren
ps. How many ways to define an int64 are there?
Index: src/crypto/aes/aes_x86core.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/aes/aes_x86core.c,v
retrieving revision 1.3
diff -u -p -u -r1.3 aes_x86core.c
--- src/crypto/aes/aes_x86core.c 17 Apr 2014 21:17:11 -0000 1.3
+++ src/crypto/aes/aes_x86core.c 24 Apr 2014 20:09:28 -0000
@@ -79,16 +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__)
-typedef unsigned long u64;
-#define U64(C) C##UL
-#else
typedef unsigned long long u64;
-#define U64(C) C##ULL
-#endif
#undef ROTATE
#if defined(__GNUC__) && __GNUC__>=2
Index: src/crypto/bn/bn.h
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/bn/bn.h,v
retrieving revision 1.18
diff -u -p -u -r1.18 bn.h
--- src/crypto/bn/bn.h 17 Apr 2014 19:59:14 -0000 1.18
+++ src/crypto/bn/bn.h 24 Apr 2014 20:09:31 -0000
@@ -221,13 +221,8 @@ extern "C" {
#ifdef THIRTY_TWO_BIT
#ifdef BN_LLONG
-# if defined(_WIN32) && !defined(__GNUC__)
-# define BN_ULLONG unsigned __int64
-# define BN_MASK (0xffffffffffffffffI64)
-# else
# define BN_ULLONG unsigned long long
# define BN_MASK (0xffffffffffffffffLL)
-# endif
#endif
#define BN_ULONG unsigned int
#define BN_LONG int
Index: src/crypto/bn/bn_exp.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/bn/bn_exp.c,v
retrieving revision 1.10
diff -u -p -u -r1.10 bn_exp.c
--- src/crypto/bn/bn_exp.c 17 Apr 2014 13:37:48 -0000 1.10
+++ src/crypto/bn/bn_exp.c 24 Apr 2014 20:09:31 -0000
@@ -114,16 +114,6 @@
#include "bn_lcl.h"
#include <stdlib.h>
-#ifdef _WIN32
-# include <malloc.h>
-# ifndef alloca
-# define alloca _alloca
-# endif
-#elif defined(__GNUC__)
-# ifndef alloca
-# define alloca(s) __builtin_alloca((s))
-# endif
-#endif
/* maximum precomputation table size for *variable* sliding windows */
#define TABLE_SIZE 32
Index: src/crypto/bn/bn_nist.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/bn/bn_nist.c,v
retrieving revision 1.8
diff -u -p -u -r1.8 bn_nist.c
--- src/crypto/bn/bn_nist.c 18 Apr 2014 19:41:23 -0000 1.8
+++ src/crypto/bn/bn_nist.c 24 Apr 2014 20:09:31 -0000
@@ -340,11 +340,7 @@ static void nist_cp_bn(BN_ULONG *dst, co
}
#define bn_cp_32(to, n, from, m) (to)[n] = (m>=0)?((from)[m]):0;
#define bn_32_set_0(to, n) (to)[n] = (BN_ULONG)0;
-# if defined(_WIN32) && !defined(__GNUC__)
-# define NIST_INT64 __int64
-# elif defined(BN_LLONG)
-# define NIST_INT64 long long
-# endif
+#define NIST_INT64 long long
#endif /* BN_BITS2 != 64 */
#define nist_set_192(to, from, a1, a2, a3) \
Index: src/crypto/cast/cast_lcl.h
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/cast/cast_lcl.h,v
retrieving revision 1.8
diff -u -p -u -r1.8 cast_lcl.h
--- src/crypto/cast/cast_lcl.h 18 Apr 2014 14:37:41 -0000 1.8
+++ src/crypto/cast/cast_lcl.h 24 Apr 2014 20:09:33 -0000
@@ -56,11 +56,6 @@
* [including the GNU Public Licence.]
*/
-#ifdef OPENSSL_SYS_WIN32
-#include <stdlib.h>
-#endif
-
-
#undef c2l
#define c2l(c,l) (l =((unsigned long)(*((c)++))) , \
l|=((unsigned long)(*((c)++)))<< 8L, \
Index: src/crypto/conf/test.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/conf/test.c,v
retrieving revision 1.4
diff -u -p -u -r1.4 test.c
--- src/crypto/conf/test.c 20 Apr 2014 09:04:56 -0000 1.4
+++ src/crypto/conf/test.c 24 Apr 2014 20:09:35 -0000
@@ -67,9 +67,6 @@ main()
long eline;
char *s, *s2;
-#ifdef USE_WIN32
- CONF_set_default_method(CONF_WIN32);
-#endif
conf = CONF_load(NULL, "ssleay.cnf", &eline);
if (conf == NULL) {
ERR_load_crypto_strings();
Index: src/crypto/des/enc_read.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/des/enc_read.c,v
retrieving revision 1.8
diff -u -p -u -r1.8 enc_read.c
--- src/crypto/des/enc_read.c 17 Apr 2014 13:37:48 -0000 1.8
+++ src/crypto/des/enc_read.c 24 Apr 2014 20:09:35 -0000
@@ -150,11 +150,7 @@ int DES_enc_read(int fd, void *buf, int
/* 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
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
Index: src/crypto/des/enc_writ.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/des/enc_writ.c,v
retrieving revision 1.8
diff -u -p -u -r1.8 enc_writ.c
--- src/crypto/des/enc_writ.c 17 Apr 2014 13:37:48 -0000 1.8
+++ src/crypto/des/enc_writ.c 24 Apr 2014 20:09:35 -0000
@@ -156,11 +156,7 @@ int DES_enc_write(int fd, const void *_b
{
/* 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
Index: src/crypto/engine/eng_aesni.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/engine/eng_aesni.c,v
retrieving revision 1.2
diff -u -p -u -r1.2 eng_aesni.c
--- src/crypto/engine/eng_aesni.c 6 Oct 2010 22:57:46 -0000 1.2
+++ src/crypto/engine/eng_aesni.c 24 Apr 2014 20:09:38 -0000
@@ -309,11 +309,7 @@ static void aesni_ofb128_encrypt(const u
}
/* ===== 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
Index: src/crypto/engine/eng_padlock.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/engine/eng_padlock.c,v
retrieving revision 1.6
diff -u -p -u -r1.6 eng_padlock.c
--- src/crypto/engine/eng_padlock.c 20 Apr 2014 16:18:06 -0000 1.6
+++ src/crypto/engine/eng_padlock.c 24 Apr 2014 20:09:38 -0000
@@ -129,16 +129,6 @@ 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 <stdlib.h>
-#ifdef _WIN32
-# include <malloc.h>
-# ifndef alloca
-# define alloca _alloca
-# endif
-#elif defined(__GNUC__)
-# ifndef alloca
-# define alloca(s) __builtin_alloca(s)
-# endif
-#endif
/* Function for ENGINE detection and control */
static int padlock_available(void);
Index: src/crypto/engine/eng_rsax.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/engine/eng_rsax.c,v
retrieving revision 1.2
diff -u -p -u -r1.2 eng_rsax.c
--- src/crypto/engine/eng_rsax.c 17 Apr 2014 13:37:49 -0000 1.2
+++ src/crypto/engine/eng_rsax.c 24 Apr 2014 20:09:38 -0000
@@ -227,11 +227,7 @@ static int e_rsax_ctrl(ENGINE *e, int cm
#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:
Index: src/crypto/modes/modes_lcl.h
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/modes/modes_lcl.h,v
retrieving revision 1.4
diff -u -p -u -r1.4 modes_lcl.h
--- src/crypto/modes/modes_lcl.h 23 Apr 2014 19:09:49 -0000 1.4
+++ src/crypto/modes/modes_lcl.h 24 Apr 2014 20:09:43 -0000
@@ -9,19 +9,9 @@
#include <machine/endian.h>
-#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
-typedef __int64 i64;
-typedef unsigned __int64 u64;
-#define U64(C) C##UI64
-#elif defined(__arch64__)
-typedef long i64;
-typedef unsigned long u64;
-#define U64(C) C##UL
-#else
typedef long long i64;
typedef unsigned long long u64;
#define U64(C) C##ULL
-#endif
typedef unsigned int u32;
typedef unsigned char u8;
Index: src/crypto/sha/sha.h
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/sha/sha.h,v
retrieving revision 1.11
diff -u -p -u -r1.11 sha.h
--- src/crypto/sha/sha.h 16 Apr 2014 04:38:11 -0000 1.11
+++ src/crypto/sha/sha.h 24 Apr 2014 20:09:48 -0000
@@ -154,16 +154,8 @@ void SHA256_Transform(SHA256_CTX *c, con
#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__)
-#define SHA_LONG64 unsigned long
-#define U64(C) C##UL
-#else
#define SHA_LONG64 unsigned long long
#define U64(C) C##ULL
-#endif
typedef struct SHA512state_st
{
Index: src/crypto/srp/srp_lib.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/srp/srp_lib.c,v
retrieving revision 1.2
diff -u -p -u -r1.2 srp_lib.c
--- src/crypto/srp/srp_lib.c 17 Apr 2014 13:37:49 -0000 1.2
+++ src/crypto/srp/srp_lib.c 24 Apr 2014 20:09:48 -0000
@@ -63,9 +63,7 @@
#include <openssl/evp.h>
#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(__arch64__)
# 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)
Index: src/crypto/ts/ts.h
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/ts/ts.h,v
retrieving revision 1.3
diff -u -p -u -r1.3 ts.h
--- src/crypto/ts/ts.h 21 Apr 2014 16:32:06 -0000 1.3
+++ src/crypto/ts/ts.h 24 Apr 2014 20:09:49 -0000
@@ -89,11 +89,6 @@
extern "C" {
#endif
-#ifdef WIN32
-/* Under Win32 this is defined in wincrypt.h */
-#undef X509_NAME
-#endif
-
#include <openssl/x509.h>
#include <openssl/x509v3.h>
Index: src/crypto/whrlpool/wp_block.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/whrlpool/wp_block.c,v
retrieving revision 1.4
diff -u -p -u -r1.4 wp_block.c
--- src/crypto/whrlpool/wp_block.c 18 Apr 2014 19:41:23 -0000 1.4
+++ src/crypto/whrlpool/wp_block.c 24 Apr 2014 20:09:50 -0000
@@ -40,13 +40,7 @@
#include <machine/endian.h>
typedef unsigned char u8;
-#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32)
-typedef unsigned __int64 u64;
-#elif defined(__arch64__)
-typedef unsigned long u64;
-#else
typedef unsigned long long u64;
-#endif
#define ROUNDS 10