summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES19
-rwxr-xr-xConfigure20
-rw-r--r--INSTALL.NW130
-rw-r--r--Netware/build.bat33
-rw-r--r--Netware/cpy_tests.bat1
-rw-r--r--Netware/do_tests.pl172
-rw-r--r--Netware/set_env.bat74
-rw-r--r--apps/ca.c9
-rw-r--r--apps/ocsp.c5
-rw-r--r--crypto/bio/b_sock.c22
-rw-r--r--crypto/bio/bss_dgram.c6
-rw-r--r--crypto/bio/bss_file.c8
-rw-r--r--crypto/engine/eng_padlock.c3
-rw-r--r--crypto/perlasm/x86nasm.pl3
-rw-r--r--crypto/rand/rand_nw.c11
-rw-r--r--crypto/rc4/asm/rc4-586.pl2
-rw-r--r--e_os.h34
-rw-r--r--engines/e_aep.c5
-rwxr-xr-xutil/mk1mf.pl7
-rw-r--r--util/pl/netware.pl375
20 files changed, 643 insertions, 296 deletions
diff --git a/CHANGES b/CHANGES
index b9e4c7a557..41b8a41f91 100644
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,25 @@
Changes between 0.9.8g and 0.9.8h [xx XXX xxxx]
+ *) Netware support:
+
+ - fixed wrong usage of ioctlsocket() when build for LIBC BSD sockets
+ - fixed do_tests.pl to run the test suite with CLIB builds too (CLIB_OPT)
+ - added some more tests to do_tests.pl
+ - fixed RunningProcess usage so that it works with newer LIBC NDKs too
+ - removed usage of BN_LLONG for CLIB builds to avoid runtime dependency
+ - added new Configure targets netware-clib-bsdsock, netware-clib-gcc,
+ netware-clib-bsdsock-gcc, netware-libc-bsdsock-gcc
+ - various changes to netware.pl to enable gcc-cross builds on Win32
+ platform
+ - changed crypto/bio/b_sock.c to work with macro functions (CLIB BSD)
+ - various changes to fix missing prototype warnings
+ - fixed x86nasm.pl to create correct asm files for NASM COFF output
+ - added AES, WHIRLPOOL and CPUID assembler code to build files
+ - added missing AES assembler make rules to mk1mf.pl
+ - fixed order of includes in apps/ocsp.c so that e_os.h settings apply
+ [Guenter Knauf <eflash@gmx.net>]
+
*) Implement certificate status request TLS extension defined in RFC3546.
A client can set the appropriate parameters and receive the encoded
OCSP response via a callback. A server can query the supplied parameters
diff --git a/Configure b/Configure
index a946b6a69e..a30715dfb3 100755
--- a/Configure
+++ b/Configure
@@ -479,15 +479,20 @@ my %table=(
"Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::CYGWIN32::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_coff_asm}:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
"debug-Cygwin", "gcc:-DTERMIOS -DL_ENDIAN -march=i486 -Wall -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror:::CYGWIN32:::${no_asm}:dlfcn:cygwin-shared:-D_WINDLL:-shared:.dll.a",
-# NetWare from David Ward (dsward@novell.com) - requires MetroWerks NLM development tools
+# NetWare from David Ward (dsward@novell.com)
+# requires either MetroWerks NLM development tools, or gcc / nlmconv
+# NetWare defaults socket bio to WinSock sockets. However,
+# the builds can be configured to use BSD sockets instead.
# netware-clib => legacy CLib c-runtime support
-"netware-clib", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::",
+"netware-clib", "mwccnlm::::::${x86_gcc_opts}::",
+"netware-clib-bsdsock", "mwccnlm::::::${x86_gcc_opts}::",
+"netware-clib-gcc", "i586-netware-gcc:-nostdinc -I/ndk/nwsdk/include/nlm -I/ndk/ws295sdk/include -DL_ENDIAN -DNETWARE_CLIB -DOPENSSL_SYSNAME_NETWARE -O2 -Wall:::::${x86_gcc_opts}::",
+"netware-clib-bsdsock-gcc", "i586-netware-gcc:-nostdinc -I/ndk/nwsdk/include/nlm -DNETWARE_BSDSOCK -DNETDB_USE_INTERNET -DL_ENDIAN -DNETWARE_CLIB -DOPENSSL_SYSNAME_NETWARE -O2 -Wall:::::${x86_gcc_opts}::",
# netware-libc => LibC/NKS support
-# NetWare defaults socket bio to WinSock sockets. However, the LibC build can be
-# configured to use BSD sockets instead.
"netware-libc", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::",
"netware-libc-bsdsock", "mwccnlm::::::BN_LLONG ${x86_gcc_opts}::",
"netware-libc-gcc", "i586-netware-gcc:-nostdinc -I/ndk/libc/include -I/ndk/libc/include/winsock -DL_ENDIAN -DNETWARE_LIBC -DOPENSSL_SYSNAME_NETWARE -DTERMIO -O2 -Wall:::::BN_LLONG ${x86_gcc_opts}::",
+"netware-libc-bsdsock-gcc", "i586-netware-gcc:-nostdinc -I/ndk/libc/include -DNETWARE_BSDSOCK -DL_ENDIAN -DNETWARE_LIBC -DOPENSSL_SYSNAME_NETWARE -DTERMIO -O2 -Wall:::::BN_LLONG ${x86_gcc_opts}::",
# DJGPP
"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}:${x86_out_asm}:",
@@ -532,7 +537,9 @@ my %table=(
my @MK1MF_Builds=qw(VC-WIN64I VC-WIN64A
VC-NT VC-CE VC-WIN32
- BC-32 OS2-EMX netware-clib netware-libc netware-libc-bsdsock);
+ BC-32 OS2-EMX
+ netware-clib netware-clib-bsdsock
+ netware-libc netware-libc-bsdsock);
my $idx = 0;
my $idx_cc = $idx++;
@@ -932,6 +939,7 @@ my $IsMK1MF=scalar grep /^$target$/,@MK1MF_Builds;
$IsMK1MF=1 if ($target eq "mingw" && $^O ne "cygwin" && !is_msys());
$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target eq "mingw");
+$exe_ext=".nlm" if ($target =~ /netware/);
$exe_ext=".pm" if ($target =~ /vos/);
$openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq "");
$prefix=$openssldir if $prefix eq "";
@@ -1624,7 +1632,7 @@ EOF
}
# create the ms/version32.rc file if needed
-if ($IsMK1MF) {
+if ($IsMK1MF && ($target !~ /^netware/)) {
my ($v1, $v2, $v3, $v4);
if ($version_num =~ /(^[0-9a-f]{1})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i) {
$v1=hex $1;
diff --git a/INSTALL.NW b/INSTALL.NW
index 92715cbbf3..609a7309e1 100644
--- a/INSTALL.NW
+++ b/INSTALL.NW
@@ -8,58 +8,62 @@ Notes about building OpenSSL for NetWare.
BUILD PLATFORM:
---------------
The build scripts (batch files, perl scripts, etc) have been developed and
-tested on W2K. The scripts should run fine on other Windows
-platforms (NT, Win9x, WinXP) but they haven't been tested. They may require
-some modifications.
+tested on W2K. The scripts should run fine on other Windows platforms
+(NT, Win9x, WinXP) but they have not been tested. They may require some
+modifications.
Supported NetWare Platforms - NetWare 5.x, NetWare 6.x:
-------------------------------------------
-OpenSSL uses the WinSock interfaces introduced in NetWare 5. Therefore,
-previous versions of NetWare, 4.x and 3.x, are not supported.
+-------------------------------------------------------
+OpenSSL can either use the WinSock interfaces introduced in NetWare 5,
+or the BSD socket interface. Previous versions of NetWare, 4.x and 3.x,
+are only supported if OpenSSL is build for CLIB and BSD sockets;
+WinSock builds only support NetWare 5 and up.
On NetWare there are two c-runtime libraries. There is the legacy CLIB
-interfaces and the newer LibC interfaces. Being ANSI-C libraries, the
-functionality in CLIB and LibC is similar but the LibC interfaces are built
+interfaces and the newer LIBC interfaces. Being ANSI-C libraries, the
+functionality in CLIB and LIBC is similar but the LIBC interfaces are built
using Novell Kernal Services (NKS) which is designed to leverage
multi-processor environments.
-The NetWare port of OpenSSL can configured to build using CLIB or LibC. The
-CLIB build was developed and tested using NetWare 5.0 sp6.0a. The LibC
+The NetWare port of OpenSSL can be configured to build using CLIB or LIBC.
+The CLIB build was developed and tested using NetWare 5.0 sp6.0a. The LIBC
build was developed and tested using the NetWare 6.0 FCS.
-The necessary LibC functionality ships with NetWare 6. However, earlier
-NetWare 5.x versions will require updates in order to run the OpenSSL LibC
-build.
+The necessary LIBC functionality ships with NetWare 6. However, earlier
+NetWare 5.x versions will require updates in order to run the OpenSSL LIBC
+build (NetWare 5.1 SP8 is known to work).
-As of June 2005, the LibC build can be configured to use BSD sockets instead
+As of June 2005, the LIBC build can be configured to use BSD sockets instead
of WinSock sockets. Call Configure (usually through netware\build.bat) using
a target of "netware-libc-bsdsock" instead of "netware-libc".
+As of June 2007, support for CLIB and BSD sockets is also now available
+using a target of "netware-clib-bsdsock" instead of "netware-clib";
+also gcc builds are now supported on both Linux and Win32 (post 0.9.8e).
REQUIRED TOOLS:
---------------
Based upon the configuration and build options used, some or all of the
following tools may be required:
-
* Perl for Win32 - required (http://www.activestate.com/ActivePerl)
Used to run the various perl scripts on the build platform.
-
* Perl 5.8.0 for NetWare v3.20 (or later) - required
(http://developer.novell.com) Used to run the test script on NetWare
after building.
+* Compiler / Linker - required:
+ Metrowerks CodeWarrior PDK 2.1 (or later) for NetWare (commercial):
+ Provides command line tools used for building.
+ Tools:
+ mwccnlm.exe - C/C++ Compiler for NetWare
+ mwldnlm.exe - Linker for NetWare
+ mwasmnlm.exe - x86 assembler for NetWare (if using assembly option)
-* Metrowerks CodeWarrior PDK 2.1 (or later) for NetWare - required:
- Provides command line tools used for building.
-
- Tools:
- mwccnlm.exe - C/C++ Compiler for NetWare
- mwldnlm.exe - Linker for NetWare
- mwasmnlm.exe - x86 assembler for NetWare (if using assembly option)
-
+ gcc / nlmconv Cross-Compiler, available from Novell Forge (free):
+ http://forge.novell.com/modules/xfmod/project/?aunixnw
* Assemblers - optional:
If you intend to build using the assembly options you will need an
@@ -79,11 +83,11 @@ following tools may be required:
In order to build you will need a make tool. Two make tools are
supported, GNU make (gmake.exe) or Microsoft nmake.exe.
- gmake.exe - GNU make for Windows (version 3.75 used for development)
- http://www.gnu.org/software/make/make.html
+ make.exe - GNU make for Windows (version 3.75 used for development)
+ http://gnuwin32.sourceforge.net/packages/make.htm
nmake.exe - Microsoft make (Version 6.00.8168.0 used for development)
-
+ http://support.microsoft.com/kb/132084/EN-US/
* Novell Developer Kit (NDK) - required: (http://developer.novell.com)
@@ -123,14 +127,14 @@ following tools may be required:
LIBC - BUILDS:
- Libraries for C (LibC) - LibC headers and import files
- If you are going to build a LibC version of OpenSSL, you will
- need the LibC headers and imports. The March 14, 2002 NDK release or
+ Libraries for C (LIBC) - LIBC headers and import files
+ If you are going to build a LIBC version of OpenSSL, you will
+ need the LIBC headers and imports. The March 14, 2002 NDK release or
later is required.
- NOTE: The LibC SDK includes the necessary WinSock2 support. It
- It is not necessary to download the WinSock2 Developer when building
- for LibC. The LibC SDK also includes the appropriate BSD socket support
+ NOTE: The LIBC SDK includes the necessary WinSock2 support.
+ It is not necessary to download the WinSock2 NDK when building for
+ LIBC. The LIBC SDK also includes the appropriate BSD socket support
if configuring to use BSD sockets.
@@ -143,33 +147,36 @@ The set_env.bat file is a template you can use to set up the path
and environment variables you will need to build. Modify the
various lines to point to YOUR tools and run set_env.bat.
- netware\set_env.bat [target]
+ netware\set_env.bat <target> [compiler]
+
+ target - "netware-clib" - CLIB NetWare build
+ - "netware-libc" - LIBC NetWare build
- target - "netware-clib" - CLib NetWare build
- - "netware-libc" - LibC NetWare build
+ compiler - "gnuc" - GNU GCC Compiler
+ - "codewarrior" - MetroWerks CodeWarrior (default)
If you don't use set_env.bat, you will need to set up the following
environment variables:
- path - Set path to point to the tools you will use.
+ PATH - Set PATH to point to the tools you will use.
- MWCIncludes - The location of the NDK include files.
+ INCLUDE - The location of the NDK include files.
- CLIB ex: set MWCIncludes=c:\ndk\nwsdk\include\nlm
- LibC ex: set MWCIncludes=c:\ndk\libc\include
+ CLIB ex: set INCLUDE=c:\ndk\nwsdk\include\nlm
+ LIBC ex: set INCLUDE=c:\ndk\libc\include
PRELUDE - The absolute path of the prelude object to link with. For
a CLIB build it is recommended you use the "clibpre.o" files shipped
- with the Metrowerks PDK for NetWare. For a LibC build you should
- use the "libcpre.o" file delivered with the LibC NDK components.
+ with the Metrowerks PDK for NetWare. For a LIBC build you should
+ use the "libcpre.o" file delivered with the LIBC NDK components.
CLIB ex: set PRELUDE=c:\ndk\nwsdk\imports\clibpre.o
- LibC ex: set PRELUDE=c:\ndk\libc\imports\libcpre.o
+ LIBC ex: set PRELUDE=c:\ndk\libc\imports\libcpre.o
IMPORTS - The locaton of the NDK import files.
CLIB ex: set IMPORTS=c:\ndk\nwsdk\imports
- LibC ex: set IMPORTS=c:\ndk\libc\imports
+ LIBC ex: set IMPORTS=c:\ndk\libc\imports
In order to build, you need to run the Perl scripts to configure the build
@@ -182,9 +189,10 @@ the assembly code. Always run build.bat from the "openssl" directory.
netware\build [target] [debug opts] [assembly opts] [configure opts]
- target - "netware-clib" - CLib NetWare build (WinSock Sockets)
- - "netware-libc" - LibC NetWare build (WinSock Sockets)
- - "netware-libc-bsdsock" - LibC NetWare build (BSD Sockets)
+ target - "netware-clib" - CLIB NetWare build (WinSock Sockets)
+ - "netware-clib-bsdsock" - CLIB NetWare build (BSD Sockets)
+ - "netware-libc" - LIBC NetWare build (WinSock Sockets)
+ - "netware-libc-bsdsock" - LIBC NetWare build (BSD Sockets)
debug opts - "debug" - build debug
@@ -193,25 +201,27 @@ the assembly code. Always run build.bat from the "openssl" directory.
"no-asm" - don't use assembly
configure opts- all unrecognized arguments are passed to the
- perl configure script
+ perl 'configure' script. See that script for
+ internal documentation regarding options that
+ are available.
examples:
CLIB build, debug, without assembly:
netware\build.bat netware-clib debug no-asm
- LibC build, non-debug, using NASM assembly:
- netware\build.bat netware-libc nw-nasm
+ LIBC build, non-debug, using NASM assembly, add mdc2 support:
+ netware\build.bat netware-libc nw-nasm enable-mdc2
- LibC build, BSD sockets, non-debug, without assembly:
+ LIBC build, BSD sockets, non-debug, without assembly:
netware\build.bat netware-libc-bsdsock no-asm
Running build.bat generates a make file to be processed by your make
tool (gmake or nmake):
CLIB ex: gmake -f netware\nlm_clib_dbg.mak
- LibC ex: gmake -f netware\nlm_libc.mak
- LibC ex: gmake -f netware\nlm_libc_bsdsock.mak
+ LIBC ex: gmake -f netware\nlm_libc.mak
+ LIBC ex: gmake -f netware\nlm_libc_bsdsock.mak
You can also run the build scripts manually if you do not want to use the
@@ -220,7 +230,7 @@ subdirectory (in the order listed below):
perl configure no-asm [other config opts] [netware-clib|netware-libc|netware-libc-bsdsock]
configures no assembly build for specified netware environment
- (CLIB or LibC).
+ (CLIB or LIBC).
perl util\mkfiles.pl >MINFO
generates a listing of source files (used by mk1mf)
@@ -250,12 +260,12 @@ The output from the build is placed in the following directories:
tmp_nw_clib - temporary build files
outinc_nw_clib - necesary include files
- LibC Debug build:
+ LIBC Debug build:
out_nw_libc.dbg - static libs & test nlm(s)
tmp_nw_libc.dbg - temporary build files
outinc_nw_libc - necessary include files
- LibC Non-debug build:
+ LIBC Non-debug build:
out_nw_libc - static libs & test nlm(s)
tmp_nw_libc - temporary build files
outinc_nw_libc - necesary include files
@@ -281,7 +291,7 @@ To run cpy_tests.bat:
NetWare drive - drive letter of mapped drive
CLIB ex: netware\cpy_tests out_nw_clib m:
- LibC ex: netware\cpy_tests out_nw_libc m:
+ LIBC ex: netware\cpy_tests out_nw_libc m:
The Perl script, "do_tests.pl", in the "OpenSSL" directory on the server
@@ -356,9 +366,9 @@ clean up the resources!
Multi-threaded Development
---------------------------
-The NetWare version of OpenSSL is thread-safe however, multi-threaded
+The NetWare version of OpenSSL is thread-safe, however multi-threaded
applications must provide the necessary locking function callbacks. This
-is described in doc\threads.doc. The file "openssl\crypto\threads\mttest.c"
+is described in doc\threads.doc. The file "openssl-x.x.x\crypto\threads\mttest.c"
is a multi-threaded test program and demonstrates the locking functions.
@@ -428,7 +438,7 @@ Makefile "vclean"
------------------
The generated makefile has a "vclean" target which cleans up the build
directories. If you have been building successfully and suddenly
-experience problems, use "vclean" (gmake -f netware\nlm.mak vclean) and retry.
+experience problems, use "vclean" (gmake -f netware\nlm_xxxx.mak vclean) and retry.
"Undefined Symbol" Linker errors
diff --git a/Netware/build.bat b/Netware/build.bat
index 50ee7d51d0..823134bda1 100644
--- a/Netware/build.bat
+++ b/Netware/build.bat
@@ -7,8 +7,9 @@ rem usage:
rem build [target] [debug opts] [assembly opts] [configure opts]
rem
rem target - "netware-clib" - CLib NetWare build (WinSock Sockets)
-rem - "netware-libc" - LibC NKS NetWare build (WinSock Sockets)
-rem - "netware-libc-bsdsock" - LibC NKS NetWare build (BSD Sockets)
+rem - "netware-clib-bsdsock" - CLib NetWare build (BSD Sockets)
+rem - "netware-libc" - LibC NetWare build (WinSock Sockets)
+rem - "netware-libc-bsdsock" - LibC NetWare build (BSD Sockets)
rem
rem debug opts - "debug" - build debug
rem
@@ -71,10 +72,12 @@ if "%1" == "nw-nasm" set NO_ASM=
if "%1" == "nw-nasm" set ARG_PROCESSED=YES
if "%1" == "nw-mwasm" set ASM_MODE=nw-mwasm
if "%1" == "nw-mwasm" set ASSEMBLER=Metrowerks
-if "%1" == "nw-mwasm" set NO_ASM=
+if "%1" == "nw-mwasm" set NO_ASM=
if "%1" == "nw-mwasm" set ARG_PROCESSED=YES
if "%1" == "netware-clib" set BLD_TARGET=netware-clib
if "%1" == "netware-clib" set ARG_PROCESSED=YES
+if "%1" == "netware-clib-bsdsock" set BLD_TARGET=netware-clib-bsdsock
+if "%1" == "netware-clib-bsdsock" set ARG_PROCESSED=YES
if "%1" == "netware-libc" set BLD_TARGET=netware-libc
if "%1" == "netware-libc" set ARG_PROCESSED=YES
if "%1" == "netware-libc-bsdsock" set BLD_TARGET=netware-libc-bsdsock
@@ -94,6 +97,7 @@ if "%BLD_TARGET%" == "no_target" goto no_target
rem build the nlm make file name which includes target and debug info
set NLM_MAKE=
if "%BLD_TARGET%" == "netware-clib" set NLM_MAKE=netware\nlm_clib
+if "%BLD_TARGET%" == "netware-clib-bsdsock" set NLM_MAKE=netware\nlm_clib_bsdsock
if "%BLD_TARGET%" == "netware-libc" set NLM_MAKE=netware\nlm_libc
if "%BLD_TARGET%" == "netware-libc-bsdsock" set NLM_MAKE=netware\nlm_libc_bsdsock
if "%DEBUG%" == "" set NLM_MAKE=%NLM_MAKE%.mak
@@ -110,7 +114,14 @@ echo Generating x86 for %ASSEMBLER% assembler
echo Bignum
cd crypto\bn\asm
-perl x86.pl %ASM_MODE% > bn-nw.asm
+rem perl x86.pl %ASM_MODE% > bn-nw.asm
+perl bn-586.pl %ASM_MODE% > bn-nw.asm
+perl co-586.pl %ASM_MODE% > co-nw.asm
+cd ..\..\..
+
+echo AES
+cd crypto\aes\asm
+perl aes-586.pl %ASM_MODE% > a-nw.asm
cd ..\..\..
echo DES
@@ -160,6 +171,11 @@ cd crypto\rc5\asm
perl rc5-586.pl %ASM_MODE% > r5-nw.asm
cd ..\..\..
+echo CPUID
+cd crypto
+perl x86cpuid.pl %ASM_MODE% > x86cpuid-nw.asm
+cd ..\
+
rem ===============================================================
rem
:do_config
@@ -176,8 +192,10 @@ echo mk1mf.pl options: %DEBUG% %ASM_MODE% %CONFIG_OPTS% %BLD_TARGET%
echo .
perl util\mk1mf.pl %DEBUG% %ASM_MODE% %CONFIG_OPTS% %BLD_TARGET% >%NLM_MAKE%
+make -f %NLM_MAKE% vclean
+echo .
echo The makefile "%NLM_MAKE%" has been created use your maketool to
-echo build (ex: gmake -f %NLM_MAKE%)
+echo build (ex: make -f %NLM_MAKE%)
goto end
rem ===============================================================
@@ -189,8 +207,9 @@ echo .
echo . usage: build [target] [debug opts] [assembly opts] [configure opts]
echo .
echo . target - "netware-clib" - CLib NetWare build (WinSock Sockets)
-echo . - "netware-libc" - LibC NKS NetWare build (WinSock Sockets)
-echo . - "netware-libc-bsdsock" - LibC NKS NetWare build (BSD Sockets)
+echo . - "netware-clib-bsdsock" - CLib NetWare build (BSD Sockets)
+echo . - "netware-libc" - LibC NetWare build (WinSock Sockets)
+echo . - "netware-libc-bsdsock" - LibC NetWare build (BSD Sockets)
echo .
echo . debug opts - "debug" - build debug
echo .
diff --git a/Netware/cpy_tests.bat b/Netware/cpy_tests.bat
index c2f07c00c7..1583f28067 100644
--- a/Netware/cpy_tests.bat
+++ b/Netware/cpy_tests.bat
@@ -73,6 +73,7 @@ copy %loc%\test\testsid.pem %2\openssl\test\
copy %loc%\test\testx509.pem %2\openssl\test\
copy %loc%\test\v3-cert1.pem %2\openssl\test\
copy %loc%\test\v3-cert2.pem %2\openssl\test\
+copy %loc%\crypto\evp\evptests.txt %2\openssl\test\
rem copy the apps directory stuff
copy %loc%\apps\client.pem %2\openssl\apps\
diff --git a/Netware/do_tests.pl b/Netware/do_tests.pl
index 0be0838a13..ac482dbe2b 100644
--- a/Netware/do_tests.pl
+++ b/Netware/do_tests.pl
@@ -34,12 +34,17 @@ sub main()
# delete all the output files in the output directory
unlink <$output_path\\*.*>;
- # open the main log file
+ # open the main log file
open(OUT, ">$log_file") || die "unable to open $log_file\n";
-
+ print( OUT "========================================================\n");
+ my $outFile = "$output_path\\version.out";
+ system("openssl2 version (CLIB_OPT)/>$outFile");
+ log_output("CHECKING FOR OPENSSL VERSION:", $outFile);
+
algorithm_tests();
encryption_tests();
+ evp_tests();
pem_tests();
verify_tests();
ca_tests();
@@ -56,9 +61,10 @@ sub algorithm_tests
{
my $i;
my $outFile;
- my @tests = ( rsa_test, destest, ideatest, bftest, shatest, sha1test,
- md5test, dsatest, md2test, mdc2test, rc2test, rc4test, randtest,
- dhtest, exptest );
+ my @tests = ( rsa_test, destest, ideatest, bftest, bntest, shatest, sha1test,
+ sha256t, sha512t, dsatest, md2test, md4test, md5test, mdc2test,
+ rc2test, rc4test, rc5test, randtest, rmdtest, dhtest, ecdhtest,
+ ecdsatest, ectest, exptest, casttest, hmactest );
print( "\nRUNNING CRYPTO ALGORITHM TESTS:\n\n");
@@ -68,16 +74,16 @@ sub algorithm_tests
foreach $i (@tests)
{
if (-e "$base_path\\$i.nlm")
- {
+ {
$outFile = "$output_path\\$i.out";
- system("$i > $outFile");
+ system("$i (CLIB_OPT)/>$outFile");
log_desc("Test: $i\.nlm:");
log_output("", $outFile );
- }
- else
- {
+ }
+ else
+ {
log_desc("Test: $i\.nlm: file not found");
- }
+ }
}
}
@@ -109,24 +115,24 @@ sub encryption_tests
# do encryption
$outFile = "$output_path\\enc.out";
- system("openssl2 $i -e -bufsize 113 -k test -in $input -out $cipher > $outFile" );
+ system("openssl2 $i -e -bufsize 113 -k test -in $input -out $cipher (CLIB_OPT)/>$outFile" );
log_output("Encrypting: $input --> $cipher", $outFile);
# do decryption
$outFile = "$output_path\\dec.out";
- system("openssl2 $i -d -bufsize 157 -k test -in $cipher -out $clear > $outFile");
+ system("openssl2 $i -d -bufsize 157 -k test -in $cipher -out $clear (CLIB_OPT)/>$outFile");
log_output("Decrypting: $cipher --> $clear", $outFile);
# compare files
$x = compare_files( $input, $clear, 1);
if ( $x == 0 )
{
- print( "SUCCESS - files match: $input, $clear\n");
+ print( "\rSUCCESS - files match: $input, $clear\n");
print( OUT "SUCCESS - files match: $input, $clear\n");
}
else
{
- print( "ERROR: files don't match\n");
+ print( "\rERROR: files don't match\n");
print( OUT "ERROR: files don't match\n");
}
@@ -136,24 +142,24 @@ sub encryption_tests
# do encryption B64
$outFile = "$output_path\\B64enc.out";
- system("openssl2 $i -a -e -bufsize 113 -k test -in $input -out $cipher > $outFile");
+ system("openssl2 $i -a -e -bufsize 113 -k test -in $input -out $cipher (CLIB_OPT)/>$outFile");
log_output("Encrypting(B64): $cipher --> $clear", $outFile);
# do decryption B64
$outFile = "$output_path\\B64dec.out";
- system("openssl2 $i -a -d -bufsize 157 -k test -in $cipher -out $clear > $outFile");
+ system("openssl2 $i -a -d -bufsize 157 -k test -in $cipher -out $clear (CLIB_OPT)/>$outFile");
log_output("Decrypting(B64): $cipher --> $clear", $outFile);
# compare files
$x = compare_files( $input, $clear, 1);
if ( $x == 0 )
{
- print( "SUCCESS - files match: $input, $clear\n");
+ print( "\rSUCCESS - files match: $input, $clear\n");
print( OUT "SUCCESS - files match: $input, $clear\n");
}
else
{
- print( "ERROR: files don't match\n");
+ print( "\rERROR: files don't match\n");
print( OUT "ERROR: files don't match\n");
}
@@ -199,24 +205,24 @@ sub pem_tests
if ($i ne "req" )
{
- system("openssl2 $i -in $input -out $tmp_out > $outFile");
+ system("openssl2 $i -in $input -out $tmp_out (CLIB_OPT)/>$outFile");
log_output( "openssl2 $i -in $input -out $tmp_out", $outFile);
}
else
{
- system("openssl2 $i -in $input -out $tmp_out -config $OpenSSL_config > $outFile");
+ system("openssl2 $i -in $input -out $tmp_out -config $OpenSSL_config (CLIB_OPT)/>$outFile");
log_output( "openssl2 $i -in $input -out $tmp_out -config $OpenSSL_config", $outFile );
}
$x = compare_files( $input, $tmp_out);
if ( $x == 0 )
{
- print( "SUCCESS - files match: $input, $tmp_out\n");
+ print( "\rSUCCESS - files match: $input, $tmp_out\n");
print( OUT "SUCCESS - files match: $input, $tmp_out\n");
}
else
{
- print( "ERROR: files don't match\n");
+ print( "\rERROR: files don't match\n");
print( OUT "ERROR: files don't match\n");
}
do_wait();
@@ -231,7 +237,8 @@ sub verify_tests
my $i;
my $outFile = "$output_path\\verify.out";
- my @cert_files = <$cert_path\\*.pem>;
+ $cert_path =~ s/\\/\//g;
+ my @cert_files = <$cert_path/*.pem>;
print( "\nRUNNING VERIFY TESTS:\n\n");
@@ -242,7 +249,7 @@ sub verify_tests
foreach $i (@cert_files)
{
- system("openssl2 verify -CAfile $tmp_cert $i >$outFile");
+ system("openssl2 verify -CAfile $tmp_cert $i (CLIB_OPT)/>$outFile");
log_desc("Verifying cert: $i");
log_output("openssl2 verify -CAfile $tmp_cert $i", $outFile);
}
@@ -263,103 +270,103 @@ sub ssl_tests
print( OUT "\n========================================================\n");
print( OUT "SSL TESTS:\n\n");
- system("ssltest -ssl2 >$outFile");
+ system("ssltest -ssl2 (CLIB_OPT)/>$outFile");
log_desc("Testing sslv2:");
log_output("ssltest -ssl2", $outFile);
- system("$ssltest -ssl2 -server_auth >$outFile");
+ system("$ssltest -ssl2 -server_auth (CLIB_OPT)/>$outFile");
log_desc("Testing sslv2 with server authentication:");
log_output("$ssltest -ssl2 -server_auth", $outFile);
- system("$ssltest -ssl2 -client_auth >$outFile");
+ system("$ssltest -ssl2 -client_auth (CLIB_OPT)/>$outFile");
log_desc("Testing sslv2 with client authentication:");
log_output("$ssltest -ssl2 -client_auth", $outFile);
- system("$ssltest -ssl2 -server_auth -client_auth >$outFile");
+ system("$ssltest -ssl2 -server_auth -client_auth (CLIB_OPT)/>$outFile");
log_desc("Testing sslv2 with both client and server authentication:");
log_output("$ssltest -ssl2 -server_auth -client_auth", $outFile);
- system("ssltest -ssl3 >$outFile");
+ system("ssltest -ssl3 (CLIB_OPT)/>$outFile");
log_desc("Testing sslv3:");
log_output("ssltest -ssl3", $outFile);
- system("$ssltest -ssl3 -server_auth >$outFile");
+ system("$ssltest -ssl3 -server_auth (CLIB_OPT)/>$outFile");
log_desc("Testing sslv3 with server authentication:");
log_output("$ssltest -ssl3 -server_auth", $outFile);
- system("$ssltest -ssl3 -client_auth >$outFile");
+ system("$ssltest -ssl3 -client_auth (CLIB_OPT)/>$outFile");
log_desc("Testing sslv3 with client authentication:");
log_output("$ssltest -ssl3 -client_auth", $outFile);
- system("$ssltest -ssl3 -server_auth -client_auth >$outFile");
+ system("$ssltest -ssl3 -server_auth -client_auth (CLIB_OPT)/>$outFile");
log_desc("Testing sslv3 with both client and server authentication:");
log_output("$ssltest -ssl3 -server_auth -client_auth", $outFile);
- system("ssltest >$outFile");
+ system("ssltest (CLIB_OPT)/>$outFile");
log_desc("Testing sslv2/sslv3:");
log_output("ssltest", $outFile);
- system("$ssltest -server_auth >$outFile");
+ system("$ssltest -server_auth (CLIB_OPT)/>$outFile");
log_desc("Testing sslv2/sslv3 with server authentication:");
log_output("$ssltest -server_auth", $outFile);
- system("$ssltest -client_auth >$outFile");
+ system("$ssltest -client_auth (CLIB_OPT)/>$outFile");
log_desc("Testing sslv2/sslv3 with client authentication:");
log_output("$ssltest -client_auth ", $outFile);
- system("$ssltest -server_auth -client_auth >$outFile");
+ system("$ssltest -server_auth -client_auth (CLIB_OPT)/>$outFile");
log_desc("Testing sslv2/sslv3 with both client and server authentication:");
log_output("$ssltest -server_auth -client_auth", $outFile);
- system("ssltest -bio_pair -ssl2 >$outFile");
+ system("ssltest -bio_pair -ssl2 (CLIB_OPT)/>$outFile");
log_desc("Testing sslv2 via BIO pair:");
log_output("ssltest -bio_pair -ssl2", $outFile);
- system("ssltest -bio_pair -dhe1024dsa -v >$outFile");
+ system("ssltest -bio_pair -dhe1024dsa -v (CLIB_OPT)/>$outFile");
log_desc("Testing sslv2/sslv3 with 1024 bit DHE via BIO pair:");
log_output("ssltest -bio_pair -dhe1024dsa -v", $outFile);
- system("$ssltest -bio_pair -ssl2 -server_auth >$outFile");
+ system("$ssltest -bio_pair -ssl2 -server_auth (CLIB_OPT)/>$outFile");
log_desc("Testing sslv2 with server authentication via BIO pair:");
log_output("$ssltest -bio_pair -ssl2 -server_auth", $outFile);
- system("$ssltest -bio_pair -ssl2 -client_auth >$outFile");
+ system("$ssltest -bio_pair -ssl2 -client_auth (CLIB_OPT)/>$outFile");
log_desc("Testing sslv2 with client authentication via BIO pair:");
log_output("$ssltest -bio_pair -ssl2 -client_auth", $outFile);
- system("$ssltest -bio_pair -ssl2 -server_auth -client_auth >$outFile");
+ system("$ssltest -bio_pair -ssl2 -server_auth -client_auth (CLIB_OPT)/>$outFile");
log_desc("Testing sslv2 with both client and server authentication via BIO pair:");
log_output("$ssltest -bio_pair -ssl2 -server_auth -client_auth", $outFile);
- system("ssltest -bio_pair -ssl3 >$outFile");
+ system("ssltest -bio_pair -ssl3 (CLIB_OPT)/>$outFile");
log_desc("Testing sslv3 via BIO pair:");
log_output("ssltest -bio_pair -ssl3", $outFile);
- system("$ssltest -bio_pair -ssl3 -server_auth >$outFile");
+ system("$ssltest -bio_pair -ssl3 -server_auth (CLIB_OPT)/>$outFile");
log_desc("Testing sslv3 with server authentication via BIO pair:");
log_output("$ssltest -bio_pair -ssl3 -server_auth", $outFile);
- system("$ssltest -bio_pair -ssl3 -client_auth >$outFile");
+ system("$ssltest -bio_pair -ssl3 -client_auth (CLIB_OPT)/>$outFile");
log_desc("Testing sslv3 with client authentication via BIO pair:");
log_output("$ssltest -bio_pair -ssl3 -client_auth", $outFile);
- system("$ssltest -bio_pair -ssl3 -server_auth -client_auth >$outFile");
+ system("$ssltest -bio_pair -ssl3 -server_auth -client_auth (CLIB_OPT)/>$outFile");
log_desc("Testing sslv3 with both client and server authentication via BIO pair:");
log_output("$ssltest -bio_pair -ssl3 -server_auth -client_auth", $outFile);
- system("ssltest -bio_pair >$outFile");
+ system("ssltest -bio_pair (CLIB_OPT)/>$outFile");
log_desc("Testing sslv2/sslv3 via BIO pair:");
log_output("ssltest -bio_pair", $outFile);
- system("$ssltest -bio_pair -server_auth >$outFile");
+ system("$ssltest -bio_pair -server_auth (CLIB_OPT)/>$outFile");
log_desc("Testing sslv2/sslv3 with server authentication via BIO pair:");
log_output("$ssltest -bio_pair -server_auth", $outFile);
- system("$ssltest -bio_pair -client_auth >$outFile");
+ system("$ssltest -bio_pair -client_auth (CLIB_OPT)/>$outFile");
log_desc("Testing sslv2/sslv3 with client authentication via BIO pair:");
log_output("$ssltest -bio_pair -client_auth", $outFile);
- system("$ssltest -bio_pair -server_auth -client_auth >$outFile");
+ system("$ssltest -bio_pair -server_auth -client_auth (CLIB_OPT)/>$outFile");
log_desc("Testing sslv2/sslv3 with both client and server authentication via BIO pair:");
log_output("$ssltest -bio_pair -server_auth -client_auth", $outFile);
}
@@ -389,43 +396,43 @@ sub ca_tests
print( OUT "\n========================================================\n");
print( OUT "CA TESTS:\n");
- system("openssl2 req -config $CAconf -out $CAreq -keyout $CAkey -new >$outFile");
+ system("openssl2 req -config $CAconf -out $CAreq -keyout $CAkey -new (CLIB_OPT)/>$outFile");
log_desc("Make a certificate request using req:");
log_output("openssl2 req -config $CAconf -out $CAreq -keyout $CAkey -new", $outFile);
- system("openssl2 x509 -CAcreateserial -in $CAreq -days 30 -req -out $CAcert -signkey $CAkey >$outFile");
+ system("openssl2 x509 -CAcreateserial -in $CAreq -days 30 -req -out $CAcert -signkey $CAkey (CLIB_OPT)/>$outFile");
log_desc("Convert the certificate request into a self signed certificate using x509:");
log_output("openssl2 x509 -CAcreateserial -in $CAreq -days 30 -req -out $CAcert -signkey $CAkey", $outFile);
- system("openssl2 x509 -in $CAcert -x509toreq -signkey $CAkey -out $CAreq2 >$outFile");
+ system("openssl2 x509 -in $CAcert -x509toreq -signkey $CAkey -out $CAreq2 (CLIB_OPT)/>$outFile");
log_desc("Convert a certificate into a certificate request using 'x509':");
log_output("openssl2 x509 -in $CAcert -x509toreq -signkey $CAkey -out $CAreq2", $outFile);
- system("openssl2 req -config $OpenSSL_config -verify -in $CAreq -noout >$outFile");
+ system("openssl2 req -config $OpenSSL_config -verify -in $CAreq -noout (CLIB_OPT)/>$outFile");
log_output("openssl2 req -config $OpenSSL_config -verify -in $CAreq -noout", $outFile);
- system("openssl2 req -config $OpenSSL_config -verify -in $CAreq2 -noout >$outFile");
+ system("openssl2 req -config $OpenSSL_config -verify -in $CAreq2 -noout (CLIB_OPT)/>$outFile");
log_output( "openssl2 req -config $OpenSSL_config -verify -in $CAreq2 -noout", $outFile);
- system("openssl2 verify -CAfile $CAcert $CAcert >$outFile");
+ system("openssl2 verify -CAfile $CAcert $CAcert (CLIB_OPT)/>$outFile");
log_output("openssl2 verify -CAfile $CAcert $CAcert", $outFile);
- system("openssl2 req -config $Uconf -out $Ureq -keyout $Ukey -new >$outFile");
+ system("openssl2 req -config $Uconf -out $Ureq -keyout $Ukey -new (CLIB_OPT)/>$outFile");
log_desc("Make another certificate request using req:");
log_output("openssl2 req -config $Uconf -out $Ureq -keyout $Ukey -new", $outFile);
- system("openssl2 x509 -CAcreateserial -in $Ureq -days 30 -req -out $Ucert -CA $CAcert -CAkey $CAkey -CAserial $CAserial >$outFile");
+ system("openssl2 x509 -CAcreateserial -in $Ureq -days 30 -req -out $Ucert -CA $CAcert -CAkey $CAkey -CAserial $CAserial (CLIB_OPT)/>$outFile");
log_desc("Sign certificate request with the just created CA via x509:");
log_output("openssl2 x509 -CAcreateserial -in $Ureq -days 30 -req -out $Ucert -CA $CAcert -CAkey $CAkey -CAserial $CAserial", $outFile);
- system("openssl2 verify -CAfile $CAcert $Ucert >$outFile");
+ system("openssl2 verify -CAfile $CAcert $Ucert (CLIB_OPT)/>$outFile");
log_output("openssl2 verify -CAfile $CAcert $Ucert", $outFile);
- system("openssl2 x509 -subject -issuer -startdate -enddate -noout -in $Ucert >$outFile");
+ system("openssl2 x509 -subject -issuer -startdate -enddate -noout -in $Ucert (CLIB_OPT)/>$outFile");
log_desc("Certificate details");
log_output("openssl2 x509 -subject -issuer -startdate -enddate -noout -in $Ucert", $outFile);
- print(OUT "-- \n");
+ print(OUT "--\n");
print(OUT "The generated CA certificate is $CAcert\n");
print(OUT "The generated CA private key is $CAkey\n");
print(OUT "The current CA signing serial number is in $CAserial\n");
@@ -436,6 +443,29 @@ sub ca_tests
}
############################################################################
+sub evp_tests
+{
+ my $i = 'evp_test';
+
+ print( "\nRUNNING EVP TESTS:\n\n");
+
+ print( OUT "\n========================================================\n");
+ print( OUT "EVP TESTS:\n\n");
+
+ if (-e "$base_path\\$i.nlm")
+ {
+ my $outFile = "$output_path\\$i.out";
+ system("$i $test_path\\evptests.txt (CLIB_OPT)/>$outFile");
+ log_desc("Test: $i\.nlm:");
+ log_output("", $outFile );
+ }
+ else
+ {
+ log_desc("Test: $i\.nlm: file not found");
+ }
+}
+
+############################################################################
sub log_output( $ $ )
{
my( $desc, $file ) = @_;
@@ -445,7 +475,7 @@ sub log_output( $ $ )
if ($desc)
{
- print("$desc\n");
+ print("\r$desc\n");
print(OUT "$desc\n");
}
@@ -457,8 +487,8 @@ sub log_output( $ $ )
# copy test output to log file
open(IN, "<$file");
while (<IN>)
- {
- print(OUT $_);
+ {
+ print(OUT $_);
if ( $_ =~ /ERROR/ )
{
$error = 1;
@@ -485,13 +515,13 @@ sub log_output( $ $ )
$key = getc;
print("\n");
}
-
- # Several of the testing scripts run a loop loading the
+
+ # Several of the testing scripts run a loop loading the
# same NLM with different options.
- # On slow NetWare machines there appears to be some delay in the
+ # On slow NetWare machines there appears to be some delay in the
# OS actually unloading the test nlms and the OS complains about.
- # the NLM already being loaded. This additional pause is to
- # to help provide a little more time for unloading before trying to
+ # the NLM already being loaded. This additional pause is to
+ # to help provide a little more time for unloading before trying to
# load again.
sleep(1);
}
@@ -562,7 +592,7 @@ sub do_wait()
############################################################################
sub make_tmp_cert_file()
{
- my @cert_files = <$cert_path\\*.pem>;
+ my @cert_files = <$cert_path/*.pem>;
# delete the file if it already exists
unlink($tmp_cert);
@@ -570,7 +600,7 @@ sub make_tmp_cert_file()
open( TMP_CERT, ">$tmp_cert") || die "\nunable to open $tmp_cert\n";
print("building temporary cert file\n");
-
+
# create a temporary cert file that contains all the certs
foreach $i (@cert_files)
{
diff --git a/Netware/set_env.bat b/Netware/set_env.bat
index e9012e3409..ace024e529 100644
--- a/Netware/set_env.bat
+++ b/Netware/set_env.bat
@@ -16,75 +16,97 @@ if "a%1" == "a" goto usage
set LIBC_BUILD=
set CLIB_BUILD=
+set GNUC=
if "%1" == "netware-clib" set CLIB_BUILD=Y
if "%1" == "netware-clib" set LIBC_BUILD=
-if "%1" == "netware-libc" set LIBC_BUILD=Y
-if "%1" == "netware-libc" set CLIB_BUILD=
+if "%1" == "netware-libc" set LIBC_BUILD=Y
+if "%1" == "netware-libc" set CLIB_BUILD=
+
+if "%2" == "gnuc" set GNUC=Y
+if "%2" == "codewarrior" set GNUC=
rem Location of tools (compiler, linker, etc)
-set TOOLS=d:\i_drive\tools
+if "%NDKBASE%" == "" set NDKBASE=c:\Novell
rem If Perl for Win32 is not already in your path, add it here
set PERL_PATH=
rem Define path to the Metrowerks command line tools
+rem or GNU Crosscompiler gcc / nlmconv
rem ( compiler, assembler, linker)
-set METROWERKS_PATH=%TOOLS%\codewar\pdk_21\tools\command line tools
-rem set METROWERKS_PATH=%TOOLS%\codewar\PDK_40\Other Metrowerks Tools\Command Line Tools
+if "%GNUC%" == "Y" set COMPILER_PATH=c:\usr\i586-netware\bin;c:\usr\bin
+if "%GNUC%" == "" set COMPILER_PATH=c:\prg\cwcmdl40
rem If using gnu make define path to utility
-set GNU_MAKE_PATH=%TOOLS%\gnu
+rem set GNU_MAKE_PATH=%NDKBASE%\gnu
+set GNU_MAKE_PATH=c:\prg\tools
rem If using ms nmake define path to nmake
-set MS_NMAKE_PATH=%TOOLS%\msvc\600\bin
+rem set MS_NMAKE_PATH=%NDKBASE%\msvc\600\bin
rem If using NASM assembler define path
-set NASM_PATH=%TOOLS%\nasm
+rem set NASM_PATH=%NDKBASE%\nasm
+set NASM_PATH=c:\prg\tools
rem Update path to include tool paths
-set path=%path%;%METROWERKS_PATH%
+set path=%path%;%COMPILER_PATH%
if not "%GNU_MAKE_PATH%" == "" set path=%path%;%GNU_MAKE_PATH%
if not "%MS_NMAKE_PATH%" == "" set path=%path%;%MS_NMAKE_PATH%
if not "%NASM_PATH%" == "" set path=%path%;%NASM_PATH%
if not "%PERL_PATH%" == "" set path=%path%;%PERL_PATH%
-rem Set MWCIncludes to location of Novell NDK includes
-if "%LIBC_BUILD%" == "Y" set MWCIncludes=%TOOLS%\ndk\libc\include;%TOOLS%\ndk\libc\include\winsock;.\engines
-if "%CLIB_BUILD%" == "Y" set MWCIncludes=%TOOLS%\ndk\nwsdk\include\nlm;.\engines
-set include=
+rem Set INCLUDES to location of Novell NDK includes
+if "%LIBC_BUILD%" == "Y" set INCLUDE=%NDKBASE%\ndk\libc\include;%NDKBASE%\ndk\libc\include\winsock
+if "%CLIB_BUILD%" == "Y" set INCLUDE=%NDKBASE%\ndk\nwsdk\include\nlm;%NDKBASE%\ws295sdk\include
rem Set Imports to location of Novell NDK import files
-if "%LIBC_BUILD%" == "Y" set IMPORTS=%TOOLS%\ndk\libc\imports
-if "%CLIB_BUILD%" == "Y" set IMPORTS=%TOOLS%\ndk\nwsdk\imports
+if "%LIBC_BUILD%" == "Y" set IMPORTS=%NDKBASE%\ndk\libc\imports
+if "%CLIB_BUILD%" == "Y" set IMPORTS=%NDKBASE%\ndk\nwsdk\imports
rem Set PRELUDE to the absolute path of the prelude object to link with in
rem the Metrowerks NetWare PDK - NOTE: for Clib builds "clibpre.o" is
rem recommended, for LibC NKS builds libcpre.o must be used
+if "%GNUC%" == "Y" goto gnuc
if "%LIBC_BUILD%" == "Y" set PRELUDE=%IMPORTS%\libcpre.o
-if "%CLIB_BUILD%" == "Y" set PRELUDE=%IMPORTS%\clibpre.o
+rem if "%CLIB_BUILD%" == "Y" set PRELUDE=%IMPORTS%\clibpre.o
+if "%CLIB_BUILD%" == "Y" set PRELUDE=%IMPORTS%\prelude.o
+echo using MetroWerks CodeWarrior
+goto info
+
+:gnuc
+if "%LIBC_BUILD%" == "Y" set PRELUDE=%IMPORTS%\libcpre.gcc.o
+rem if "%CLIB_BUILD%" == "Y" set PRELUDE=%IMPORTS%\clibpre.gcc.o
+if "%CLIB_BUILD%" == "Y" set PRELUDE=%IMPORTS%\prelude.gcc.o
+echo using GNU GCC Compiler
+:info
+echo.
if "%LIBC_BUILD%" == "Y" echo Enviroment configured for LibC build
if "%LIBC_BUILD%" == "Y" echo use "netware\build.bat netware-libc ..."
if "%CLIB_BUILD%" == "Y" echo Enviroment configured for CLib build
if "%CLIB_BUILD%" == "Y" echo use "netware\build.bat netware-clib ..."
+
goto end
:usage
rem ===============================================================
-echo .
-echo . No target build specified!
-echo .
-echo . usage: set_env [target]
-echo .
-echo . target - "netware-clib" - Clib build
-echo . - "netware-libc" - LibC build
-echo .
-
-
+echo.
+echo No target build specified!
+echo.
+echo usage: set_env [target] [compiler]
+echo.
+echo target - "netware-clib" - Clib build
+echo - "netware-libc" - LibC build
+echo.
+echo compiler - "gnuc" - GNU GCC Compiler
+echo - "codewarrior" - MetroWerks CodeWarrior (default)
+echo.
:end
+echo.
+
diff --git a/apps/ca.c b/apps/ca.c
index e9d79def61..87f0405f5d 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -2882,13 +2882,22 @@ int old_entry_print(BIO *bp, ASN1_OBJECT *obj, ASN1_STRING *str)
p=(char *)str->data;
for (j=str->length; j>0; j--)
{
+#ifdef CHARSET_EBCDIC
+ if ((*p >= 0x20) && (*p <= 0x7e))
+ BIO_printf(bp,"%c",os_toebcdic[*p]);
+#else
if ((*p >= ' ') && (*p <= '~'))
BIO_printf(bp,"%c",*p);
+#endif
else if (*p & 0x80)
BIO_printf(bp,"\\0x%02X",*p);
else if ((unsigned char)*p == 0xf7)
BIO_printf(bp,"^?");
+#ifdef CHARSET_EBCDIC
+ else BIO_printf(bp,"^%c",os_toebcdic[*p+0x40]);
+#else
else BIO_printf(bp,"^%c",*p+'@');
+#endif
p++;
}
BIO_printf(bp,"'\n");
diff --git a/apps/ocsp.c b/apps/ocsp.c
index b95424b69b..a4b1454bb8 100644
--- a/apps/ocsp.c
+++ b/apps/ocsp.c
@@ -60,12 +60,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "apps.h" /* needs to be included before the openssl headers! */
#include <openssl/e_os2.h>
-#include <openssl/bio.h>
-#include <openssl/ocsp.h>
-#include <openssl/txt_db.h>
#include <openssl/ssl.h>
-#include "apps.h"
/* Maximum leeway in validity period: default 5 minutes */
#define MAX_VALIDITY_PERIOD (5 * 60)
diff --git a/crypto/bio/b_sock.c b/crypto/bio/b_sock.c
index cd78de1e87..ead477d8a2 100644
--- a/crypto/bio/b_sock.c
+++ b/crypto/bio/b_sock.c
@@ -63,7 +63,11 @@
#include "cryptlib.h"
#include <openssl/bio.h>
#if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_BSDSOCK)
-#include "netdb.h"
+#include <netdb.h>
+#if defined(NETWARE_CLIB)
+#include <sys/ioctl.h>
+NETDB_DEFINE_CONTEXT
+#endif
#endif
#ifndef OPENSSL_NO_SOCK
@@ -178,11 +182,11 @@ int BIO_get_port(const char *str, unsigned short *port_ptr)
/* Note: under VMS with SOCKETSHR, it seems like the first
* parameter is 'char *', instead of 'const char *'
*/
- s=getservbyname(
#ifndef CONST_STRICT
- (char *)
+ s=getservbyname((char *)str,"tcp");
+#else
+ s=getservbyname(str,"tcp");
#endif
- str,"tcp");
if(s != NULL)
*port_ptr=ntohs((unsigned short)s->s_port);
CRYPTO_w_unlock(CRYPTO_LOCK_GETSERVBYNAME);
@@ -360,7 +364,11 @@ struct hostent *BIO_gethostbyname(const char *name)
#if 1
/* Caching gethostbyname() results forever is wrong,
* so we have to let the true gethostbyname() worry about this */
+#if (defined(NETWARE_BSDSOCK) && !defined(__NOVELL_LIBC__))
+ return gethostbyname((char*)name);
+#else
return gethostbyname(name);
+#endif
#else
struct hostent *ret;
int i,lowi=0,j;
@@ -400,11 +408,11 @@ struct hostent *BIO_gethostbyname(const char *name)
/* Note: under VMS with SOCKETSHR, it seems like the first
* parameter is 'char *', instead of 'const char *'
*/
- ret=gethostbyname(
# ifndef CONST_STRICT
- (char *)
+ ret=gethostbyname((char *)name);
+# else
+ ret=gethostbyname(name);
# endif
- name);
if (ret == NULL)
goto end;
diff --git a/crypto/bio/bss_dgram.c b/crypto/bio/bss_dgram.c
index a0cb29b3dc..ea2c3fff63 100644
--- a/crypto/bio/bss_dgram.c
+++ b/crypto/bio/bss_dgram.c
@@ -208,9 +208,13 @@ static int dgram_write(BIO *b, const char *in, int inl)
clear_socket_error();
if ( data->connected )
- ret=send(b->num,in,inl,0);
+ ret=writesocket(b->num,in,inl);
else
+#if defined(NETWARE_CLIB) && defined(NETWARE_BSDSOCK)
+ ret=sendto(b->num, (char *)in, inl, 0, &data->peer, sizeof(data->peer));
+#else
ret=sendto(b->num, in, inl, 0, &data->peer, sizeof(data->peer));
+#endif
BIO_clear_retry_flags(b);
if (ret <= 0)
diff --git a/crypto/bio/bss_file.c b/crypto/bio/bss_file.c
index b277367da3..4df9927c43 100644
--- a/crypto/bio/bss_file.c
+++ b/crypto/bio/bss_file.c
@@ -89,6 +89,10 @@
#include "bio_lcl.h"
#include <openssl/err.h>
+#if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB)
+#include <nwfileio.h>
+#endif
+
#if !defined(OPENSSL_NO_STDIO)
static int MS_CALLBACK file_write(BIO *h, const char *buf, int num);
@@ -285,9 +289,9 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr)
/* Under CLib there are differences in file modes
*/
if (num & BIO_FP_TEXT)
- _setmode(fd,O_TEXT);
+ setmode(fd,O_TEXT);
else
- _setmode(fd,O_BINARY);
+ setmode(fd,O_BINARY);
#elif defined(OPENSSL_SYS_MSDOS)
int fd = fileno((FILE*)ptr);
/* Set correct text/binary mode */
diff --git a/crypto/engine/eng_padlock.c b/crypto/engine/eng_padlock.c
index 8531bde1db..1ba9d85db4 100644
--- a/crypto/engine/eng_padlock.c
+++ b/crypto/engine/eng_padlock.c
@@ -126,6 +126,9 @@ void ENGINE_load_padlock (void)
#ifdef _MSC_VER
# include <malloc.h>
# define alloca _alloca
+#elif defined(NETWARE_CLIB) && defined(__GNUC__)
+ void *alloca(size_t);
+# define alloca(s) __builtin_alloca(s)
#else
# include <stdlib.h>
#endif
diff --git a/crypto/perlasm/x86nasm.pl b/crypto/perlasm/x86nasm.pl
index b6dfcbdf02..863c7e9d6e 100644
--- a/crypto/perlasm/x86nasm.pl
+++ b/crypto/perlasm/x86nasm.pl
@@ -281,6 +281,7 @@ sub main'function_begin
my($func,$extra)=@_;
push(@labels,$func);
+ push(@out,".") if ($main'mwerks);
my($tmp)=<<"EOF";
global $under$func
$under$func:
@@ -296,6 +297,7 @@ EOF
sub main'function_begin_B
{
my($func,$extra)=@_;
+ push(@out,".") if ($main'mwerks);
my($tmp)=<<"EOF";
global $under$func
$under$func:
@@ -375,6 +377,7 @@ sub main'comment
sub main'public_label
{
$label{$_[0]}="${under}${_[0]}" if (!defined($label{$_[0]}));
+ push(@out,".") if ($main'mwerks);
push(@out,"global\t$label{$_[0]}\n");
}
diff --git a/crypto/rand/rand_nw.c b/crypto/rand/rand_nw.c
index ba57812788..f177ffbe82 100644
--- a/crypto/rand/rand_nw.c
+++ b/crypto/rand/rand_nw.c
@@ -117,9 +117,15 @@
#if defined(NETWARE_LIBC)
#include <nks/thread.h>
+#else
+#include <nwthread.h>
#endif
-extern long RunningProcess;
+extern int GetProcessSwitchCount(void);
+#if !defined(NETWARE_LIBC) || (CURRENT_NDK_THRESHOLD < 509220000)
+extern void *RunningProcess; /* declare here same as found in newer NDKs */
+extern unsigned long GetSuperHighResolutionTimer(void);
+#endif
/* the FAQ indicates we need to provide at least 20 bytes (160 bits) of seed
*/
@@ -142,7 +148,8 @@ int RAND_poll(void)
l = GetProcessSwitchCount();
RAND_add(&l,sizeof(l),1);
- l=RunningProcess;
+ /* need to cast the void* to unsigned long here */
+ l = (unsigned long)RunningProcess;
RAND_add(&l,sizeof(l),1);
for( i=2; i<ENTROPY_NEEDED; i++)
diff --git a/crypto/rc4/asm/rc4-586.pl b/crypto/rc4/asm/rc4-586.pl
index 5efb68c551..ef7eee766c 100644
--- a/crypto/rc4/asm/rc4-586.pl
+++ b/crypto/rc4/asm/rc4-586.pl
@@ -216,7 +216,7 @@ sub RC4
&movz ($tx,&BP(0,$d,$x));
&cmp ($in,&swtmp(2));
&movb (&BP(0,$out),&LB($ty));
- &lea ($out,&BP(1,$out));
+ &lea ($out,&DWP(1,$out));
&jb (&label("RC4_CHAR_loop"));
&set_label("finished");
diff --git a/e_os.h b/e_os.h
index ab3c539eab..acc6a15eb7 100644
--- a/e_os.h
+++ b/e_os.h
@@ -186,9 +186,15 @@ extern "C" {
#define get_last_socket_error() errno
#define clear_socket_error() errno=0
#define closesocket(s) close(s)
+#define ioctlsocket(a,b,c) ioctl(a,b,c)
+#if defined(NETWARE_LIBC)
#define readsocket(s,b,n) recv((s),(b),(n),0)
#define writesocket(s,b,n) send((s),(b),(n),0)
#else
+#define readsocket(s,b,n) recv((s),(char*)(b),(n),0)
+#define writesocket(s,b,n) send((s),(char*)(b),(n),0)
+#endif
+#else
#define get_last_socket_error() WSAGetLastError()
#define clear_socket_error() WSASetLastError(0)
#define readsocket(s,b,n) recv((s),(b),(n),0)
@@ -379,6 +385,12 @@ static unsigned int _strlen31(const char *str)
# undef DEVRANDOM
# ifdef NETWARE_CLIB
# define getpid GetThreadID
+ extern int GetThreadID(void);
+/* # include <conio.h> */
+ extern int kbhit(void);
+ extern void delay(unsigned milliseconds);
+# else
+# include <screen.h>
# endif
# define NO_SYSLOG
# define _setmode setmode
@@ -479,7 +491,11 @@ extern HINSTANCE _hInstance;
# include <sys/socket.h>
# include <netinet/in.h>
# include <sys/time.h>
-# include <sys/select.h>
+# if defined(NETWARE_CLIB)
+# include <sys/bsdskt.h>
+# else
+# include <sys/select.h>
+# endif
# define INVALID_SOCKET (int)(~0)
# else
# include <novsock2.h>
@@ -621,16 +637,12 @@ extern char *sys_errlist[]; extern int sys_nerr;
#elif defined(OPENSSL_SYS_OS2) && defined(__EMX__)
# define strcasecmp stricmp
# define strncasecmp strnicmp
-#elif defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB)
-# define strcasecmp stricmp
-# define strncasecmp strnicmp
-#else
-# ifdef NO_STRINGS_H
- int strcasecmp();
- int strncasecmp();
-# else
-# include <strings.h>
-# endif /* NO_STRINGS_H */
+#elif defined(OPENSSL_SYS_NETWARE)
+# include <string.h>
+# if defined(NETWARE_CLIB)
+# define strcasecmp stricmp
+# define strncasecmp strnicmp
+# endif /* NETWARE_CLIB */
#endif
#if defined(OPENSSL_SYS_OS2) && defined(__EMX__)
diff --git a/engines/e_aep.c b/engines/e_aep.c
index 7307ddfafb..ffdc354cdc 100644
--- a/engines/e_aep.c
+++ b/engines/e_aep.c
@@ -65,6 +65,11 @@
typedef int pid_t;
#endif
+#if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB)
+#define getpid GetThreadID
+extern int GetThreadID(void);
+#endif
+
#include <openssl/crypto.h>
#include <openssl/dso.h>
#include <openssl/engine.h>
diff --git a/util/mk1mf.pl b/util/mk1mf.pl
index 40e1572609..518595f278 100755
--- a/util/mk1mf.pl
+++ b/util/mk1mf.pl
@@ -42,6 +42,7 @@ $infile="MINFO";
"FreeBSD","FreeBSD distribution",
"OS2-EMX", "EMX GCC OS/2",
"netware-clib", "CodeWarrior for NetWare - CLib - with WinSock Sockets",
+ "netware-clib-bsdsock", "CodeWarrior for NetWare - CLib - with BSD Sockets",
"netware-libc", "CodeWarrior for NetWare - LibC - with WinSock Sockets",
"netware-libc-bsdsock", "CodeWarrior for NetWare - LibC - with BSD Sockets",
"default","cc under unix",
@@ -76,7 +77,7 @@ and [options] can be one of
no-hw - No hw
nasm - Use NASM for x86 asm
nw-nasm - Use NASM x86 asm for NetWare
- nw-mwasm - Use Metrowerks x86 asm for NetWare
+ nw-mwasm - Use Metrowerks x86 asm for NetWare
gaswin - Use GNU as with Mingw32
no-socks - No socket code
no-err - No error strings
@@ -173,10 +174,10 @@ elsif ($platform eq "OS2-EMX")
require 'OS2-EMX.pl';
}
elsif (($platform eq "netware-clib") || ($platform eq "netware-libc") ||
- ($platform eq "netware-libc-bsdsock"))
+ ($platform eq "netware-clib-bsdsock") || ($platform eq "netware-libc-bsdsock"))
{
$LIBC=1 if $platform eq "netware-libc" || $platform eq "netware-libc-bsdsock";
- $BSDSOCK=1 if $platform eq "netware-libc-bsdsock";
+ $BSDSOCK=1 if ($platform eq "netware-libc-bsdsock") || ($platform eq "netware-clib-bsdsock");
require 'netware.pl';
}
else
diff --git a/util/pl/netware.pl b/util/pl/netware.pl
index c05789b22f..173c9919f2 100644
--- a/util/pl/netware.pl
+++ b/util/pl/netware.pl
@@ -1,26 +1,74 @@
-# Metrowerks Codewarrior for NetWare
+# Metrowerks Codewarrior or gcc / nlmconv for NetWare
#
+$version_header = "crypto/opensslv.h";
+open(IN, "$version_header") or die "Couldn't open $version_header: $!";
+while (<IN>) {
+ if (/^#define[\s\t]+OPENSSL_VERSION_NUMBER[\s\t]+0x(\d)(\d{2})(\d{2})(\d{2})/)
+ {
+ # die "OpenSSL version detected: $1.$2.$3.$4\n";
+ #$nlmvernum = "$1,$2,$3";
+ $nlmvernum = "$1,".($2*10+$3).",".($4*1);
+ #$nlmverstr = "$1.".($2*1).".".($3*1).($4?(chr(96+$4)):"");
+ break;
+ }
+}
+close(IN) or die "Couldn't close $version_header: $!";
+
+$readme_file = "README";
+open(IN, $readme_file) or die "Couldn't open $readme_file: $!";
+while (<IN>) {
+ if (/^[\s\t]+OpenSSL[\s\t]+(\d)\.(\d{1,2})\.(\d{1,2})([a-z])(.*)/)
+ {
+ #$nlmvernum = "$1,$2,$3";
+ #$nlmvernum = "$1,".($2*10+$3).",".($4*1);
+ $nlmverstr = "$1.$2.$3$4$5";
+ }
+ elsif (/^[\s\t]+(Copyright \(c\) \d{4}\-\d{4} The OpenSSL Project)$/)
+ {
+ $nlmcpystr = $1;
+ }
+ break if ($nlmvernum && $nlmcpystr);
+}
+close(IN) or die "Couldn't close $readme_file: $!";
+
+# Define stacksize here
+$nlmstack = "32768";
+
+# some default settings here in case we failed to find them in README
+$nlmvernum = "1,0,0" if (!$nlmvernum);
+$nlmverstr = "OpenSSL" if (!$nlmverstr);
+$nlmcpystr = "Copyright (c) 1998-now The OpenSSL Project" if (!$nlmcpystr);
+
+# die "OpenSSL copyright: $nlmcpystr\nOpenSSL verstring: $nlmverstr\nOpenSSL vernumber: $nlmvernum\n";
+
# The import files and other misc imports needed to link
-@misc_imports = ("GetProcessSwitchCount", "RunningProcess",
+@misc_imports = ("GetProcessSwitchCount", "RunningProcess",
"GetSuperHighResolutionTimer");
if ($LIBC)
{
@import_files = ("libc.imp");
@module_files = ("libc");
+ $libarch = "LIBC";
}
else
{
# clib build
@import_files = ("clib.imp");
+ push(@import_files, "socklib.imp") if ($BSDSOCK);
@module_files = ("clib");
- push(@misc_imports, "_rt_modu64%16", "_rt_divu64%16");
+ # push(@misc_imports, "_rt_modu64%16", "_rt_divu64%16");
+ $libarch = "CLIB";
}
-if (!$BSDSOCK)
+if ($BSDSOCK)
+{
+ $libarch .= "-BSD";
+}
+else
{
+ $libarch .= "-WS2";
push(@import_files, "ws2nlm.imp");
}
-
# The "IMPORTS" environment variable must be set and point to the location
# where import files (*.imp) can be found.
@@ -33,30 +81,68 @@ $import_path = $ENV{"IMPORTS"} || die ("IMPORTS environment variable not set\n")
# Example: set PRELUDE=c:\codewar\novell support\metrowerks support\libraries\runtime\nwpre.obj
$prelude = $ENV{"PRELUDE"} || die ("PRELUDE environment variable not set\n");
-#$ssl= "ssleay32";
-#$crypto="libeay32";
-
-$o='\\\\';
-$cp='copy >nul:';
-$rm='del';
+# The "INCLUDES" environment variable must be set and point to the location
+# where import files (*.imp) can be found.
+$include_path = $ENV{"INCLUDE"} || die ("INCLUDES environment variable not set\n");
+$include_path =~ s/\\/\//g;
+$include_path = join(" -I", split(/;/, $include_path));
-# C compiler
-$cc="mwccnlm";
+# check for gcc compiler
+$gnuc = $ENV{"GNUC"};
-# Linker
-$link="mwldnlm";
+#$ssl= "ssleay32";
+#$crypto="libeay32";
-# librarian
-$mklib="mwldnlm";
+if ($gnuc)
+{
+ # C compiler
+ $cc='gcc';
+ # Linker
+ $link='nlmconv';
+ # librarian
+ $mklib='ar';
+ $o='/';
+ # cp command
+ $cp='cp -af';
+ # rm command
+ $rm='rm -f';
+ # mv command
+ $mv='mv -f';
+ # mkdir command
+ $mkdir='gmkdir';
+ #$ranlib='ranlib';
+}
+else
+{
+ # C compiler
+ $cc='mwccnlm';
+ # Linker
+ $link='mwldnlm';
+ # librarian
+ $mklib='mwldnlm';
+ # Path separator
+ $o='\\';
+ # cp command
+ $cp='copy >nul:';
+ # rm command
+ $rm='del /f /q';
+}
-# assembler
-if ($nw_nasm)
+# assembler
+if ($nw_nasm)
{
- $asm="nasmw -s -f coff";
+ if ($gnuc)
+ {
+ $asm="nasmw -s -f elf";
+ }
+ else
+ {
+ $asm="nasmw -s -f coff";
+ }
$afile="-o ";
$asm.=" -g" if $debug;
}
-elsif ($nw_mwasm)
+elsif ($nw_mwasm)
{
$asm="mwasmnlm -maxerrors 20";
$afile="-o ";
@@ -64,14 +150,14 @@ elsif ($nw_mwasm)
}
elsif ($nw_masm)
{
-# masm assembly settings - it should be possible to use masm but haven't
+# masm assembly settings - it should be possible to use masm but haven't
# got it working.
# $asm='ml /Cp /coff /c /Cx';
# $asm.=" /Zi" if $debug;
# $afile='/Fo';
die("Support for masm assembler not yet functional\n");
}
-else
+else
{
$asm="";
$afile="";
@@ -79,59 +165,89 @@ else
-# compile flags
-#
-# NOTES: Several c files in the crypto subdirectory include headers from
-# their local directories. Metrowerks wouldn't find these h files
-# without adding individual include directives as compile flags
-# or modifying the c files. Instead of adding individual include
-# paths for each subdirectory a recursive include directive
-# is used ( -ir crypto ).
-#
-# A similar issue exists for the engines and apps subdirectories.
-#
-# Turned off the "possible" warnings ( -w nopossible ). Metrowerks
-# complained a lot about various stuff. May want to turn back
-# on for further development.
-$cflags="-ir crypto -ir engines -ir apps -msgstyle gcc -align 4 -processor pentium \\
- -char unsigned -w on -w nolargeargs -w nopossible -w nounusedarg \\
- -w noimplicitconv -relax_pointers -nosyspath -DL_ENDIAN \\
- -DOPENSSL_SYSNAME_NETWARE -U_WIN32 -maxerrors 20 ";
-
-# link flags
-$lflags="-msgstyle gcc -zerobss -stacksize 32768 -nostdlib -sym internal ";
-
-
-# additional flags based upon debug | non-debug
-if ($debug)
+if ($gnuc)
{
- $cflags.=" -opt off -g -sym internal -DDEBUG";
+ # compile flags for GNUC
+ # additional flags based upon debug | non-debug
+ if ($debug)
+ {
+ $cflags="-g -DDEBUG";
+ }
+ else
+ {
+ $cflags="-O2";
+ }
+ $cflags.=" -nostdinc -I$include_path \\
+ -fno-builtin -fpcc-struct-return -fno-strict-aliasing \\
+ -funsigned-char -Wall -Wno-unused -Wno-uninitialized";
+
+ # link flags
+ $lflags="-T";
}
else
{
-# CodeWarrior compiler has a problem with optimizations for floating
-# points - no optimizations until further investigation
-# $cflags.=" -opt all";
+ # compile flags for CodeWarrior
+ # additional flags based upon debug | non-debug
+ if ($debug)
+ {
+ $cflags="-opt off -g -sym internal -DDEBUG";
+ }
+ else
+ {
+ # CodeWarrior compiler has a problem with optimizations for floating
+ # points - no optimizations until further investigation
+ # $cflags="-opt all";
+ }
+
+ # NOTES: Several c files in the crypto subdirectory include headers from
+ # their local directories. Metrowerks wouldn't find these h files
+ # without adding individual include directives as compile flags
+ # or modifying the c files. Instead of adding individual include
+ # paths for each subdirectory a recursive include directive
+ # is used ( -ir crypto ).
+ #
+ # A similar issue exists for the engines and apps subdirectories.
+ #
+ # Turned off the "possible" warnings ( -w nopossible ). Metrowerks
+ # complained a lot about various stuff. May want to turn back
+ # on for further development.
+ $cflags.=" -nostdinc -ir crypto -ir engines -ir apps -I$include_path \\
+ -msgstyle gcc -align 4 -processor pentium -char unsigned \\
+ -w on -w nolargeargs -w nopossible -w nounusedarg -w nounusedexpr \\
+ -w noimplicitconv -relax_pointers -nosyspath -maxerrors 20";
+
+ # link flags
+ $lflags="-msgstyle gcc -zerobss -nostdlib -sym internal -commandfile";
}
+# common defines
+$cflags.=" -DL_ENDIAN -DOPENSSL_SYSNAME_NETWARE -U_WIN32";
+
# If LibC build add in NKS_LIBC define and set the entry/exit
# routines - The default entry/exit routines are for CLib and don't exist
# in LibC
if ($LIBC)
{
$cflags.=" -DNETWARE_LIBC";
- $lflags.=" -entry _LibCPrelude -exit _LibCPostlude -flags pseudopreemption";
+ $nlmstart = "_LibCPrelude";
+ $nlmexit = "_LibCPostlude";
+ @nlm_flags = ("pseudopreemption", "flag_on 64");
}
else
{
$cflags.=" -DNETWARE_CLIB";
- $lflags.=" -entry _Prelude -exit _Stop";
+ $nlmstart = "_Prelude";
+ $nlmexit = "_Stop";
}
# If BSD Socket support is requested, set a define for the compiler
if ($BSDSOCK)
{
$cflags.=" -DNETWARE_BSDSOCK";
+ if (!$LIBC)
+ {
+ $cflags.=" -DNETDB_USE_INTERNET";
+ }
}
@@ -154,16 +270,25 @@ if ($shlib)
}
else
{
- $libp=".lib";
- $shlibp=".lib";
- $lib_flags="-nodefaults -type library";
+ if ($gnuc) # GNUC Tools
+ {
+ $libp=".a";
+ $shlibp=".a";
+ $lib_flags="-cr";
+ }
+ else # CodeWarrior
+ {
+ $libp=".lib";
+ $shlibp=".lib";
+ $lib_flags="-nodefaults -type library -o";
+ }
if ($LIBC)
{
$out_def.="_nw_libc";
$tmp_def.="_nw_libc";
$inc_def.="_nw_libc";
}
- else # NETWARE_CLIB
+ else # NETWARE_CLIB
{
$out_def.="_nw_clib";
$tmp_def.="_nw_clib";
@@ -172,7 +297,7 @@ else
}
# used by mk1mf.pl
-$obj='.obj';
+$obj='.o';
$ofile='-o ';
$efile='';
$exep='.nlm';
@@ -180,30 +305,41 @@ $ex_libs='';
if (!$no_asm)
{
- $bn_asm_obj="crypto${o}bn${o}asm${o}bn-nw.obj";
+ $bn_asm_obj="\$(OBJ_D)${o}bn-nw${obj}";
$bn_asm_src="crypto${o}bn${o}asm${o}bn-nw.asm";
- $des_enc_obj="crypto${o}des${o}asm${o}d-nw.obj crypto${o}des${o}asm${o}y-nw.obj";
+ $bnco_asm_obj="\$(OBJ_D)${o}co-nw${obj}";
+ $bnco_asm_src="crypto${o}bn${o}asm${o}co-nw.asm";
+ $aes_asm_obj="\$(OBJ_D)${o}a-nw${obj}";
+ $aes_asm_src="crypto${o}aes${o}asm${o}a-nw.asm";
+ $des_enc_obj="\$(OBJ_D)${o}d-nw${obj} \$(OBJ_D)${o}y-nw${obj}";
$des_enc_src="crypto${o}des${o}asm${o}d-nw.asm crypto${o}des${o}asm${o}y-nw.asm";
- $bf_enc_obj="crypto${o}bf${o}asm${o}b-nw.obj";
+ $bf_enc_obj="\$(OBJ_D)${o}b-nw${obj}";
$bf_enc_src="crypto${o}bf${o}asm${o}b-nw.asm";
- $cast_enc_obj="crypto${o}cast${o}asm${o}c-nw.obj";
+ $cast_enc_obj="\$(OBJ_D)${o}c-nw${obj}";
$cast_enc_src="crypto${o}cast${o}asm${o}c-nw.asm";
- $rc4_enc_obj="crypto${o}rc4${o}asm${o}r4-nw.obj";
+ $rc4_enc_obj="\$(OBJ_D)${o}r4-nw${obj}";
$rc4_enc_src="crypto${o}rc4${o}asm${o}r4-nw.asm";
- $rc5_enc_obj="crypto${o}rc5${o}asm${o}r5-nw.obj";
+ $rc5_enc_obj="\$(OBJ_D)${o}r5-nw${obj}";
$rc5_enc_src="crypto${o}rc5${o}asm${o}r5-nw.asm";
- $md5_asm_obj="crypto${o}md5${o}asm${o}m5-nw.obj";
+ $md5_asm_obj="\$(OBJ_D)${o}m5-nw${obj}";
$md5_asm_src="crypto${o}md5${o}asm${o}m5-nw.asm";
- $sha1_asm_obj="crypto${o}sha${o}asm${o}s1-nw.obj";
+ $sha1_asm_obj="\$(OBJ_D)${o}s1-nw${obj}";
$sha1_asm_src="crypto${o}sha${o}asm${o}s1-nw.asm";
- $rmd160_asm_obj="crypto${o}ripemd${o}asm${o}rm-nw.obj";
+ $rmd160_asm_obj="\$(OBJ_D)${o}rm-nw${obj}";
$rmd160_asm_src="crypto${o}ripemd${o}asm${o}rm-nw.asm";
- $cflags.=" -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
+ $cpuid_asm_obj="\$(OBJ_D)${o}x86cpuid-nw${obj}";
+ $cpuid_asm_src="crypto${o}x86cpuid-nw.asm";
+ $cflags.=" -DOPENSSL_CPUID_OBJ -DBN_ASM -DOPENSSL_BN_ASM_PART_WORDS -DMD5_ASM -DSHA1_ASM";
+ $cflags.=" -DAES_ASM -DRMD160_ASM";
}
else
{
$bn_asm_obj='';
$bn_asm_src='';
+ $bnco_asm_obj='';
+ $bnco_asm_src='';
+ $aes_asm_obj='';
+ $aes_asm_src='';
$des_enc_obj='';
$des_enc_src='';
$bf_enc_obj='';
@@ -220,15 +356,15 @@ else
$sha1_asm_src='';
$rmd160_asm_obj='';
$rmd160_asm_src='';
+ $cpuid_asm_obj='';
+ $cpuid_asm_src='';
}
# create the *.def linker command files in \openssl\netware\ directory
sub do_def_file
{
# strip off the leading path
- my($target) = bname(@_);
- my($def_file);
- my($mod_file);
+ my($target) = bname(shift);
my($i);
if ($target =~ /(.*).nlm/)
@@ -239,35 +375,72 @@ sub do_def_file
# special case for openssl - the mk1mf.pl defines E_EXE = openssl
if ($target =~ /E_EXE/)
{
- $target = "openssl";
+ $target =~ s/\$\(E_EXE\)/openssl/;
}
# Note: originally tried to use full path ( \openssl\netware\$target.def )
# Metrowerks linker choked on this with an assertion failure. bug???
#
- $def_file = "netware\\$target.def";
+ my($def_file) = "netware${o}$target.def";
open(DEF_OUT, ">$def_file") || die("unable to open file $def_file\n");
- print( DEF_OUT "# command file generated by netware.pl for Metrowerks build\n" );
+ print( DEF_OUT "# command file generated by netware.pl for NLM target.\n" );
+ print( DEF_OUT "# do not edit this file - all your changes will be lost!!\n" );
print( DEF_OUT "#\n");
- print( DEF_OUT "DESCRIPTION \"$target\"\n");
-
+ print( DEF_OUT "DESCRIPTION \"$target ($libarch) - OpenSSL $nlmverstr\"\n");
+ print( DEF_OUT "COPYRIGHT \"$nlmcpystr\"\n");
+ print( DEF_OUT "VERSION $nlmvernum\n");
+ print( DEF_OUT "STACK $nlmstack\n");
+ print( DEF_OUT "START $nlmstart\n");
+ print( DEF_OUT "EXIT $nlmexit\n");
+
+ # special case for openssl
+ if ($target eq "openssl")
+ {
+ print( DEF_OUT "SCREENNAME \"OpenSSL $nlmverstr\"\n");
+ }
+ else
+ {
+ print( DEF_OUT "SCREENNAME \"DEFAULT\"\n");
+ }
+
foreach $i (@misc_imports)
{
print( DEF_OUT "IMPORT $i\n");
}
-
+
foreach $i (@import_files)
{
- print( DEF_OUT "IMPORT \@$import_path\\$i\n");
+ print( DEF_OUT "IMPORT \@$import_path${o}$i\n");
}
-
+
foreach $i (@module_files)
{
print( DEF_OUT "MODULE $i\n");
}
+ foreach $i (@nlm_flags)
+ {
+ print( DEF_OUT "$i\n");
+ }
+
+ if ($gnuc)
+ {
+ if ($target =~ /openssl/)
+ {
+ print( DEF_OUT "INPUT ${tmp_def}${o}openssl${obj}\n");
+ print( DEF_OUT "INPUT ${tmp_def}${o}openssl${libp}\n");
+ }
+ else
+ {
+ print( DEF_OUT "INPUT ${tmp_def}${o}${target}${obj}\n");
+ }
+ print( DEF_OUT "INPUT $prelude\n");
+ print( DEF_OUT "INPUT ${out_def}${o}${ssl}${libp} ${out_def}${o}${crypto}${libp}\n");
+ print( DEF_OUT "OUTPUT $target.nlm\n");
+ }
+
close(DEF_OUT);
return($def_file);
}
@@ -281,7 +454,7 @@ sub do_lib_rule
if (!$shlib)
{
$ret.="\t\@echo Building Lib: $name\n";
- $ret.="\t\$(MKLIB) $lib_flags -o $target $objs\n";
+ $ret.="\t\$(MKLIB) $lib_flags $target $objs\n";
$ret.="\t\@echo .\n"
}
else
@@ -297,17 +470,15 @@ sub do_link_rule
{
my($target,$files,$dep_libs,$libs)=@_;
my($ret);
- my($def_file);
-
- $def_file = do_def_file($target);
+ my($def_file) = do_def_file($target);
- # special case for openssl - the mk1mf.pl defines E_EXE = openssl
+ $ret.="$target: $files $dep_libs\n";
# NOTE: When building the test nlms no screen name is given
# which causes the console screen to be used. By using the console
# screen there is no "<press any key to continue>" message which
- # requires user interaction. The test script ( tests.pl ) needs to be
- # able to run the tests without requiring user interaction.
+ # requires user interaction. The test script ( do_tests.pl ) needs
+ # to be able to run the tests without requiring user interaction.
#
# However, the sample program "openssl.nlm" is used by the tests and is
# a interactive sample so a screen is desired when not be run by the
@@ -315,27 +486,41 @@ sub do_link_rule
# openssl2 - no screen used by tests
# openssl - default screen - use for normal interactive modes
#
+
+ # special case for openssl - the mk1mf.pl defines E_EXE = openssl
if ($target =~ /E_EXE/)
{
my($target2) = $target;
$target2 =~ s/\(E_EXE\)/\(E_EXE\)2/;
- $ret.="$target: $files $dep_libs\n";
-
- # openssl
- $ret.="\t\$(LINK) \$(LFLAGS) -screenname openssl -commandfile $def_file $files \"$prelude\" $libs -o $target\n";
- # openssl2
- $ret.="\t\$(LINK) \$(LFLAGS) -commandfile $def_file $files \"$prelude\" $libs -o $target2\n";
+ # openssl2
+ my($def_file2) = do_def_file($target2);
+
+ if ($gnuc)
+ {
+ $ret.="\t\$(MKLIB) $lib_flags \$(TMP_D)${o}\$(E_EXE).a \$(filter-out \$(TMP_D)${o}\$(E_EXE)${obj},$files)\n";
+ $ret.="\t\$(LINK) \$(LFLAGS) $def_file2\n";
+ $ret.="\t\@$mv \$(E_EXE)2.nlm \$(TEST_D)\n";
+ }
+ else
+ {
+ $ret.="\t\$(LINK) \$(LFLAGS) $def_file2 $files \"$prelude\" $libs -o $target2\n";
+ }
+ }
+ if ($gnuc)
+ {
+ $ret.="\t\$(LINK) \$(LFLAGS) $def_file\n";
+ $ret.="\t\@$mv \$(\@F) \$(TEST_D)\n";
}
else
{
- $ret.="$target: $files $dep_libs\n";
- $ret.="\t\$(LINK) \$(LFLAGS) -commandfile $def_file $files \"$prelude\" $libs -o $target\n";
+ $ret.="\t\$(LINK) \$(LFLAGS) $def_file $files \"$prelude\" $libs -o $target\n";
}
$ret.="\n";
return($ret);
+
}
1;