From 9f45bcd3ecf3f3548ed7a8490b882a6ca9ffeb94 Mon Sep 17 00:00:00 2001 From: jbj Date: Tue, 16 Oct 2001 14:58:57 +0000 Subject: More lclint annotations. CVS patchset: 5116 CVS date: 2001/10/16 14:58:57 --- beecrypt/rsakp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'beecrypt/rsakp.c') diff --git a/beecrypt/rsakp.c b/beecrypt/rsakp.c index f60f9ec7f..159ce0716 100644 --- a/beecrypt/rsakp.c +++ b/beecrypt/rsakp.c @@ -50,7 +50,7 @@ int rsakpMake(rsakp* kp, randomGeneratorContext* rgc, int nsize) */ register uint32 pqsize = ((uint32)(nsize+1)) >> 1; - register uint32* temp = (uint32*) malloc((16*pqsize+6)*sizeof(uint32)); + register uint32* temp = (uint32*) malloc((16*pqsize+6) * sizeof(*temp)); register uint32 newn = 1; if (temp) @@ -71,9 +71,11 @@ int rsakpMake(rsakp* kp, randomGeneratorContext* rgc, int nsize) /* if p <= q, perform a swap to make p larger than q */ if (mp32le(pqsize, kp->p.modl, kp->q.modl)) { + /*@-sizeoftype@*/ memcpy(&r, &kp->q, sizeof(mp32barrett)); memcpy(&kp->q, &kp->p, sizeof(mp32barrett)); memcpy(&kp->p, &r, sizeof(mp32barrett)); + /*@=sizeoftype@*/ } mp32bzero(&r); @@ -98,15 +100,19 @@ int rsakpMake(rsakp* kp, randomGeneratorContext* rgc, int nsize) if (mp32le(pqsize, kp->p.modl, r.modl)) { mp32bfree(&kp->q); + /*@-sizeoftype@*/ memcpy(&kp->q, &kp->p, sizeof(mp32barrett)); memcpy(&kp->p, &r, sizeof(mp32barrett)); + /*@=sizeoftype@*/ mp32bzero(&r); newn = 1; } else if (mp32le(pqsize, kp->q.modl, r.modl)) { mp32bfree(&kp->q); + /*@-sizeoftype@*/ memcpy(&kp->q, &r, sizeof(mp32barrett)); + /*@=sizeoftype@*/ mp32bzero(&r); newn = 1; } @@ -159,7 +165,7 @@ int rsakpMake(rsakp* kp, randomGeneratorContext* rgc, int nsize) int rsakpInit(rsakp* kp) { - memset(kp, 0, sizeof(rsakp)); + memset(kp, 0, sizeof(*kp)); /* or mp32bzero(&kp->n); mp32nzero(&kp->e); -- cgit v1.2.3