Commit 673c55a2 authored by Andy Polyakov's avatar Andy Polyakov
Browse files

Latest bn_mont.c modification broke ECDSA test. I've got math wrong, which

is fixed now.
parent 949ce10e
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -262,8 +262,6 @@ bn_mul_mont:
	mov	$rp,$bp		# put rp aside
	mov	sp,$tp
	mov	sp,$ap
	srl	$nj,62,AT	# boundary condition...
	beq	AT,.Lcopy	# ... is met
	mov	0,$hi0		# clear borrow bit

.align	4
+0 −3
Original line number Diff line number Diff line
@@ -163,9 +163,6 @@ bn_mul_mont:
	mov	$ap,$tp			@ "borrow" $ap
	sub	$np,$np,$aj		@ "rewind" $np to &np[0]

	movs	$tj,$nj,lsr#30		@ boundary condition...
	beq	.Lcopy			@ ... is met

	subs	$tj,$tj,$tj		@ "clear" carry flag
.Lsub:	ldr	$tj,[$tp],#4
	ldr	$nj,[$np],#4
+0 −3
Original line number Diff line number Diff line
@@ -270,9 +270,6 @@ bn_mul_mont:
	PTR_ADD	$tj,sp,$num	# &tp[num]
	move	$tp,sp
	move	$ap,sp

	dsrl	AT,$nj,62	# boundary condition...
	beqz	AT,.Lcopy	# ... is met
	li	$hi0,0		# clear borrow bit

.align	4
+0 −2
Original line number Diff line number Diff line
@@ -267,13 +267,11 @@ Linner:
	addi	$i,$i,$BNSZ
	ble-	Louter

	$SHRI.	$nj,$nj,$BITS-2	; check boundary condition
	addi	$num,$num,2	; restore $num
	subfc	$j,$j,$j	; j=0 and "clear" XER[CA]
	addi	$tp,$sp,$FRAME
	addi	$ap,$sp,$FRAME
	mtctr	$num
	beq	Lcopy		; boundary condition is met

.align	4
Lsub:	$LDX	$tj,$tp,$j
+0 −6
Original line number Diff line number Diff line
@@ -183,12 +183,6 @@ $code.=<<___;
	la	$ap,8($fp)
	lgr	$j,$num

	#lg	$nhi,-8($np)		# buggy assembler
	lghi	$count,-8		# buggy assembler
	lg	$nhi,0($count,$np)	# buggy assembler
	srag	$nhi,$nhi,62	# boundary condition...
	jz	.Lcopy		# ... is met

	lcgr	$count,$num
	sra	$count,3	# incidentally clears "borrow"
.Lsub:	lg	$alo,0($j,$ap)
Loading