Re: linux+mingw - create openssl for windows [u]

2005-07-04 Thread Andy Polyakov

Point is that I'd rather see it cross-built by 'make' [which is known to
work at least under cygwin], than by an extra script. In other words you
should be able to get away with single extra mingwx line to ./Configure
and patch for $exe_ext line... No extra scripts should be required...


so you want a Configure based approach, but still using mk1mf.pl,
or do you want native Configure / make / make install based system?

I guess the second option,


Correct.


so I tried implementing it. But I need some
help, as the openssl make system is quite complex, and I don't know
all nuances.

The attached diff should be a step in the right direction.


Can you confirm that 'i586-mingw32msvc-cc -shared' can't be used in 
place for dllwrap? And if so why? It works under cygwin... Well, apart 
from --def stuff... BTW, what is the exact purpose of this project? If 
it's not provide 100% equivalent replacement for .dll built with 
Microsoft C, then why bother with --def?


but 
linking libcrypto.dll fails, as there are still references to:
libcrypto.exp:fake:(.edata+0x2964): undefined reference to 
`_ENGINE_load_ubsec'
libcrypto.exp:fake:(.edata+0x2f80): undefined reference to 
`_ENGINE_load_cswift'

...
even though I used -DOPENSSL_NO_HW.


Well, you have to figure this one out yourself. It's likely to be 
something trivial such as left-over from previous attempt without 
OPENSSL_NO_HW. If your're positive that it's not the case, then 'rm 
crypto/engine/eng_all.o', collect output from make and verify if 
-DOPENSSL_NO_HW is actually passed down.



the command that creates this problem is
i586-mingw32msvc-dllwrap --dllname libcrypto.dll \
--output-lib libcrypto.a \
--def ms/libeay32.def libcrypto.a \
-lwsock32 -lgdi32


libcrypto.a is used as both input and output. Is it actually fool-proof? A.
__
OpenSSL Project http://www.openssl.org
Development Mailing List   openssl-dev@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: linux+mingw - create openssl for windows [u]

2005-07-03 Thread Andreas Jellinghaus [c]
On Monday 20 June 2005 18:48, Andy Polyakov wrote:
 - gaswin option is being phased out and should not be used;
 - can you confirm that just issuing 'make' right after 'perl Configure
 mingwx' doesn't work?
 - if you can confirm that it doesn't, can you show how does it fail?

 Point is that I'd rather see it cross-built by 'make' [which is known to
 work at least under cygwin], than by an extra script. In other words you
 should be able to get away with single extra mingwx line to ./Configure
 and patch for $exe_ext line... No extra scripts should be required...

so you want a Configure based approach, but still using mk1mf.pl,
or do you want native Configure / make / make install based system?

I guess the second option, so I tried implementing it. But I need some
help, as the openssl make system is quite complex, and I don't know
all nuances.

The attached diff should be a step in the right direction. but 
linking libcrypto.dll fails, as there are still references to:
libcrypto.exp:fake:(.edata+0x2964): undefined reference to 
`_ENGINE_load_ubsec'
libcrypto.exp:fake:(.edata+0x2f80): undefined reference to 
`_ENGINE_load_cswift'
...
even though I used 
-DOPENSSL_NO_HW.

the command that creates this problem is
i586-mingw32msvc-dllwrap --dllname libcrypto.dll \
--output-lib libcrypto.a \
--def ms/libeay32.def libcrypto.a \
-lwsock32 -lgdi32 

I guess it has to do with the definition files,
but as I don't know what those exactly do, I'm pretty much lost.

Regards, Andreas
diff -udrNP openssl-0.9.8-stable-SNAP-20050703.orig/Configure openssl-0.9.8-stable-SNAP-20050703/Configure
--- openssl-0.9.8-stable-SNAP-20050703.orig/Configure	2005-07-04 00:27:11.169168808 +0200
+++ openssl-0.9.8-stable-SNAP-20050703/Configure	2005-07-04 00:56:17.650663264 +0200
@@ -469,6 +469,7 @@
 
 # MinGW
 mingw, gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall -D_WIN32_WINNT=0x333:::MINGW32:-lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_coff_asm}:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin -shared:.dll.a,
+mingwx, i586-mingw32msvc-cc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall -D_WIN32_WINNT=0x333 -DOPENSSL_NO_HW:::MINGW32:-lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_coff_asm}:win32:mingw-shared:-D_WINDLL:-mno-cygwin -shared:.dll:i586-mingw32msvc-ranlib,
 
 # UWIN 
 UWIN, cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32,
@@ -909,7 +910,7 @@
 
 $IsMK1MF=1 if ($target eq mingw  $^O ne cygwin);
 
-$exe_ext=.exe if ($target eq Cygwin || $target eq DJGPP || $target eq mingw);
+$exe_ext=.exe if ($target eq Cygwin || $target eq DJGPP || $target eq mingw || $target eq mingwx);
 $exe_ext=.pm  if ($target =~ /vos/);
 $openssldir=/usr/local/ssl if ($openssldir eq  and $prefix eq );
 $prefix=$openssldir if $prefix eq ;
diff -udrNP openssl-0.9.8-stable-SNAP-20050703.orig/Makefile.org openssl-0.9.8-stable-SNAP-20050703/Makefile.org
--- openssl-0.9.8-stable-SNAP-20050703.orig/Makefile.org	2005-07-04 00:27:11.182166832 +0200
+++ openssl-0.9.8-stable-SNAP-20050703/Makefile.org	2005-07-04 00:27:21.282631328 +0200
@@ -496,7 +496,7 @@
 	@pod2man=`cd util; ./pod2mantest $(PERL)`; \
 	here=`pwd`; \
 	filecase=; \
-	if [ $(PLATFORM) = DJGPP -o $(PLATFORM) = Cygwin -o $(PLATFORM) = mingw ]; then \
+	if [ $(PLATFORM) = DJGPP -o $(PLATFORM) = Cygwin -o $(PLATFORM) = mingw -o $(PLATFORM) = mingwx ]; then \
 		filecase=-i; \
 	fi; \
 	set -e; for i in doc/apps/*.pod; do \
diff -udrNP openssl-0.9.8-stable-SNAP-20050703.orig/Makefile.shared openssl-0.9.8-stable-SNAP-20050703/Makefile.shared
--- openssl-0.9.8-stable-SNAP-20050703.orig/Makefile.shared	2005-07-04 00:27:11.182166832 +0200
+++ openssl-0.9.8-stable-SNAP-20050703/Makefile.shared	2005-07-04 00:37:31.029935648 +0200
@@ -258,6 +258,55 @@
 link_app.cygwin:
 	$(LINK_APP)
 
+link_o.mingw:
+	@ $(CALC_VERSIONS); \
+	INHIBIT_SYMLINKS=yes; \
+	SHLIB=$(LIBNAME)eay32; \
+	SHLIB_SUFFIX=.dll; \
+	LIBVERSION=$(LIBVERSION); \
+	SHLIB_SOVER=${LIBVERSION:+-$(LIBVERSION)}; \
+	ALLSYMSFLAGS='-Wl,--whole-archive'; \
+	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
+	SHAREDFLAGS=$(CFLAGS) $(SHARED_LDFLAGS) -o lib$(LIBNAME).dll; \
+	expr $(LIBNAME) : 'crypto'  /dev/null  ( \
+	perl util/mkdef.pl 32 libeay  ms/libeay32.def ; \
+	i586-mingw32msvc-dllwrap --dllname lib$(LIBNAME).dll \
+		--output-lib lib$(LIBNAME).a \
+		--def ms/libeay32.def lib$(LIBNAME).a \
+		-lwsock32 -lgdi32 ) || ( \
+	perl util/mkdef.pl 32 ssleay  ms/ssleay32.def ; \
+	i586-mingw32msvc-dllwrap --dllname lib$(LIBNAME).dll \
+		--output-lib lib$(LIBNAME).a \
+		--def ms/ssleay32.def lib$(LIBNAME).a \
+		-lwsock32 -lgdi32 ) 
+link_a.mingw:
+	@ $(CALC_VERSIONS); \
+	INHIBIT_SYMLINKS=yes; \
+	SHLIB=$(LIBNAME)eay32; \
+	SHLIB_SUFFIX=.dll; \
+	SHLIB_SOVER=-$(LIBVERSION); \
+	ALLSYMSFLAGS='-Wl,--whole-archive'; \
+	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
+	

Re: linux+mingw - create openssl for windows [u]

2005-06-20 Thread Andy Polyakov

My goal: compile opensc, openssl and putty for windows,
but using linux and mingw (on i686 machine, debian sarge).
that way opensc could build nightly binary pacakges for windows.

so, here is a patch for openssl, so it can be compiled with
mingw under linux. no big changes, mostly using the existing
code, changed paths from \ to / and used the i586-mingw32msvc-*
tools (thats how they are called on debian gnu/linux).

install procedure:

wget http://www.openssl.org/source/openssl-0.9.8-beta5.tar.gz
tar xfvz openssl-0.9.8-beta5.tar.gz
cd openssl-0.9.8-beta5
patch -p1  ../diff5
sh -x ms/mingw32.sh


- gaswin option is being phased out and should not be used;
- can you confirm that just issuing 'make' right after 'perl Configure 
mingwx' doesn't work?

- if you can confirm that it doesn't, can you show how does it fail?

Point is that I'd rather see it cross-built by 'make' [which is known to 
work at least under cygwin], than by an extra script. In other words you 
should be able to get away with single extra mingwx line to ./Configure 
and patch for $exe_ext line... No extra scripts should be required...





diff -udrNP openssl-0.9.8-beta4.orig/Configure openssl-0.9.8-beta4/Configure
--- openssl-0.9.8-beta4.orig/Configure  2005-06-06 00:19:34.0 +0200
+++ openssl-0.9.8-beta4/Configure   2005-06-19 18:38:18.195835720 +0200
@@ -474,6 +474,9 @@
 # MinGW
 mingw, gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall 
-D_WIN32_WINNT=0x333:::MINGW32:-lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} 
EXPORT_VAR_AS_FN:${x86_coff_asm}:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin 
-shared:.dll.a,
 
+# MinGW cross compile

+mingwx, i586-mingw32msvc-cc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 
-march=i486 -Wall -D_WIN32_WINNT=0x333:::MINGW32:-lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} 
${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_coff_asm}:win32:cygwin-shared:-D_WINDLL 
-DOPENSSL_USE_APPLINK:-mno-cygwin -shared:.dll.a,
+
 # UWIN 
 UWIN, cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32,
 
@@ -908,9 +911,9 @@
 
 my $IsMK1MF=scalar grep /^$target$/,@MK1MF_Builds;
 
-$IsMK1MF=1 if ($target eq mingw  $^O ne cygwin);

+$IsMK1MF=1 if ($target eq mingw  $^O ne mingwx  $^O ne cygwin);


That's not the way to extend this expression... And how does it help in 
your case anyway? Indeed, first comparison is false [in your case] and 
IsMK1MF is assigned zero [in your case] regardless $^O... A.

__
OpenSSL Project http://www.openssl.org
Development Mailing List   openssl-dev@openssl.org
Automated List Manager   [EMAIL PROTECTED]


linux+mingw - create openssl for windows [u]

2005-06-19 Thread Andreas Jellinghaus [c]
My goal: compile opensc, openssl and putty for windows,
but using linux and mingw (on i686 machine, debian sarge).
that way opensc could build nightly binary pacakges for windows.

so, here is a patch for openssl, so it can be compiled with
mingw under linux. no big changes, mostly using the existing
code, changed paths from \ to / and used the i586-mingw32msvc-*
tools (thats how they are called on debian gnu/linux).

install procedure:

wget http://www.openssl.org/source/openssl-0.9.8-beta5.tar.gz
tar xfvz openssl-0.9.8-beta5.tar.gz
cd openssl-0.9.8-beta5
patch -p1  ../diff5
sh -x ms/mingw32.sh

mkdir -p /opt/win32/openssl
mkdir /opt/win32/openssl/bin
mkdir /opt/win32/openssl/lib
mkdir /opt/win32/openssl/include
mkdir /opt/win32/openssl/include/openssl

cp outinc/openssl/* /opt/win32/openssl/include/openssl
cp out/*.lib /opt/win32/openssl/lib
cp *.dll /opt/win32/openssl/bin
cp out/openssl.exe /opt/win32/openssl/bin

I can't test the result well today (no windows here),but will
do so tomorrow. the resulting binaries are located at
http://www.opensc.org/files/testing/openssl-0.9.8-beta5-win32.tar.gz

I don't know the openssl build system well, so please help me to
fix any bugs I might have in this patch. (it doesn't change any
existing code, only adds new files and a mingwx option.) 

Thanks, Andreas
diff -udrNP openssl-0.9.8-beta4.orig/Configure openssl-0.9.8-beta4/Configure
--- openssl-0.9.8-beta4.orig/Configure  2005-06-06 00:19:34.0 +0200
+++ openssl-0.9.8-beta4/Configure   2005-06-19 18:38:18.195835720 +0200
@@ -474,6 +474,9 @@
 # MinGW
 mingw, gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 
-Wall -D_WIN32_WINNT=0x333:::MINGW32:-lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} 
${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_coff_asm}:win32:cygwin-shared:-D_WINDLL 
-DOPENSSL_USE_APPLINK:-mno-cygwin -shared:.dll.a,
 
+# MinGW cross compile
+mingwx, i586-mingw32msvc-cc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 
-march=i486 -Wall -D_WIN32_WINNT=0x333:::MINGW32:-lwsock32 -lgdi32:BN_LLONG 
${x86_gcc_des} ${x86_gcc_opts} 
EXPORT_VAR_AS_FN:${x86_coff_asm}:win32:cygwin-shared:-D_WINDLL 
-DOPENSSL_USE_APPLINK:-mno-cygwin -shared:.dll.a,
+
 # UWIN 
 UWIN, cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} 
${x86_gcc_opts}:${no_asm}:win32,
 
@@ -908,9 +911,9 @@
 
 my $IsMK1MF=scalar grep /^$target$/,@MK1MF_Builds;
 
-$IsMK1MF=1 if ($target eq mingw  $^O ne cygwin);
+$IsMK1MF=1 if ($target eq mingw  $^O ne mingwx  $^O ne cygwin);
 
-$exe_ext=.exe if ($target eq Cygwin || $target eq DJGPP || $target eq 
mingw);
+$exe_ext=.exe if ($target eq Cygwin || $target eq DJGPP || $target eq 
mingw || $target eq mingwx);
 $exe_ext=.pm  if ($target =~ /vos/);
 $openssldir=/usr/local/ssl if ($openssldir eq  and $prefix eq );
 $prefix=$openssldir if $prefix eq ;
diff -udrNP openssl-0.9.8-beta4.orig/Makefile openssl-0.9.8-beta4/Makefile
--- openssl-0.9.8-beta4.orig/Makefile   2005-06-06 02:51:46.0 +0200
+++ openssl-0.9.8-beta4/Makefile2005-06-19 18:38:24.904815800 +0200
@@ -11,11 +11,11 @@
 SHLIB_VERSION_HISTORY=
 SHLIB_MAJOR=0
 SHLIB_MINOR=9.8
-SHLIB_EXT=
-PLATFORM=dist
-OPTIONS= no-gmp no-krb5 no-mdc2 no-rc5 no-shared no-zlib no-zlib-dynamic
-CONFIGURE_ARGS=dist
-SHLIB_TARGET=
+SHLIB_EXT=.dll.a
+PLATFORM=mingwx
+OPTIONS=386 no-gmp no-krb5 no-mdc2 no-rc5 no-shared no-sse2 no-zlib 
no-zlib-dynamic
+CONFIGURE_ARGS=386 mingwx
+SHLIB_TARGET=cygwin-shared
 
 # HERE indicates where this Makefile lives.  This can be used to indicate
 # where sub-Makefiles are expected to be.  Currently has very limited usage,
@@ -59,16 +59,16 @@
 # equal 4.
 # PKCS1_CHECK - pkcs1 tests.
 
-CC= cc
-CFLAG= -O
+CC= i586-mingw32msvc-cc
+CFLAG= -DOPENSSL_THREADS  -DDSO_WIN32 -mno-cygwin -DL_ENDIAN 
-fomit-frame-pointer -O3 -march=i486 -Wall -D_WIN32_WINNT=0x333 
-DOPENSSL_BN_ASM_PART_WORDS -DSHA1_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM
 DEPFLAG= -DOPENSSL_NO_GMP -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5 
 PEX_LIBS= 
-EX_LIBS= 
-EXE_EXT= 
+EX_LIBS= -lwsock32 -lgdi32
+EXE_EXT= .exe
 ARFLAGS= 
 AR=ar $(ARFLAGS) r
-RANLIB= /usr/bin/ranlib
-PERL= /usr/bin/perl
+RANLIB= true
+PERL= perl
 TAR= tar
 TARFLAGS= --no-recursion
 MAKEDEPPROG=makedepend
@@ -83,20 +83,20 @@
 
 # For x86 assembler: Set PROCESSOR to 386 if you want to support
 # the 80386.
-PROCESSOR= 
+PROCESSOR= 386
 
 # CPUID module collects small commonly used assembler snippets
 CPUID_OBJ= 
-BN_ASM= bn_asm.o
-DES_ENC= des_enc.o fcrypt_b.o
-AES_ASM_OBJ= aes_core.o aes_cbc.o
-BF_ENC= bf_enc.o
-CAST_ENC= c_enc.o
-RC4_ENC= rc4_enc.o
-RC5_ENC= rc5_enc.o
-MD5_ASM_OBJ= 
-SHA1_ASM_OBJ= 
-RMD160_ASM_OBJ= 
+BN_ASM= bn86-cof.o co86-cof.o
+DES_ENC= dx86-cof.o yx86-cof.o
+AES_ASM_OBJ= ax86-cof.o
+BF_ENC= bx86-cof.o
+CAST_ENC= cx86-cof.o
+RC4_ENC= rx86-cof.o
+RC5_ENC= r586-cof.o
+MD5_ASM_OBJ= mx86-cof.o
+SHA1_ASM_OBJ= sx86-cof.o 
+RMD160_ASM_OBJ= rm86-cof.o
 
 # KRB5 stuff
 KRB5_INCLUDES=
@@ -136,7 +136,7 @@
 SHARED_SSL=libssl$(SHLIB_EXT)
 SHARED_LIBS=
 SHARED_LIBS_LINK_EXTS=