chacha/asm/chacha-x86[_64].pl: fix typos and logical errors.
authorAndy Polyakov <appro@openssl.org>
Sat, 13 Feb 2016 12:37:25 +0000 (13:37 +0100)
committerAndy Polyakov <appro@openssl.org>
Sun, 14 Feb 2016 20:03:10 +0000 (21:03 +0100)
Thanks to: David Benjamin of Chromuim.

RT#4305

Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/chacha/asm/chacha-x86.pl
crypto/chacha/asm/chacha-x86_64.pl

index 60d604882f76c227798895da6fafd798834f467a..e2019aa3b5ed65e452f7260d8c67e6a6b5f1f81b 100755 (executable)
@@ -219,7 +219,7 @@ if ($xmm) {
        &dec    ($b);
        &jnz    (&label("loop"));
 
-       &mov    ($b,&wparam(3));                # load len
+       &mov    ($b,&wparam(2));                # load len
 
        &add    ($a,0x61707865);                # accumulate key material
        &add    ($b_,&DWP(64+4*4,"esp"));
index 41dbef51b26db07a78d8939c728a8da5c703d806..1a87cf8495abc7f3dba2016897c640b8b2ff2dc4 100755 (executable)
@@ -344,8 +344,8 @@ $code.=<<___;
 .align 16
 .Ltail:
        mov     @x[0],4*0(%rsp)
-       xor     %rbx,%rbx
        mov     @x[1],4*1(%rsp)
+       xor     %rbx,%rbx
        mov     @x[2],4*2(%rsp)
        mov     @x[3],4*3(%rsp)
        mov     @x[4],4*4(%rsp)
@@ -521,11 +521,11 @@ $code.=<<___;
 
 .Loop_tail_ssse3:
        movzb   ($inp,%rbx),%eax
-       movzb   (%rsp,%rbx),%edx
+       movzb   (%rsp,%rbx),%ecx
        lea     1(%rbx),%rbx
-       xor     %edx,%eax
+       xor     %ecx,%eax
        mov     %al,-1($out,%rbx)
-       inc     %rbp
+       dec     $len
        jnz     .Loop_tail_ssse3
 
 .Ldone_ssse3: