Commit 4d524040 authored by Andy Polyakov's avatar Andy Polyakov
Browse files

Change bn_mul_mont declaration and BN_MONT_CTX. Update CHANGES.

parent 0fe120ba
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -4,6 +4,12 @@


 Changes between 0.9.8a and 0.9.9  [xx XXX xxxx]
 Changes between 0.9.8a and 0.9.9  [xx XXX xxxx]


  *) New candidate for BIGNUM assembler implementation, bn_mul_mont,
     dedicated Montgomery multiplication procedure, is introduced.
     BN_MONT_CTX is modified to allow bn_mul_mont to reach for higher
     "64-bit" performance on certain 32-bit targets.
     [Andy Polyakov]

  *) New option SSL_OP_NO_COMP to disable use of compression selectively
  *) New option SSL_OP_NO_COMP to disable use of compression selectively
     in SSL structures. New SSL ctrl to set maximum send fragment size. 
     in SSL structures. New SSL ctrl to set maximum send fragment size. 
     Save memory by seeting the I/O buffer sizes dynamically instead of
     Save memory by seeting the I/O buffer sizes dynamically instead of
+2 −2
Original line number Original line Diff line number Diff line
@@ -70,7 +70,7 @@ $rp="%i0"; # BN_ULONG *rp,
$ap="%i1";	# const BN_ULONG *ap,
$ap="%i1";	# const BN_ULONG *ap,
$bp="%i2";	# const BN_ULONG *bp,
$bp="%i2";	# const BN_ULONG *bp,
$np="%i3";	# const BN_ULONG *np,
$np="%i3";	# const BN_ULONG *np,
$n0="%i4";	# BN_ULONG n0,
$n0="%i4";	# const BN_ULONG *n0,
$num="%i5";	# int num);
$num="%i5";	# int num);


$tp="%l0";
$tp="%l0";
@@ -125,7 +125,7 @@ $fname:
	sethi	%hi(0xffff),$mask
	sethi	%hi(0xffff),$mask
	sll	$num,3,$num		! num*=8
	sll	$num,3,$num		! num*=8
	or	$mask,%lo(0xffff),$mask
	or	$mask,%lo(0xffff),$mask
	mov	%i4,$n0			! reassigned, remember?
	ldx	[%i4],$n0		! reassigned, remember?


	add	%sp,$bias,%o0		! real top of stack
	add	%sp,$bias,%o0		! real top of stack
	sll	$num,2,%o1
	sll	$num,2,%o1
+2 −1
Original line number Original line Diff line number Diff line
@@ -66,7 +66,7 @@ if($sse2) {
	&mov	("ebx",&wparam(1));	# const BN_ULONG *ap
	&mov	("ebx",&wparam(1));	# const BN_ULONG *ap
	&mov	("ecx",&wparam(2));	# const BN_ULONG *bp
	&mov	("ecx",&wparam(2));	# const BN_ULONG *bp
	&mov	("edx",&wparam(3));	# const BN_ULONG *np
	&mov	("edx",&wparam(3));	# const BN_ULONG *np
	&mov	("esi",&wparam(4));	# BN_ULONG n0
	&mov	("esi",&wparam(4));	# const BN_ULONG *n0
	&mov	($num,&wparam(5));	# int num
	&mov	($num,&wparam(5));	# int num


	&mov	("edi","esp");		# saved stack pointer!
	&mov	("edi","esp");		# saved stack pointer!
@@ -78,6 +78,7 @@ if($sse2) {
	&sub	($num,1);		# num is restored to its original value
	&sub	($num,1);		# num is restored to its original value
					# and will remain constant from now...
					# and will remain constant from now...


	&mov	("esi",&DWP(0,"esi"));	# pull n0[0]
	&mov	($_rp,"eax");		# ... save a copy of argument block
	&mov	($_rp,"eax");		# ... save a copy of argument block
	&mov	($_ap,"ebx");
	&mov	($_ap,"ebx");
	&mov	($_bp,"ecx");
	&mov	($_bp,"ecx");
+3 −1
Original line number Original line Diff line number Diff line
@@ -22,7 +22,7 @@ $rp="%rdi"; # BN_ULONG *rp,
$ap="%rsi";	# const BN_ULONG *ap,
$ap="%rsi";	# const BN_ULONG *ap,
$bp="%rdx";	# const BN_ULONG *bp,
$bp="%rdx";	# const BN_ULONG *bp,
$np="%rcx";	# const BN_ULONG *np,
$np="%rcx";	# const BN_ULONG *np,
$n0="%r8";	# BN_ULONG n0,
$n0="%r8";	# const BN_ULONG *n0,
$num="%r9";	# int num);
$num="%r9";	# int num);
$lo0="%r10";
$lo0="%r10";
$hi0="%r11";
$hi0="%r11";
@@ -55,6 +55,8 @@ bn_mul_mont:
	mov	%rbp,8(%rsp,$num,8)	# tp[num+1]=%rsp
	mov	%rbp,8(%rsp,$num,8)	# tp[num+1]=%rsp
	mov	%rdx,$bp		# $bp reassigned, remember?
	mov	%rdx,$bp		# $bp reassigned, remember?


	mov	($n0),$n0		# pull n0[0] value

	xor	$i,$i			# i=0
	xor	$i,$i			# i=0
	xor	$j,$j			# j=0
	xor	$j,$j			# j=0


+2 −2
Original line number Original line Diff line number Diff line
@@ -295,7 +295,7 @@ struct bn_mont_ctx_st
	BIGNUM N;      /* The modulus */
	BIGNUM N;      /* The modulus */
	BIGNUM Ni;     /* R*(1/R mod N) - N*Ni = 1
	BIGNUM Ni;     /* R*(1/R mod N) - N*Ni = 1
	                * (Ni is only stored for bignum algorithm) */
	                * (Ni is only stored for bignum algorithm) */
	BN_ULONG n0;   /* least significant word of Ni */
	BN_ULONG n0[2];/* least significant word(s) of Ni */
	int flags;
	int flags;
	};
	};


@@ -729,7 +729,7 @@ int RAND_pseudo_bytes(unsigned char *buf,int num);
	bn_pollute(a); \
	bn_pollute(a); \
	}
	}


int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_ULONG *np,BN_ULONG n0, int num);
int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_ULONG *np,const BN_ULONG *n0, int num);
BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w);
BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w);
BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w);
BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w);
void     bn_sqr_words(BN_ULONG *rp, const BN_ULONG *ap, int num);
void     bn_sqr_words(BN_ULONG *rp, const BN_ULONG *ap, int num);
Loading