diff options
author | jbj <devnull@localhost> | 2001-10-16 14:58:57 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2001-10-16 14:58:57 +0000 |
commit | 9f45bcd3ecf3f3548ed7a8490b882a6ca9ffeb94 (patch) | |
tree | 65c941cf8e72c29c2d63822cd98aec4db0967afc /beecrypt | |
parent | cafccc00586497bdc9c5a4c12b19709fbd417976 (diff) | |
download | rpm-9f45bcd3ecf3f3548ed7a8490b882a6ca9ffeb94.tar.gz |
More lclint annotations.
CVS patchset: 5116
CVS date: 2001/10/16 14:58:57
Diffstat (limited to 'beecrypt')
-rw-r--r-- | beecrypt/beecrypt.c | 2 | ||||
-rw-r--r-- | beecrypt/blowfish.c | 6 | ||||
-rw-r--r-- | beecrypt/dhaes.c | 2 | ||||
-rw-r--r-- | beecrypt/dldp.c | 14 | ||||
-rw-r--r-- | beecrypt/dsa.c | 8 | ||||
-rw-r--r-- | beecrypt/elgamal.c | 8 | ||||
-rw-r--r-- | beecrypt/entropy.c | 34 | ||||
-rw-r--r-- | beecrypt/fips180.c | 2 | ||||
-rw-r--r-- | beecrypt/fips186.c | 2 | ||||
-rw-r--r-- | beecrypt/hmacmd5.c | 2 | ||||
-rw-r--r-- | beecrypt/hmacsha1.c | 2 | ||||
-rw-r--r-- | beecrypt/hmacsha256.c | 2 | ||||
-rw-r--r-- | beecrypt/md5.c | 2 | ||||
-rw-r--r-- | beecrypt/memchunk.c | 2 | ||||
-rw-r--r-- | beecrypt/mp32barrett.c | 2 | ||||
-rw-r--r-- | beecrypt/mp32number.c | 2 | ||||
-rw-r--r-- | beecrypt/mtprng.c | 2 | ||||
-rw-r--r-- | beecrypt/rsa.c | 6 | ||||
-rw-r--r-- | beecrypt/rsakp.c | 10 | ||||
-rw-r--r-- | beecrypt/rsapk.c | 2 | ||||
-rw-r--r-- | beecrypt/sha256.c | 2 |
21 files changed, 74 insertions, 40 deletions
diff --git a/beecrypt/beecrypt.c b/beecrypt/beecrypt.c index d28762840..c888cfa2a 100644 --- a/beecrypt/beecrypt.c +++ b/beecrypt/beecrypt.c @@ -1,3 +1,4 @@ +/*@-sizeoftype@*/ /** * \file beecrypt.c * @@ -846,3 +847,4 @@ BOOL WINAPI DllMain(HINSTANCE hInst, DWORD wDataSeg, LPVOID lpReserved) return TRUE; } #endif +/*@=sizeoftype@*/ diff --git a/beecrypt/blowfish.c b/beecrypt/blowfish.c index 9203ed1e4..7eaec7a69 100644 --- a/beecrypt/blowfish.c +++ b/beecrypt/blowfish.c @@ -324,7 +324,9 @@ static const blockMode blowfishModes[2] = { /* CBC */ (blockModeEncrypt) blowfishCBCEncrypt, (blockModeDecrypt) blowfishCBCDecrypt } }; +/*@-sizeoftype@*/ const blockCipher blowfish = { "Blowfish", sizeof(blowfishParam), 8, 64, 448, 32, (blockCipherSetup) blowfishSetup, (blockCipherSetIV) blowfishSetIV, (blockCipherEncrypt) blowfishEncrypt, (blockCipherDecrypt) blowfishDecrypt, blowfishModes }; +/*@=sizeoftype@*/ int blowfishSetup(blowfishParam* bp, const uint32* key, int keybits, /*@unused@*/ cipherOperation op) { @@ -336,8 +338,8 @@ int blowfishSetup(blowfishParam* bp, const uint32* key, int keybits, /*@unused@* uint32 work[2]; - memcpy(p, _bf_p, BLOWFISHPSIZE * sizeof(uint32)); - memcpy(s, _bf_s, 1024 * sizeof(uint32)); + memcpy(p, _bf_p, BLOWFISHPSIZE * sizeof(*p)); + memcpy(s, _bf_s, 1024 * sizeof(*s)); if ((keybits & 31) == 0) { diff --git a/beecrypt/dhaes.c b/beecrypt/dhaes.c index 98e6ea910..da4bd0b11 100644 --- a/beecrypt/dhaes.c +++ b/beecrypt/dhaes.c @@ -327,7 +327,9 @@ memchunk* dhaes_pContextDecrypt(dhaes_pContext* ctxt, const mp32number* ephemera goto decrypt_end; /* decrypt the memchunk with CBC mode */ + /*@-sizeoftype@*/ paddedtext = (memchunk*) calloc(1, sizeof(memchunk)); + /*@=sizeoftype@*/ if (paddedtext == (memchunk*) 0) goto decrypt_end; diff --git a/beecrypt/dldp.c b/beecrypt/dldp.c index 79e6b9ceb..b8c6bd169 100644 --- a/beecrypt/dldp.c +++ b/beecrypt/dldp.c @@ -100,7 +100,7 @@ static int dldp_pValidate(const dldp_p* dp, randomGeneratorContext* rgc) /*@*/ { register uint32 size = dp->p.size; - register uint32* temp = (uint32*) malloc((8*size+2) * sizeof(uint32)); + register uint32* temp = (uint32*) malloc((8*size+2) * sizeof(*temp)); if (temp) { @@ -185,7 +185,7 @@ int dldp_pgoqMake(dldp_p* dp, randomGeneratorContext* rgc, uint32 psize, uint32 * Generate parameters as described by IEEE P1363, A.16.1 */ - register uint32* temp = (uint32*) malloc((8*psize+2) * sizeof(uint32)); + register uint32* temp = (uint32*) malloc((8*psize+2) * sizeof(*temp)); if (temp) { @@ -221,7 +221,7 @@ int dldp_pgoqMakeSafe(dldp_p* dp, randomGeneratorContext* rgc, uint32 psize) * */ - register uint32* temp = (uint32*) malloc((8*psize+2) * sizeof(uint32)); + register uint32* temp = (uint32*) malloc((8*psize+2) * sizeof(*temp)); if (temp) { @@ -280,7 +280,7 @@ int dldp_pgoqGenerator_w(dldp_p* dp, randomGeneratorContext* rgc, uint32* wksp) int dldp_pgoqGenerator(dldp_p* dp, randomGeneratorContext* rgc) { register uint32 size = dp->p.size; - register uint32* temp = (uint32*) malloc((4*size+2)*sizeof(uint32)); + register uint32* temp = (uint32*) malloc((4*size+2) * sizeof(*temp)); if (temp) { @@ -315,7 +315,7 @@ int dldp_pgonMake(dldp_p* dp, randomGeneratorContext* rgc, uint32 psize, uint32 * Generate parameters with a prime p such that p = qr+1, with q prime, and r = 2s, with s prime */ - register uint32* temp = (uint32*) malloc((8*psize+2) * sizeof(uint32)); + register uint32* temp = (uint32*) malloc((8*psize+2) * sizeof(*temp)); if (temp) { @@ -348,7 +348,7 @@ int dldp_pgonMakeSafe(dldp_p* dp, randomGeneratorContext* rgc, uint32 psize) * Generate parameters with a safe prime; i.e. p = 2q+1, where q is prime */ - register uint32* temp = (uint32*) malloc((8*psize+2) * sizeof(uint32)); + register uint32* temp = (uint32*) malloc((8*psize+2) * sizeof(*temp)); if (temp) { @@ -446,7 +446,7 @@ int dldp_pgonGenerator_w(dldp_p* dp, randomGeneratorContext* rgc, uint32* wksp) int dldp_pgonGenerator(dldp_p* dp, randomGeneratorContext* rgc) { register uint32 psize = dp->p.size; - register uint32* temp = (uint32*) malloc((8*psize+2) * sizeof(uint32)); + register uint32* temp = (uint32*) malloc((8*psize+2) * sizeof(*temp)); if (temp) { diff --git a/beecrypt/dsa.c b/beecrypt/dsa.c index 78874623d..5d21d5049 100644 --- a/beecrypt/dsa.c +++ b/beecrypt/dsa.c @@ -65,10 +65,10 @@ int dsasign(const mp32barrett* p, const mp32barrett* q, const mp32number* g, ran register uint32* qtemp; register int rc = -1; /* assume failure */ - ptemp = (uint32*) malloc((5*psize+2)*sizeof(uint32)); + ptemp = (uint32*) malloc((5*psize+2) * sizeof(*ptemp)); if (ptemp == NULL) return rc; - qtemp = (uint32*) malloc((9*qsize+6)*sizeof(uint32)); + qtemp = (uint32*) malloc((9*qsize+6) * sizeof(*qtemp)); if (qtemp == NULL) { free(ptemp); return rc; @@ -144,11 +144,11 @@ int dsavrfy(const mp32barrett* p, const mp32barrett* q, const mp32number* g, con if (mp32gex(s->size, s->data, qsize, q->modl)) return rc; - ptemp = (uint32*) malloc((6*psize+2)*sizeof(uint32)); + ptemp = (uint32*) malloc((6*psize+2) * sizeof(*ptemp)); if (ptemp == NULL) return rc; - qtemp = (uint32*) malloc((8*qsize+6)*sizeof(uint32)); + qtemp = (uint32*) malloc((8*qsize+6) * sizeof(*qtemp)); if (qtemp == NULL) { free(ptemp); return rc; diff --git a/beecrypt/elgamal.c b/beecrypt/elgamal.c index d0540c968..1d172fc66 100644 --- a/beecrypt/elgamal.c +++ b/beecrypt/elgamal.c @@ -70,7 +70,7 @@ int elgv1sign(const mp32barrett* p, const mp32barrett* n, const mp32number* g, randomGeneratorContext* rgc, const mp32number* hm, const mp32number* x, mp32number* r, mp32number* s) { register uint32 size = p->size; - register uint32* temp = (uint32*) malloc((8*size+6)*sizeof(uint32)); + register uint32* temp = (uint32*) malloc((8*size+6) * sizeof(*temp)); if (temp) { @@ -121,7 +121,7 @@ int elgv1vrfy(const mp32barrett* p, const mp32barrett* n, const mp32number* g, c if (mp32gex(s->size, s->data, n->size, n->modl)) return 0; - temp = (uint32*) malloc((6*size+2)*sizeof(uint32)); + temp = (uint32*) malloc((6*size+2) * sizeof(*temp)); if (temp) { @@ -151,7 +151,7 @@ int elgv1vrfy(const mp32barrett* p, const mp32barrett* n, const mp32number* g, c int elgv3sign(const mp32barrett* p, const mp32barrett* n, const mp32number* g, randomGeneratorContext* rgc, const mp32number* hm, const mp32number* x, mp32number* r, mp32number* s) { register uint32 size = p->size; - register uint32* temp = (uint32*) malloc((6*size+2)*sizeof(uint32)); + register uint32* temp = (uint32*) malloc((6*size+2) * sizeof(*temp)); if (temp) { @@ -198,7 +198,7 @@ int elgv3vrfy(const mp32barrett* p, const mp32barrett* n, const mp32number* g, c if (mp32gex(s->size, s->data, n->size, n->modl)) return 0; - temp = (uint32*) malloc((6*size+2)*sizeof(uint32)); + temp = (uint32*) malloc((6*size+2) * sizeof(*temp)); if (temp) { diff --git a/beecrypt/entropy.c b/beecrypt/entropy.c index 2e07a0f48..04689641f 100644 --- a/beecrypt/entropy.c +++ b/beecrypt/entropy.c @@ -1,3 +1,4 @@ +/*@-sizeoftype@*/ /** \ingroup ES_m * \file entropy.c * @@ -1345,10 +1346,10 @@ int entropy_dev_dsp(uint32 *data, int size) if (mutex_lock(&dev_dsp_lock)) return -1; # elif HAVE_PTHREAD_H - /*@-moduncon@*/ + /*@-moduncon -noeffectuncon @*/ /* FIX: annotate */ if (pthread_mutex_lock(&dev_dsp_lock)) return -1; - /*@=moduncon@*/ + /*@=moduncon =noeffectuncon @*/ # endif #endif @@ -1456,9 +1457,9 @@ dev_dsp_end: # if HAVE_SYNCH_H mutex_unlock(&dev_dsp_lock); # elif HAVE_PTHREAD_H - /*@-moduncon@*/ + /*@-moduncon -noeffectuncon @*/ /* FIX: annotate */ (void) pthread_mutex_unlock(&dev_dsp_lock); - /*@=moduncon@*/ + /*@=moduncon =noeffectuncon @*/ # endif #endif @@ -1480,10 +1481,10 @@ int entropy_dev_random(uint32* data, int size) if (mutex_lock(&dev_random_lock)) return -1; # elif HAVE_PTHREAD_H - /*@-moduncon@*/ + /*@-moduncon -noeffectuncon @*/ /* FIX: annotate */ if (pthread_mutex_lock(&dev_random_lock)) return -1; - /*@=moduncon@*/ + /*@=moduncon =noeffectuncon @*/ # endif #endif @@ -1505,9 +1506,9 @@ dev_random_end: # if HAVE_SYNCH_H mutex_unlock(&dev_random_lock); # elif HAVE_PTHREAD_H - /*@-moduncon@*/ + /*@-moduncon -noeffectuncon @*/ /* FIX: annotate */ (void) pthread_mutex_unlock(&dev_random_lock); - /*@=moduncon@*/ + /*@=moduncon =noeffectuncon @*/ # endif #endif return rc; @@ -1528,10 +1529,10 @@ int entropy_dev_urandom(uint32* data, int size) if (mutex_lock(&dev_urandom_lock)) return -1; # elif HAVE_PTHREAD_H - /*@-moduncon@*/ + /*@-moduncon -noeffectuncon @*/ /* FIX: annotate */ if (pthread_mutex_lock(&dev_urandom_lock)) return -1; - /*@=moduncon@*/ + /*@=moduncon =noeffectuncon @*/ # endif #endif @@ -1553,9 +1554,9 @@ dev_urandom_end: # if HAVE_SYNCH_H mutex_unlock(&dev_urandom_lock); # elif HAVE_PTHREAD_H - /*@-moduncon@*/ + /*@-moduncon -noeffectuncon @*/ /* FIX: annotate */ (void) pthread_mutex_unlock(&dev_urandom_lock); - /*@=moduncon@*/ + /*@=moduncon =noeffectuncon @*/ # endif #endif return rc; @@ -1574,10 +1575,10 @@ int entropy_dev_tty(uint32* data, int size) if (mutex_lock(&dev_tty_lock)) return -1; # elif HAVE_PTHREAD_H - /*@-moduncon@*/ + /*@-moduncon -noeffectuncon @*/ /* FIX: annotate */ if (pthread_mutex_lock(&dev_tty_lock)) return -1; - /*@=moduncon@*/ + /*@=moduncon =noeffectuncon @*/ # endif #endif @@ -1598,9 +1599,9 @@ dev_tty_end: # if HAVE_SYNCH_H mutex_unlock(&dev_tty_lock); # elif HAVE_PTHREAD_H - /*@-moduncon@*/ + /*@-moduncon -noeffectuncon @*/ /* FIX: annotate */ (void) pthread_mutex_unlock(&dev_tty_lock); - /*@=moduncon@*/ + /*@=moduncon =noeffectuncon @*/ # endif #endif @@ -1609,3 +1610,4 @@ dev_tty_end: #endif #endif +/*@=sizeoftype@*/ diff --git a/beecrypt/fips180.c b/beecrypt/fips180.c index 82e069666..7dfb94c05 100644 --- a/beecrypt/fips180.c +++ b/beecrypt/fips180.c @@ -44,7 +44,9 @@ static const uint32 k[4] = { 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6 }; /*@observer@*/ /*@unchecked@*/ static const uint32 hinit[5] = { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 }; +/*@-sizeoftype@*/ const hashFunction sha1 = { "SHA-1", sizeof(sha1Param), 64, 5 * sizeof(uint32), (hashFunctionReset) sha1Reset, (hashFunctionUpdate) sha1Update, (hashFunctionDigest) sha1Digest }; +/*@=sizeoftype@*/ int sha1Reset(register sha1Param *p) { diff --git a/beecrypt/fips186.c b/beecrypt/fips186.c index e30fa319e..be5908232 100644 --- a/beecrypt/fips186.c +++ b/beecrypt/fips186.c @@ -43,7 +43,9 @@ /*@observer@*/ /*@unchecked@*/ static uint32 fips186hinit[5] = { 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0, 0x67452301 }; +/*@-sizeoftype@*/ const randomGenerator fips186prng = { "FIPS 186", sizeof(fips186Param), (const randomGeneratorSetup) fips186Setup, (const randomGeneratorSeed) fips186Seed, (const randomGeneratorNext) fips186Next, (const randomGeneratorCleanup) fips186Cleanup }; +/*@=sizeoftype@*/ /** */ diff --git a/beecrypt/hmacmd5.c b/beecrypt/hmacmd5.c index f11ccae41..2fb7caff0 100644 --- a/beecrypt/hmacmd5.c +++ b/beecrypt/hmacmd5.c @@ -29,7 +29,9 @@ #include "hmacmd5.h" +/*@-sizeoftype@*/ const keyedHashFunction hmacmd5 = { "HMAC-MD5", sizeof(hmacmd5Param), 64, 4 * sizeof(uint32), 64, 512, 32, (const keyedHashFunctionSetup) hmacmd5Setup, (const keyedHashFunctionReset) hmacmd5Reset, (const keyedHashFunctionUpdate) hmacmd5Update, (const keyedHashFunctionDigest) hmacmd5Digest }; +/*@=sizeoftype@*/ int hmacmd5Setup (hmacmd5Param* sp, const uint32* key, int keybits) { diff --git a/beecrypt/hmacsha1.c b/beecrypt/hmacsha1.c index 25feef0fb..7cd69939e 100644 --- a/beecrypt/hmacsha1.c +++ b/beecrypt/hmacsha1.c @@ -29,7 +29,9 @@ #include "hmacsha1.h" +/*@-sizeoftype@*/ const keyedHashFunction hmacsha1 = { "HMAC-SHA-1", sizeof(hmacsha1Param), 64, 5 * sizeof(uint32), 64, 512, 32, (keyedHashFunctionSetup) hmacsha1Setup, (keyedHashFunctionReset) hmacsha1Reset, (keyedHashFunctionUpdate) hmacsha1Update, (keyedHashFunctionDigest) hmacsha1Digest }; +/*@=sizeoftype@*/ int hmacsha1Setup (hmacsha1Param* sp, const uint32* key, int keybits) { diff --git a/beecrypt/hmacsha256.c b/beecrypt/hmacsha256.c index 97faa2c2c..8eaeb8c71 100644 --- a/beecrypt/hmacsha256.c +++ b/beecrypt/hmacsha256.c @@ -29,7 +29,9 @@ #include "hmacsha256.h" +/*@-sizeoftype@*/ const keyedHashFunction hmacsha256 = { "HMAC-SHA-256", sizeof(hmacsha256Param), 64, 8 * sizeof(uint32), 64, 512, 32, (keyedHashFunctionSetup) hmacsha256Setup, (keyedHashFunctionReset) hmacsha256Reset, (keyedHashFunctionUpdate) hmacsha256Update, (keyedHashFunctionDigest) hmacsha256Digest }; +/*@=sizeoftype@*/ int hmacsha256Setup (hmacsha256Param* sp, const uint32* key, int keybits) { diff --git a/beecrypt/md5.c b/beecrypt/md5.c index 251abe227..07391a971 100644 --- a/beecrypt/md5.c +++ b/beecrypt/md5.c @@ -36,7 +36,9 @@ /*@observer@*/ /*@unchecked@*/ static uint32 md5hinit[4] = { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 }; +/*@-sizeoftype@*/ const hashFunction md5 = { "MD5", sizeof(md5Param), 64, 4 * sizeof(uint32), (hashFunctionReset) md5Reset, (hashFunctionUpdate) md5Update, (hashFunctionDigest) md5Digest }; +/*@=sizeoftype@*/ int md5Reset(register md5Param* p) { diff --git a/beecrypt/memchunk.c b/beecrypt/memchunk.c index 2befd60a2..40597be9b 100644 --- a/beecrypt/memchunk.c +++ b/beecrypt/memchunk.c @@ -37,7 +37,7 @@ /*@-compdef@*/ /* tmp->data is undefined */ memchunk* memchunkAlloc(int size) { - memchunk* tmp = (memchunk*) calloc(1, sizeof(memchunk)); + memchunk* tmp = (memchunk*) calloc(1, sizeof(*tmp)); if (tmp) { diff --git a/beecrypt/mp32barrett.c b/beecrypt/mp32barrett.c index a9b90e534..78e50b6de 100644 --- a/beecrypt/mp32barrett.c +++ b/beecrypt/mp32barrett.c @@ -1,3 +1,4 @@ +/*@-sizeoftype@*/ /** \ingroup MP_m * \file mp32barrett.c * @@ -1053,3 +1054,4 @@ void mp32bnpowmodsld(const mp32barrett* b, const uint32* slide, const mp32number free(temp); /*@=nullpass@*/ } +/*@=sizeoftype@*/ diff --git a/beecrypt/mp32number.c b/beecrypt/mp32number.c index a4c766de7..8a205ba20 100644 --- a/beecrypt/mp32number.c +++ b/beecrypt/mp32number.c @@ -1,3 +1,4 @@ +/*@-sizeoftype@*/ /** \ingroup MP_m * \file mp32number.c * @@ -229,3 +230,4 @@ void mp32nsethex(mp32number* n, const char* hex) } } /*@=nullstate =compdef @*/ +/*@=sizeoftype@*/ diff --git a/beecrypt/mtprng.c b/beecrypt/mtprng.c index 165c1e251..ada28ecb2 100644 --- a/beecrypt/mtprng.c +++ b/beecrypt/mtprng.c @@ -53,7 +53,9 @@ #define loBits(a) ((a) & 0x7FFFFFFF) #define mixBits(a, b) (hiBit(a) | loBits(b)) +/*@-sizeoftype@*/ const randomGenerator mtprng = { "Mersenne Twister", sizeof(mtprngParam), (randomGeneratorSetup) mtprngSetup, (randomGeneratorSeed) mtprngSeed, (randomGeneratorNext) mtprngNext, (randomGeneratorCleanup) mtprngCleanup }; +/*@=sizeoftype@*/ /** */ diff --git a/beecrypt/rsa.c b/beecrypt/rsa.c index 177640b65..78c0068b1 100644 --- a/beecrypt/rsa.c +++ b/beecrypt/rsa.c @@ -40,7 +40,7 @@ int rsapri(const rsakp* kp, const mp32number* m, mp32number* c) { register uint32 size = kp->n.size; - register uint32* temp = (uint32*) malloc((4*size+2)*sizeof(uint32)); + register uint32* temp = (uint32*) malloc((4*size+2) * sizeof(*temp)); if (temp) { @@ -61,7 +61,7 @@ int rsapricrt(const rsakp* kp, const mp32number* m, mp32number* c) register uint32 nsize = kp->n.size; register uint32 psize = kp->p.size; register uint32 qsize = kp->q.size; - register uint32* temp = (uint32*) malloc((psize+qsize+(5*nsize+6))*sizeof(uint32)); + register uint32* temp = (uint32*) malloc((psize+qsize+(5*nsize+6))*sizeof(*temp)); register uint32* wksp = temp+psize+qsize+nsize; /* compute j1 = m^d1 mod p */ @@ -116,7 +116,7 @@ int rsavrfy(const rsapk* pk, const mp32number* m, const mp32number* c) { int rc; register uint32 size = pk->n.size; - register uint32* temp = (uint32*) malloc((5*size+2)*sizeof(uint32)); + register uint32* temp = (uint32*) malloc((5*size+2) * sizeof(*temp)); if (temp) { 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); diff --git a/beecrypt/rsapk.c b/beecrypt/rsapk.c index 4dcfbe1c8..5032941be 100644 --- a/beecrypt/rsapk.c +++ b/beecrypt/rsapk.c @@ -37,7 +37,7 @@ int rsapkInit(rsapk* pk) { - memset(pk, 0, sizeof(rsapk)); + memset(pk, 0, sizeof(*pk)); /* or mp32bzero(&pk->n); mp32nzero(&pk->e); diff --git a/beecrypt/sha256.c b/beecrypt/sha256.c index 558d3c7c8..329f3c60d 100644 --- a/beecrypt/sha256.c +++ b/beecrypt/sha256.c @@ -52,7 +52,9 @@ static const uint32 hinit[8] = { 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 }; +/*@-sizeoftype@*/ const hashFunction sha256 = { "SHA-256", sizeof(sha256Param), 64, 8 * sizeof(uint32), (hashFunctionReset) sha256Reset, (hashFunctionUpdate) sha256Update, (hashFunctionDigest) sha256Digest }; +/*@=sizeoftype@*/ int sha256Reset(register sha256Param *p) { |