Commit 7676eebf authored by Andy Polyakov's avatar Andy Polyakov
Browse files

OPENSSL_cleanse to accept zero length parameter [matching C implementation].

parent 21a5c040
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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
+7 −0
Original line number Diff line number Diff line
@@ -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 {
+2 −0
Original line number Diff line number Diff line
@@ -83,6 +83,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
+2 −0
Original line number Diff line number Diff line
@@ -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)
+4 −0
Original line number Diff line number Diff line
@@ -242,6 +242,10 @@ OPENSSL_cleanse:
#else
	bgu	.Lot
#endif
	cmp	%o1,0
	bne	.Little
	nop
	retl
	nop

.Little:
Loading