I have just finished porting the 0.9.6 version of openssl to DOS via
the DJGPP compiling environment. I know that Gisle Vanem had commented
on the ability to compile openssl under DJGPP in February and April
of this year, but I didn't see a patch to make this go smoothly. The
main obstacle to the port was the assumption in several places that
symbolic links are available in the operating system, an assumption
not true in DOS. This problem starts with the tar.gz archive. The DJTAR
program tries to convert symbolic links into hard links (by copying the
file), but only 0 byte files are created, because the symbolic links are
unpacked before the file itself.
With this patch openssl compiles without problem. The only warnings
are of unused parameters, missing initializers, and comparisons
between signed and unsigned. Make test has no errors. Make install
seems to work properly also. The DJGPP port of the lynx browser
compiled with the openssl library works well, connecting to secure
sites.
Please note that I am not a programmer and have never worked with
perl before. Nonetheless, I have checked the patch and it seems to
work properly. The changes in regard to handling of symbolic links
shouldn't break other platforms. Compiling instructions are in the
file install.djgpp, included in the patch file. Any suggestions for
improving this would be appreciated.
Doug
--- openssl-0.9.6/Configure Sun Sep 24 07:27:36 2000
+++ openssl-0.9.6/Configure.new Sat Nov 18 14:13:08 2000
@@ -390,6 +390,9 @@
# CygWin32
"CygWin32", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486
-Wall::::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::win32",
+# DJGPP
+"DJGPP", "gcc:-I/dev/env/DJDIR/watt/inc -DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2
+-Wall -W:::-L/dev/env/DJDIR/watt/lib -lwatt:BN_LLONG ${x86_gcc_des}
+${x86_gcc_opts}::::::::::",
+
# Ultrix from Bernhard Simon <[EMAIL PROTECTED]>
"ultrix-cc","cc:-std1 -O -Olimit 1000 -DL_ENDIAN::(unknown)::::::",
"ultrix-gcc","gcc:-O3 -DL_ENDIAN::(unknown)::::::",
--- openssl-0.9.6/crypto/bio/bss_file.c Mon Sep 11 04:42:16 2000
+++ openssl-0.9.6/crypto/bio/bss_file.c.new Sat Oct 28 14:11:40 2000
@@ -205,11 +205,19 @@
b->ptr=(char *)ptr;
b->init=1;
#if defined(MSDOS) || defined(WINDOWS)
+#ifdef __DJGPP__
+ /* Set correct text/binary mode */
+ if (num & BIO_FP_TEXT)
+ setmode(fileno((FILE *)ptr),O_TEXT);
+ else
+ setmode(fileno((FILE *)ptr),O_BINARY);
+#else
/* Set correct text/binary mode */
if (num & BIO_FP_TEXT)
_setmode(fileno((FILE *)ptr),_O_TEXT);
else
_setmode(fileno((FILE *)ptr),_O_BINARY);
+#endif /* __DJGPP__ */
#endif
break;
case BIO_C_SET_FILENAME:
--- openssl-0.9.6/tools/c_rehash.in Mon Sep 11 04:43:06 2000
+++ openssl-0.9.6/tools/c_rehash.in.new Sat Nov 18 00:49:56 2000
@@ -117,7 +117,13 @@
}
$hash .= ".$suffix";
print "$fname => $hash\n";
+ $symlink_exists=eval {symlink("",""); 1};
+ if ($symlink_exists eq '1') {
symlink $fname, $hash;
+ } else {
+ @args= ("cp", "$fname", "$hash");
+ system {$args[0]} @args;
+ }
$hashlist{$hash} = $fprint;
}
@@ -142,7 +148,13 @@
}
$hash .= ".r$suffix";
print "$fname => $hash\n";
+ $symlink_exists=eval {symlink("",""); 1};
+ if ($symlink_exists eq '1') {
symlink $fname, $hash;
+ } else {
+ @args= ("cp", "$fname", "$hash");
+ system {$args[0]} @args;
+ }
$hashlist{$hash} = $fprint;
}
--- openssl-0.9.6/e_os.h Thu Sep 21 01:23:14 2000
+++ openssl-0.9.6/e_os.h.new Sun Nov 19 09:40:58 2000
@@ -172,6 +172,11 @@
#if (defined(WINDOWS) || defined(MSDOS)) && !defined(__CYGWIN32__)
+# ifdef __DJGPP__
+# include <unistd.h>
+# include <sys/stat.h>
+# endif /* __DJGPP__ */
+
# ifndef S_IFDIR
# define S_IFDIR _S_IFDIR
# endif
@@ -317,7 +322,7 @@
/*************/
#ifdef USE_SOCKETS
-# if defined(WINDOWS) || defined(MSDOS)
+# if (defined(WINDOWS) || defined(MSDOS)) && !defined(__DJGPP__)
/* windows world */
# ifdef NO_SOCK
@@ -400,7 +405,9 @@
# define SSLeay_Write(a,b,c) write((a),(b),(c))
# define SHUTDOWN(fd) { shutdown((fd),0); closesocket((fd)); }
# define SHUTDOWN2(fd) { shutdown((fd),2); closesocket((fd)); }
+# ifndef INVALID_SOCKET
# define INVALID_SOCKET (-1)
+# endif /* INVALID_SOCKET */
# endif
#endif
--- openssl-0.9.6/util/mklink.pl Mon Sep 11 04:43:08 2000
+++ openssl-0.9.6/util/mklink.pl.new Sat Nov 18 18:12:38 2000
@@ -48,8 +48,18 @@
my $to = join('/', @to_path);
my $file;
+$symlink_exists=eval {symlink("",""); 1};
+if ($symlink_exists eq '1') {
foreach $file (@files) {
my $err = "";
symlink("$to/$file", "$from/$file") or $err = " [$!]";
+ print $file . " => $from/$file$err\n";
+}
+} else {
+foreach $file (@files) {
+ my $err = "";
+ @args= ("cp", "$file", "$from/$file");
+ system {$args[0]} @args or $err = " [$!]";
+ }
print $file . " => $from/$file$err\n";
}
--- openssl-0.9.6/crypto/rand/rand_egd.c Mon Sep 11 04:42:38 2000
+++ openssl-0.9.6/crypto/rand/rand_egd.c.new Sat Oct 28 13:44:04 2000
@@ -59,7 +59,7 @@
/* Query the EGD <URL: http://www.lothar.com/tech/crypto/>.
*/
-#if defined(WIN32) || defined(VMS) || defined(__VMS)
+#if defined(WIN32) || defined(VMS) || defined(__VMS) || defined(__DJGPP__)
int RAND_egd(const char *path)
{
return(-1);
--- openssl-0.9.6/crypto/des/read_pwd.c Thu Sep 21 01:23:34 2000
+++ openssl-0.9.6/crypto/des/read_pwd.c.new Sat Oct 28 03:15:36 2000
@@ -240,7 +240,7 @@
long status;
unsigned short channel = 0;
#else
-#ifndef MSDOS
+#if !defined(MSDOS) || defined(__DJGPP__)
TTY_STRUCT tty_orig,tty_new;
#endif
#endif
--- openssl-0.9.6/test/tcrl Sat Oct 28 16:00:20 2000
+++ openssl-0.9.6/test/tcrl.new Thu Nov 16 23:13:00 2000
@@ -1,6 +1,10 @@
#!/bin/sh
+#ifdef __DJGPP__
+PATH=../apps\;$PATH
+#else
PATH=../apps:$PATH
+#endif /* __DJGPP__ */
export PATH
cmd='../apps/openssl crl'
--- openssl-0.9.6/test/testca Sat Oct 28 16:01:04 2000
+++ openssl-0.9.6/test/testca.new Thu Nov 16 23:15:34 2000
@@ -1,7 +1,11 @@
#!/bin/sh
SH="/bin/sh"
+#ifdef __DJGPP__
+PATH=../apps\;$PATH
+#else
PATH=../apps:$PATH
+#endif /* __DJGPP__ */
export SH PATH
SSLEAY_CONFIG="-config CAss.cnf"
--- openssl-0.9.6/test/testgen Sat Oct 28 16:01:38 2000
+++ openssl-0.9.6/test/testgen.new Thu Nov 16 23:17:32 2000
@@ -6,7 +6,11 @@
/bin/rm -f $T.1 $T.2 $T.key
+#ifdef __DJGPP__
+PATH=../apps\;$PATH;
+#else
PATH=../apps:$PATH;
+#endif /* __DJGPP__ */
export PATH
echo "generating certificate request"
--- openssl-0.9.6/test/tpkcs7 Sat Oct 28 16:02:02 2000
+++ openssl-0.9.6/test/tpkcs7.new Thu Nov 16 23:27:14 2000
@@ -1,6 +1,10 @@
#!/bin/sh
+#ifdef __DJGPP__
+PATH=../apps\;$PATH
+#else
PATH=../apps:$PATH
+#endif /* __DJGPP__ */
export PATH
cmd='../apps/openssl pkcs7'
--- openssl-0.9.6/test/tpkcs7d Sat Oct 28 16:03:42 2000
+++ openssl-0.9.6/test/tpkcs7d.new Thu Nov 16 23:28:48 2000
@@ -1,6 +1,10 @@
#!/bin/sh
+#ifdef __DJGPP__
+PATH=../apps\;$PATH
+#else
PATH=../apps:$PATH
+#endif /* __DJGPP__ */
export PATH
cmd='../apps/openssl pkcs7'
--- openssl-0.9.6/test/treq Sat Oct 28 16:02:36 2000
+++ openssl-0.9.6/test/treq.new Thu Nov 16 23:19:46 2000
@@ -1,6 +1,10 @@
#!/bin/sh
+#ifdef __DJGPP__
+PATH=../apps\;$PATH
+#else
PATH=../apps:$PATH
+#endif /* __DJGPP__ */
export PATH
cmd='../apps/openssl req -config ../apps/openssl.cnf'
--- openssl-0.9.6/test/trsa Sat Oct 28 17:56:28 2000
+++ openssl-0.9.6/test/trsa.new Thu Nov 16 23:21:32 2000
@@ -1,6 +1,10 @@
#!/bin/sh
+#ifdef __DJGPP__
+PATH=../apps\;$PATH
+#else
PATH=../apps:$PATH
+#endif /* __DJGPP__ */
export PATH
if ../apps/openssl no-rsa; then
--- openssl-0.9.6/test/tsid Sat Oct 28 16:02:52 2000
+++ openssl-0.9.6/test/tsid.new Thu Nov 16 23:22:54 2000
@@ -1,6 +1,10 @@
#!/bin/sh
+#ifdef __DJGPP__
+PATH=../apps\;$PATH
+#else
PATH=../apps:$PATH
+#endif /* __DJGPP__ */
export PATH
cmd='../apps/openssl sess_id'
--- openssl-0.9.6/test/tx509 Sat Oct 28 15:19:02 2000
+++ openssl-0.9.6/test/tx509.new Sat Nov 18 14:44:46 2000
@@ -1,6 +1,10 @@
#!/bin/sh
+#ifdef __DJGPP__
+PATH=../apps\;$PATH
+#else
PATH=../apps:$PATH
+#endif /* __DJGPP__ */
export PATH
cmd='../apps/openssl x509'
--- openssl-0.9.6/util/point.sh Sat Mar 6 04:32:06 1999
+++ openssl-0.9.6/util/point.sh.new Sat Nov 18 20:09:06 2000
@@ -1,6 +1,9 @@
#!/bin/sh
rm -f $2
-ln -s $1 $2
+if test "$MACHTYPE" == i386-pc-msdosdjgpp;
+then cp $1 $2;
+else ln -s $1 $2;
+fi
echo "$2 => $1"
--- openssl-0.9.6/djcopy.sh Sat Nov 18 22:33:26 2000
+++ openssl-0.9.6/djcopy.sh.new Sat Nov 18 18:06:42 2000
@@ -0,0 +1,126 @@
+#!/bin/sh
+cp Makefile.ssl Makefile
+cp apps/Makefile.ssl apps/Makefile
+cp crypto/md4/md4.c apps/md4.c
+cp crypto/md5/md5.c apps/md5.c
+cp crypto/ripemd/rmd160.c apps/rmd160.c
+cp crypto/Makefile.ssl crypto/Makefile
+cp crypto/asn1/Makefile.ssl crypto/asn1/Makefile
+cp crypto/bf/Makefile.ssl crypto/bf/Makefile
+cp crypto/bio/Makefile.ssl crypto/bio/Makefile
+cp crypto/bn/Makefile.ssl crypto/bn/Makefile
+cp crypto/buffer/Makefile.ssl crypto/buffer/Makefile
+cp crypto/cast/Makefile.ssl crypto/cast/Makefile
+cp crypto/comp/Makefile.ssl crypto/comp/Makefile
+cp crypto/conf/Makefile.ssl crypto/conf/Makefile
+cp crypto/des/Makefile.ssl crypto/des/Makefile
+cp -r crypto/perlasm crypto/des/asm/perlasm
+cp crypto/dh/Makefile.ssl crypto/dh/Makefile
+cp crypto/dsa/Makefile.ssl crypto/dsa/Makefile
+cp crypto/dso/Makefile.ssl crypto/dso/Makefile
+cp crypto/err/Makefile.ssl crypto/err/Makefile
+cp crypto/evp/Makefile.ssl crypto/evp/Makefile
+cp crypto/hmac/Makefile.ssl crypto/hmac/Makefile
+cp crypto/idea/Makefile.ssl crypto/idea/Makefile
+cp crypto/lhash/Makefile.ssl crypto/lhash/Makefile
+cp crypto/md2/Makefile.ssl crypto/md2/Makefile
+cp crypto/md4/Makefile.ssl crypto/md4/Makefile
+cp crypto/md5/Makefile.ssl crypto/md5/Makefile
+cp crypto/mdc2/Makefile.ssl crypto/mdc2/Makefile
+cp crypto/objects/Makefile.ssl crypto/objects/Makefile
+cp crypto/pem/Makefile.ssl crypto/pem/Makefile
+cp crypto/pkcs12/Makefile.ssl crypto/pkcs12/Makefile
+cp crypto/pkcs7/Makefile.ssl crypto/pkcs7/Makefile
+cp crypto/rand/Makefile.ssl crypto/rand/Makefile
+cp crypto/rc2/Makefile.ssl crypto/rc2/Makefile
+cp crypto/rc4/Makefile.ssl crypto/rc4/Makefile
+cp crypto/rc5/Makefile.ssl crypto/rc5/Makefile
+cp crypto/ripemd/Makefile.ssl crypto/ripemd/Makefile
+cp crypto/rsa/Makefile.ssl crypto/rsa/Makefile
+cp crypto/sha/Makefile.ssl crypto/sha/Makefile
+cp crypto/stack/Makefile.ssl crypto/stack/Makefile
+cp crypto/txt_db/Makefile.ssl crypto/txt_db/Makefile
+cp crypto/x509/Makefile.ssl crypto/x509/Makefile
+cp crypto/x509v3/Makefile.ssl crypto/x509v3/Makefile
+cp crypto/asn1/asn1.h include/openssl/asn1.h
+cp crypto/asn1/asn1_mac.h include/openssl/asn1_mac.h
+cp crypto/bio/bio.h include/openssl/bio.h
+cp crypto/bf/blowfish.h include/openssl/blowfish.h
+cp crypto/bn/bn.h include/openssl/bn.h
+cp crypto/buffer/buffer.h include/openssl/buffer.h
+cp crypto/cast/cast.h include/openssl/cast.h
+cp crypto/comp/comp.h include/openssl/comp.h
+cp crypto/conf/conf.h include/openssl/conf.h
+cp crypto/conf/conf_api.h include/openssl/conf_api.h
+cp crypto/crypto.h include/openssl/crypto.h
+cp crypto/des/des.h include/openssl/des.h
+cp crypto/dh/dh.h include/openssl/dh.h
+cp crypto/dsa/dsa.h include/openssl/dsa.h
+cp crypto/dso/dso.h include/openssl/dso.h
+cp e_os.h include/openssl/e_os.h
+cp e_os2.h include/openssl/e_os2.h
+cp crypto/ebcdic.h include/openssl/ebcdic.h
+cp crypto/err/err.h include/openssl/err.h
+cp crypto/evp/evp.h include/openssl/evp.h
+cp crypto/hmac/hmac.h include/openssl/hmac.h
+cp crypto/idea/idea.h include/openssl/idea.h
+cp crypto/lhash/lhash.h include/openssl/lhash.h
+cp crypto/md2/md2.h include/openssl/md2.h
+cp crypto/md4/md4.h include/openssl/md4.h
+cp crypto/md5/md5.h include/openssl/md5.h
+cp crypto/mdc2/mdc2.h include/openssl/mdc2.h
+cp crypto/objects/obj_mac.h include/openssl/obj_mac.h
+cp crypto/objects/objects.h include/openssl/objects.h
+cp crypto/opensslconf.h include/openssl/opensslconf.h
+cp crypto/opensslv.h include/openssl/opensslv.h
+cp crypto/pem/pem.h include/openssl/pem.h
+cp crypto/pem/pem2.h include/openssl/pem2.h
+cp crypto/pkcs12/pkcs12.h include/openssl/pkcs12.h
+cp crypto/pkcs7/pkcs7.h include/openssl/pkcs7.h
+cp crypto/rand/rand.h include/openssl/rand.h
+cp crypto/rc2/rc2.h include/openssl/rc2.h
+cp crypto/rc4/rc4.h include/openssl/rc4.h
+cp crypto/rc5/rc5.h include/openssl/rc5.h
+cp crypto/ripemd/ripemd.h include/openssl/ripemd.h
+cp crypto/rsa/rsa.h include/openssl/rsa.h
+cp crypto/rsa/rsa.h include/openssl/rsa.h
+cp rsaref/rsaref.h include/openssl/rsaref.h
+cp crypto/stack/safestack.h include/openssl/safestack.h
+cp crypto/sha/sha.h include/openssl/sha.h
+cp ssl/ssl.h include/openssl/ssl.h
+cp ssl/ssl2.h include/openssl/ssl2.h
+cp ssl/ssl23.h include/openssl/ssl23.h
+cp ssl/ssl3.h include/openssl/ssl3.h
+cp crypto/stack/stack.h include/openssl/stack.h
+cp crypto/symhacks.h include/openssl/symhacks.h
+cp ssl/tls1.h include/openssl/tls1.h
+cp crypto/tmdiff.h include/openssl/tmdiff.h
+cp crypto/txt_db/txt_db.h include/openssl/txt_db.h
+cp crypto/x509/x509.h include/openssl/x509.h
+cp crypto/x509/x509_vfy.h include/openssl/x509_vfy.h
+cp crypto/x509v3/x509v3.h include/openssl/x509v3.h
+cp rsaref/Makefile.ssl rsaref/Makefile
+cp ssl/Makefile.ssl ssl/Makefile
+cp test/Makefile.ssl test/Makefile
+cp crypto/bf/bftest.c test/bftest.c
+cp crypto/bn/bntest.c test/bntest.c
+cp crypto/cast/casttest.c test/casttest.c
+cp crypto/des/destest.c test/destest.c
+cp crypto/dh/dhtest.c test/dhtest.c
+cp crypto/dsa/dsatest.c test/dsatest.c
+cp crypto/bn/exptest.c test/exptest.c
+cp crypto/hmac/hmactest.c test/hmactest.c
+cp crypto/idea/ideatest.c test/ideatest.c
+cp crypto/md2/md2test.c test/md2test.c
+cp crypto/md4/md4test.c test/md4test.c
+cp crypto/md5/md5test.c test/md5test.c
+cp crypto/mdc2/mdc2test.c test/mdc2test.c
+cp crypto/rand/randtest.c test/randtest.c
+cp crypto/rc2/rc2test.c test/rc2test.c
+cp crypto/rc4/rc4test.c test/rc4test.c
+cp crypto/rc5/rc5test.c test/rc5test.c
+cp crypto/ripemd/rmdtest.c test/rmdtest.c
+cp crypto/rsa/rsa_test.c test/rsa_test.c
+cp crypto/sha/shatest.c test/shatest.c
+cp ssl/ssltest.c test/ssltest.c
+cp tools/Makefile.ssl tools/Makefile
--- openssl-0.9.6/install.djgpp Sun Nov 19 11:19:16 2000
+++ openssl-0.9.6/install.djgpp.new Sun Nov 19 11:18:42 2000
@@ -0,0 +1,33 @@
+
+
+ INSTALLATION ON THE DOS PLATFORM WITH DJGPP
+ -------------------------------------------
+
+ Openssl has been ported to DOS, but only with long filename support. If
+ you wish to compile on native DOS with 8+3 filenames, you will have to
+ tweak the installation yourself, including renaming files with illegal
+ or duplicate names.
+
+ You should have a full DJGPP environment installed, including the
+ latest versions of DJGPP, GCC, BINUTILS, BASH, etc. This package
+ requires that PERL and BC also be installed.
+
+ All of these can be obtained from the usual DJGPP mirror sites, such as
+ "http://www.simtel.net/pub/simtelnet/gnu/djgpp/". You also need to have
+ the WATT-32 networking package installed before you try to compile
+ openssl. This can be obtained from "http://www.bgnett.no/~giva/". The
+ Makefile assumes that the WATT-32 code is in directory "watt" under
+ $DJDIR.
+
+ To compile openssl, start your BASH shell. The tar.gz file doesn't
+ unpack properly on DOS because of lack of symbolic links. After you
+ unpack the openssl archive, run "./djcopy.sh" to copy files that
+ couldn't be symbolically linked. Then configure for DOS by running
+ "./Configure" with appropriate arguments. The basic syntax for DOS is:
+ "./Configure no-threads DJGPP". Then run "make" and "make test". You
+ may run out of DPMI selectors when running in a DOS box under
+ Windows. If so, just close the BASH shell, go back to Windows, and
+ restart BASH. Then run "make" again.
+
+ Building openssl under DJGPP has only been tested with DJGPP 2.03,
+ GCC 2.952, and perl 5.005_02.
--- openssl-0.9.6/crypto/bio/b_sock.c Mon Sep 11 04:42:14 2000
+++ openssl-0.9.6/crypto/bio/b_sock.c.new Sun Nov 19 10:53:00 2000
@@ -471,7 +471,11 @@
{
int i;
+#ifdef __DJGPP__
+ i=ioctlsocket(fd,type,(char *)arg);
+#else
i=ioctlsocket(fd,type,arg);
+#endif /* __DJGPP__ */
if (i < 0)
SYSerr(SYS_F_IOCTLSOCKET,get_last_socket_error());
return(i);
__
Doug Kaufman
Internet: [EMAIL PROTECTED]
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]