On Thursday 30 October 2008, Andy Polyakov via RT wrote:
> > There is no assembly support for pe64.

>
> Well, Win64 ABI is fully supported by OpenSSL x86_64 assembler modules.
> There is no support for GNU assembler under Win64, but masm (rather
> known as ml64) and nasm are fully supported (though there are
> requirements for least supported versions, for nasm it's 2.03).


This would be great!

> > 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.

>
> What you should have done instead is to modify macro in question
> declaring ret as unsigned long long. If it doesn't work, then it's more
> appropriate to leave ROTR undefined, i.e. *not* using _rotr64. Please
> verify.


Thanks, I converted this to SHA_LONG64 and it now compiles.

> Also. As NT is natively UNICODE, and there are no non-NT Win64
> implementations(*), there is no reason to favor legacy ANSI interfaces.
> Could you verify that it compiles and works with -DUNICODE -D_UNICODE
> added to config line? A.


This is too much work, and it is not related to mingw-win64, as this is needed
also for NT port. There is too much dependency in ANSI in current implementation.

I forgot to mention that the uplink was removed due to assembly issues.

There is another issue... sizeof(long) that needs some attention, the "Should be fixed" category probably impact more than
I can fix. Alignments are simple to fix, but changing the long variables that hold pointers
modifies interfaces. I just don't understand how using Microsoft compiler this code makes
sense.

Works but cast need do be fixed:
cryptlib.c:442: warning: cast from pointer to integer of different size

printf, should be converted to %p and remove cast:
asn1_lib.c:467: warning: cast from pointer to integer of different size
mem_dbg.c:699: warning: cast from pointer to integer of different size
bio_cb.c:78: warning: cast from pointer to integer of different size

Should be fixed:
mem_dbg.c:333: warning: cast from pointer to integer of different size
rc4_enc.c:123: warning: cast from pointer to integer of different size
rc4_enc.c:124: warning: cast from pointer to integer of different size
b_print.c:379: warning: cast from pointer to integer of different size
s3_pkt.c:146: warning: cast from pointer to integer of different size
s3_pkt.c:688: warning: cast from pointer to integer of different size
s3_pkt.c:701: warning: cast from pointer to integer of different size

dllimport issues, probably unrelated:
ecb_enc.c:64: warning: ‘OSSL_libdes_version’ redeclared without dllimport attribute: previous dllimport ignored
ecb_enc.c:65: warning: ‘OSSL_DES_version’ redeclared without dllimport attribute: previous dllimport ignored
s2_lib.c:124: warning: ‘ssl2_ciphers’ redeclared without dllimport attribute: previous dllimport ignored
s3_lib.c:170: warning: ‘ssl3_ciphers’ redeclared without dllimport attribute: previous dllimport ignored

If you like, I wrote a build script for the mingw-win64 toolchain and OpenSC components (Including OpenSSL).
It is available at [1] and [2].

Attached is a new patch.

Thank you,
Alon Bar-Lev.

[1] http://www.opensc-project.org/build/.../trunk/mingw64
[2] http://www.opensc-project.org/build/browser/trunk