verify outcome when defining LTC_NOTHING

check that LTC_NOTHING really creates nothing but the libraries' basic
API functions
This commit is contained in:
Steffen Jaeckel 2015-02-15 17:25:45 +01:00
parent 90e968a202
commit dfa938a4f6
7 changed files with 30 additions and 7 deletions

View File

@ -10,6 +10,7 @@
*/
#include "tomcrypt.h"
#ifdef LTC_HASH_HELPERS
/**
@file hash_memory.c
Hash memory helper, Tom St Denis
@ -63,6 +64,7 @@ LBL_ERR:
return err;
}
#endif /* #ifdef LTC_HASH_HELPERS */
/* $Source$ */
/* $Revision$ */

View File

@ -10,13 +10,15 @@
*/
#include "tomcrypt.h"
#include <stdarg.h>
#ifdef LTC_HASH_HELPERS
/**
@file hash_memory_multi.c
Hash (multiple buffers) memory helper, Tom St Denis
*/
/**
Hash multiple (non-adjacent) blocks of memory at once.
Hash multiple (non-adjacent) blocks of memory at once.
@param hash The index of the hash you wish to use
@param out [out] Where to store the digest
@param outlen [in/out] Max size and resulting size of the digest
@ -24,7 +26,7 @@
@param inlen The length of the data to hash (octets)
@param ... tuples of (data,len) pairs to hash, terminated with a (NULL,x) (x=don't care)
@return CRYPT_OK if successful
*/
*/
int hash_memory_multi(int hash, unsigned char *out, unsigned long *outlen,
const unsigned char *in, unsigned long inlen, ...)
{
@ -57,7 +59,7 @@ int hash_memory_multi(int hash, unsigned char *out, unsigned long *outlen,
}
va_start(args, inlen);
curptr = in;
curptr = in;
curlen = inlen;
for (;;) {
/* process buf */
@ -81,6 +83,7 @@ LBL_ERR:
va_end(args);
return err;
}
#endif /* #ifdef LTC_HASH_HELPERS */
/* $Source$ */
/* $Revision$ */

View File

@ -77,6 +77,7 @@
#define LTC_NO_PK
#define LTC_NO_PKCS
#define LTC_NO_MISC
#define LTC_NO_FILE
#endif /* LTC_NOTHING */
/* Easy button? */
@ -98,6 +99,7 @@
#define LTC_SHA384
#define LTC_SHA256
#define LTC_SHA224
#define LTC_HASH_HELPERS
#define LTC_NO_MACS
#define LTC_HMAC
@ -109,6 +111,8 @@
#define LTC_YARROW
#define LTC_DEVRANDOM
#define LTC_TRY_URANDOM_FIRST
#define LTC_RNG_GET_BYTES
#define LTC_RNG_MAKE_PRNG
#define LTC_NO_PK
#define LTC_MRSA
@ -241,6 +245,8 @@
#define LTC_RIPEMD256
#define LTC_RIPEMD320
#define LTC_HASH_HELPERS
#endif /* LTC_NO_HASHES */
/* ---> MAC functions <--- */
@ -307,6 +313,10 @@
#define LTC_DEVRANDOM
/* try /dev/urandom before trying /dev/random */
#define LTC_TRY_URANDOM_FIRST
/* rng_get_bytes() */
#define LTC_RNG_GET_BYTES
/* rng_make_prng() */
#define LTC_RNG_MAKE_PRNG
#endif /* LTC_NO_PRNGS */

View File

@ -9,6 +9,7 @@
*/
#include "tomcrypt.h"
#ifdef LTC_MDSA
/**
Generate a random number N with given bitlength (note: MSB can be 0)
*/
@ -67,3 +68,4 @@ int rand_bn_range(void *N, void *limit, prng_state *prng, int wprng)
return CRYPT_OK;
}
#endif

View File

@ -9,6 +9,7 @@
*/
#include "tomcrypt.h"
#ifdef LTC_DER
static const oid_st rsa_oid = {
{ 1, 2, 840, 113549, 1, 1, 1 },
7,
@ -37,3 +38,4 @@ int pk_get_oid(int pk, oid_st *st)
}
return CRYPT_OK;
}
#endif

View File

@ -10,6 +10,7 @@
*/
#include "tomcrypt.h"
#ifdef LTC_RNG_GET_BYTES
/**
@file rng_get_bytes.c
portable way to get secure random bits to feed a PRNG (Tom St Denis)
@ -150,6 +151,7 @@ unsigned long rng_get_bytes(unsigned char *out, unsigned long outlen,
#endif
return 0;
}
#endif /* #ifdef LTC_RNG_GET_BYTES */
/* $Source$ */
/* $Revision$ */

View File

@ -10,7 +10,8 @@
*/
#include "tomcrypt.h"
/**
#ifdef LTC_RNG_MAKE_PRNG
/**
@file rng_make_prng.c
portable way to get secure random bits to feed a PRNG (Tom St Denis)
*/
@ -22,13 +23,13 @@
@param prng [out] PRNG state to initialize
@param callback A pointer to a void function for when the RNG is slow, this can be NULL
@return CRYPT_OK if successful
*/
int rng_make_prng(int bits, int wprng, prng_state *prng,
*/
int rng_make_prng(int bits, int wprng, prng_state *prng,
void (*callback)(void))
{
unsigned char buf[256];
int err;
LTC_ARGCHK(prng != NULL);
/* check parameter */
@ -62,6 +63,7 @@ int rng_make_prng(int bits, int wprng, prng_state *prng,
#endif
return CRYPT_OK;
}
#endif /* #ifdef LTC_RNG_MAKE_PRNG */
/* $Source$ */