summaryrefslogtreecommitdiffstats
path: root/engines/asm/e_padlock-x86.pl
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2011-10-05 17:03:44 +0000
committerAndy Polyakov <appro@openssl.org>2011-10-05 17:03:44 +0000
commit50452b2e60b0e967b03a32462c29750a99de5ffe (patch)
treeef8eb3830cf42fc82c7757096582818c039abd5d /engines/asm/e_padlock-x86.pl
parentd18762f7c93c4d0362dde43a80c0c425292d2bed (diff)
e_padlock: add CTR mode.
Diffstat (limited to 'engines/asm/e_padlock-x86.pl')
-rw-r--r--engines/asm/e_padlock-x86.pl21
1 files changed, 11 insertions, 10 deletions
diff --git a/engines/asm/e_padlock-x86.pl b/engines/asm/e_padlock-x86.pl
index df8f56b521..61e91d889f 100644
--- a/engines/asm/e_padlock-x86.pl
+++ b/engines/asm/e_padlock-x86.pl
@@ -183,7 +183,7 @@ my ($mode,$opcode) = @_;
&set_label("${mode}_pic_point");
&lea ($ctx,&DWP(16,$ctx)); # control word
&xor ("eax","eax");
- if ($mode eq "ctr16") {
+ if ($mode eq "ctr32") {
&movq ("mm0",&QWP(-16,$ctx)); # load [upper part of] counter
} else {
&xor ("ebx","ebx");
@@ -216,7 +216,7 @@ my ($mode,$opcode) = @_;
&mov (&DWP(8,"ebp"),$len);
&mov ($len,$chunk);
&mov (&DWP(12,"ebp"),$chunk); # chunk
- if ($mode eq "ctr16") {
+ if ($mode eq "ctr32") {
&mov ("ecx",&DWP(-4,$ctx));
&xor ($out,$out);
&mov ("eax",&DWP(-8,$ctx)); # borrow $len
@@ -257,7 +257,7 @@ my ($mode,$opcode) = @_;
}
&mov ($out,&DWP(0,"ebp")); # restore parameters
&mov ($chunk,&DWP(12,"ebp"));
- if ($mode eq "ctr16") {
+ if ($mode eq "ctr32") {
&mov ($inp,&DWP(4,"ebp"));
&xor ($len,$len);
&set_label("${mode}_xor");
@@ -284,7 +284,7 @@ my ($mode,$opcode) = @_;
&sub ($len,$chunk);
&mov ($chunk,$PADLOCK_CHUNK);
&jnz (&label("${mode}_loop"));
- if ($mode ne "ctr16") {
+ if ($mode ne "ctr32") {
&test ($out,0x0f); # out_misaligned
&jz (&label("${mode}_done"));
}
@@ -296,7 +296,7 @@ my ($mode,$opcode) = @_;
&data_byte(0xf3,0xab); # rep stosl
&set_label("${mode}_done");
&lea ("esp",&DWP(24,"ebp"));
- if ($mode ne "ctr16") {
+ if ($mode ne "ctr32") {
&jmp (&label("${mode}_exit"));
&set_label("${mode}_aligned",16);
@@ -311,7 +311,7 @@ my ($mode,$opcode) = @_;
&set_label("${mode}_exit"); }
&mov ("eax",1);
&lea ("esp",&DWP(4,"esp")); # popf
- &emms () if ($mode eq "ctr16");
+ &emms () if ($mode eq "ctr32");
&set_label("${mode}_abort");
&function_end("padlock_${mode}_encrypt");
}
@@ -320,10 +320,11 @@ my ($mode,$opcode) = @_;
&generate_mode("cbc",0xd0);
&generate_mode("cfb",0xe0);
&generate_mode("ofb",0xe8);
-&generate_mode("ctr16",0xc8); # yes, it implements own ctr with ecb opcode,
- # because hardware ctr was introduced later
- # and even has errata on certain CPU stepping.
- # own implementation *always* works...
+&generate_mode("ctr32",0xc8); # yes, it implements own CTR with ECB opcode,
+ # because hardware CTR was introduced later
+ # and even has errata on certain C7 stepping.
+ # own implementation *always* works, though
+ # ~15% slower than dedicated hardware...
&function_begin_B("padlock_xstore");
&push ("edi");