OpenSSL CVS Repository
http://cvs.openssl.org/
____________________________________________________________
________________
Server: cvs.openssl.org Name: Andy
Polyakov
Root: /v/openssl/cvs Email: appro openssl.org
Module: openssl Date:
18-Sep-2007 22:55:11
Branch: OpenSSL_0_9_8-stable Handle:
2007091821551000
Modified files: (Branch: OpenSSL_0_9_8-stable)
openssl/crypto/bn bn_prime.c bn_prime.h
bn_prime.pl
Log:
Minimize stack utilization in probable_prime [from
HEAD].
Summary:
Revision Changes Path
1.33.2.3 +2 -2 openssl/crypto/bn/bn_prime.c
1.4.20.1 +3 -1 openssl/crypto/bn/bn_prime.h
1.4.2.1 +3 -1 openssl/crypto/bn/bn_prime.pl
____________________________________________________________
________________
patch -p0 <<' .'
Index: openssl/crypto/bn/bn_prime.c
============================================================
================
$ cvs diff -u -r1.33.2.2 -r1.33.2.3 bn_prime.c
--- openssl/crypto/bn/bn_prime.c 18 Sep 2006 14:01:39
-0000 1.33.2.2
+++ openssl/crypto/bn/bn_prime.c 18 Sep 2007 20:55:10
-0000 1.33.2.3
 -377,14 +377,14 
static int probable_prime(BIGNUM *rnd, int bits)
{
int i;
- BN_ULONG mods[NUMPRIMES];
+ prime_t mods[NUMPRIMES];
BN_ULONG delta,maxdelta;
again:
if (!BN_rand(rnd,bits,1,1)) return(0);
/* we now have a random number 'rand' to test. */
for (i=1; i<NUMPRIMES; i++)
- mods[i]=BN_mod_word(rnd,(BN_ULONG)primes[i]);
+ mods[i]=(prime_t)BN_mod_word(rnd,(BN_ULONG)primes[i]);
maxdelta=BN_MASK2 - primes[NUMPRIMES-1];
delta=0;
loop: for (i=1; i<NUMPRIMES; i++)
 .
patch -p0 <<' .'
Index: openssl/crypto/bn/bn_prime.h
============================================================
================
$ cvs diff -u -r1.4 -r1.4.20.1 bn_prime.h
--- openssl/crypto/bn/bn_prime.h 16 Feb 2000 13:24:06
-0000 1.4
+++ openssl/crypto/bn/bn_prime.h 18 Sep 2007 20:55:10
-0000 1.4.20.1
 -58,10 +58,12 
#ifndef EIGHT_BIT
#define NUMPRIMES 2048
+typedef unsigned short prime_t;
#else
#define NUMPRIMES 54
+typedef unsigned char prime_t;
#endif
-static const unsigned int primes[NUMPRIMES]=
+static const prime_t primes[NUMPRIMES]=
{
2, 3, 5, 7, 11, 13, 17, 19,
23, 29, 31, 37, 41, 43, 47, 53,
 .
patch -p0 <<' .'
Index: openssl/crypto/bn/bn_prime.pl
============================================================
================
$ cvs diff -u -r1.4 -r1.4.2.1 bn_prime.pl
--- openssl/crypto/bn/bn_prime.pl 25 Sep 2003 13:57:58
-0000 1.4
+++ openssl/crypto/bn/bn_prime.pl 18 Sep 2007 20:55:10
-0000 1.4.2.1
 -101,10 +101,12 
printf "#ifndef EIGHT_BITn";
printf "#define NUMPRIMES %dn",$num;
+printf "typedef unsigned short prime_t;n";
printf "#elsen";
printf "#define NUMPRIMES %dn",$eight;
+printf "typedef unsigned char prime_t;n";
printf "#endifn";
-print "static const unsigned int
primes[NUMPRIMES]=nt{nt";
+print "static const prime_t
primes[NUMPRIMES]=nt{nt";
$init=0;
for ($i=0; $i <= $#primes; $i++)
{
 .
____________________________________________________________
__________
OpenSSL Project http://www.openssl.org
CVS Repository Commit List
openssl-cvs openssl.org
Automated List Manager
majordomo openssl.org
|