summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2003-05-23 16:32:16 +0000
committerjbj <devnull@localhost>2003-05-23 16:32:16 +0000
commitdfcd749bbb273c6638174cdf640216c56786a7e6 (patch)
tree1d54964bb61e0a2fa6b17a2d55f3891ea3d01d93
parent0baf05de865499764c4d9ff82c56679737432a0d (diff)
downloadrpm-dfcd749bbb273c6638174cdf640216c56786a7e6.tar.gz
rpm-dfcd749bbb273c6638174cdf640216c56786a7e6.tar.bz2
rpm-dfcd749bbb273c6638174cdf640216c56786a7e6.zip
Spliddles.
CVS patchset: 6873 CVS date: 2003/05/23 16:32:16
-rw-r--r--beecrypt/dsa.c2
-rw-r--r--beecrypt/mp.c20
-rw-r--r--beecrypt/mp.h6
-rw-r--r--beecrypt/mpnumber.c3
-rw-r--r--beecrypt/rsakp.c2
5 files changed, 20 insertions, 13 deletions
diff --git a/beecrypt/dsa.c b/beecrypt/dsa.c
index c8222d632..51a1b0ccd 100644
--- a/beecrypt/dsa.c
+++ b/beecrypt/dsa.c
@@ -150,7 +150,9 @@ int dsavrfy(const mpbarrett* p, const mpbarrett* q, const mpnumber* g, const mpn
mpsetx(qsize, qtemp+qsize, s->size, s->data);
/* compute w = inv(s) mod q */
+/*@-compdef@*/ /* FIX: mpsetx annotations, qtemp[qsize] is defined */
if (mpextgcd_w(qsize, qtemp+qsize, q->modl, qtemp, qwksp))
+/*@=compdef@*/
{
/* compute u1 = h(m)*w mod q */
mpbmulmod_w(q, hm->size, hm->data, qsize, qtemp, qtemp+qsize, qwksp);
diff --git a/beecrypt/mp.c b/beecrypt/mp.c
index 2369e63b3..f95339aa3 100644
--- a/beecrypt/mp.c
+++ b/beecrypt/mp.c
@@ -1199,8 +1199,8 @@ int mpextgcd_w(size_t size, const mpw* xdata, const mpw* ndata, mpw* result, mpw
if ((full && mpodd(sizep, adata)) || mpodd(sizep, bdata))
{
- if (full) mpaddx(sizep, adata, size, xdata);
- mpsubx(sizep, bdata, size, ndata);
+ if (full) (void) mpaddx(sizep, adata, size, xdata);
+ (void) mpsubx(sizep, bdata, size, ndata);
}
if (full) mpsdivtwo(sizep, adata);
@@ -1212,8 +1212,8 @@ int mpextgcd_w(size_t size, const mpw* xdata, const mpw* ndata, mpw* result, mpw
if ((full && mpodd(sizep, cdata)) || mpodd(sizep, ddata))
{
- if (full) mpaddx(sizep, cdata, size, xdata);
- mpsubx(sizep, ddata, size, ndata);
+ if (full) (void) mpaddx(sizep, cdata, size, xdata);
+ (void) mpsubx(sizep, ddata, size, ndata);
}
if (full) mpsdivtwo(sizep, cdata);
@@ -1221,15 +1221,15 @@ int mpextgcd_w(size_t size, const mpw* xdata, const mpw* ndata, mpw* result, mpw
}
if (mpge(sizep, udata, vdata))
{
- mpsub(sizep, udata, vdata);
- if (full) mpsub(sizep, adata, cdata);
- mpsub(sizep, bdata, ddata);
+ (void) mpsub(sizep, udata, vdata);
+ if (full) (void) mpsub(sizep, adata, cdata);
+ (void) mpsub(sizep, bdata, ddata);
}
else
{
- mpsub(sizep, vdata, udata);
- if (full) mpsub(sizep, cdata, adata);
- mpsub(sizep, ddata, bdata);
+ (void) mpsub(sizep, vdata, udata);
+ if (full) (void) mpsub(sizep, cdata, adata);
+ (void) mpsub(sizep, ddata, bdata);
}
if (mpz(sizep, udata))
{
diff --git a/beecrypt/mp.h b/beecrypt/mp.h
index c1c6ed54e..4eb7b371e 100644
--- a/beecrypt/mp.h
+++ b/beecrypt/mp.h
@@ -580,9 +580,11 @@ void mpdivtwo (size_t size, mpw* data)
/**
*/
+/*@-exportlocal@*/
BEECRYPTAPI
void mpsdivtwo(size_t size, mpw* data)
/*@modifies data @*/;
+/*@=exportlocal@*/
/**
* This function performs a multi-precision multiply-setup.
@@ -652,7 +654,7 @@ void mpgcd_w(size_t size, const mpw* xdata, const mpw* ydata, /*@out@*/ mpw* res
/**
*/
BEECRYPTAPI
-int mpextgcd_w(size_t size, const mpw* xdata, const mpw* ydata, /*@out@*/ mpw* result, /*@out@*/ mpw* wksp)
+int mpextgcd_w(size_t size, const mpw* xdata, const mpw* ndata, /*@out@*/ mpw* result, /*@out@*/ mpw* wksp)
/*@modifies result, wksp @*/;
/**
@@ -704,10 +706,12 @@ void mpfprint(/*@null@*/ FILE * f, size_t size, /*@null@*/ const mpw* data)
/**
*/
+/*@-exportlocal@*/
BEECRYPTAPI
void mpfprintln(/*@null@*/ FILE * f, size_t size, /*@null@*/ const mpw* data)
/*@globals fileSystem @*/
/*@modifies *f, fileSystem @*/;
+/*@=exportlocal@*/
/**
*/
diff --git a/beecrypt/mpnumber.c b/beecrypt/mpnumber.c
index 463247048..0295e563e 100644
--- a/beecrypt/mpnumber.c
+++ b/beecrypt/mpnumber.c
@@ -186,10 +186,11 @@ int mpninv(mpnumber* inv, const mpnumber* k, const mpnumber* mod)
{
int rc = 0;
size_t size = mod->size;
- mpw* wksp = (mpw*) malloc((7*size+6) * sizeof(mpw));
+ mpw* wksp = (mpw*) malloc((7*size+6) * sizeof(*wksp));
if (wksp)
{
+ mpnzero(inv);
mpnsize(inv, size);
mpsetx(size, wksp, k->size, k->data);
rc = mpextgcd_w(size, wksp, mod->data, inv->data, wksp+size);
diff --git a/beecrypt/rsakp.c b/beecrypt/rsakp.c
index 89ac25165..6da864f84 100644
--- a/beecrypt/rsakp.c
+++ b/beecrypt/rsakp.c
@@ -118,7 +118,7 @@ int rsakpMake(rsakp* kp, randomGeneratorContext* rgc, size_t nsize)
/*@-usedef@*/ /* psubone/qsubone are set */
/* compute phi = (p-1)*(q-1) */
mpmul(temp, pqsize, psubone.modl, pqsize, qsubone.modl);
- mpbset(&phi, nsize, temp);
+ mpnset(&phi, nsize, temp);
/* compute d = inv(e) mod phi */
(void) mpninv(&kp->d, &kp->e, &phi);