Make latest assembler additions (vpaes and e_padlock) work in Windows build.
authorAndy Polyakov <appro@openssl.org>
Sun, 18 Sep 2011 15:40:11 +0000 (15:40 +0000)
committerAndy Polyakov <appro@openssl.org>
Sun, 18 Sep 2011 15:40:11 +0000 (15:40 +0000)
crypto/aes/asm/vpaes-x86.pl
engines/asm/e_padlock-x86.pl
util/mk1mf.pl

index f2414cc..7898106 100644 (file)
@@ -276,7 +276,7 @@ $k_dsbo=0x2c0;              # decryption sbox final output
        &shl    ($magic,4);
        &pand   ("xmm0","xmm6");
        &pshufb ("xmm2","xmm0");
-       &movdqa ("xmm0",&DWP($k_dipt-$k_dsbd+16,$base));
+       &movdqa ("xmm0",&QWP($k_dipt-$k_dsbd+16,$base));
        &xor    ($magic,0x30);
        &pshufb ("xmm0","xmm1");
        &and    ($magic,0x30);
index 4a00d9d..1ee622f 100644 (file)
@@ -110,7 +110,8 @@ $chunk="ebx";
 
 &function_begin_B("padlock_verify_context");
        &mov    ($ctx,&wparam(0));
-       &lea    ("eax",&DWP("padlock_saved_context-".&label("verify_pic_point")));
+       &lea    ("eax",($::win32 or $::coff) ? &DWP(&label("padlock_saved_context")) :
+                      &DWP(&label("padlock_saved_context")."-".&label("verify_pic_point")));
        &pushf  ();
        &call   ("_padlock_verify_ctx");
 &set_label("verify_pic_point");
@@ -119,7 +120,7 @@ $chunk="ebx";
 &function_end_B("padlock_verify_context");
 
 &function_begin_B("_padlock_verify_ctx");
-       &add    ("eax",&DWP(0,"esp"));          # &padlock_saved_context
+       &add    ("eax",&DWP(0,"esp")) if(!($::win32 or $::coff));# &padlock_saved_context
        &bt     (&DWP(4,"esp"),30);             # eflags
        &jnc    (&label("verified"));
        &cmp    ($ctx,&DWP(0,"eax"));
@@ -167,7 +168,8 @@ my ($mode,$opcode) = @_;
        &jnz    (&label("${mode}_abort"));
        &test   ($len,15);
        &jnz    (&label("${mode}_abort"));
-       &lea    ("eax",&DWP("padlock_saved_context-".&label("${mode}_pic_point")));
+       &lea    ("eax",($::win32 or $::coff) ? &DWP(&label("padlock_saved_context")) :
+                      &DWP(&label("padlock_saved_context")."-".&label("${mode}_pic_point")));
        &pushf  ();
        &cld    ();
        &call   ("_padlock_verify_ctx");
@@ -243,7 +245,7 @@ my ($mode,$opcode) = @_;
        &data_byte(0xf3,0x0f,0xa7,$opcode);     # rep xcrypt*
                                                if ($mode !~ /ecb|ctr/) {
        &movdqa ("xmm0",&QWP(0,"eax"));
-       &movdqa (&DWP(-16,$ctx),"xmm0");        # copy [or refresh] iv
+       &movdqa (&QWP(-16,$ctx),"xmm0");        # copy [or refresh] iv
                                                }
        &mov    ($out,&DWP(0,"ebp"));           # restore parameters
        &mov    ($chunk,&DWP(12,"ebp"));
@@ -300,7 +302,7 @@ my ($mode,$opcode) = @_;
        &data_byte(0xf3,0x0f,0xa7,$opcode);     # rep xcrypt*
                                                if ($mode ne "ecb") {
        &movdqa ("xmm0",&QWP(0,"eax"));
-       &movdqa (&DWP(-16,$ctx),"xmm0");        # copy [or refresh] iv
+       &movdqa (&QWP(-16,$ctx),"xmm0");        # copy [or refresh] iv
                                                }
 &set_label("${mode}_exit");                    }
        &mov    ("eax",1);
index 4bf4a1a..d639fba 100755 (executable)
@@ -13,6 +13,7 @@ $banner="\t\@echo Building OpenSSL";
 
 my $no_static_engine = 1;
 my $engines = "";
+my @engines_obj = "";
 my $otherlibs = "";
 local $zlib_opt = 0;   # 0 = no zlib, 1 = static, 2 = dynamic
 local $zlib_lib = "";
@@ -411,8 +412,13 @@ for (;;)
        if ($key eq "HEADER")
                { $header.=&var_add($dir,$val, 1); }
 
-       if ($key eq "LIBOBJ" && ($dir ne "engines" || !$no_static_engine))
+       if ($key eq "LIBOBJ")
+           {
+           if ($dir ne "engines" || !$no_static_engine)
                { $libobj=&var_add($dir,$val, 0); }
+           else
+               { push(@engines_obj,split(/\s+/,&var_add($dir,$val,0))); }
+           }
        if ($key eq "LIBNAMES" && $dir eq "engines" && $no_static_engine)
                { $engines.=$val }
 
@@ -899,8 +905,11 @@ $defs.=&do_defs("E_SHLIB",$engines . $otherlibs,"\$(ENG_D)",$shlibp);
 
 foreach (split(/\s+/,$engines))
        {
-       $rules.=&do_compile_rule("\$(OBJ_D)","engines${o}e_$_",$lib);
-       $rules.= &do_lib_rule("\$(OBJ_D)${o}e_${_}.obj","\$(ENG_D)$o$_$shlibp","",$shlib,"");
+       my $engine = $_;
+       my @objs   = grep(/$engine/,@engines_obj);
+       $rules.=&do_compile_rule("\$(OBJ_D)",join(" ",@objs),$lib);
+       map {$_=~s/[^\/]*\/*([^\/]+)/\$(OBJ_D)${o}$1.obj/} @objs;
+       $rules.= &do_lib_rule(join(" ",@objs),"\$(ENG_D)$o$engine$shlibp","",$shlib,"");
        }