diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2010-02-12 17:02:13 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2010-02-12 17:02:13 +0000 |
commit | 1d8fa09c80232ee924fdf87000e3473b40c37da2 (patch) | |
tree | e8e3ac72b79248b715813bc62089ec6e51eff2a9 /crypto | |
parent | e085e6c84c2827d6bff3cc13bcb8a97db23dd188 (diff) |
Make assembly language versions of OPENSSL_cleanse() accept zero length
parameter. Backport from HEAD, orginal by appro.
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/alphacpuid.s | 1 | ||||
-rw-r--r-- | crypto/ia64cpuid.S | 4 | ||||
-rwxr-xr-x | crypto/perlasm/ppc-xlate.pl | 7 | ||||
-rwxr-xr-x | crypto/ppccpuid.pl | 2 | ||||
-rw-r--r-- | crypto/s390xcpuid.S | 2 | ||||
-rw-r--r-- | crypto/sparccpuid.S | 4 | ||||
-rw-r--r-- | crypto/x86_64cpuid.pl | 4 | ||||
-rw-r--r-- | crypto/x86cpuid.pl | 3 |
8 files changed, 25 insertions, 2 deletions
diff --git a/crypto/alphacpuid.s b/crypto/alphacpuid.s index b13b3cdb3c..3fa77a0ade 100644 --- a/crypto/alphacpuid.s +++ b/crypto/alphacpuid.s @@ -90,6 +90,7 @@ OPENSSL_rdtsc: OPENSSL_cleanse: .frame $30,0,$26 .prologue 0 + beq $17,.Ldone and $16,7,$0 bic $17,7,$at beq $at,.Little diff --git a/crypto/ia64cpuid.S b/crypto/ia64cpuid.S index 1a03b028fc..d705fff7ee 100644 --- a/crypto/ia64cpuid.S +++ b/crypto/ia64cpuid.S @@ -130,9 +130,11 @@ OPENSSL_wipe_cpu: .global OPENSSL_cleanse# .proc OPENSSL_cleanse# OPENSSL_cleanse: +{ .mib; cmp.eq p6,p0=0,r33 // len==0 #if defined(_HPUX_SOURCE) && !defined(_LP64) -{ .mmi; addp4 r32=0,r32 };; + addp4 r32=0,r32 #endif +(p6) br.ret.spnt b0 };; { .mib; and r2=7,r32 cmp.leu p6,p0=15,r33 // len>=15 (p6) br.cond.dptk .Lot };; diff --git a/crypto/perlasm/ppc-xlate.pl b/crypto/perlasm/ppc-xlate.pl index 755524c9cf..4579671c97 100755 --- a/crypto/perlasm/ppc-xlate.pl +++ b/crypto/perlasm/ppc-xlate.pl @@ -101,6 +101,13 @@ my $bnelr = sub { " .long ".sprintf "0x%x",19<<26|$bo<<21|2<<16|16<<1 : " bclr $bo,2"; }; +my $beqlr = sub { + my $f = shift; + my $bo = $f=~/-/ ? 12+2 : 12; # optional "not to be taken" hint + ($flavour =~ /linux/) ? # GNU as doesn't allow most recent hints + " .long ".sprintf "0x%X",19<<26|$bo<<21|2<<16|16<<1 : + " bclr $bo,2"; +}; # GNU assembler can't handle extrdi rA,rS,16,48, or when sum of last two # arguments is 64, with "operand out of range" error. my $extrdi = sub { diff --git a/crypto/ppccpuid.pl b/crypto/ppccpuid.pl index fe44ff07bc..369e1d0df9 100755 --- a/crypto/ppccpuid.pl +++ b/crypto/ppccpuid.pl @@ -67,6 +67,8 @@ Loop: lwarx r5,0,r3 $CMPLI r4,7 li r0,0 bge Lot + $CMPLI r4,0 + beqlr- Little: mtctr r4 stb r0,0(r3) addi r3,r3,1 diff --git a/crypto/s390xcpuid.S b/crypto/s390xcpuid.S index aa704c033a..b053c6a281 100644 --- a/crypto/s390xcpuid.S +++ b/crypto/s390xcpuid.S @@ -62,6 +62,8 @@ OPENSSL_cleanse: lghi %r0,0 clgr %r3,%r4 jh .Lot + clgr %r3,%r0 + bcr 8,%r14 .Little: stc %r0,0(%r2) la %r2,1(%r2) diff --git a/crypto/sparccpuid.S b/crypto/sparccpuid.S index 4691bd72bb..bcf46f209d 100644 --- a/crypto/sparccpuid.S +++ b/crypto/sparccpuid.S @@ -242,6 +242,10 @@ OPENSSL_cleanse: #else bgu .Lot #endif + cmp %o1,0 + bne .Little + nop + retl nop .Little: diff --git a/crypto/x86_64cpuid.pl b/crypto/x86_64cpuid.pl index 862118f285..a7f98b3fd3 100644 --- a/crypto/x86_64cpuid.pl +++ b/crypto/x86_64cpuid.pl @@ -145,12 +145,14 @@ OPENSSL_cleanse: xor %rax,%rax cmp \$15,$arg2 jae .Lot + cmp \$0,$arg2 + je .Lret .Little: mov %al,($arg1) sub \$1,$arg2 lea 1($arg1),$arg1 jnz .Little - ret +.Lret: ret .align 16 .Lot: test \$7,$arg1 diff --git a/crypto/x86cpuid.pl b/crypto/x86cpuid.pl index e5dcc58124..a7464af19b 100644 --- a/crypto/x86cpuid.pl +++ b/crypto/x86cpuid.pl @@ -279,11 +279,14 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } &xor ("eax","eax"); &cmp ("ecx",7); &jae (&label("lot")); + &cmp ("ecx",0); + &je (&label("ret")); &set_label("little"); &mov (&BP(0,"edx"),"al"); &sub ("ecx",1); &lea ("edx",&DWP(1,"edx")); &jnz (&label("little")); +&set_label("ret"); &ret (); &set_label("lot",16); |