I had a small change from my previous post ... when pasting in my fix
for the asm code, I had a "DW" where a "DB" belonged. Here is the
corrected diff:
--- openssl-1.0.2-stable-SNAP-20140226\crypto\perlasm\x86masm_ORIG.pl
2014-02-27 10:40:36.599122930 -0400
+++ openssl-1.0.2-stable-SNAP-20140226\crypto\perlasm\x86masm.pl
2014-02-27 10:40:36.600123057 -0400
@@ -160,13 +160,13 @@
{ push(@out,"PUBLIC\t".&::LABEL($_[0],$nmdecor.$_[0])."\n"); }
sub ::data_byte
-{ push(@out,("DB\t").join(',',@_)."\n"); }
+{ push @out, (("DB\t").join(',',splice(@_, 0, 16))."\n") while @_; }
sub ::data_short
-{ push(@out,("DW\t").join(',',@_)."\n"); }
+{ push @out, (("DW\t").join(',',splice(@_, 0, 8))."\n") while @_; }
sub ::data_word
-{ push(@out,("DD\t").join(',',@_)."\n"); }
+{ push @out, (("DD\t").join(',',splice(@_, 0, 4))."\n") while @_; }
sub ::align
{ push(@out,"ALIGN\t$_[0]\n"); }
On the open issue at: https://github.com/openssl/openssl/issues/34
There was another part to the issue besides the "complexity/line too
long" issue:
tmp32\sha256-586.asm(4422) : error A2070:invalid instruction operands
tmp32\sha256-586.asm(4424) : error A2070:invalid instruction operands
tmp32\sha256-586.asm(4425) : error A2070:invalid instruction operands
tmp32\sha256-586.asm(4426) : error A2070:invalid instruction operands
tmp32\sha256-586.asm(4559) : error A2070:invalid instruction operands
tmp32\sha256-586.asm(4712) : error A2070:invalid instruction operands
tmp32\sha256-586.asm(4865) : error A2070:invalid instruction operands
tmp32\sha256-586.asm(5018) : error A2070:invalid instruction operands
NMAKE : fatal error U1077: “"C:\Program Files (x86)\Microsoft Visual Studio 10.
0\VC\BIN\ml.EXE"”: 返回代码“0x1”
Stop.
I am not an expert on this asm code or sha or anything, but armed with
the "tools of the inter-web" I thought I might see what I could see!
I looked at the code, and I noticed a mix of vpaddd with QWORD, and I
wondered what would happen if I flipped the vpaddd's in those to
vpaddq instead. I did it, and the thing compiled and passed the
"ms\test.bat" process! (I have no idea if what I did is
mathematically correct!) So I am now able to get the build for 32 bit
on Visual Studio 2010 to work by adding in this change in addition to
the one above:
--- openssl-1.0.2-stable-SNAP-20140226/crypto/sha/asm/sha256-586_ORIG.pl
2014-02-27 13:53:05.182539228 -0400
+++ openssl-1.0.2-stable-SNAP-20140226/crypto/sha/asm/sha256-586.pl
2014-02-27 13:53:05.182539228 -0400
@@ -851,11 +851,11 @@
&mov (&DWP(96+4,"esp"),"edi");
&vpshufb (@X[1],@X[1],$t3);
&vpshufb (@X[2],@X[2],$t3);
- &vpaddd ($t0,@X[0],&QWP(0,$K256));
+ &vpaddq ($t0,@X[0],&QWP(0,$K256));
&vpshufb (@X[3],@X[3],$t3);
- &vpaddd ($t1,@X[1],&QWP(16,$K256));
- &vpaddd ($t2,@X[2],&QWP(32,$K256));
- &vpaddd ($t3,@X[3],&QWP(48,$K256));
+ &vpaddq ($t1,@X[1],&QWP(16,$K256));
+ &vpaddq ($t2,@X[2],&QWP(32,$K256));
+ &vpaddq ($t3,@X[3],&QWP(48,$K256));
&vmovdqa (&QWP(32+0,"esp"),$t0);
&vmovdqa (&QWP(32+16,"esp"),$t1);
&vmovdqa (&QWP(32+32,"esp"),$t2);
@@ -916,7 +916,7 @@
eval($insn = shift(@insns));
eval(shift(@insns)) if ($insn =~ /rorx/ && @insns[0] =~ /rorx/);
}
- &vpaddd ($t2,@X[0],&QWP(16*$j,$K256));
+ &vpaddq ($t2,@X[0],&QWP(16*$j,$K256));
foreach (@insns) { eval; } # remaining instructions
&vmovdqa (&QWP(32+16*$j,"esp"),$t2);
}
@@ -1048,11 +1048,11 @@
&mov (&DWP(96+4,"esp"),"edi");
&vpshufb (@X[1],@X[1],$t3);
&vpshufb (@X[2],@X[2],$t3);
- &vpaddd ($t0,@X[0],&QWP(0,$K256));
+ &vpaddq ($t0,@X[0],&QWP(0,$K256));
&vpshufb (@X[3],@X[3],$t3);
- &vpaddd ($t1,@X[1],&QWP(16,$K256));
- &vpaddd ($t2,@X[2],&QWP(32,$K256));
- &vpaddd ($t3,@X[3],&QWP(48,$K256));
+ &vpaddq ($t1,@X[1],&QWP(16,$K256));
+ &vpaddq ($t2,@X[2],&QWP(32,$K256));
+ &vpaddq ($t3,@X[3],&QWP(48,$K256));
&vmovdqa (&QWP(32+0,"esp"),$t0);
&vmovdqa (&QWP(32+16,"esp"),$t1);
&vmovdqa (&QWP(32+32,"esp"),$t2);
Hopefully this information will be useful to somebody.
Thanks,
Steve...
On Thu, Feb 27, 2014 at 10:23 AM, Steven Kneizys <[email protected]> wrote:
> Greetings,
>
> I have been building the newer 1.0.1's and the beta/snapshots of
> 1.0.2. For the 32 bit builds, I like to put in the "/safeseh" flag.
> For 64 bit I like to put them in a separate directory (such as
> out64dll instead of out32dll) so that the 32 and 64 versions can be
> built on the same tree and it is easier to keep things straight. Here
> are the changes I make to do that, just wondering if this kind of
> thing might be rolled into the distributions of if there is a better
> way to do it:
>
> --- openssl-1.0.2-stable-SNAP-20140226/util/pl/VC-32_ORIG.pl
> 2014-02-27 11:01:09.248294010 -0400
> +++ openssl-1.0.2-stable-SNAP-20140226/util/pl/VC-32.pl 2014-02-27
> 11:01:09.248294010 -0400
> @@ -134,7 +134,7 @@
> $ff = "/fixed";
> $opt_cflags=$f.' /Ox /O2 /Ob2';
> $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG';
> - $lflags="/nologo /subsystem:console /opt:ref";
> + $lflags="/nologo /subsystem:console /opt:ref /safeseh";
> }
> $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib
> $mlflags='';
> @@ -145,6 +145,13 @@
> $tmp_def.='_$(TARGETCPU)' if ($FLAVOR =~ /CE/);
> $inc_def="inc32";
> +if ($FLAVOR =~ /WIN64/) {
> + # change directory names so 32 and 64 bit can somewhat co-exist in
> same build tree
> + $out_def =~ s/32/64/;
> + $tmp_def =~ s/32/64/;
> + $inc_def =~ s/32/64/;
> +}
> +
> if ($debug)
> {
> $cflags=$dbg_cflags.$base_cflags;
> @@ -228,7 +235,7 @@
> $asmtype="win32n";
> $afile='-o ';
> } else {
> - $asm='ml /nologo /Cp /coff /c /Cx /Zi';
> + $asm='ml /nologo /Cp /coff /c /Cx /Zi /safeseh';
> $afile='/Fo';
> $asmtype="win32";
> }
>
>
> --------------------------------------------------
>
> On the 1.0.2 builds there is an issue with VS and the sha256-586.asm
> and a DD declaration being to big. It is in:
>
> https://github.com/openssl/openssl/issues/34
>
> There are two issues in #34, I am currently just addressing this one:
> tmp32\sha256-586.asm(264) : error A2042:statement too complex
> tmp32\sha256-586.asm(264) : error A2039:line too long
>
> I have a patch for that to break down such declarations into smaller
> chunks if needed:
>
> --- openssl-1.0.2-stable-SNAP-20140226\crypto\perlasm\x86masm_ORIG.pl
> 2014-02-27 10:40:36.599122930 -0400
> +++ openssl-1.0.2-stable-SNAP-20140226\crypto\perlasm\x86masm.pl
> 2014-02-27 10:40:36.600123057 -0400
> @@ -160,13 +160,13 @@
> { push(@out,"PUBLIC\t".&::LABEL($_[0],$nmdecor.$_[0])."\n"); }
> sub ::data_byte
> -{ push(@out,("DB\t").join(',',@_)."\n"); }
> +{ push @out, (("DW\t").join(',',splice(@_, 0, 16))."\n") while @_; }
> sub ::data_short
> -{ push(@out,("DW\t").join(',',@_)."\n"); }
> +{ push @out, (("DW\t").join(',',splice(@_, 0, 8))."\n") while @_; }
> sub ::data_word
> -{ push(@out,("DD\t").join(',',@_)."\n"); }
> +{ push @out, (("DD\t").join(',',splice(@_, 0, 4))."\n") while @_; }
> sub ::align
> { push(@out,"ALIGN\t$_[0]\n"); }
>
>
> Thanks,
>
> Steve...
>
> --
> 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 [email protected]
Automated List Manager [email protected]