aboutsummaryrefslogtreecommitdiff
path: root/src/libsec/port/rsagen.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2006-04-01 19:24:03 +0000
committerrsc <devnull@localhost>2006-04-01 19:24:03 +0000
commitcbeb0b26e4c7caa8d1b47de791a7418dc20a4567 (patch)
treee0f7e445de1aa22a42ef873dc4b1118a8105ae93 /src/libsec/port/rsagen.c
parent226d80b8213821af0cbf092d1507c52b504fd368 (diff)
downloadplan9port-cbeb0b26e4c7caa8d1b47de791a7418dc20a4567.tar.gz
plan9port-cbeb0b26e4c7caa8d1b47de791a7418dc20a4567.tar.bz2
plan9port-cbeb0b26e4c7caa8d1b47de791a7418dc20a4567.zip
Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms.
Diffstat (limited to 'src/libsec/port/rsagen.c')
-rw-r--r--src/libsec/port/rsagen.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libsec/port/rsagen.c b/src/libsec/port/rsagen.c
index ebe1079d..f51cddaf 100644
--- a/src/libsec/port/rsagen.c
+++ b/src/libsec/port/rsagen.c
@@ -15,7 +15,7 @@ rsagen(int nlen, int elen, int rounds)
d = mpnew(0);
phi = mpnew(nlen);
- // create the prime factors and euclid's function
+ /* create the prime factors and euclid's function */
genprime(p, nlen/2, rounds);
genprime(q, nlen - mpsignif(p) + 1, rounds);
mpmul(p, q, n);
@@ -23,16 +23,16 @@ rsagen(int nlen, int elen, int rounds)
mpsub(q, mpone, d);
mpmul(e, d, phi);
- // find an e relatively prime to phi
+ /* find an e relatively prime to phi */
t1 = mpnew(0);
t2 = mpnew(0);
mprand(elen, genrandom, e);
if(mpcmp(e,mptwo) <= 0)
itomp(3, e);
- // See Menezes et al. p.291 "8.8 Note (selecting primes)" for discussion
- // of the merits of various choices of primes and exponents. e=3 is a
- // common and recommended exponent, but doesn't necessarily work here
- // because we chose strong rather than safe primes.
+ /* See Menezes et al. p.291 "8.8 Note (selecting primes)" for discussion */
+ /* of the merits of various choices of primes and exponents. e=3 is a */
+ /* common and recommended exponent, but doesn't necessarily work here */
+ /* because we chose strong rather than safe primes. */
for(;;){
mpextendedgcd(e, phi, t1, d, t2);
if(mpcmp(t1, mpone) == 0)
@@ -42,11 +42,11 @@ rsagen(int nlen, int elen, int rounds)
mpfree(t1);
mpfree(t2);
- // compute chinese remainder coefficient
+ /* compute chinese remainder coefficient */
c2 = mpnew(0);
mpinvert(p, q, c2);
- // for crt a**k mod p == (a**(k mod p-1)) mod p
+ /* for crt a**k mod p == (a**(k mod p-1)) mod p */
kq = mpnew(0);
kp = mpnew(0);
mpsub(p, mpone, phi);