I wanted to be able to build 32 and 64 bit versions of recent OpenSSL
1.0.x production and beta/snapshots using Visual Studio Express
edition. The new Visual Studios include ml/ml64, and while NASM is
great sometimes it is nice to have the option of MASM as well.
I was trying to do things with the built-in translator and other
support code but decided to get the biggest initial return on invested
time that I would do the translation work out the build itself at
first, then integrate later, especially since 1.0.2 is already in beta
and 1.0.1 is winding down. The best way I could see to do that is to
use what is already standard, the NASM flavour (dialect), and go to
MASM from there. So the strategy was to make the OpenSSL build think
it was going to send to NASM, but really I would translate to MASM.
So I created my experimental "fake nasm".
It is available here if anybody wants to play with it:
http://erpdata.com/fakenasm
If run, it will sort of say it is "nasm":
E:\usr_local_src\>nasm -v
NASM version 2.11.02 compiled on Feb 19 2014 (fakeout ver 1.0 03-MAR-2014)
Actually, it is a tiny C program that forwards the request to a ".bat"
file, and a perl script, which then does a translation of the dialect,
creating an intermediate code file ending in ".XMASM" (meaning
translated to MASM) which is then fed to ml/ml64. Here is a sample
from a build:
E:\usr_local_src\openssl-1.0.1f_64>nmake -f ms\ntdll.mak
Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
Copyright (C) Microsoft Corporation. All rights reserved.
Building OpenSSL
set ASM=nasm -f win64 -DNEAR -Ox -g
perl crypto\
x86_64cpuid.pl tmp32dll\x86_64cpuid.asm
nasm -f win64 -DNEAR -Ox -g -o tmp32dll\x86_64cpuid.obj
tmp32dll\x86_64cpuid.asm
NASM version 2.11.02 compiled on Feb 19 2014 (fakeout ver 1.0 03-MAR-2014)
Assembling tmp32dll\x86_64cpuid.asm to tmp32dll\x86_64cpuid.obj (via
tmp32dll\x86_64cpuid.asm.XMASM)
ml64 /c /Cp /Cx /Zi /Fotmp32dll\x86_64cpuid.obj tmp32dll\x86_64cpuid.asm.XMASM
Microsoft (R) Macro Assembler (x64) Version 12.00.21005.1
Copyright (C) Microsoft Corporation. All rights reserved.
Assembling: tmp32dll\x86_64cpuid.asm.XMASM
It tells the OpenSSL build it is "nasm", but then passes the request
on to ml or ml64. By keep the translation out of the OpenSSL tree at
first I was able to apply it to a wide variety of OpenSSL snapshots
and releases. I was just able to build 32 and 64 bit version of:
1.0.1f
openssl-1.0.2-stable-SNAP-20140303
openssl-1.0.2-stable-SNAP-20140305
All you have to do is put the "fake nasm" in your path instead of the
real one, then build as usual using Visual Studio 2013 x86 or x64
command tools prompt, and it will have ml/ml64 do the assembly parts.
While I am able to build those versions and they pass the "ms\test", I
do not have a CPU with Intel® AVX, Intel® AVX2, Intel® AVX-512 ...
anybody want to test it on those processors? :-)
Eventually I hope to put what I am learning into the base openssl so
maybe ml/ml64 might be supported again.
Thanks,
Steve...
On Tue, Mar 4, 2014 at 9:11 AM, Steven Kneizys <
skne...@ferrilli.com> wrote:
> I'm working on a little fun thing to see if I can get Visual Studio to
> compile and assemble (64 bit) the 1.0.2 snapshots ... more on that
> later on in the week. I am trying to figure out what the MASM 12.x
> assembler wants that is different from what NASM takes right now. I
> know things are going through the translator on OpenSSL, but the
> current MASM-generated code is not working, and I know it is
> officially unsupported. But I am looking at it :-)
>
> On Fri, Feb 28, 2014 at 5:00 PM, Andy Polyakov <
ap...@openssl.org> wrote:
>>> I remembered seeing XMMWORD being taken into consideration if the
>>> opcode args were of the xmm variety, so out of curiosity I added a
>>> little code to my previous patch to modify the opcode's third arg as
>>> well, if present:
>>
>>
>> It will be looked into as time permits, but not for 1.0.2 release. If
>> anything one should also look into AVX2 and AVX512 support
>>
>> ______________________________________________________________________
>> OpenSSL Project
http://www.openssl.org
>> Development Mailing List
opens...@openssl.org
>> Automated List Manager
majo...@openssl.org
>
>
>
> --
> Steve Kneizys
> Senior Business Process Engineer
> Voice:
(610) 256-1396 [For Emergency Service
(888)864-3282]
> Ferrilli Information Group -- Quality Service and Solutions for Higher Education
> web:
http://www.ferrilli.com/
>
> Making you a success while exceeding your expectations.
--
Steve Kneizys
Senior Business Process Engineer
Voice:
(610) 256-1396 [For Emergency Service
(888)864-3282]
Ferrilli Information Group -- Quality Service and Solutions for Higher Education
web:
http://www.ferrilli.com/
Making you a success while exceeding your expectations.
______________________________________________________________________
OpenSSL Project
http://www.openssl.org
Development Mailing List
opens...@openssl.org
Automated List Manager
majo...@openssl.org