+strict # lclint level
# --- in progress
-#+bounds
++likelybounds
-bufferoverflowhigh
-aliasunique
-mayaliasunique
+-compdef # 83
+-noeffectuncon # 11
+
-elseifcomplete
--exportheader
--exportheadervar
--exportlocal
--fcnuse
--typeuse
--varuse
--compdef
--noeffectuncon
-whileempty
# --- not-yet at strict level
--exportconst # 4
+-exportconst # 3
-exportfcn # 308
-exporttype # 53
-exportvar # 14
-ptrarith # 212
--compdestroy # 6
--mustdefine # 49
-
--bitwisesigned # 77
--strictops # 48
--sizeoftype # 22
+-mustdefine # 54
+-strictops # 23
-impcheckedstrictglobs
-impcheckedstrictstatics
-ansi-reserved # goofy
# --- not-yet at standard level
--boolops # 49
+-boolops # 53
-predboolint # 238
--type # 965
++matchanyintegral
+-type # 150
{
t = rk[3];
rk[4] = rk[0] ^
- (_ae4[(t >> 16) & 0xff] & 0xff000000) ^
- (_ae4[(t >> 8) & 0xff] & 0x00ff0000) ^
- (_ae4[(t ) & 0xff] & 0x0000ff00) ^
- (_ae4[(t >> 24) ] & 0x000000ff) ^
+ (_ae4[(t >> 16) & 0xff] & 0xff000000U) ^
+ (_ae4[(t >> 8) & 0xff] & 0x00ff0000U) ^
+ (_ae4[(t ) & 0xff] & 0x0000ff00U) ^
+ (_ae4[(t >> 24) ] & 0x000000ffU) ^
_arc[i];
rk[5] = rk[1] ^ rk[4];
rk[6] = rk[2] ^ rk[5];
{
t = rk[5];
rk[ 6] = rk[0] ^
- (_ae4[(t >> 16) & 0xff] & 0xff000000) ^
- (_ae4[(t >> 8) & 0xff] & 0x00ff0000) ^
- (_ae4[(t ) & 0xff] & 0x0000ff00) ^
- (_ae4[(t >> 24) ] & 0x000000ff) ^
+ (_ae4[(t >> 16) & 0xff] & 0xff000000U) ^
+ (_ae4[(t >> 8) & 0xff] & 0x00ff0000U) ^
+ (_ae4[(t ) & 0xff] & 0x0000ff00U) ^
+ (_ae4[(t >> 24) ] & 0x000000ffU) ^
_arc[i];
rk[ 7] = rk[1] ^ rk[ 6];
rk[ 8] = rk[2] ^ rk[ 7];
{
t = rk[7];
rk[8] = rk[0] ^
- (_ae4[(t >> 16) & 0xff] & 0xff000000) ^
- (_ae4[(t >> 8) & 0xff] & 0x00ff0000) ^
- (_ae4[(t ) & 0xff] & 0x0000ff00) ^
- (_ae4[(t >> 24) ] & 0x000000ff) ^
+ (_ae4[(t >> 16) & 0xff] & 0xff000000U) ^
+ (_ae4[(t >> 8) & 0xff] & 0x00ff0000U) ^
+ (_ae4[(t ) & 0xff] & 0x0000ff00U) ^
+ (_ae4[(t >> 24) ] & 0x000000ffU) ^
_arc[i];
rk[ 9] = rk[1] ^ rk[ 8];
rk[10] = rk[2] ^ rk[ 9];
break;
t = rk[7];
rk[12] = rk[4] ^
- (_ae4[(t >> 16) & 0xff] & 0xff000000) ^
- (_ae4[(t >> 8) & 0xff] & 0x00ff0000) ^
- (_ae4[(t ) & 0xff] & 0x0000ff00) ^
- (_ae4[(t >> 24) ] & 0x000000ff);
+ (_ae4[(t >> 16) & 0xff] & 0xff000000U) ^
+ (_ae4[(t >> 8) & 0xff] & 0x00ff0000U) ^
+ (_ae4[(t ) & 0xff] & 0x0000ff00U) ^
+ (_ae4[(t >> 24) ] & 0x000000ffU);
rk[13] = rk[5] ^ rk[12];
rk[14] = rk[6] ^ rk[13];
rk[15] = rk[7] ^ rk[14];
#define elr() \
s0 = \
- (_ae4[(t0 >> 24) ] & 0xff000000) ^ \
- (_ae4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ \
- (_ae4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ \
- (_ae4[(t3 ) & 0xff] & 0x000000ff) ^ \
+ (_ae4[(t0 >> 24) ] & 0xff000000U) ^ \
+ (_ae4[(t1 >> 16) & 0xff] & 0x00ff0000U) ^ \
+ (_ae4[(t2 >> 8) & 0xff] & 0x0000ff00U) ^ \
+ (_ae4[(t3 ) & 0xff] & 0x000000ffU) ^ \
rk[0]; \
s1 = \
- (_ae4[(t1 >> 24) ] & 0xff000000) ^ \
- (_ae4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ \
- (_ae4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ \
- (_ae4[(t0 ) & 0xff] & 0x000000ff) ^ \
+ (_ae4[(t1 >> 24) ] & 0xff000000U) ^ \
+ (_ae4[(t2 >> 16) & 0xff] & 0x00ff0000U) ^ \
+ (_ae4[(t3 >> 8) & 0xff] & 0x0000ff00U) ^ \
+ (_ae4[(t0 ) & 0xff] & 0x000000ffU) ^ \
rk[1]; \
s2 = \
- (_ae4[(t2 >> 24) ] & 0xff000000) ^ \
- (_ae4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ \
- (_ae4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ \
- (_ae4[(t1 ) & 0xff] & 0x000000ff) ^ \
+ (_ae4[(t2 >> 24) ] & 0xff000000U) ^ \
+ (_ae4[(t3 >> 16) & 0xff] & 0x00ff0000U) ^ \
+ (_ae4[(t0 >> 8) & 0xff] & 0x0000ff00U) ^ \
+ (_ae4[(t1 ) & 0xff] & 0x000000ffU) ^ \
rk[2]; \
s3 = \
- (_ae4[(t3 >> 24) ] & 0xff000000) ^ \
- (_ae4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ \
- (_ae4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ \
- (_ae4[(t2 ) & 0xff] & 0x000000ff) ^ \
+ (_ae4[(t3 >> 24) ] & 0xff000000U) ^ \
+ (_ae4[(t0 >> 16) & 0xff] & 0x00ff0000U) ^ \
+ (_ae4[(t1 >> 8) & 0xff] & 0x0000ff00U) ^ \
+ (_ae4[(t2 ) & 0xff] & 0x000000ffU) ^ \
rk[3];
#ifndef ASM_AESENCRYPT
#define dlr() \
s0 = \
- (_ad4[(t0 >> 24) ] & 0xff000000) ^ \
- (_ad4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ \
- (_ad4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ \
- (_ad4[(t1 ) & 0xff] & 0x000000ff) ^ \
+ (_ad4[(t0 >> 24) ] & 0xff000000U) ^ \
+ (_ad4[(t3 >> 16) & 0xff] & 0x00ff0000U) ^ \
+ (_ad4[(t2 >> 8) & 0xff] & 0x0000ff00U) ^ \
+ (_ad4[(t1 ) & 0xff] & 0x000000ffU) ^ \
rk[0]; \
s1 = \
- (_ad4[(t1 >> 24) ] & 0xff000000) ^ \
- (_ad4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ \
- (_ad4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ \
- (_ad4[(t2 ) & 0xff] & 0x000000ff) ^ \
+ (_ad4[(t1 >> 24) ] & 0xff000000U) ^ \
+ (_ad4[(t0 >> 16) & 0xff] & 0x00ff0000U) ^ \
+ (_ad4[(t3 >> 8) & 0xff] & 0x0000ff00U) ^ \
+ (_ad4[(t2 ) & 0xff] & 0x000000ffU) ^ \
rk[1]; \
s2 = \
- (_ad4[(t2 >> 24) ] & 0xff000000) ^ \
- (_ad4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ \
- (_ad4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ \
- (_ad4[(t3 ) & 0xff] & 0x000000ff) ^ \
+ (_ad4[(t2 >> 24) ] & 0xff000000U) ^ \
+ (_ad4[(t1 >> 16) & 0xff] & 0x00ff0000U) ^ \
+ (_ad4[(t0 >> 8) & 0xff] & 0x0000ff00U) ^ \
+ (_ad4[(t3 ) & 0xff] & 0x000000ffU) ^ \
rk[2]; \
s3 = \
- (_ad4[(t3 >> 24) ] & 0xff000000) ^ \
- (_ad4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ \
- (_ad4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ \
- (_ad4[(t0 ) & 0xff] & 0x000000ff) ^ \
+ (_ad4[(t3 >> 24) ] & 0xff000000U) ^ \
+ (_ad4[(t2 >> 16) & 0xff] & 0x00ff0000U) ^ \
+ (_ad4[(t1 >> 8) & 0xff] & 0x0000ff00U) ^ \
+ (_ad4[(t0 ) & 0xff] & 0x000000ffU) ^ \
rk[3];
#ifndef ASM_AESDECRYPT
}
}
- if (ns & 0x3) return 2;
+ if (((unsigned)ns) & 0x3) return 2;
nt = (ns / 4) * 3;
t = te = malloc(nt + 1);
return -1;
ctxt->algo = hash;
- if (ctxt->param) /* XXX error? */
- free(ctxt->param);
ctxt->param = (hashFunctionParam*) calloc(hash->paramsize, 1);
/*@-nullstate@*/ /* FIX: ctxt->param may be NULL */
return -1;
ctxt->algo = mac;
- if (ctxt->param) /* XXX error? */
- free(ctxt->param);
ctxt->param = (keyedHashFunctionParam*) calloc(mac->paramsize, 1);
/*@-nullstate@*/ /* FIX: ctxt->param may be NULL */
return -1;
ctxt->algo = ciph;
- if (ctxt->param) /* XXX error? */
- free(ctxt->param);
ctxt->param = (blockCipherParam*) calloc(ciph->paramsize, 1);
ctxt->op = NOCRYPT;
* Initialize a randomGenerator instance.
*/
BEECRYPTAPI /*@unused@*/
-int randomGeneratorContextInit(randomGeneratorContext* ctxt, /*@observer@*/ /*@dependent@*/ const randomGenerator* rng)
+int randomGeneratorContextInit(/*@special@*/ /*@null@*/ randomGeneratorContext* ctxt, /*@observer@*/ /*@dependent@*/ /*@null@*/ const randomGenerator* rng)
+ /*@defines ctxt->rng, ctxt->param @*/
/*@modifies ctxt->rng, ctxt->param @*/;
/** \ingroup PRNG_m
* Initialize a hashFunction instance.
*/
BEECRYPTAPI
-int hashFunctionContextInit(hashFunctionContext* ctxt, /*@observer@*/ /*@dependent@*/ const hashFunction* hash)
- /*@modifies ctxt->algo, ctxt->param */;
+int hashFunctionContextInit(/*@special@*/ hashFunctionContext* ctxt, /*@observer@*/ /*@dependent@*/ const hashFunction* hash)
+ /*@defines ctxt->algo, ctxt->param @*/
+ /*@modifies ctxt->algo, ctxt->param @*/;
/** \ingroup HASH_m
* Destroy a hashFunction instance.
BEECRYPTAPI
int hashFunctionContextFree(/*@special@*/ hashFunctionContext* ctxt)
/*@releases ctxt->param @*/
- /*@modifies ctxt->algo, ctxt->param */;
+ /*@modifies ctxt->algo, ctxt->param @*/;
/** \ingroup HASH_m
*/
BEECRYPTAPI
int hashFunctionContextReset(hashFunctionContext* ctxt)
- /*@modifies ctxt */;
+ /*@modifies ctxt @*/;
/** \ingroup HASH_m
*/
BEECRYPTAPI /*@unused@*/
int hashFunctionContextUpdate(hashFunctionContext* ctxt, const byte* data, size_t size)
- /*@modifies ctxt */;
+ /*@modifies ctxt @*/;
/** \ingroup HASH_m
*/
BEECRYPTAPI /*@unused@*/
int hashFunctionContextUpdateMC(hashFunctionContext* ctxt, const memchunk* m)
- /*@modifies ctxt */;
+ /*@modifies ctxt @*/;
/** \ingroup HASH_m
*/
BEECRYPTAPI
int hashFunctionContextUpdateMP(hashFunctionContext* ctxt, const mpnumber* n)
- /*@modifies ctxt */;
+ /*@modifies ctxt @*/;
/** \ingroup HASH_m
*/
BEECRYPTAPI
int hashFunctionContextDigest(hashFunctionContext* ctxt, byte* digest)
- /*@modifies ctxt, *digest */;
+ /*@modifies ctxt, *digest @*/;
/** \ingroup HASH_m
*/
+/*@-exportlocal@*/
BEECRYPTAPI
int hashFunctionContextDigestMP(hashFunctionContext* ctxt, mpnumber* d)
- /*@modifies ctxt, *d */;
+ /*@modifies ctxt, *d @*/;
+/*@=exportlocal@*/
/** \ingroup HASH_m
*/
BEECRYPTAPI /*@unused@*/
int hashFunctionContextDigestMatch(hashFunctionContext* ctxt, const mpnumber* d)
- /*@modifies ctxt */;
+ /*@modifies ctxt @*/;
#ifdef __cplusplus
}
* Initialize a keyedHashFunction instance.
*/
BEECRYPTAPI
-int keyedHashFunctionContextInit(keyedHashFunctionContext* ctxt, /*@observer@*/ /*@dependent@*/ const keyedHashFunction* mac)
+int keyedHashFunctionContextInit(/*@special@*/ keyedHashFunctionContext* ctxt, /*@observer@*/ /*@dependent@*/ const keyedHashFunction* mac)
+ /*@defines ctxt->algo, ctxt->param @*/
/*@modifies ctxt->algo, ctxt->param @*/;
/** \ingroup HMAC_m
/** \ingroup HMAC_m
*/
-BEECRYPTAPI
+BEECRYPTAPI /*@unused@*/
int keyedHashFunctionContextDigest(keyedHashFunctionContext* ctxt, byte* digest)
/*@modifies ctxt, *digest @*/;
} cipherOperation;
/** \ingroup BC_m
- * @param param blockcipher parameters
- * @param size no. of ints
- * @retval dst ciphertext block
- * @param src plaintext block
- * @return 0 on success, -1 on failure
- */
-typedef int (*blockModeEncrypt) (blockCipherParam* param, int count, byte* dst, const byte* src)
- /*@modifies *param, *dst @*/;
-
-/** \ingroup BC_m
- * @param param blockcipher parameters
- * @param size no. of ints
- * @retval dst plainttext block
- * @param src ciphertext block
- * @return 0 on success, -1 on failure
- */
-typedef int (*blockModeDecrypt) (blockCipherParam* param, int count, byte* dst, const byte* src)
- /*@modifies *param, *dst @*/;
-
-/** \ingroup BC_m
- */
-typedef struct
-{
- const blockModeEncrypt encrypt;
- const blockModeDecrypt decrypt;
-} blockMode;
-
-/** \ingroup BC_m
* Setup the blockcipher parameters with the given secret key for either
* encryption or decryption.
*
* Initialize a blockCipher instance.
*/
BEECRYPTAPI
-int blockCipherContextInit(blockCipherContext* ctxt, /*@observer@*/ /*@dependent@*/ const blockCipher* ciph)
+int blockCipherContextInit(/*@special@*/ blockCipherContext* ctxt, /*@observer@*/ /*@dependent@*/ const blockCipher* ciph)
+ /*@defines ctxt->algo, ctxt->param, ctxt->op @*/
/*@modifies ctxt->algo, ctxt->param, ctxt->op @*/;
/** \ingroup BC_m
nblocks--;
+/*@-usedef@*/ /* LCL: dst is initialized. */
while (nblocks > 0)
{
for (i = 0; i < blockwords; i++)
for (i = 0; i < blockwords; i++)
fdback[i] = dst[i-blockwords];
+/*@=usedef@*/
}
return 0;
}
/* assumes that every blockcipher's blocksize is a multiple of 32 bits */
register int blockwords = bc->blocksize >> 2;
register uint32_t* fdback = bc->getfb(bp);
- register uint32_t* buf = (uint32_t*) malloc(blockwords * sizeof(uint32_t));
+ register uint32_t* buf = (uint32_t*) malloc(blockwords * sizeof(*buf));
if (buf)
{
for (i = 0; i < blockwords; i++)
{
tmp = src[i];
+/*@-usedef@*/ /* LCL: buf is initialized. */
dst[i] = buf[i] ^ fdback[i];
+/*@-usedef@*/
fdback[i] = tmp;
}
byte padvalue;
int i;
+/*@-usedef@*/ /* LCL: tmp->{data,size} not initialized? */
if (tmp->data == (byte*) 0)
return (memchunk*) 0;
padvalue = tmp->data[tmp->size - 1];
+/*@=usedef@*/
if (padvalue > blockbytes)
return (memchunk*) 0;
BEECRYPTAPI /*@only@*/ /*@null@*/
memchunk* pkcs5Unpad(int blockbytes,
/*@returned@*/ /*@null@*/ /*@out@*/ memchunk* tmp)
- /*@modifies tmp */;
+ /*@modifies tmp @*/;
/**
* Copy/enlarge buffer to boundary.
if (ctxt->hash.algo->digestsize > 0)
{
byte* mackey = digest;
- byte* cipherkey = digest + ((ctxt->mackeybits + 7) >> 3);
+ byte* cipherkey = digest + ((ctxt->mackeybits + 7U) >> 3);
if ((rc = keyedHashFunctionContextSetup(&ctxt->mac, mackey, ctxt->mackeybits)))
goto setup_end;
*/
/*@-exportlocal@*/
BEECRYPTAPI
-int dhaes_pContextInit (dhaes_pContext* ctxt, const dhaes_pParameters* params)
- /*@modifies ctxt */;
+int dhaes_pContextInit (/*@special@*/ dhaes_pContext* ctxt, const dhaes_pParameters* params)
+ /*@defines ctxt->hash, ctxt->cipher, ctxt->mac @*/
+ /*@modifies ctxt @*/;
/*@=exportlocal@*/
/**
*/
BEECRYPTAPI /*@unused@*/
int dhaes_pContextInitDecrypt(dhaes_pContext* ctxt, const dhaes_pParameters* params, const mpnumber* pri)
- /*@modifies ctxt */;
+ /*@modifies ctxt @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int dhaes_pContextInitEncrypt(dhaes_pContext* ctxt, const dhaes_pParameters* params, const mpnumber* pub)
- /*@modifies ctxt */;
+ /*@modifies ctxt @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int dhaes_pContextFree (/*@only@*/ dhaes_pContext* ctxt)
- /*@modifies ctxt */;
+ /*@modifies ctxt @*/;
/**
*/
BEECRYPTAPI /*@only@*/ /*@null@*/ /*@unused@*/
memchunk* dhaes_pContextEncrypt(dhaes_pContext* ctxt, mpnumber* ephemeralPublicKey, mpnumber* mac, const memchunk* cleartext, randomGeneratorContext* rng)
- /*@modifies ctxt, ephemeralPublicKey, mac, rng */;
+ /*@modifies ctxt, ephemeralPublicKey, mac, rng @*/;
/**
*/
BEECRYPTAPI /*@only@*/ /*@null@*/ /*@unused@*/
memchunk* dhaes_pContextDecrypt(dhaes_pContext* ctxt, const mpnumber* ephemeralPublicKey, const mpnumber* mac, const memchunk* ciphertext)
- /*@modifies ctxt */;
+ /*@modifies ctxt @*/;
#ifdef __cplusplus
}
/**
*/
BEECRYPTAPI /*@unused@*/
-int dldp_pgoqMake(dldp_p* dp, randomGeneratorContext* rgc, size_t pbits, size_t qbits, int cofactor)
+int dldp_pgoqMake(/*@special@*/ dldp_p* dp, randomGeneratorContext* rgc, size_t pbits, size_t qbits, int cofactor)
+ /*@defines dp->p, dp->q, dp->n @*/
/*@modifies dp->p, dp->q, dp->r, dp->g, dp->n, rgc @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int dlkp_pPair(dlkp_p* kp, randomGeneratorContext* rgc, const dldp_p* param)
- /*@modifies kp, rgc */;
+ /*@modifies kp, rgc @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int dlkp_pInit(dlkp_p* kp)
- /*@modifies kp */;
+ /*@modifies kp @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int dlkp_pFree(dlkp_p* kp)
- /*@modifies kp */;
+ /*@modifies kp @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int dlkp_pCopy(dlkp_p* dst, const dlkp_p* src)
- /*@modifies dst */;
+ /*@modifies dst @*/;
#ifdef __cplusplus
}
*/
BEECRYPTAPI /*@unused@*/
int dlpk_pInit(dlpk_p* pk)
- /*@modifies pk */;
+ /*@modifies pk @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int dlpk_pFree(dlpk_p* pk)
- /*@modifies pk */;
+ /*@modifies pk @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int dlpk_pCopy(dlpk_p* dst, const dlpk_p* src)
- /*@modifies dst */;
+ /*@modifies dst @*/;
/**
*/
*/
BEECRYPTAPI
int dlsvdp_pDHSecret(const dldp_p* dp, const mpnumber* x, const mpnumber* y, mpnumber* s)
- /*@modifies s */;
+ /*@modifies s @*/;
#ifdef __cplusplus
}
#include "endianness.h"
#include "debug.h"
-/*@-shiftimplementation@*/
+/*@-bitwisesigned -shiftimplementation@*/
int16_t swap16(int16_t n)
{
return ( ((n & 0xff) << 8) |
((n & 0xff00000000000000L) >> 56) );
#endif
}
-/*@=shiftimplementation@*/
+/*@=bitwisesigned =shiftimplementation@*/
int encodeByte(javabyte b, byte *data)
{
*/
BEECRYPTAPI /*@unused@*/
int encodeByte(javabyte b, /*@out@*/ byte* data)
- /*@modifies data */;
+ /*@modifies data @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int encodeShort(javashort s, /*@out@*/ byte* data)
- /*@modifies data */;
+ /*@modifies data @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int encodeInt(javaint i, /*@out@*/ byte* data)
- /*@modifies data */;
+ /*@modifies data @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int encodeLong(javalong l, /*@out@*/ byte* data)
- /*@modifies data */;
+ /*@modifies data @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int encodeChar(javachar c, /*@out@*/ byte* data)
- /*@modifies data */;
+ /*@modifies data @*/;
/**
*/
BEECRYPTAPI
int encodeInts(const javaint* i, /*@out@*/ byte* data, int count)
- /*@modifies data */;
+ /*@modifies data @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int encodeIntsPartial(const javaint* i, /*@out@*/ byte* data, int bytecount)
- /*@modifies data */;
+ /*@modifies data @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int encodeIntsPartialPad(const javaint* i, byte* data, int bytecount, byte padvalue)
- /*@modifies data */;
+ /*@modifies data @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int encodeChars(const javachar* c, /*@out@*/ byte* data, int count)
- /*@modifies data */;
+ /*@modifies data @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int decodeByte(/*@out@*/ javabyte* b, const byte* data)
- /*@modifies b */;
+ /*@modifies b @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int decodeShort(/*@out@*/ javashort* s, const byte* data)
- /*@modifies s */;
+ /*@modifies s @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int decodeInt(/*@out@*/ javaint* i, const byte* data)
- /*@modifies i */;
+ /*@modifies i @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int decodeLong(/*@out@*/ javalong* l, const byte* data)
- /*@modifies l */;
+ /*@modifies l @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int decodeChar(/*@out@*/ javachar* c, const byte* data)
- /*@modifies c */;
+ /*@modifies c @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int decodeInts(/*@out@*/ javaint* i, const byte* data, int count)
- /*@modifies i */;
+ /*@modifies i @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int decodeIntsPartial(/*@out@*/ javaint* i, const byte* data, int bytecount)
- /*@modifies i */;
+ /*@modifies i @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int decodeChars(/*@out@*/ javachar* c, const byte* data, int count)
- /*@modifies c */;
+ /*@modifies c @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int writeByte(javabyte b, FILE* ofp)
/*@globals fileSystem @*/
- /*@modifies ofp, fileSystem */;
+ /*@modifies ofp, fileSystem @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int writeShort(javashort s, FILE* ofp)
/*@globals fileSystem @*/
- /*@modifies ofp, fileSystem */;
+ /*@modifies ofp, fileSystem @*/;
/**
*/
BEECRYPTAPI
int writeInt(javaint i, FILE* ofp)
/*@globals fileSystem @*/
- /*@modifies ofp, fileSystem */;
+ /*@modifies ofp, fileSystem @*/;
/*@=exportlocal@*/
/**
BEECRYPTAPI /*@unused@*/
int writeLong(javalong l, FILE* ofp)
/*@globals fileSystem @*/
- /*@modifies ofp, fileSystem */;
+ /*@modifies ofp, fileSystem @*/;
/**
*/
BEECRYPTAPI
int writeChar(javachar c, FILE* ofp)
/*@globals fileSystem @*/
- /*@modifies ofp, fileSystem */;
+ /*@modifies ofp, fileSystem @*/;
/*@=exportlocal@*/
/**
BEECRYPTAPI /*@unused@*/
int writeInts(const javaint* i, FILE* ofp, int count)
/*@globals fileSystem @*/
- /*@modifies ofp, fileSystem */;
+ /*@modifies ofp, fileSystem @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int writeChars(const javachar* c, FILE* ofp, int count)
/*@globals fileSystem @*/
- /*@modifies ofp, fileSystem */;
+ /*@modifies ofp, fileSystem @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int readByte(/*@out@*/ javabyte* b, FILE* ifp)
/*@globals fileSystem @*/
- /*@modifies b, ifp, fileSystem */;
+ /*@modifies b, ifp, fileSystem @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int readShort(/*@out@*/ javashort* s, FILE* ifp)
/*@globals fileSystem @*/
- /*@modifies s, ifp, fileSystem */;
+ /*@modifies s, ifp, fileSystem @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int readInt(/*@out@*/ javaint* i, FILE* ifp)
/*@globals fileSystem @*/
- /*@modifies i, ifp, fileSystem */;
+ /*@modifies i, ifp, fileSystem @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int readLong(/*@out@*/ javalong* l, FILE* ifp)
/*@globals fileSystem @*/
- /*@modifies l, ifp, fileSystem */;
+ /*@modifies l, ifp, fileSystem @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int readChar(/*@out@*/ javachar* c, FILE* ifp)
/*@globals fileSystem @*/
- /*@modifies c, ifp, fileSystem */;
+ /*@modifies c, ifp, fileSystem @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int readInts(/*@out@*/ javaint* i, FILE* ifp, int count)
/*@globals fileSystem @*/
- /*@modifies i, ifp, fileSystem */;
+ /*@modifies i, ifp, fileSystem @*/;
/**
*/
BEECRYPTAPI /*@unused@*/
int readChars(/*@out@*/ javachar* c, FILE* ifp, int count)
/*@globals fileSystem @*/
- /*@modifies c, ifp, fileSystem */;
+ /*@modifies c, ifp, fileSystem @*/;
#ifdef __cplusplus
}
# include <aio.h>
# if defined(__LCLINT__)
/*@-declundef -exportheader -incondefs -constuse -warnmissingglobs @*/
- extern int
+ extern int /*@unused@*/
nanosleep (const struct timespec *__requested_time,
/*@out@*/ /*@null@*/ struct timespec *__remaining)
/*@modifies *__remaining, errno @*/;
/*@globals errno @*/
/*@modifies sampledata, errno @*/
{
- register int rc = 0, i;
+ register int rc = 0;
+ register unsigned i;
switch (samplesize)
{
for (i = 0; i < samplecount; i++)
{
- if (i & 1)
+ if (i & 1U)
{
if ((samples[i] & 0x1) != 0)
ones_count_left++;
static int entropy_noise_gather(HWAVEIN wavein, int samplesize, int channels, int swap, int timeout, byte* data, size_t size)
#else
/*@-mustmod@*/ /* data is modified, annotations incorrect */
-static int entropy_noise_gather(int fd, int samplesize, int channels, int swap, int timeout, /*@out@*/ byte* data, size_t size)
+static int entropy_noise_gather(int fd, int samplesize, int channels, int swap, /*@unused@*/ int timeout, /*@out@*/ byte* data, size_t size)
/*@globals errno, fileSystem @*/
- /*@modifies data, errno, fileSystem @*/
+ /*@modifies *data, errno, fileSystem @*/
#endif
{
size_t randombits = size << 3;
* @param size
* @return
*/
-static int entropy_randombits(int fd, int timeout, byte* data, size_t size)
- /*@*/
+static int entropy_randombits(int fd, /*@unused@*/ int timeout, byte* data, size_t size)
+ /*@modifies *data @*/
{
register int rc;
tio_set.c_cc[VMIN] = 1; /* read 1 tty character at a time */
tio_set.c_cc[VTIME] = 0; /* don't timeout the read */
/*@=noeffect@*/
+/*@-bitwisesigned@*/
tio_set.c_iflag |= IGNBRK; /* ignore <ctrl>-c */
tio_set.c_lflag &= ~(ECHO|ICANON); /* don't echo characters */
+/*@=bitwisesigned@*/
/* change the tty settings, and flush input characters */
if (tcsetattr(fd, TCSAFLUSH, &tio_set) < 0)
int mask, format, samplesize, stereo, speed, swap;
mask = 0;
- /*@-shiftimplementation@*/
+ /*@-bitwisesigned -shiftimplementation@*/
if ((rc = ioctl(dev_dsp_fd, SNDCTL_DSP_GETFMTS, &mask)) < 0)
- /*@=shiftimplementation@*/
+ /*@=bitwisesigned =shiftimplementation@*/
{
#if HAVE_ERRNO_H
perror("ioctl SNDCTL_DSP_GETFMTS failed");
goto dev_dsp_end;
}
+/*@-bitwisesigned@*/
#if WORDS_BIGENDIAN
if (mask & AFMT_S16_BE)
{
goto dev_dsp_end;
}
+/*@=bitwisesigned@*/
- /*@-shiftimplementation@*/
+ /*@-bitwisesigned -shiftimplementation@*/
if ((rc = ioctl(dev_dsp_fd, SNDCTL_DSP_SETFMT, &format)) < 0)
- /*@=shiftimplementation@*/
+ /*@=bitwisesigned =shiftimplementation@*/
{
#if HAVE_ERRNO_H
perror("ioctl SNDCTL_DSP_SETFMT failed");
/* the next two commands are not critical */
stereo = 1;
- /*@-shiftimplementation@*/
+ /*@-bitwisesigned -shiftimplementation@*/
(void) ioctl(dev_dsp_fd, SNDCTL_DSP_STEREO, &stereo);
- /*@=shiftimplementation@*/
+ /*@=bitwisesigned =shiftimplementation@*/
speed = 44100;
- /*@-shiftimplementation@*/
+ /*@-bitwisesigned -shiftimplementation@*/
(void) ioctl(dev_dsp_fd, SNDCTL_DSP_SPEED, &speed);
- /*@=shiftimplementation@*/
+ /*@=bitwisesigned =shiftimplementation@*/
rc = entropy_noise_gather(dev_dsp_fd, samplesize, 2, swap, timeout_env ? atoi(timeout_env) : 1000, data, size);
}
/*@-exportlocal@*/
BEECRYPTAPI
int fips186Setup (fips186Param* fp)
- /*@modifies fp */;
+ /*@modifies fp @*/;
/*@=exportlocal@*/
/**
/*@-exportlocal@*/
BEECRYPTAPI
int fips186Seed (fips186Param* fp, const byte* data, size_t size)
- /*@modifies fp */;
+ /*@modifies fp @*/;
/*@=exportlocal@*/
/**
/*@-exportlocal@*/
BEECRYPTAPI
int fips186Next (fips186Param* fp, byte* data, size_t size)
- /*@modifies fp, data */;
+ /*@modifies fp, data @*/;
/*@=exportlocal@*/
/**
/*@-exportlocal@*/
BEECRYPTAPI
int fips186Cleanup(fips186Param* fp)
- /*@modifies fp */;
+ /*@modifies fp @*/;
/*@=exportlocal@*/
#ifdef __cplusplus
*/
BEECRYPTAPI
int hmacSetup (byte* kxi, byte* kxo, const hashFunction* hash, hashFunctionParam* param, const byte* key, size_t keybits)
- /*@modifies kxi, kxo, param */;
+ /*@modifies kxi, kxo, param @*/;
/**
*/
BEECRYPTAPI
int hmacReset (const byte* kxi, const hashFunction* hash, hashFunctionParam* param)
- /*@modifies param */;
+ /*@modifies param @*/;
/**
*/
BEECRYPTAPI
int hmacUpdate(const hashFunction* hash, hashFunctionParam* param, const byte* data, size_t size)
- /*@modifies param */;
+ /*@modifies param @*/;
/**
*/
BEECRYPTAPI
int hmacDigest(const byte* kxo, const hashFunction* hash, hashFunctionParam* param, /*@out@*/ byte* data)
- /*@modifies data */;
+ /*@modifies data @*/;
#ifdef __cplusplus
}
int md5Reset(register md5Param* p)
{
- memcpy(p->h, md5hinit, 4 * sizeof(uint32_t));
- memset(p->data, 0, 16 * sizeof(uint32_t));
+ memcpy(p->h, md5hinit, sizeof(p->h));
+ memset(p->data, 0, sizeof(p->data));
#if (MP_WBITS == 64)
mpzero(1, p->length);
#elif (MP_WBITS == 32)
while (count--)
{
- if (carry | (xhi >= y))
+ if (((unsigned)carry) | (unsigned)(xhi >= y))
{
xhi -= y;
result |= 1;
xlo <<= 1;
result <<= 1;
}
- if (carry | (xhi >= y))
+ if (((unsigned)carry) | (unsigned)(xhi >= y))
{
xhi -= y;
result |= 1;
if (mpge(ysize, result+1, ydata))
{
(void) mpsub(ysize, result+1, ydata);
- *(result++) = 1;
+ *result = 1;
}
else
- *(result++) = 0;
+ *result = 0;
+ result++;
while (qsize--)
{
void mpcopy(size_t size, /*@out@*/ mpw* dst, const mpw* src)
/*@modifies dst @*/;
#ifndef ASM_MPCOPY
-# define mpcopy(size, dst, src) memcpy(dst, src, MP_WORDS_TO_BYTES(size))
+# define mpcopy(size, dst, src) memcpy(dst, src, MP_WORDS_TO_BYTES((unsigned)size))
#endif
/**
void mpmove(size_t size, /*@out@*/ mpw* dst, const mpw* src)
/*@modifies dst @*/;
#ifndef ASM_MPMOVE
-# define mpmove(size, dst, src) memmove(dst, src, MP_WORDS_TO_BYTES(size))
+# define mpmove(size, dst, src) memmove(dst, src, MP_WORDS_TO_BYTES((unsigned)size))
#endif
/**
/**
*/
-BEECRYPTAPI /*@unused@*/
+BEECRYPTAPI
size_t mpbits(size_t size, const mpw* data)
/*@*/;
/**
*/
-BEECRYPTAPI
+BEECRYPTAPI /*@unused@*/
size_t mpbitcnt(size_t size, const mpw* data)
/*@*/;
/**
*/
-/*@-exportlocal@*/
BEECRYPTAPI
void mplshift(size_t size, mpw* data, size_t count)
/*@modifies data @*/;
-/*@=exportlocal@*/
/**
*/
/**
*/
-BEECRYPTAPI /*@unused@*/
+/*@-exportlocal@*/
+BEECRYPTAPI
mpw mppndiv(mpw xhi, mpw xlo, mpw y)
/*@*/;
+/*@=exportlocal@*/
/**
*/
/**
*/
-BEECRYPTAPI /*@unused@*/
+BEECRYPTAPI
void mpnmod(/*@out@*/ mpw* result, size_t xsize, const mpw* xdata, size_t ysize, const mpw* ydata, /*@out@*/ mpw* workspace)
/*@modifies result, workspace @*/;
/**
*/
-BEECRYPTAPI /*@unused@*/
+BEECRYPTAPI
void mpprintln(/*@null@*/ FILE * fp, size_t size, /*@null@*/ const mpw* data)
/*@globals fileSystem @*/
/*@modifies *fp, fileSystem @*/;
/**
*/
-BEECRYPTAPI /*@unused@*/
+BEECRYPTAPI
int i2osp(/*@out@*/ byte *osdata, size_t ossize, const mpw* idata, size_t isize)
/*@modifies osdata @*/;
/**
*/
-BEECRYPTAPI /*@unused@*/
+BEECRYPTAPI
int os2ip(/*@out@*/ mpw *idata, size_t isize, const byte* osdata, size_t ossize)
/*@modifies idata @*/;
/**
*/
-BEECRYPTAPI /*@unused@*/
+BEECRYPTAPI
int hs2ip(/*@out@*/ mpw* idata, size_t isize, const char* hsdata, size_t hssize)
/*@modifies idata @*/;
n->data = (mpw*) malloc(size * sizeof(*n->data));
if (n->data && data)
+ {
+ n->size = size;
/*@-nullpass@*/ /* data is notnull */
- mpcopy(n->size = size, n->data, data);
+ mpcopy(n->size, n->data, data);
/*@=nullpass@*/
+ }
else
{
n->size = 0;
#include "mp.h"
#include "debug.h"
-#define hiBit(a) ((a) & 0x80000000)
-#define loBit(a) ((a) & 0x1)
-#define loBits(a) ((a) & 0x7FFFFFFF)
+#define hiBit(a) ((a) & 0x80000000U)
+#define loBit(a) ((a) & 0x1U)
+#define loBits(a) ((a) & 0x7FFFFFFFU)
#define mixBits(a, b) (hiBit(a) | loBits(b))
/*@-sizeoftype@*/
tmp = *(mp->nextw++);
tmp ^= (tmp >> 11);
- tmp ^= (tmp << 7) & 0x9D2C5680;
- tmp ^= (tmp << 15) & 0xEFC60000;
+ tmp ^= (tmp << 7) & 0x9D2C5680U;
+ tmp ^= (tmp << 15) & 0xEFC60000U;
tmp ^= (tmp >> 18);
mp->left--;
*(data++) = tmp;
#define N 624
#define M 397
-#define K 0x9908B0DF
+#define K 0x9908B0DFU
/**
*/
* @param c ciphertext
* @retval 0 on success, -1 on failure
*/
+BEECRYPTAPI /*@unused@*/
int rsapub(const rsapk* pk, const mpnumber* m, mpnumber* c)
- /*@modifies c */;
+ /*@modifies c @*/;
/**
* The raw RSA private key operation.
*/
BEECRYPTAPI /*@unused@*/
int rsapri (const rsakp* kp, const mpnumber* c, mpnumber* m)
- /*@modifies m */;
+ /*@modifies m @*/;
/**
* The raw RSA private key operation, with Chinese Remainder Theorem.
* @param m message
* @retval 0 on success, -1 on failure.
*/
-BEECRYPTAPI /*@unused@*/
+BEECRYPTAPI
int rsapricrt(const rsakp* kp, const mpnumber* c, mpnumber* m)
- /*@modifies m */;
+ /*@modifies m @*/;
/**
* Verify if ciphertext \e c was encrypted from cleartext \e m
* @param c ciphertext message
* @retval 1 on success, 0 on failure
*/
-BEECRYPTAPI /*@unused@*/
+BEECRYPTAPI
int rsavrfy (const rsapk* pk, const mpnumber* m, const mpnumber* c)
/*@*/;
* Generates an RSA Keypair for use with the Chinese Remainder Theorem
*/
- register size_t pqsize = (nsize+1) >> 1;
+ register size_t pqsize = (nsize + 1U) >> 1;
register mpw* temp = (mpw*) malloc((16*pqsize+6) * sizeof(*temp));
register int newn = 1;
*/
BEECRYPTAPI
void sha1Process(sha1Param* p)
- /*@modifies p */;
+ /*@modifies p @*/;
/** \ingroup HASH_sha1_m
*/
BEECRYPTAPI /*@unused@*/
int sha1Reset (sha1Param* p)
- /*@modifies p */;
+ /*@modifies p @*/;
/** \ingroup HASH_sha1_m
*/
BEECRYPTAPI /*@unused@*/
int sha1Update (sha1Param* p, const byte* data, size_t size)
- /*@modifies p */;
+ /*@modifies p @*/;
/** \ingroup HASH_sha1_m
*/
BEECRYPTAPI /*@unused@*/
int sha1Digest (sha1Param* p, /*@out@*/ byte* data)
- /*@modifies p, data */;
+ /*@modifies p, data @*/;
#ifdef __cplusplus
}
*/
#include "system.h"
-
#include "beecrypt.h"
#include "blockmode.h"
#include "aes.h"
#include "sha1.h"
#include "sha256.h"
#include "mp.h"
-
#include "debug.h"
-/*@unchecked@*/ /*@observer@*/
+/*@unchecked@*/ /*@observer@*/ /*@unused@*/
static const char* dsa_p = "8df2a494492276aa3d25759bb06869cbeac0d83afb8d0cf7cbb8324f0d7882e5d0762fc5b7210eafc2e9adac32ab7aac49693dfbf83724c2ec0736ee31c80291";
-/*@unchecked@*/ /*@observer@*/
+/*@unchecked@*/ /*@observer@*/ /*@unused@*/
static const char* dsa_q = "c773218c737ec8ee993b4f2ded30f48edace915f";
-/*@unchecked@*/ /*@observer@*/
+/*@unchecked@*/ /*@observer@*/ /*@unused@*/
static const char* dsa_g = "626d027839ea0a13413163a55b4cb500299d5522956cefcb3bff10f399ce2c2e71cb9de5fa24babf58e5b79521925c9cc42e9f6f464b088cc572af53e6d78802";
-/*@unchecked@*/ /*@observer@*/
+/*@unchecked@*/ /*@observer@*/ /*@unused@*/
static const char* dsa_x = "2070b3223dba372fde1c0ffc7b2e3b498b260614";
-/*@unchecked@*/ /*@observer@*/
+/*@unchecked@*/ /*@observer@*/ /*@unused@*/
static const char* dsa_y = "19131871d75b1612a819f29d78d1b0d7346f7aa77bb62a859bfd6c5675da9d212d3a36ef1672ef660b8c7c255cc0ec74858fba33f44c06699630a76b030ee333";
-/*@unchecked@*/ /*@observer@*/
+/*@unchecked@*/ /*@observer@*/ /*@unused@*/
static const char* elg_n = "8df2a494492276aa3d25759bb06869cbeac0d83afb8d0cf7cbb8324f0d7882e5d0762fc5b7210eafc2e9adac32ab7aac49693dfbf83724c2ec0736ee31c80290";
+/*@unused@*/
static int testVectorInvMod(const dlkp_p* keypair)
/*@*/
{
randomGeneratorContext rngc;
+ int rc = -1;
+/*@-branchstate@*/
+ /*@-modobserver -usedef @*/
if (randomGeneratorContextInit(&rngc, randomGeneratorDefault()) == 0)
+ /*@=modobserver =usedef @*/
{
- register int rc;
-
register size_t size = keypair->param.p.size;
register mpw* temp = (mpw*) malloc((8*size+6) * sizeof(*temp));
+ assert(temp != NULL);
mpbrndinv_w(&keypair->param.n, &rngc, temp, temp+size, temp+2*size);
mpbmulmod_w(&keypair->param.n, size, temp, size, temp+size, temp, temp+2*size);
free(temp);
+ /*@-modobserver -usedef @*/
(void) randomGeneratorContextFree(&rngc);
-
- return rc;
+ /*@=modobserver =usedef @*/
}
- return -1;
+/*@=branchstate@*/
+ return rc;
}
+/*@unused@*/
static int testVectorExpMod(const dlkp_p* keypair)
/*@*/
{
return rc;
}
+/*@unused@*/
static int testVectorElGamalV1(const dlkp_p* keypair)
/*@*/
{
randomGeneratorContext rngc;
+/*@-branchstate@*/
+ /*@-modobserver -usedef @*/
if (randomGeneratorContextInit(&rngc, randomGeneratorDefault()) == 0)
+ /*@=modobserver =usedef @*/
{
mpnumber digest, r, s;
mpnzero(&s);
mpnsize(&digest, 5);
+ memset(digest.data, 0, digest.size * sizeof(*digest.data));
(void) rngc.rng->next(rngc.param, digest.data, digest.size);
mpnfree(&r);
mpnfree(&s);
+ /*@-modobserver -usedef @*/
(void) randomGeneratorContextFree(&rngc);
+ /*@=modobserver =usedef @*/
}
+/*@=branchstate@*/
return rc;
}
+/*@unused@*/
static int testVectorElGamalV3(const dlkp_p* keypair)
/*@*/
{
randomGeneratorContext rngc;
+/*@-branchstate@*/
+ /*@-modobserver -usedef @*/
if (randomGeneratorContextInit(&rngc, randomGeneratorDefault()) == 0)
+ /*@=modobserver =usedef @*/
{
mpnumber digest, r, s;
mpnzero(&s);
mpnsize(&digest, 5);
+ memset(digest.data, 0, digest.size * sizeof(*digest.data));
(void) rngc.rng->next(rngc.param, digest.data, digest.size);
mpnfree(&r);
mpnfree(&s);
+ /*@-modobserver -usedef @*/
(void) randomGeneratorContextFree(&rngc);
+ /*@=modobserver =usedef @*/
}
+/*@=branchstate@*/
return rc;
}
};
static void testBlockInit(uint8_t* block, int length)
- /*@modifies block @*/
+ /*@modifies *block @*/
{
register int i;
- for (i = 1; i <= length; i++)
- *(block++) = (uint8_t) i;
+ for (i = 1; i <= length; i++) {
+ *block = (uint8_t) i;
+ block++;
+ }
}
static void testBlockCiphers(void)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
+ /*@globals fileSystem, internalState @*/
+ /*@modifies fileSystem, internalState @*/
{
int i, k;
void* encrypt_param = (void*) malloc(tmp->paramsize);
void* decrypt_param = (void*) malloc(tmp->paramsize);
+ assert(src_block != NULL);
+ assert(enc_block != NULL);
+ assert(dec_block != NULL);
+ assert(spd_block != NULL);
+ assert(encrypt_param != NULL);
+ assert(decrypt_param != NULL);
+
printf(" %s:\n", tmp->name);
for (k = tmp->keybitsmin; k <= tmp->keybitsmax; k += tmp->keybitsinc)
#if HAVE_TIME_H
tstop = clock();
ttime = ((double)(tstop - tstart)) / CLOCKS_PER_SEC;
- printf(" ECB encrypts 1M blocks of %d bits in %.3f seconds (%.3f MB/s)\n", tmp->blocksize << 3, ttime, (tmp->blocksize) / ttime);
+ printf(" ECB encrypts 1M blocks of %u bits in %.3f seconds (%.3f MB/s)\n", tmp->blocksize << 3, ttime, (tmp->blocksize) / ttime);
#endif
#if HAVE_TIME_H
tstart = clock();
#if HAVE_TIME_H
tstop = clock();
ttime = ((double)(tstop - tstart)) / CLOCKS_PER_SEC;
- printf(" ECB decrypts 1M blocks of %d bits in %.3f seconds (%.3f MB/s)\n", tmp->blocksize << 3, ttime, (tmp->blocksize) / ttime);
+ printf(" ECB decrypts 1M blocks of %u bits in %.3f seconds (%.3f MB/s)\n", tmp->blocksize << 3, ttime, (tmp->blocksize) / ttime);
#endif
#if HAVE_TIME_H
tstart = clock();
#if HAVE_TIME_H
tstop = clock();
ttime = ((double)(tstop - tstart)) / CLOCKS_PER_SEC;
- printf(" CBC encrypts 1M blocks of %d bits in %.3f seconds (%.3f MB/s)\n", tmp->blocksize << 3, ttime, (tmp->blocksize) / ttime);
+ printf(" CBC encrypts 1M blocks of %u bits in %.3f seconds (%.3f MB/s)\n", tmp->blocksize << 3, ttime, (tmp->blocksize) / ttime);
#endif
#if HAVE_TIME_H
tstart = clock();
#endif
- (void) blockDecrypt(tmp, decrypt_param, CBC, 1024 * 1024, spd_block, spd_block);
+ (void) blockDecryptCBC(tmp, decrypt_param, 1024 * 1024, spd_block, spd_block);
#if HAVE_TIME_H
tstop = clock();
ttime = ((double)(tstop - tstart)) / CLOCKS_PER_SEC;
- printf(" CBC decrypts 1M blocks of %d bits in %.3f seconds (%.3f MB/s)\n", tmp->blocksize << 3, ttime, (tmp->blocksize) / ttime);
+ printf(" CBC decrypts 1M blocks of %u bits in %.3f seconds (%.3f MB/s)\n", tmp->blocksize << 3, ttime, (tmp->blocksize) / ttime);
#endif
}
}
}
static void testHashFunctions(void)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
+ /*@globals fileSystem, internalState @*/
+ /*@modifies fileSystem, internalState @*/
{
int i, j;
{
const hashFunction* tmp = hashFunctionGet(i);
+/*@-branchstate@*/
if (tmp)
{
#if HAVE_TIME_H
printf(" %s:\n", tmp->name);
+ /*@-modobserver -usedef @*/
if (hashFunctionContextInit(&hfc, tmp) == 0)
+ /*@=modobserver =usedef @*/
{
for (j = 0; j < 4; j++)
{
#endif
}
+ /*@-modobserver -usedef @*/
(void) hashFunctionContextFree(&hfc);
+ /*@=modobserver =usedef @*/
}
mpnfree(&digest);
}
+/*@=branchstate@*/
}
+ free(data);
}
}
static void testExpMods(void)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
+ /*@globals fileSystem, internalState @*/
+ /*@modifies fileSystem, internalState @*/
{
/*@unchecked@*/ /*@observer@*/
static const char* p_512 = "ffcf0a0767f18f9b659d92b9550351430737c3633dc6ae7d52445d937d8336e07a7ccdb119e9ab3e011a8f938151230e91187f84ac05c3220f335193fc5e351b";
mpnzero(&y);
mpnzero(&tmp);
+/*@-branchstate@*/
+ /*@-modobserver -usedef @*/
if (randomGeneratorContextInit(&rngc, randomGeneratorDefault()) == 0)
+ /*@=modobserver =usedef @*/
{
int i;
#if HAVE_TIME_H
mpnfree(&y);
mpnfree(&tmp);
+ /*@-modobserver -usedef @*/
(void) randomGeneratorContextFree(&rngc);
+ /*@=modobserver =usedef @*/
}
else
printf("random generator setup problem\n");
+/*@=branchstate@*/
}
static void testRSA(void)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
+ /*@globals fileSystem, internalState @*/
+ /*@modifies fileSystem, internalState @*/
{
randomGeneratorContext rngc;
mpnumber hm, s;
rsakp kp;
+ int xx;
mpnzero(&hm);
mpnzero(&s);
(void) rsakpInit(&kp);
+/*@-branchstate@*/
+ /*@-modobserver -usedef @*/
if (randomGeneratorContextInit(&rngc, randomGeneratorDefault()) == 0)
+ /*@=modobserver =usedef @*/
{
int i;
#endif
for (i = 0; i < 100; i++)
{
- (void) rsapricrt(&kp, &hm, &s);
+ xx = rsapricrt(&kp, &hm, &s);
}
#if HAVE_TIME_H
tstop = clock();
#endif
for (i = 0; i < 1000; i++)
{
- (void) rsavrfy((rsapk*) &kp, &hm, &s);
+ xx = rsavrfy((rsapk*) &kp, &hm, &s);
}
#if HAVE_TIME_H
tstop = clock();
#endif
(void) rsakpFree(&kp);
+
+ /*@-modobserver -usedef @*/
(void) randomGeneratorContextFree(&rngc);
+ /*@=modobserver =usedef @*/
}
+/*@=branchstate@*/
}
static void testDLAlgorithms(void)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
+ /*@globals fileSystem, internalState @*/
+ /*@modifies fileSystem, internalState @*/
{
randomGeneratorContext rngc;
mpnumber hm, r, s;
dldp_p dp;
dlkp_p kp;
+ int xx;
mpnzero(&hm);
mpnzero(&r);
printf("Timing Discrete Logarithm algorithms:\n");
+/*@-branchstate@*/
+ /*@-modobserver -usedef @*/
if (randomGeneratorContextInit(&rngc, randomGeneratorDefault()) == 0)
+ /*@=modobserver =usedef @*/
{
int i;
#endif
for (i = 0; i < 100; i++)
{
- (void) dsasign(&kp.param.p, &kp.param.q, &kp.param.g, &rngc, &hm, &kp.x, &r, &s);
+ xx = dsasign(&kp.param.p, &kp.param.q, &kp.param.g, &rngc, &hm, &kp.x, &r, &s);
}
- #if HAVE_TIME_H
- tstop = clock();
- ttime = ((double)(tstop - tstart)) / CLOCKS_PER_SEC;
- printf(" 100x in %.3f seconds\n", ttime);
- #endif
+ #if HAVE_TIME_H
+ tstop = clock();
+ ttime = ((double)(tstop - tstart)) / CLOCKS_PER_SEC;
+ printf(" 100x in %.3f seconds\n", ttime);
+ #endif
printf(" DSA verify:");
#if HAVE_TIME_H
#endif
for (i = 0; i < 100; i++)
{
- (void) dsavrfy(&kp.param.p, &kp.param.q, &kp.param.g, &hm, &kp.y, &r, &s);
+ xx = dsavrfy(&kp.param.p, &kp.param.q, &kp.param.g, &hm, &kp.y, &r, &s);
}
#if HAVE_TIME_H
tstop = clock();
#if HAVE_TIME_H
tstart = clock();
#endif
+/*@-usereleased@*/
(void) dldp_pgonMake(&dp, &rngc, 1024 >> 5, 768 >> 5);
+/*@=usereleased@*/
#if HAVE_TIME_H
tstop = clock();
ttime = ((double)(tstop - tstart)) / CLOCKS_PER_SEC;
printf(" done in %.3f seconds\n", ttime);
#endif
+/*@-usedef@*/
(void) dldp_pFree(&dp);
+/*@=usedef@*/
+ /*@-modobserver -usedef @*/
(void) randomGeneratorContextFree(&rngc);
+ /*@=modobserver =usedef @*/
}
+/*@=branchstate@*/
}
int main(/*@unused@*/ int argc, /*@unused@*/ char *argv[])
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
+ /*@globals fileSystem, internalState @*/
+ /*@modifies fileSystem, internalState @*/
{
int i, j;
typedef uint64_t mpdw;
# endif
typedef uint32_t mpw;
+/*@-typeuse@*/
typedef uint16_t mphw;
+/*@=typeuse@*/
#else
# error
#endif