Hello, Attached is latest mingw win64 patch for OpenSSL.
It is verified to work with the OpenSC project and the OpenVPN project using cross compile from Linux machine using binutils CVS head, gcc-4.3.2 and mingw-w64 svn head. There is no assembly support for pe64. So no assembly is available. Can someone estimate if it is better to use 32bit with assembly than 64bit without? I am not fully sure that the crypto/sha/sha512.c is correct, it simulate the behavior of win64 using Microsoft compiler, using _rotr64 function as ROTR. If correct, please consider to merge this so there is some solution for win64 users and not require to keep syncing with CVS head. I use: ./Configure --prefix="//" --cross-compile-prefix=x86_64-pc-mingw32- no-zlib shared mingw64 no-capieng Thank you, Alon Bar-Lev.
diff -urNp openssl-SNAP-20081003/Configure openssl-SNAP-20081003.mingw64/Configure --- openssl-SNAP-20081003/Configure 2008-09-16 00:00:05.000000000 +0300 +++ openssl-SNAP-20081003.mingw64/Configure 2008-10-20 12:37:37.000000000 +0200 @@ -496,6 +496,8 @@ my %table=( # MinGW "mingw", "gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall:::MINGW32:-lws2_32 -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:.dll.a", +"mingw64", "gcc:-mno-cygwin -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -fomit-frame-pointer -O3 -Wall -D_WIN32_WINNT=0x333:::MINGW64:-lws2_32 -lgdi32:SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:${no_asm}:win32:cygwin-shared:-D_WINDLL:-mno-cygwin:.dll.a", + # UWIN "UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32", @@ -968,7 +970,7 @@ foreach (sort (keys %disabled)) my $IsMK1MF=scalar grep /^$target$/,@MK1MF_Builds; -$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target eq "mingw"); +$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target =~ /^mingw/); $exe_ext=".nlm" if ($target =~ /netware/); $exe_ext=".pm" if ($target =~ /vos/); $openssldir="/usr/local/ssl" if ($openssldir eq "" and $prefix eq ""); --- openssl-SNAP-20081003/engines/e_aep.c 2008-01-04 01:01:24.000000000 +0200 +++ openssl-SNAP-20081003.mingw64/engines/e_aep.c 2008-10-20 12:46:24.000000000 +0200 @@ -62,8 +62,10 @@ #include <unistd.h> #else #include <process.h> +#ifndef _PID_T_ typedef int pid_t; +#endif #endif #if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB) #define getpid GetThreadID --- openssl-SNAP-20081023/crypto/sha/sha512.c 2008-04-24 13:00:12.000000000 +0300 +++ openssl-SNAP-20081023.mingw64/crypto/sha/sha512.c 2008-10-28 00:19:56.000000000 +0200 @@ -350,11 +350,15 @@ static const SHA_LONG64 K512[80] = { #ifndef PEDANTIC # if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) # if defined(__x86_64) || defined(__x86_64__) -# define ROTR(a,n) ({ unsigned long ret; \ +# if defined(_WIN64) +# define ROTR(a,n) _rotr64((a),n) /* applies to both IA-64 and AMD64 */ +# else +# define ROTR(a,n) ({ unsigned long ret; \ asm ("rorq %1,%0" \ : "=r"(ret) \ : "J"(n),"0"(a) \ : "cc"); ret; }) +# endif # if !defined(B_ENDIAN) # define PULL64(x) ({ SHA_LONG64 ret=*((const SHA_LONG64 *)(&(x))); \ asm ("bswapq %0" \