forked from rpms/openssl
bffe20438c
OPENSSL_cleanse (#564029) - do not fail in s_server if client hostname not resolvable (#561260)
110 lines
3.8 KiB
Diff
110 lines
3.8 KiB
Diff
Gracefully handle zero length in assembler implementations of OPENSSL_cleanse.
|
|
diff -up openssl-1.0.0-beta5/crypto/ia64cpuid.S.cleanse openssl-1.0.0-beta5/crypto/ia64cpuid.S
|
|
--- openssl-1.0.0-beta5/crypto/ia64cpuid.S.cleanse 2007-07-27 20:03:27.000000000 +0200
|
|
+++ openssl-1.0.0-beta5/crypto/ia64cpuid.S 2010-02-12 18:13:52.000000000 +0100
|
|
@@ -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 -up openssl-1.0.0-beta5/crypto/perlasm/ppc-xlate.pl.cleanse openssl-1.0.0-beta5/crypto/perlasm/ppc-xlate.pl
|
|
--- openssl-1.0.0-beta5/crypto/perlasm/ppc-xlate.pl.cleanse 2008-01-13 23:01:29.000000000 +0100
|
|
+++ openssl-1.0.0-beta5/crypto/perlasm/ppc-xlate.pl 2010-02-12 18:13:52.000000000 +0100
|
|
@@ -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 -up openssl-1.0.0-beta5/crypto/ppccpuid.pl.cleanse openssl-1.0.0-beta5/crypto/ppccpuid.pl
|
|
--- openssl-1.0.0-beta5/crypto/ppccpuid.pl.cleanse 2008-09-12 16:45:53.000000000 +0200
|
|
+++ openssl-1.0.0-beta5/crypto/ppccpuid.pl 2010-02-12 18:13:52.000000000 +0100
|
|
@@ -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 -up openssl-1.0.0-beta5/crypto/sparccpuid.S.cleanse openssl-1.0.0-beta5/crypto/sparccpuid.S
|
|
--- openssl-1.0.0-beta5/crypto/sparccpuid.S.cleanse 2007-05-19 19:26:48.000000000 +0200
|
|
+++ openssl-1.0.0-beta5/crypto/sparccpuid.S 2010-02-12 18:13:52.000000000 +0100
|
|
@@ -242,6 +242,10 @@ OPENSSL_cleanse:
|
|
#else
|
|
bgu .Lot
|
|
#endif
|
|
+ cmp %o1,0
|
|
+ bne .Little
|
|
+ nop
|
|
+ retl
|
|
nop
|
|
|
|
.Little:
|
|
diff -up openssl-1.0.0-beta5/crypto/s390xcpuid.S.cleanse openssl-1.0.0-beta5/crypto/s390xcpuid.S
|
|
--- openssl-1.0.0-beta5/crypto/s390xcpuid.S.cleanse 2010-01-19 22:40:56.000000000 +0100
|
|
+++ openssl-1.0.0-beta5/crypto/s390xcpuid.S 2010-02-12 18:13:52.000000000 +0100
|
|
@@ -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 -up openssl-1.0.0-beta5/crypto/x86cpuid.pl.cleanse openssl-1.0.0-beta5/crypto/x86cpuid.pl
|
|
--- openssl-1.0.0-beta5/crypto/x86cpuid.pl.cleanse 2009-05-14 20:25:29.000000000 +0200
|
|
+++ openssl-1.0.0-beta5/crypto/x86cpuid.pl 2010-02-12 18:13:52.000000000 +0100
|
|
@@ -279,11 +279,14 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA3
|
|
&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);
|
|
diff -up openssl-1.0.0-beta5/crypto/x86_64cpuid.pl.cleanse openssl-1.0.0-beta5/crypto/x86_64cpuid.pl
|
|
--- openssl-1.0.0-beta5/crypto/x86_64cpuid.pl.cleanse 2009-05-14 20:25:29.000000000 +0200
|
|
+++ openssl-1.0.0-beta5/crypto/x86_64cpuid.pl 2010-02-12 18:13:52.000000000 +0100
|
|
@@ -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
|