From cbeb0b26e4c7caa8d1b47de791a7418dc20a4567 Mon Sep 17 00:00:00 2001 From: rsc Date: Sat, 1 Apr 2006 19:24:03 +0000 Subject: Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. --- src/libmp/port/crt.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/libmp/port/crt.c') diff --git a/src/libmp/port/crt.c b/src/libmp/port/crt.c index a98fef53..6dc6eea6 100644 --- a/src/libmp/port/crt.c +++ b/src/libmp/port/crt.c @@ -1,20 +1,20 @@ #include "os.h" #include -// chinese remainder theorem -// -// handbook of applied cryptography, menezes et al, 1997, pp 610 - 613 +/* chinese remainder theorem */ +/* */ +/* handbook of applied cryptography, menezes et al, 1997, pp 610 - 613 */ struct CRTpre { - int n; // number of moduli - mpint **m; // pointer to moduli - mpint **c; // precomputed coefficients - mpint **p; // precomputed products - mpint *a[1]; // local storage + int n; /* number of moduli */ + mpint **m; /* pointer to moduli */ + mpint **c; /* precomputed coefficients */ + mpint **p; /* precomputed products */ + mpint *a[1]; /* local storage */ }; -// setup crt info, returns a newly created structure +/* setup crt info, returns a newly created structure */ CRTpre* crtpre(int n, mpint **m) { @@ -30,18 +30,18 @@ crtpre(int n, mpint **m) crt->p = crt->c+n; crt->n = n; - // make a copy of the moduli + /* make a copy of the moduli */ for(i = 0; i < n; i++) crt->m[i] = mpcopy(m[i]); - // precompute the products + /* precompute the products */ u = mpcopy(mpone); for(i = 0; i < n; i++){ mpmul(u, m[i], u); crt->p[i] = mpcopy(u); } - // precompute the coefficients + /* precompute the coefficients */ for(i = 1; i < n; i++){ crt->c[i] = mpcopy(mpone); for(j = 0; j < i; j++){ @@ -70,7 +70,7 @@ crtprefree(CRTpre *crt) free(crt); } -// convert to residues, returns a newly created structure +/* convert to residues, returns a newly created structure */ CRTres* crtin(CRTpre *crt, mpint *x) { @@ -88,7 +88,7 @@ crtin(CRTpre *crt, mpint *x) return res; } -// garners algorithm for converting residue form to linear +/* garners algorithm for converting residue form to linear */ void crtout(CRTpre *crt, CRTres *res, mpint *x) { @@ -109,7 +109,7 @@ crtout(CRTpre *crt, CRTres *res, mpint *x) mpfree(u); } -// free the residue +/* free the residue */ void crtresfree(CRTres *res) { -- cgit v1.2.3