提交 4700aea9 编写于 作者: U Ulf Möller

Add BeOS support.

PR: 1312
Submitted by: Oliver Tappe <zooey@hirschkaefer.de>
Reviewed by: Ulf Moeller
上级 60cdb821
...@@ -4,6 +4,13 @@ ...@@ -4,6 +4,13 @@
Changes between 0.9.8a and 0.9.9 [xx XXX xxxx] Changes between 0.9.8a and 0.9.9 [xx XXX xxxx]
*) BeOS support.
[Oliver Tappe <zooey@hirschkaefer.de>]
*) New make target "install_html_docs" installs HTML renditions of the
manual pages.
[Oliver Tappe <zooey@hirschkaefer.de>]
*) New utility "genpkey" this is analagous to "genrsa" etc except it can *) New utility "genpkey" this is analagous to "genrsa" etc except it can
generate keys for any algorithm. Extend and update EVP_PKEY_METHOD to generate keys for any algorithm. Extend and update EVP_PKEY_METHOD to
support key and parameter generation and add initial key generation support key and parameter generation and add initial key generation
......
...@@ -381,6 +381,10 @@ my %table=( ...@@ -381,6 +381,10 @@ my %table=(
"qnx4", "cc:-DL_ENDIAN -DTERMIO::(unknown):::${x86_gcc_des} ${x86_gcc_opts}:", "qnx4", "cc:-DL_ENDIAN -DTERMIO::(unknown):::${x86_gcc_des} ${x86_gcc_opts}:",
"qnx6", "cc:-DL_ENDIAN -DTERMIOS::(unknown)::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:", "qnx6", "cc:-DL_ENDIAN -DTERMIOS::(unknown)::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:",
# BeOS
"beos-x86-r5", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -mcpu=pentium -Wall::-D_REENTRANT:BEOS:-lbe -lnet:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:beos:beos-shared:-fPIC -DPIC:-shared:.so",
"beos-x86-bone", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -mcpu=pentium -Wall::-D_REENTRANT:BEOS:-lbe -lbind -lsocket:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:beos:beos-shared:-fPIC:-shared:.so",
#### SCO/Caldera targets. #### SCO/Caldera targets.
# #
# Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, etc. # Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, etc.
......
...@@ -170,6 +170,17 @@ link_a.gnu: ...@@ -170,6 +170,17 @@ link_a.gnu:
link_app.gnu: link_app.gnu:
@ $(DO_GNU_APP); $(LINK_APP) @ $(DO_GNU_APP); $(LINK_APP)
DO_BEOS_SO= SHLIB=lib$(LIBNAME).so; \
SHLIB_SUFFIX=; \
ALLSYMSFLAGS='-Wl,--whole-archive'; \
NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SUFFIX"
link_o.beos:
@ $(DO_BEOS_SO); $(LINK_SO_O)
link_a.beos:
@ $(DO_BEOS_SO); $(LINK_SO_A)
link_o.bsd: link_o.bsd:
@if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \ @if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
$(CALC_VERSIONS); \ $(CALC_VERSIONS); \
...@@ -543,7 +554,7 @@ symlink.hpux: ...@@ -543,7 +554,7 @@ symlink.hpux:
expr $(PLATFORM) : '.*ia64' > /dev/null && SHLIB=lib$(LIBNAME).so; \ expr $(PLATFORM) : '.*ia64' > /dev/null && SHLIB=lib$(LIBNAME).so; \
$(SYMLINK_SO) $(SYMLINK_SO)
# The following lines means those specific architectures do no symlinks # The following lines means those specific architectures do no symlinks
symlink.cygwin symlink.alpha-osf1 symlink.tru64 symlink.tru64-rpath: symlink.cygwin symlink.alpha-osf1 symlink.tru64 symlink.tru64-rpath symlink.beos:
# Compatibility targets # Compatibility targets
link_o.bsd-gcc-shared link_o.linux-shared link_o.gnu-shared: link_o.gnu link_o.bsd-gcc-shared link_o.linux-shared link_o.gnu-shared: link_o.gnu
...@@ -601,3 +612,7 @@ link_o.reliantunix-shared: link_o.reliantunix ...@@ -601,3 +612,7 @@ link_o.reliantunix-shared: link_o.reliantunix
link_a.reliantunix-shared: link_a.reliantunix link_a.reliantunix-shared: link_a.reliantunix
link_app.reliantunix-shared: link_app.reliantunix link_app.reliantunix-shared: link_app.reliantunix
symlink.reliantunix-shared: symlink.reliantunix symlink.reliantunix-shared: symlink.reliantunix
link_o.beos-shared: link_o.beos
link_a.beos-shared: link_a.beos
link_app.beos-shared: link_app.gnu
symlink.beos-shared: symlink.beos
...@@ -169,6 +169,10 @@ typedef unsigned int u_int; ...@@ -169,6 +169,10 @@ typedef unsigned int u_int;
#undef FIONBIO #undef FIONBIO
#endif #endif
#if defined(OPENSSL_SYS_BEOS_R5)
#include <fcntl.h>
#endif
#undef PROG #undef PROG
#define PROG s_client_main #define PROG s_client_main
...@@ -379,8 +383,11 @@ int MAIN(int argc, char **argv) ...@@ -379,8 +383,11 @@ int MAIN(int argc, char **argv)
char *engine_id=NULL; char *engine_id=NULL;
ENGINE *e=NULL; ENGINE *e=NULL;
#endif #endif
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE) #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS_R5)
struct timeval tv; struct timeval tv;
#if defined(OPENSSL_SYS_BEOS_R5)
int stdin_set = 0;
#endif
#endif #endif
#ifndef OPENSSL_NO_TLSEXT #ifndef OPENSSL_NO_TLSEXT
...@@ -949,7 +956,7 @@ re_start: ...@@ -949,7 +956,7 @@ re_start:
if (!ssl_pending) if (!ssl_pending)
{ {
#if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_NETWARE) #if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_NETWARE) && !defined (OPENSSL_SYS_BEOS_R5)
if (tty_on) if (tty_on)
{ {
if (read_tty) FD_SET(fileno(stdin),&readfds); if (read_tty) FD_SET(fileno(stdin),&readfds);
...@@ -1009,6 +1016,25 @@ re_start: ...@@ -1009,6 +1016,25 @@ re_start:
} else i=select(width,(void *)&readfds,(void *)&writefds, } else i=select(width,(void *)&readfds,(void *)&writefds,
NULL,NULL); NULL,NULL);
} }
#elif defined(OPENSSL_SYS_BEOS_R5)
/* Under BeOS-R5 the situation is similar to DOS */
i=0;
stdin_set = 0;
(void)fcntl(fileno(stdin), F_SETFL, O_NONBLOCK);
if(!write_tty) {
if(read_tty) {
tv.tv_sec = 1;
tv.tv_usec = 0;
i=select(width,(void *)&readfds,(void *)&writefds,
NULL,&tv);
if (read(fileno(stdin), sbuf, 0) >= 0)
stdin_set = 1;
if (!i && (stdin_set != 1 || !read_tty))
continue;
} else i=select(width,(void *)&readfds,(void *)&writefds,
NULL,NULL);
}
(void)fcntl(fileno(stdin), F_SETFL, 0);
#else #else
i=select(width,(void *)&readfds,(void *)&writefds, i=select(width,(void *)&readfds,(void *)&writefds,
NULL,NULL); NULL,NULL);
...@@ -1089,8 +1115,8 @@ re_start: ...@@ -1089,8 +1115,8 @@ re_start:
goto shut; goto shut;
} }
} }
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE) #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS_R5)
/* Assume Windows/DOS can always write */ /* Assume Windows/DOS/BeOS can always write */
else if (!ssl_pending && write_tty) else if (!ssl_pending && write_tty)
#else #else
else if (!ssl_pending && FD_ISSET(fileno(stdout),&writefds)) else if (!ssl_pending && FD_ISSET(fileno(stdout),&writefds))
...@@ -1178,6 +1204,8 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240 ...@@ -1178,6 +1204,8 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
#endif #endif
#elif defined (OPENSSL_SYS_NETWARE) #elif defined (OPENSSL_SYS_NETWARE)
else if (_kbhit()) else if (_kbhit())
#elif defined(OPENSSL_SYS_BEOS_R5)
else if (stdin_set)
#else #else
else if (FD_ISSET(fileno(stdin),&readfds)) else if (FD_ISSET(fileno(stdin),&readfds))
#endif #endif
......
...@@ -193,6 +193,10 @@ typedef unsigned int u_int; ...@@ -193,6 +193,10 @@ typedef unsigned int u_int;
#undef FIONBIO #undef FIONBIO
#endif #endif
#if defined(OPENSSL_SYS_BEOS_R5)
#include <fcntl.h>
#endif
#ifndef OPENSSL_NO_RSA #ifndef OPENSSL_NO_RSA
static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int is_export, int keylength); static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int is_export, int keylength);
#endif #endif
...@@ -1511,7 +1515,7 @@ static int sv_body(char *hostname, int s, unsigned char *context) ...@@ -1511,7 +1515,7 @@ static int sv_body(char *hostname, int s, unsigned char *context)
unsigned long l; unsigned long l;
SSL *con=NULL; SSL *con=NULL;
BIO *sbio; BIO *sbio;
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE) #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS_R5)
struct timeval tv; struct timeval tv;
#endif #endif
...@@ -1616,7 +1620,7 @@ static int sv_body(char *hostname, int s, unsigned char *context) ...@@ -1616,7 +1620,7 @@ static int sv_body(char *hostname, int s, unsigned char *context)
if (!read_from_sslcon) if (!read_from_sslcon)
{ {
FD_ZERO(&readfds); FD_ZERO(&readfds);
#if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_NETWARE) #if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_NETWARE) && !defined(OPENSSL_SYS_BEOS_R5)
FD_SET(fileno(stdin),&readfds); FD_SET(fileno(stdin),&readfds);
#endif #endif
FD_SET(s,&readfds); FD_SET(s,&readfds);
...@@ -1638,6 +1642,17 @@ static int sv_body(char *hostname, int s, unsigned char *context) ...@@ -1638,6 +1642,17 @@ static int sv_body(char *hostname, int s, unsigned char *context)
if((i < 0) || (!i && !_kbhit() ) )continue; if((i < 0) || (!i && !_kbhit() ) )continue;
if(_kbhit()) if(_kbhit())
read_from_terminal = 1; read_from_terminal = 1;
#elif defined(OPENSSL_SYS_BEOS_R5)
/* Under BeOS-R5 the situation is similar to DOS */
tv.tv_sec = 1;
tv.tv_usec = 0;
(void)fcntl(fileno(stdin), F_SETFL, O_NONBLOCK);
i=select(width,(void *)&readfds,NULL,NULL,&tv);
if ((i < 0) || (!i && read(fileno(stdin), buf, 0) < 0))
continue;
if (read(fileno(stdin), buf, 0) >= 0)
read_from_terminal = 1;
(void)fcntl(fileno(stdin), F_SETFL, 0);
#else #else
i=select(width,(void *)&readfds,NULL,NULL,NULL); i=select(width,(void *)&readfds,NULL,NULL,NULL);
if (i <= 0) continue; if (i <= 0) continue;
......
...@@ -122,6 +122,14 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in ...@@ -122,6 +122,14 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
echo "${MACHINE}-ibm-aix3"; exit 0 echo "${MACHINE}-ibm-aix3"; exit 0
;; ;;
BeOS:*:BePC)
if [ -e /boot/develop/headers/be/bone ]; then
echo "beos-x86-bone"; exit 0
else
echo "beos-x86-r5"; exit 0
fi
;;
dgux:*) dgux:*)
echo "${MACHINE}-dg-dgux"; exit 0 echo "${MACHINE}-dg-dgux"; exit 0
;; ;;
...@@ -759,6 +767,7 @@ case "$GUESSOS" in ...@@ -759,6 +767,7 @@ case "$GUESSOS" in
t3e-cray-unicosmk) OUT="cray-t3e" ;; t3e-cray-unicosmk) OUT="cray-t3e" ;;
j90-cray-unicos) OUT="cray-j90" ;; j90-cray-unicos) OUT="cray-j90" ;;
nsr-tandem-nsk) OUT="tandem-c89" ;; nsr-tandem-nsk) OUT="tandem-c89" ;;
beos-*) OUT="$GUESSOS" ;;
*) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;; *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
esac esac
......
...@@ -84,6 +84,11 @@ ...@@ -84,6 +84,11 @@
static int wsa_init_done=0; static int wsa_init_done=0;
#endif #endif
#if defined(OPENSSL_SYS_BEOS_BONE)
/* BONE's IP6 support is incomplete */
#undef AF_INET6
#endif
#if 0 #if 0
static unsigned long BIO_ghbn_hits=0L; static unsigned long BIO_ghbn_hits=0L;
static unsigned long BIO_ghbn_miss=0L; static unsigned long BIO_ghbn_miss=0L;
...@@ -220,6 +225,10 @@ int BIO_sock_error(int sock) ...@@ -220,6 +225,10 @@ int BIO_sock_error(int sock)
int j,i; int j,i;
int size; int size;
#if defined(OPENSSL_SYS_BEOS_R5)
return 0;
#endif
size=sizeof(int); size=sizeof(int);
/* Note: under Windows the third parameter is of type (char *) /* Note: under Windows the third parameter is of type (char *)
* whereas under other systems it is (void *) if you don't have * whereas under other systems it is (void *) if you don't have
...@@ -799,7 +808,7 @@ int BIO_accept(int sock, char **addr) ...@@ -799,7 +808,7 @@ int BIO_accept(int sock, char **addr)
if (addr == NULL) goto end; if (addr == NULL) goto end;
#ifdef EAI_FAMILY #ifdef EAI_FAMILY
# ifdef OPENSSL_SYS_VMS # if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_BEOS_BONE)
# define SOCKLEN_T size_t # define SOCKLEN_T size_t
# else # else
# define SOCKLEN_T socklen_t # define SOCKLEN_T socklen_t
......
...@@ -341,6 +341,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) ...@@ -341,6 +341,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
memcpy(&(data->peer), to, sizeof(struct sockaddr)); memcpy(&(data->peer), to, sizeof(struct sockaddr));
break; break;
#if defined(SO_RCVTIMEO)
case BIO_CTRL_DGRAM_SET_RECV_TIMEOUT: case BIO_CTRL_DGRAM_SET_RECV_TIMEOUT:
if ( setsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, ptr, if ( setsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, ptr,
sizeof(struct timeval)) < 0) sizeof(struct timeval)) < 0)
...@@ -351,6 +352,8 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) ...@@ -351,6 +352,8 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
ptr, (void *)&ret) < 0) ptr, (void *)&ret) < 0)
{ perror("getsockopt"); ret = -1; } { perror("getsockopt"); ret = -1; }
break; break;
#endif
#if defined(SO_SNDTIMEO)
case BIO_CTRL_DGRAM_SET_SEND_TIMEOUT: case BIO_CTRL_DGRAM_SET_SEND_TIMEOUT:
if ( setsockopt(b->num, SOL_SOCKET, SO_SNDTIMEO, ptr, if ( setsockopt(b->num, SOL_SOCKET, SO_SNDTIMEO, ptr,
sizeof(struct timeval)) < 0) sizeof(struct timeval)) < 0)
...@@ -361,6 +364,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr) ...@@ -361,6 +364,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
ptr, (void *)&ret) < 0) ptr, (void *)&ret) < 0)
{ perror("getsockopt"); ret = -1; } { perror("getsockopt"); ret = -1; }
break; break;
#endif
case BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP: case BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP:
/* fall-through */ /* fall-through */
case BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP: case BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP:
......
...@@ -436,6 +436,8 @@ unsigned long CRYPTO_thread_id(void) ...@@ -436,6 +436,8 @@ unsigned long CRYPTO_thread_id(void)
ret=(unsigned long)GetCurrentThreadId(); ret=(unsigned long)GetCurrentThreadId();
#elif defined(GETPID_IS_MEANINGLESS) #elif defined(GETPID_IS_MEANINGLESS)
ret=1L; ret=1L;
#elif defined(OPENSSL_SYS_BEOS)
ret=(unsigned long)find_thread(NULL);
#else #else
ret=(unsigned long)getpid(); ret=(unsigned long)getpid();
#endif #endif
......
...@@ -18,9 +18,9 @@ APPS= ...@@ -18,9 +18,9 @@ APPS=
LIB=$(TOP)/libcrypto.a LIB=$(TOP)/libcrypto.a
LIBSRC= dso_dl.c dso_dlfcn.c dso_err.c dso_lib.c dso_null.c \ LIBSRC= dso_dl.c dso_dlfcn.c dso_err.c dso_lib.c dso_null.c \
dso_openssl.c dso_win32.c dso_vms.c dso_openssl.c dso_win32.c dso_vms.c dso_beos.c
LIBOBJ= dso_dl.o dso_dlfcn.o dso_err.o dso_lib.o dso_null.o \ LIBOBJ= dso_dl.o dso_dlfcn.o dso_err.o dso_lib.o dso_null.o \
dso_openssl.o dso_win32.o dso_vms.o dso_openssl.o dso_win32.o dso_vms.o dso_beos.o
SRC= $(LIBSRC) SRC= $(LIBSRC)
......
...@@ -322,6 +322,9 @@ int DSO_pathbyaddr(void *addr,char *path,int sz); ...@@ -322,6 +322,9 @@ int DSO_pathbyaddr(void *addr,char *path,int sz);
* itself or libsocket. */ * itself or libsocket. */
void *DSO_global_lookup(const char *name); void *DSO_global_lookup(const char *name);
/* If BeOS is defined, use shared images. If not, return NULL. */
DSO_METHOD *DSO_METHOD_beos(void);
/* BEGIN ERROR CODES */ /* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes /* The following lines are auto generated by the script mkerr.pl. Any changes
* made after this point may be overwritten when the script is next run. * made after this point may be overwritten when the script is next run.
...@@ -331,6 +334,11 @@ void ERR_load_DSO_strings(void); ...@@ -331,6 +334,11 @@ void ERR_load_DSO_strings(void);
/* Error codes for the DSO functions. */ /* Error codes for the DSO functions. */
/* Function codes. */ /* Function codes. */
#define DSO_F_BEOS_BIND_FUNC 130
#define DSO_F_BEOS_BIND_VAR 131
#define DSO_F_BEOS_LOAD 132
#define DSO_F_BEOS_NAME_CONVERTER 133
#define DSO_F_BEOS_UNLOAD 134
#define DSO_F_DLFCN_BIND_FUNC 100 #define DSO_F_DLFCN_BIND_FUNC 100
#define DSO_F_DLFCN_BIND_VAR 101 #define DSO_F_DLFCN_BIND_VAR 101
#define DSO_F_DLFCN_LOAD 102 #define DSO_F_DLFCN_LOAD 102
......
...@@ -70,6 +70,11 @@ ...@@ -70,6 +70,11 @@
static ERR_STRING_DATA DSO_str_functs[]= static ERR_STRING_DATA DSO_str_functs[]=
{ {
{ERR_FUNC(DSO_F_BEOS_BIND_FUNC), "BEOS_BIND_FUNC"},
{ERR_FUNC(DSO_F_BEOS_BIND_VAR), "BEOS_BIND_VAR"},
{ERR_FUNC(DSO_F_BEOS_LOAD), "BEOS_LOAD"},
{ERR_FUNC(DSO_F_BEOS_NAME_CONVERTER), "BEOS_NAME_CONVERTER"},
{ERR_FUNC(DSO_F_BEOS_UNLOAD), "BEOS_UNLOAD"},
{ERR_FUNC(DSO_F_DLFCN_BIND_FUNC), "DLFCN_BIND_FUNC"}, {ERR_FUNC(DSO_F_DLFCN_BIND_FUNC), "DLFCN_BIND_FUNC"},
{ERR_FUNC(DSO_F_DLFCN_BIND_VAR), "DLFCN_BIND_VAR"}, {ERR_FUNC(DSO_F_DLFCN_BIND_VAR), "DLFCN_BIND_VAR"},
{ERR_FUNC(DSO_F_DLFCN_LOAD), "DLFCN_LOAD"}, {ERR_FUNC(DSO_F_DLFCN_LOAD), "DLFCN_LOAD"},
......
...@@ -74,6 +74,8 @@ DSO_METHOD *DSO_METHOD_openssl(void) ...@@ -74,6 +74,8 @@ DSO_METHOD *DSO_METHOD_openssl(void)
return(DSO_METHOD_win32()); return(DSO_METHOD_win32());
#elif defined(DSO_VMS) #elif defined(DSO_VMS)
return(DSO_METHOD_vms()); return(DSO_METHOD_vms());
#elif defined(DSO_BEOS)
return(DSO_METHOD_beos());
#else #else
return(DSO_METHOD_null()); return(DSO_METHOD_null());
#endif #endif
......
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
* RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255. * RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255.
*/ */
#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_VOS) #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_VOS) || defined(OPENSSL_SYS_BEOS)
int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
{ {
return(-1); return(-1);
......
...@@ -205,6 +205,16 @@ int RAND_poll(void) ...@@ -205,6 +205,16 @@ int RAND_poll(void)
do do
{ {
#if defined(OPENSSL_SYS_BEOS_R5)
/* select() is broken in BeOS R5, so we simply
* try to read something and snooze if we couldn't: */
r=read(fd,(unsigned char *)tmpbuf+n,
ENTROPY_NEEDED-n);
if (r > 0)
n += r;
else if (r == 0)
snooze(t.tv_usec);
#else
FD_ZERO(&fset); FD_ZERO(&fset);
FD_SET(fd, &fset); FD_SET(fd, &fset);
r = -1; r = -1;
...@@ -218,7 +228,7 @@ int RAND_poll(void) ...@@ -218,7 +228,7 @@ int RAND_poll(void)
if (r > 0) if (r > 0)
n += r; n += r;
} }
#endif
/* Some Unixen will update t, some /* Some Unixen will update t, some
won't. For those who won't, give won't. For those who won't, give
up here, otherwise, we will do up here, otherwise, we will do
...@@ -267,6 +277,14 @@ int RAND_poll(void) ...@@ -267,6 +277,14 @@ int RAND_poll(void)
l=time(NULL); l=time(NULL);
RAND_add(&l,sizeof(l),0.0); RAND_add(&l,sizeof(l),0.0);
#if defined(OPENSSL_SYS_BEOS)
{
system_info sysInfo;
get_system_info(&sysInfo);
RAND_add(&sysInfo,sizeof(sysInfo),0);
}
#endif
#if defined(DEVRANDOM) || defined(DEVRANDOM_EGD) #if defined(DEVRANDOM) || defined(DEVRANDOM_EGD)
return 1; return 1;
#else #else
......
...@@ -117,11 +117,13 @@ void solaris_locking_callback(int mode,int type,char *file,int line); ...@@ -117,11 +117,13 @@ void solaris_locking_callback(int mode,int type,char *file,int line);
void win32_locking_callback(int mode,int type,char *file,int line); void win32_locking_callback(int mode,int type,char *file,int line);
void pthreads_locking_callback(int mode,int type,char *file,int line); void pthreads_locking_callback(int mode,int type,char *file,int line);
void netware_locking_callback(int mode,int type,char *file,int line); void netware_locking_callback(int mode,int type,char *file,int line);
void beos_locking_callback(int mode,int type,const char *file,int line);
unsigned long irix_thread_id(void ); unsigned long irix_thread_id(void );
unsigned long solaris_thread_id(void ); unsigned long solaris_thread_id(void );
unsigned long pthreads_thread_id(void ); unsigned long pthreads_thread_id(void );
unsigned long netware_thread_id(void ); unsigned long netware_thread_id(void );
unsigned long beos_thread_id(void );
#if defined(OPENSSL_SYS_NETWARE) #if defined(OPENSSL_SYS_NETWARE)
static MPKMutex *lock_cs; static MPKMutex *lock_cs;
...@@ -1209,3 +1211,100 @@ unsigned long netware_thread_id(void) ...@@ -1209,3 +1211,100 @@ unsigned long netware_thread_id(void)
return(ret); return(ret);
} }
#endif /* NETWARE */ #endif /* NETWARE */
#ifdef BEOS_THREADS
#include <Locker.h>
static BLocker** lock_cs;
static long* lock_count;
void thread_setup(void)
{
int i;
lock_cs=(BLocker**)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(BLocker*));
lock_count=(long*)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
for (i=0; i<CRYPTO_num_locks(); i++)
{
lock_count[i]=0;
lock_cs[i] = new BLocker(CRYPTO_get_lock_name(i));
}
CRYPTO_set_id_callback((unsigned long (*)())beos_thread_id);
CRYPTO_set_locking_callback(beos_locking_callback);
}
void thread_cleanup(void)
{
int i;
CRYPTO_set_locking_callback(NULL);
fprintf(stderr,"cleanup\n");
for (i=0; i<CRYPTO_num_locks(); i++)
{
delete lock_cs[i];
fprintf(stderr,"%8ld:%s\n",lock_count[i],
CRYPTO_get_lock_name(i));
}
OPENSSL_free(lock_cs);
OPENSSL_free(lock_count);
fprintf(stderr,"done cleanup\n");
}
void beos_locking_callback(int mode, int type, const char *file, int line)
{
#if 0
fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n",
CRYPTO_thread_id(),
(mode&CRYPTO_LOCK)?"l":"u",
(type&CRYPTO_READ)?"r":"w",file,line);
#endif
if (mode & CRYPTO_LOCK)
{
lock_cs[type]->Lock();
lock_count[type]++;
}
else
{
lock_cs[type]->Unlock();
}
}
void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx)
{
SSL_CTX *ssl_ctx[2];
thread_id thread_ctx[MAX_THREAD_NUMBER];
int i;
ssl_ctx[0]=s_ctx;
ssl_ctx[1]=c_ctx;
for (i=0; i<thread_number; i++)
{
thread_ctx[i] = spawn_thread((thread_func)ndoit,
NULL, B_NORMAL_PRIORITY, (void *)ssl_ctx);
resume_thread(thread_ctx[i]);
}
printf("waiting...\n");
for (i=0; i<thread_number; i++)
{
status_t result;
wait_for_thread(thread_ctx[i], &result);
}
printf("beos threads done (%d,%d)\n",
s_ctx->references,c_ctx->references);
}
unsigned long beos_thread_id(void)
{
unsigned long ret;
ret=(unsigned long)find_thread(NULL);
return(ret);
}
#endif /* BEOS_THREADS */
...@@ -473,7 +473,7 @@ static int open_console(UI *ui) ...@@ -473,7 +473,7 @@ static int open_console(UI *ui)
CRYPTO_w_lock(CRYPTO_LOCK_UI); CRYPTO_w_lock(CRYPTO_LOCK_UI);
is_a_tty = 1; is_a_tty = 1;
#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS)
tty_in=stdin; tty_in=stdin;
tty_out=stderr; tty_out=stderr;
#else #else
......
...@@ -178,6 +178,13 @@ extern "C" { ...@@ -178,6 +178,13 @@ extern "C" {
#define closesocket(s) close(s) #define closesocket(s) close(s)
#define readsocket(s,b,n) read((s),(b),(n)) #define readsocket(s,b,n) read((s),(b),(n))
#define writesocket(s,b,n) write((s),(char *)(b),(n)) #define writesocket(s,b,n) write((s),(char *)(b),(n))
#elif defined(OPENSSL_SYS_BEOS_R5)
#define get_last_socket_error() errno
#define clear_socket_error() errno=0
#define FIONBIO SO_NONBLOCK
#define ioctlsocket(a,b,c) setsockopt((a),SOL_SOCKET,(b),(c),sizeof(*(c)))
#define readsocket(s,b,n) recv((s),(b),(n),0)
#define writesocket(s,b,n) send((s),(b),(n),0)
#elif defined(OPENSSL_SYS_NETWARE) #elif defined(OPENSSL_SYS_NETWARE)
#if defined(NETWARE_BSDSOCK) #if defined(NETWARE_BSDSOCK)
#define get_last_socket_error() errno #define get_last_socket_error() errno
...@@ -519,8 +526,10 @@ static unsigned int _strlen31(const char *str) ...@@ -519,8 +526,10 @@ static unsigned int _strlen31(const char *str)
# include <sys/filio.h> /* Added for FIONBIO under unixware */ # include <sys/filio.h> /* Added for FIONBIO under unixware */
# endif # endif
# include <netinet/in.h> # include <netinet/in.h>
# if !defined(OPENSSL_SYS_BEOS_R5)
# include <arpa/inet.h> # include <arpa/inet.h>
# endif # endif
# endif
# if defined(NeXT) || defined(_NEXT_SOURCE) # if defined(NeXT) || defined(_NEXT_SOURCE)
# include <sys/fcntl.h> # include <sys/fcntl.h>
...@@ -661,6 +670,15 @@ struct servent *getservbyname(const char *name, const char *proto); ...@@ -661,6 +670,15 @@ struct servent *getservbyname(const char *name, const char *proto);
#endif #endif
/* end vxworks */ /* end vxworks */
/* beos */
#if defined(OPENSSL_SYS_BEOS_R5)
#define SO_ERROR 0
#define NO_SYS_UN
#define IPPROTO_IP 0
#include <OS.h>
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -202,6 +202,17 @@ extern "C" { ...@@ -202,6 +202,17 @@ extern "C" {
# define OPENSSL_SYS_VXWORKS # define OPENSSL_SYS_VXWORKS
#endif #endif
/* --------------------------------- BeOS ---------------------------------- */
#if defined(__BEOS__)
# define OPENSSL_SYS_BEOS
# include <sys/socket.h>
# if defined(BONE_VERSION)
# define OPENSSL_SYS_BEOS_BONE
# else
# define OPENSSL_SYS_BEOS_R5
# endif
#endif
/** /**
* That's it for OS-specific stuff * That's it for OS-specific stuff
*****************************************************************************/ *****************************************************************************/
......
...@@ -93,6 +93,7 @@ install: ...@@ -93,6 +93,7 @@ install:
( echo installing $$l; \ ( echo installing $$l; \
if [ "$(PLATFORM)" != "Cygwin" ]; then \ if [ "$(PLATFORM)" != "Cygwin" ]; then \
case "$(CFLAGS)" in \ case "$(CFLAGS)" in \
*DSO_BEOS*) sfx="so";; \
*DSO_DLFCN*) sfx="so";; \ *DSO_DLFCN*) sfx="so";; \
*DSO_DL*) sfx="sl";; \ *DSO_DL*) sfx="sl";; \
*) sfx="bad";; \ *) sfx="bad";; \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册