Changes between 0.9.8e and 0.9.8f-fips [xx XXX xxxx]
+ *) Add SSE2 instruction support to WIN32 build. These will be compiled
+ by default and used it an appopriate CPU is detected. Some older versions
+ of NASM or MASM which don't support SSE2 will need to be updated.
+ [Steve Henson]
+
*) Tolerate DigestInfo structure with absent parameters in FIPS mode
(as required by several standards).
[Steve Henson]
sub out2
{
local($name,$p1,$p2)=@_;
- local($l,$t);
+ local($l,$t,$line);
- push(@out,"\t$name\t");
+ $line="\t$name\t";
$t=&conv($p1).",";
$l=length($t);
- push(@out,$t);
+ $line.="$t";
$l=4-($l+9)/8;
- push(@out,"\t" x $l);
- push(@out,&conv($p2));
- push(@out,"\n");
+ $line.="\t" x $l;
+ $line.=&conv($p2);
+ if ($line=~/\bxmm[0-7]\b/i) { $line=~s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i; }
+ push(@out,$line."\n");
}
sub out0
sub main'file_end
{
# try to detect if SSE2 or MMX extensions were used...
- if (grep {/xmm[0-7]\s*,/i} @out) {
+ if (grep {/\b[x]?mm[0-7]\b,/i} @out) {
grep {s/\.[3-7]86/\.686\n\t\.XMM/} @out;
}
- elsif (grep {/mm[0-7]\s*,/i} @out) {
- grep {s/\.[3-7]86/\.686\n\t\.MMX/} @out;
- }
push(@out,"_TEXT\$ ENDS\n");
push(@out,"END\n");
}
* module...
* <appro@fy.chalmers.se>
*/
+#ifdef OPENSSL_FIPS
+ unsigned long *ia32cap_ptr = OPENSSL_ia32cap_loc();
+ if (ia32cap_ptr && (*ia32cap_ptr & (1<<28))) {
+#else
if (OPENSSL_ia32cap_P & (1<<28)) {
+#endif
unsigned char *cp=(unsigned char *)d;
for (i=0;i<256;i++) cp[i]=i;
@echo off
+
+SET ASMOPTS=-DOPENSSL_IA32_SSE2
echo Generating x86 for MASM assember
echo Bignum
cd crypto\bn\asm
-perl x86.pl win32 > bn_win32.asm
+perl bn-586.pl win32 %ASMOPTS% > bn_win32.asm
+perl co-586.pl win32 %ASMOPTS% > co_win32.asm
cd ..\..\..
echo AES
cd crypto\aes\asm
-perl aes-586.pl win32 > a_win32.asm
+perl aes-586.pl win32 %ASMOPTS% > a_win32.asm
cd ..\..\..
echo DES
cd crypto\des\asm
-perl des-586.pl win32 > d_win32.asm
+perl des-586.pl win32 %ASMOPTS% > d_win32.asm
cd ..\..\..
echo "crypt(3)"
cd crypto\des\asm
-perl crypt586.pl win32 > y_win32.asm
+perl crypt586.pl win32 %ASMOPTS% > y_win32.asm
cd ..\..\..
echo Blowfish
cd crypto\bf\asm
-perl bf-586.pl win32 > b_win32.asm
+perl bf-586.pl win32 %ASMOPTS% > b_win32.asm
cd ..\..\..
echo CAST5
cd crypto\cast\asm
-perl cast-586.pl win32 > c_win32.asm
+perl cast-586.pl win32 %ASMOPTS% > c_win32.asm
cd ..\..\..
echo RC4
cd crypto\rc4\asm
-perl rc4-586.pl win32 > r4_win32.asm
+perl rc4-586.pl win32 %ASMOPTS% > r4_win32.asm
cd ..\..\..
echo MD5
cd crypto\md5\asm
-perl md5-586.pl win32 > m5_win32.asm
+perl md5-586.pl win32 %ASMOPTS% > m5_win32.asm
cd ..\..\..
echo SHA1
cd crypto\sha\asm
-perl sha1-586.pl win32 > s1_win32.asm
+perl sha1-586.pl win32 %ASMOPTS% > s1_win32.asm
+perl sha512-sse2.pl win32 %ASMOPTS% > sha512-sse2.asm
cd ..\..\..
echo RIPEMD160
cd crypto\ripemd\asm
-perl rmd-586.pl win32 > rm_win32.asm
+perl rmd-586.pl win32 %ASMOPTS% > rm_win32.asm
cd ..\..\..
echo RC5\32
cd crypto\rc5\asm
-perl rc5-586.pl win32 > r5_win32.asm
+perl rc5-586.pl win32 %ASMOPTS% > r5_win32.asm
cd ..\..\..
+echo CPU-ID
+cd crypto
+perl x86cpuid.pl win32 %ASMOPTS% > cpu_win32.asm
+cd ..
+
echo on
perl util\mkfiles.pl >MINFO
@echo off
+
+SET ASMOPTS=-DOPENSSL_IA32_SSE2
echo Generating x86 for NASM assember
echo Bignum
cd crypto\bn\asm
-perl x86.pl win32n > bn_win32.asm
+perl bn-586.pl win32n %ASMOPTS% > bn_win32.asm
+perl co-586.pl win32n %ASMOPTS% > co_win32.asm
cd ..\..\..
echo AES
cd crypto\aes\asm
-perl aes-586.pl win32n > a_win32.asm
+perl aes-586.pl win32n %ASMOPTS% > a_win32.asm
cd ..\..\..
echo DES
cd crypto\des\asm
-perl des-586.pl win32n > d_win32.asm
+perl des-586.pl win32n %ASMOPTS% > d_win32.asm
cd ..\..\..
echo "crypt(3)"
cd crypto\des\asm
-perl crypt586.pl win32n > y_win32.asm
+perl crypt586.pl win32n %ASMOPTS% > y_win32.asm
cd ..\..\..
echo Blowfish
cd crypto\bf\asm
-perl bf-586.pl win32n > b_win32.asm
+perl bf-586.pl win32n %ASMOPTS% > b_win32.asm
cd ..\..\..
echo CAST5
cd crypto\cast\asm
-perl cast-586.pl win32n > c_win32.asm
+perl cast-586.pl win32n %ASMOPTS% > c_win32.asm
cd ..\..\..
echo RC4
cd crypto\rc4\asm
-perl rc4-586.pl win32n > r4_win32.asm
+perl rc4-586.pl win32n %ASMOPTS% > r4_win32.asm
cd ..\..\..
echo MD5
cd crypto\md5\asm
-perl md5-586.pl win32n > m5_win32.asm
+perl md5-586.pl win32n %ASMOPTS% > m5_win32.asm
cd ..\..\..
echo SHA1
cd crypto\sha\asm
-perl sha1-586.pl win32n > s1_win32.asm
+perl sha1-586.pl win32n %ASMOPTS% > s1_win32.asm
+perl sha512-sse2.pl win32n %ASMOPTS% > sha512-sse2.asm
cd ..\..\..
echo RIPEMD160
cd crypto\ripemd\asm
-perl rmd-586.pl win32n > rm_win32.asm
+perl rmd-586.pl win32n %ASMOPTS% > rm_win32.asm
cd ..\..\..
echo RC5\32
cd crypto\rc5\asm
-perl rc5-586.pl win32n > r5_win32.asm
+perl rc5-586.pl win32n %ASMOPTS% > r5_win32.asm
cd ..\..\..
+echo CPU-ID
+cd crypto
+perl x86cpuid.pl win32n %ASMOPTS% > cpu_win32.asm
+cd ..
+
echo on
perl util\mkfiles.pl >MINFO
$fips_exclude_obj{$1} = 1 if (/\/([^\/]*)$/);
}
+ $fips_exclude_obj{"cpu_win32"} = 1;
$fips_exclude_obj{"bn_asm"} = 1;
$fips_exclude_obj{"des_enc"} = 1;
$fips_exclude_obj{"fcrypt_b"} = 1;
if ((!$fips && ($_ eq "CRYPTO")) || ($fips && ($_ eq "FIPS")))
{
+ if ($cpuid_asm_obj ne "")
+ {
+ $lib_obj =~ s/\s(\S*\/cryptlib\S*)/ $1 \$(CPUID_ASM_OBJ)/;
+ $rules.=&do_asm_rule($cpuid_asm_obj,$cpuid_asm_src);
+ }
if ($aes_asm_obj ne "")
{
$lib_obj =~ s/\s(\S*\/aes_core\S*)/ \$(AES_ASM_OBJ)/;
$lib_obj =~ s/\s(\S*\/rmd_dgst\S*)/ $1 \$(RMD160_ASM_OBJ)/;
$rules.=&do_asm_rule($rmd160_asm_obj,$rmd160_asm_src);
}
- if (($cpuid_asm_obj ne "") && ($_ eq "CRYPTO"))
- {
- $lib_obj =~ s/\s(\S*\/cversion\S*)/ $1 \$(CPUID_ASM_OBJ)/;
- $rules.=&do_asm_rule($cpuid_asm_obj,$cpuid_asm_src);
- }
$defs.=&do_defs(${_}."OBJ",$lib_obj,"\$(OBJ_D)",$obj);
$lib=($slib)?" \$(SHLIB_CFLAGS)".$shlib_ex_cflags{$_}:" \$(LIB_CFLAGS)";
$rules.=&do_compile_rule("\$(OBJ_D)",$lib_obj{$_},$lib);
$aes_asm_src='crypto\aes\asm\a_win32.asm';
$bn_asm_obj='crypto\bn\asm\bn_win32.obj';
$bn_asm_src='crypto\bn\asm\bn_win32.asm';
+ $bnco_asm_obj='crypto\bn\asm\co_win32.obj';
+ $bnco_asm_src='crypto\bn\asm\co_win32.asm';
$des_enc_obj='crypto\des\asm\d_win32.obj crypto\des\asm\y_win32.obj';
$des_enc_src='crypto\des\asm\d_win32.asm crypto\des\asm\y_win32.asm';
$bf_enc_obj='crypto\bf\asm\b_win32.obj';
$rc5_enc_src='crypto\rc5\asm\r5_win32.asm';
$md5_asm_obj='crypto\md5\asm\m5_win32.obj';
$md5_asm_src='crypto\md5\asm\m5_win32.asm';
- $sha1_asm_obj='crypto\sha\asm\s1_win32.obj';
- $sha1_asm_src='crypto\sha\asm\s1_win32.asm';
+ $sha1_asm_obj='crypto\sha\asm\s1_win32.obj crypto\sha\asm\sha512-sse2.obj';
+ $sha1_asm_src='crypto\sha\asm\s1_win32.asm crypto\sha\asm\sha512-sse2.asm';
$rmd160_asm_obj='crypto\ripemd\asm\rm_win32.obj';
$rmd160_asm_src='crypto\ripemd\asm\rm_win32.asm';
- $cflags.=" -DAES_ASM -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
+ $cpuid_asm_obj='crypto\cpu_win32.obj';
+ $cpuid_asm_src='crypto\cpu_win32.asm';
+ $cflags.=" -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DAES_ASM -DBN_ASM -DOPENSSL_BN_ASM_PART_WORDS -DMD5_ASM -DSHA1_ASM -DRMD160_ASM";
}
if ($shlib && $FLAVOR !~ /CE/)