verify outcome when defining LTC_NOTHING
check that LTC_NOTHING really creates nothing but the libraries' basic API functions
This commit is contained in:
parent
90e968a202
commit
dfa938a4f6
@ -10,6 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "tomcrypt.h"
|
#include "tomcrypt.h"
|
||||||
|
|
||||||
|
#ifdef LTC_HASH_HELPERS
|
||||||
/**
|
/**
|
||||||
@file hash_memory.c
|
@file hash_memory.c
|
||||||
Hash memory helper, Tom St Denis
|
Hash memory helper, Tom St Denis
|
||||||
@ -63,6 +64,7 @@ LBL_ERR:
|
|||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
#endif /* #ifdef LTC_HASH_HELPERS */
|
||||||
|
|
||||||
/* $Source$ */
|
/* $Source$ */
|
||||||
/* $Revision$ */
|
/* $Revision$ */
|
||||||
|
@ -10,13 +10,15 @@
|
|||||||
*/
|
*/
|
||||||
#include "tomcrypt.h"
|
#include "tomcrypt.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#ifdef LTC_HASH_HELPERS
|
||||||
/**
|
/**
|
||||||
@file hash_memory_multi.c
|
@file hash_memory_multi.c
|
||||||
Hash (multiple buffers) memory helper, Tom St Denis
|
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 hash The index of the hash you wish to use
|
||||||
@param out [out] Where to store the digest
|
@param out [out] Where to store the digest
|
||||||
@param outlen [in/out] Max size and resulting size of 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 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)
|
@param ... tuples of (data,len) pairs to hash, terminated with a (NULL,x) (x=don't care)
|
||||||
@return CRYPT_OK if successful
|
@return CRYPT_OK if successful
|
||||||
*/
|
*/
|
||||||
int hash_memory_multi(int hash, unsigned char *out, unsigned long *outlen,
|
int hash_memory_multi(int hash, unsigned char *out, unsigned long *outlen,
|
||||||
const unsigned char *in, unsigned long inlen, ...)
|
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);
|
va_start(args, inlen);
|
||||||
curptr = in;
|
curptr = in;
|
||||||
curlen = inlen;
|
curlen = inlen;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
/* process buf */
|
/* process buf */
|
||||||
@ -81,6 +83,7 @@ LBL_ERR:
|
|||||||
va_end(args);
|
va_end(args);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
#endif /* #ifdef LTC_HASH_HELPERS */
|
||||||
|
|
||||||
/* $Source$ */
|
/* $Source$ */
|
||||||
/* $Revision$ */
|
/* $Revision$ */
|
||||||
|
@ -77,6 +77,7 @@
|
|||||||
#define LTC_NO_PK
|
#define LTC_NO_PK
|
||||||
#define LTC_NO_PKCS
|
#define LTC_NO_PKCS
|
||||||
#define LTC_NO_MISC
|
#define LTC_NO_MISC
|
||||||
|
#define LTC_NO_FILE
|
||||||
#endif /* LTC_NOTHING */
|
#endif /* LTC_NOTHING */
|
||||||
|
|
||||||
/* Easy button? */
|
/* Easy button? */
|
||||||
@ -98,6 +99,7 @@
|
|||||||
#define LTC_SHA384
|
#define LTC_SHA384
|
||||||
#define LTC_SHA256
|
#define LTC_SHA256
|
||||||
#define LTC_SHA224
|
#define LTC_SHA224
|
||||||
|
#define LTC_HASH_HELPERS
|
||||||
|
|
||||||
#define LTC_NO_MACS
|
#define LTC_NO_MACS
|
||||||
#define LTC_HMAC
|
#define LTC_HMAC
|
||||||
@ -109,6 +111,8 @@
|
|||||||
#define LTC_YARROW
|
#define LTC_YARROW
|
||||||
#define LTC_DEVRANDOM
|
#define LTC_DEVRANDOM
|
||||||
#define LTC_TRY_URANDOM_FIRST
|
#define LTC_TRY_URANDOM_FIRST
|
||||||
|
#define LTC_RNG_GET_BYTES
|
||||||
|
#define LTC_RNG_MAKE_PRNG
|
||||||
|
|
||||||
#define LTC_NO_PK
|
#define LTC_NO_PK
|
||||||
#define LTC_MRSA
|
#define LTC_MRSA
|
||||||
@ -241,6 +245,8 @@
|
|||||||
#define LTC_RIPEMD256
|
#define LTC_RIPEMD256
|
||||||
#define LTC_RIPEMD320
|
#define LTC_RIPEMD320
|
||||||
|
|
||||||
|
#define LTC_HASH_HELPERS
|
||||||
|
|
||||||
#endif /* LTC_NO_HASHES */
|
#endif /* LTC_NO_HASHES */
|
||||||
|
|
||||||
/* ---> MAC functions <--- */
|
/* ---> MAC functions <--- */
|
||||||
@ -307,6 +313,10 @@
|
|||||||
#define LTC_DEVRANDOM
|
#define LTC_DEVRANDOM
|
||||||
/* try /dev/urandom before trying /dev/random */
|
/* try /dev/urandom before trying /dev/random */
|
||||||
#define LTC_TRY_URANDOM_FIRST
|
#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 */
|
#endif /* LTC_NO_PRNGS */
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "tomcrypt.h"
|
#include "tomcrypt.h"
|
||||||
|
|
||||||
|
#ifdef LTC_MDSA
|
||||||
/**
|
/**
|
||||||
Generate a random number N with given bitlength (note: MSB can be 0)
|
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;
|
return CRYPT_OK;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "tomcrypt.h"
|
#include "tomcrypt.h"
|
||||||
|
|
||||||
|
#ifdef LTC_DER
|
||||||
static const oid_st rsa_oid = {
|
static const oid_st rsa_oid = {
|
||||||
{ 1, 2, 840, 113549, 1, 1, 1 },
|
{ 1, 2, 840, 113549, 1, 1, 1 },
|
||||||
7,
|
7,
|
||||||
@ -37,3 +38,4 @@ int pk_get_oid(int pk, oid_st *st)
|
|||||||
}
|
}
|
||||||
return CRYPT_OK;
|
return CRYPT_OK;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "tomcrypt.h"
|
#include "tomcrypt.h"
|
||||||
|
|
||||||
|
#ifdef LTC_RNG_GET_BYTES
|
||||||
/**
|
/**
|
||||||
@file rng_get_bytes.c
|
@file rng_get_bytes.c
|
||||||
portable way to get secure random bits to feed a PRNG (Tom St Denis)
|
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
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif /* #ifdef LTC_RNG_GET_BYTES */
|
||||||
|
|
||||||
/* $Source$ */
|
/* $Source$ */
|
||||||
/* $Revision$ */
|
/* $Revision$ */
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
*/
|
*/
|
||||||
#include "tomcrypt.h"
|
#include "tomcrypt.h"
|
||||||
|
|
||||||
/**
|
#ifdef LTC_RNG_MAKE_PRNG
|
||||||
|
/**
|
||||||
@file rng_make_prng.c
|
@file rng_make_prng.c
|
||||||
portable way to get secure random bits to feed a PRNG (Tom St Denis)
|
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 prng [out] PRNG state to initialize
|
||||||
@param callback A pointer to a void function for when the RNG is slow, this can be NULL
|
@param callback A pointer to a void function for when the RNG is slow, this can be NULL
|
||||||
@return CRYPT_OK if successful
|
@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))
|
void (*callback)(void))
|
||||||
{
|
{
|
||||||
unsigned char buf[256];
|
unsigned char buf[256];
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
LTC_ARGCHK(prng != NULL);
|
LTC_ARGCHK(prng != NULL);
|
||||||
|
|
||||||
/* check parameter */
|
/* check parameter */
|
||||||
@ -62,6 +63,7 @@ int rng_make_prng(int bits, int wprng, prng_state *prng,
|
|||||||
#endif
|
#endif
|
||||||
return CRYPT_OK;
|
return CRYPT_OK;
|
||||||
}
|
}
|
||||||
|
#endif /* #ifdef LTC_RNG_MAKE_PRNG */
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
/* $Source$ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user