I just applied the patch and committed. Please test tomorrows
snapshot.
This ticket is now resolved.
[[EMAIL PROTECTED] - Tue Nov 12 22:31:27 2002]:
> Here are some patches for MSDOS and djgpp using Watt-32 tcp/ip
stack.
> Patch against snapshot 11-Nov 2002.
>
> 1. sock_init() renamed to ssl_sock_init() in ./apps/s_socket.c due
> to name-clash with Watt-32.
>
> 2. rand() renamed to Rand() in ./crypto/bn/divtest.c due to
name-clash
> with <stdlib.h>
>
> 3. Added calls to dbug_init()/sock_init() in some demo programs.
>
> 4. Changed cflags/lflags in configure. Watt-32 install root now
taken
> from $WATT_ROOT.
>
> -------------------------------------------
>
> diff -B -H -u3 -r ./apps/s_client.c ./patch/apps/s_client.c
> --- ./apps/s_client.c Tue Jul 16 07:00:18 2002
> +++ ./patch/apps/s_client.c Tue Nov 12 18:06:32 2002
> @@ -746,8 +746,8 @@
> goto shut;
> }
> }
> -#ifdef OPENSSL_SYS_WINDOWS
> - /* Assume Windows can always write */
> +#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS)
> + /* Assume Windows/DOS can always write */
> else if (!ssl_pending && write_tty)
> #else
> else if (!ssl_pending && FD_ISSET(fileno(stdout),&writefds))
>
> diff -B -H -u3 -r ./apps/s_server.c ./patch/apps/s_server.c
> --- ./apps/s_server.c Thu Aug 15 15:00:20 2002
> +++ ./patch/apps/s_server.c Tue Nov 12 18:02:08 2002
> @@ -1473,8 +1473,8 @@
> else
> {
> BIO_printf(bio_s_out,"read R BLOCK\n");
> -#ifndef OPENSSL_SYS_MSDOS
> - sleep(1);
> +#if !defined(OPENSSL_SYS_MSDOS) && !defined(__DJGPP__)
> + sleep(1);
> #endif
> continue;
> }
>
> diff -B -H -u3 -r ./apps/s_socket.c ./patch/apps/s_socket.c
> --- ./apps/s_socket.c Tue Feb 20 18:00:10 2001
> +++ ./patch/apps/s_socket.c Thu Sep 13 08:23:08 2002
> @@ -85,7 +85,7 @@
> #ifdef OPENSSL_SYS_WINDOWS
> static void sock_cleanup(void);
> #endif
> -static int sock_init(void);
> +static int ssl_sock_init(void);
> static int init_client_ip(int *sock,unsigned char ip[4], int
port);
> static int init_server(int *sock, int port);
> static int init_server_long(int *sock, int port,char *ip);
> @@ -146,9 +146,16 @@
> }
> #endif
>
> -static int sock_init(void)
> +static int ssl_sock_init(void)
> {
> -#ifdef OPENSSL_SYS_WINDOWS
> +#ifdef WATT32
> + extern int _watt_do_exit;
> + _watt_do_exit = 0;
> + dbug_init();
> + if (sock_init())
> + return (0);
> +
> +#elif defined(OPENSSL_SYS_WINDOWS)
> if (!wsa_init_done)
> {
> int err;
> @@ -196,7 +203,7 @@
> struct sockaddr_in them;
> int s,i;
>
> - if (!sock_init()) return(0);
> + if (!ssl_sock_init()) return(0);
>
> memset((char *)&them,0,sizeof(them));
> them.sin_family=AF_INET;
> @@ -261,7 +268,7 @@
> struct sockaddr_in server;
> int s= -1,i;
>
> - if (!sock_init()) return(0);
> + if (!ssl_sock_init()) return(0);
>
> memset((char *)&server,0,sizeof(server));
> server.sin_family=AF_INET;
> @@ -318,7 +325,7 @@
> int len;
> /* struct linger ling; */
>
> - if (!sock_init()) return(0);
> + if (!ssl_sock_init()) return(0);
>
> #ifndef OPENSSL_SYS_WINDOWS
> redoit:
> @@ -448,7 +455,7 @@
> { /* do a gethostbyname */
> struct hostent *he;
>
> - if (!sock_init()) return(0);
> + if (!ssl_sock_init()) return(0);
>
> he=GetHostByName(str);
> if (he == NULL)
>
> diff -B -H -u3 -r ./configur ./patch/configur
> --- ./configur Tue Nov 12 17:56:10 2002
> +++ ./patch/configur Tue Nov 12 18:00:44 2002
> @@ -521,7 +521,7 @@
> "Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486
> -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des}
> ${x86_gcc_opts}:${x86_out_asm}:win32:cygwin-shared:::.dll",
>
> # DJGPP
> -"DJGPP",
> "gcc:-I/dev/env/DJDIR/watt32/inc -DTERMIOS -DL_ENDIAN
> -fomit-frame-pointer -O2
-Wall:::MSDOS:-L/dev/env/DJDIR/watt32/lib
> -lwatt:BN_L
> LONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::",
> +"DJGPP",
> "gcc:-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN
> -fomit-frame-pointer -O2 -Wall:::MSDOS:-L/dev/env/WATT_ROOT/lib
> -lwatt:BN_LLONG
> ${x86_gcc_des} ${x86_gcc_opts}::::::::::",
>
> # Ultrix from Bernhard Simon <[EMAIL PROTECTED]>
> "ultrix-cc","cc:-std1 -O -Olimit 1000
-DL_ENDIAN::(unknown):::::::",
>
> diff -B -H -u3 -r ./crypto/bio/b_sock.c ./patch/crypto/bio/b_sock.c
> --- ./crypto/bio/b_sock.c Thu Jun 13 21:00:34 2002
> +++ ./patch/crypto/bio/b_sock.c Mon Jun 17 11:24:28 2002
> @@ -463,7 +463,14 @@
> }
> }
> #endif /* OPENSSL_SYS_WINDOWS */
> - return(1);
> +
> +#ifdef WATT32
> + extern int _watt_do_exit;
> + _watt_do_exit = 0; /* don't make sock_init() call
exit()
> */
> + if (sock_init())
> + return (-1);
> +#endif
> + return(1);
> }
>
> void BIO_sock_cleanup(void)
>
> diff -B -H -u3 -r ./crypto/bio/bss_log.c
./patch/crypto/bio/bss_log.c
> --- ./crypto/bio/bss_log.c Thu Feb 14 16:00:44 2002
> +++ ./patch/crypto/bio/bss_log.c Tue Nov 12 18:04:32 2002
> @@ -77,7 +77,7 @@
> # include <starlet.h>
> #elif defined(__ultrix)
> # include <sys/syslog.h>
> -#elif !defined(MSDOS) && !defined(OPENSSL_SYS_VXWORKS) &&
> !defined(NO_SYSLOG) /* Unix */
> +#elif (!defined(MSDOS) || defined(WATT32)) &&
> !defined(OPENSSL_SYS_VXWORKS) && !defined(NO_SYSLOG)
> # include <syslog.h>
> #endif
>
> @@ -373,11 +373,15 @@
> {
> }
>
> -#else /* Unix */
> +#else /* Unix/Watt32 */
>
> static void xopenlog(BIO* bp, char* name, int level)
> {
> - openlog(name, LOG_PID|LOG_CONS, level);
> +#ifdef WATT32 /* djgpp/DOS */
> + openlog(name, LOG_PID|LOG_CONS|LOG_NDELAY, level);
> +#else
> + openlog(name, LOG_PID|LOG_CONS, level);
> +#endif
> }
>
> static void xsyslog(BIO *bp, int priority, const char *string)
>
> diff -B -H -u3 -r ./crypto/bio/bss_sock.c
> ./patch/crypto/bio/bss_sock.c
> --- ./crypto/bio/bss_sock.c Tue Feb 20 09:00:38 2001
> +++ ./patch/crypto/bio/bss_sock.c Wed Feb 21 10:27:04 2001
> @@ -64,6 +64,12 @@
> #include "cryptlib.h"
> #include <openssl/bio.h>
>
> +#ifdef WATT32
> +#define sock_write SockWrite /* Watt-32 uses same names */
> +#define sock_read SockRead
> +#define sock_puts SockPuts
> +#endif
> +
> static int sock_write(BIO *h, const char *buf, int num);
> static int sock_read(BIO *h, char *buf, int size);
> static int sock_puts(BIO *h, const char *str);
>
> diff -B -H -u3 -r ./crypto/bn/divtest.c ./patch/crypto/bn/divtest.c
> --- ./crypto/bn/divtest.c Sun Feb 27 23:00:38 2000
> +++ ./patch/crypto/bn/divtest.c Thu Mar 14 08:25:26 2002
> @@ -1,7 +1,7 @@
> #include <openssl/bn.h>
> #include <openssl/rand.h>
>
> -static int rand(n)
> +static int Rand(n)
> {
> unsigned char x[2];
> RAND_pseudo_bytes(x,2);
> @@ -26,8 +26,8 @@
> BN_CTX *ctx=BN_CTX_new();
>
> for(;;) {
> - BN_pseudo_rand(a,rand(),0,0);
> - BN_pseudo_rand(b,rand(),0,0);
> + BN_pseudo_rand(a,Rand(),0,0);
> + BN_pseudo_rand(b,Rand(),0,0);
> if (BN_is_zero(b)) continue;
>
> BN_RECP_CTX_set(recp,b,ctx);
>
> diff -B -H -u3 -r ./demos/bio/saccept.c ./patch/demos/bio/saccept.c
> --- ./demos/bio/saccept.c Fri Feb 4 15:00:26 2000
> +++ ./patch/demos/bio/saccept.c Thu Sep 13 08:24:26 2001
> @@ -45,6 +45,11 @@
>
> SSL_load_error_strings();
>
> +#ifdef WATT32
> + dbug_init();
> + sock_init();
> +#endif
> +
> /* Add ciphers and message digests */
> OpenSSL_add_ssl_algorithms();
>
> diff -B -H -u3 -r ./demos/bio/sconnect.c
./patch/demos/bio/sconnect.c
> --- ./demos/bio/sconnect.c Fri Feb 4 15:00:26 2000
> +++ ./patch/demos/bio/sconnect.c Thu Sep 13 08:24:10 2001
> @@ -32,6 +32,10 @@
> else
> host=argv[1];
>
> +#ifdef WATT32
> + dbug_init();
> + sock_init();
> +#endif
> /* Lets get nice error messages */
> SSL_load_error_strings();
>
> diff -B -H -u3 -r ./e_os.h ./patch/e_os.h
> --- ./e_os.h Wed Oct 9 14:00:26 2002
> +++ ./patch/e_os.h Tue Nov 12 18:01:26 2002
> @@ -154,6 +154,13 @@
> #define readsocket(s,b,n) recv((s),(b),(n),0)
> #define writesocket(s,b,n) send((s),(b),(n),0)
> #define EADDRINUSE WSAEADDRINUSE
> +#elif defined(__DJGPP__)
> +#define WATT32
> +#define get_last_socket_error() errno
> +#define clear_socket_error() errno=0
> +#define closesocket(s) close_s(s)
> +#define readsocket(s,b,n) read_s(s,b,n)
> +#define writesocket(s,b,n) send(s,b,n,0)
> #elif defined(MAC_OS_pre_X)
> #define get_last_socket_error() errno
> #define clear_socket_error() errno=0
> @@ -207,7 +214,7 @@
> # define S_IFMT _S_IFMT
> # endif
>
> -# if !defined(WINNT)
> +# if !defined(WINNT) && !defined(__DJGPP__)
> # define NO_SYSLOG
> # endif
> # define NO_DIRENT
> @@ -344,7 +351,7 @@
> /*************/
>
> #ifdef USE_SOCKETS
> -# if (defined(WINDOWS) || defined(MSDOS)) && !defined(__DJGPP__)
> +# if defined(WINDOWS) || defined(MSDOS)
> /* windows world */
>
> # ifdef OPENSSL_NO_SOCK
> @@ -352,13 +359,18 @@
> # define SSLeay_Read(a,b,c) (-1)
> # define SHUTDOWN(fd) close(fd)
> # define SHUTDOWN2(fd) close(fd)
> -# else
> +# elif defined(WINDOWS)
> # include <winsock.h>
> extern HINSTANCE _hInstance;
> # define SSLeay_Write(a,b,c) send((a),(b),(c),0)
> # define SSLeay_Read(a,b,c) recv((a),(b),(c),0)
> # define SHUTDOWN(fd) { shutdown((fd),0); closesocket(fd); }
> # define SHUTDOWN2(fd) { shutdown((fd),2); closesocket(fd);
}
> +# elif defined(__DJGPP__)
> +# define SSLeay_Write(a,b,c) write_s(a,b,c,0)
> +# define SSLeay_Read(a,b,c) read_s(a,b,c)
> +# define SHUTDOWN(fd) close_s(fd)
> +# define SHUTDOWN2(fd) close_s(fd)
> # endif
>
> # elif defined(MAC_OS_pre_X)
>
>
--------------------------------------------------------------------------
>
> Gisle V.
>
>
>
______________________________________________________________________
> OpenSSL Project
http://www.openssl.org
> Development Mailing List
[EMAIL PROTECTED]
> Automated List Manager
[EMAIL PROTECTED]
--
Richard Levitte
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]