From e527201f6be3c295358bcc8b6bafec598f02dc97 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Mon, 22 Dec 2008 13:54:12 +0000 Subject: This _WIN32-specific patch makes it possible to "wrap" OpenSSL in another .DLL, in particular static build. The issue has been discussed in RT#1230 and later on openssl-dev, and mutually exclusive approaches were suggested. This completes compromise solution suggested in RT#1230. PR: 1230 --- crypto/bio/bss_file.c | 2 +- crypto/des/enc_read.c | 4 ++++ crypto/des/enc_writ.c | 4 ++++ crypto/ocsp/ocsp_ht.c | 3 ++- crypto/rand/randfile.c | 7 +++++++ crypto/ui/ui_openssl.c | 2 ++ crypto/x509/by_dir.c | 3 +++ 7 files changed, 23 insertions(+), 2 deletions(-) (limited to 'crypto') diff --git a/crypto/bio/bss_file.c b/crypto/bio/bss_file.c index 545c1b2bdd..480208a315 100644 --- a/crypto/bio/bss_file.c +++ b/crypto/bio/bss_file.c @@ -279,7 +279,7 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) #endif { #if defined(OPENSSL_SYS_WINDOWS) - int fd = fileno((FILE*)ptr); + int fd = _fileno((FILE*)ptr); if (num & BIO_FP_TEXT) _setmode(fd,_O_TEXT); else diff --git a/crypto/des/enc_read.c b/crypto/des/enc_read.c index b86620f568..372ef667b8 100644 --- a/crypto/des/enc_read.c +++ b/crypto/des/enc_read.c @@ -150,7 +150,11 @@ int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched, /* first - get the length */ while (net_num < HDRSIZE) { +#ifndef _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 diff --git a/crypto/des/enc_writ.c b/crypto/des/enc_writ.c index 6e25b6d4f0..2353ac1e89 100644 --- a/crypto/des/enc_writ.c +++ b/crypto/des/enc_writ.c @@ -156,7 +156,11 @@ 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/crypto/ocsp/ocsp_ht.c b/crypto/ocsp/ocsp_ht.c index dd25f5c85f..38602fae4a 100644 --- a/crypto/ocsp/ocsp_ht.c +++ b/crypto/ocsp/ocsp_ht.c @@ -56,11 +56,12 @@ * */ -#include #include #include #include #include +#include "e_os.h" +#include #include #include #include diff --git a/crypto/rand/randfile.c b/crypto/rand/randfile.c index c4e6160779..4723feecaf 100644 --- a/crypto/rand/randfile.c +++ b/crypto/rand/randfile.c @@ -79,6 +79,13 @@ # include #endif +#ifdef _WIN32 +#define stat _stat +#define chmod _chmod +#define open _open +#define fdopen _fdopen +#endif + #undef BUFSIZE #define BUFSIZE 1024 #define RAND_DATA 1024 diff --git a/crypto/ui/ui_openssl.c b/crypto/ui/ui_openssl.c index 8eabb850ff..1c2dcc406e 100644 --- a/crypto/ui/ui_openssl.c +++ b/crypto/ui/ui_openssl.c @@ -677,6 +677,8 @@ static int noecho_fgets(char *buf, int size, FILE *tty) size--; #ifdef WIN16TTY i=_inchar(); +#elif defined(_WIN32) + i=_getch(); #else i=getch(); #endif diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c index b355de9b1c..170cd89608 100644 --- a/crypto/x509/by_dir.c +++ b/crypto/x509/by_dir.c @@ -392,6 +392,9 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, postfix,k); } #ifndef OPENSSL_NO_POSIX_IO +#ifdef _WIN32 +#define stat _stat +#endif { struct stat st; if (stat(b->data,&st) < 0) -- cgit v1.2.3