disable ltc_rng by default
This commit is contained in:
parent
fcae7e2c49
commit
cd08a8cec3
@ -304,6 +304,9 @@
|
|||||||
/* rng_make_prng() */
|
/* rng_make_prng() */
|
||||||
#define LTC_RNG_MAKE_PRNG
|
#define LTC_RNG_MAKE_PRNG
|
||||||
|
|
||||||
|
/* enable the ltc_rng hook to integrate e.g. embedded hardware RNG's easily */
|
||||||
|
/* #define LTC_PRNG_ENABLE_LTC_RNG */
|
||||||
|
|
||||||
#endif /* LTC_NO_PRNGS */
|
#endif /* LTC_NO_PRNGS */
|
||||||
|
|
||||||
#ifdef LTC_YARROW
|
#ifdef LTC_YARROW
|
||||||
|
@ -193,8 +193,10 @@ unsigned long rng_get_bytes(unsigned char *out,
|
|||||||
|
|
||||||
int rng_make_prng(int bits, int wprng, prng_state *prng, void (*callback)(void));
|
int rng_make_prng(int bits, int wprng, prng_state *prng, void (*callback)(void));
|
||||||
|
|
||||||
|
#ifdef LTC_PRNG_ENABLE_LTC_RNG
|
||||||
extern unsigned long (*ltc_rng)(unsigned char *out, unsigned long outlen,
|
extern unsigned long (*ltc_rng)(unsigned char *out, unsigned long outlen,
|
||||||
void (*callback)(void));
|
void (*callback)(void));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* $Source$ */
|
/* $Source$ */
|
||||||
|
@ -371,6 +371,9 @@ const char *crypt_build_settings =
|
|||||||
#if defined(LTC_RNG_MAKE_PRNG)
|
#if defined(LTC_RNG_MAKE_PRNG)
|
||||||
" LTC_RNG_MAKE_PRNG "
|
" LTC_RNG_MAKE_PRNG "
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(LTC_PRNG_ENABLE_LTC_RNG)
|
||||||
|
" LTC_PRNG_ENABLE_LTC_RNG "
|
||||||
|
#endif
|
||||||
#if defined(LTC_HASH_HELPERS)
|
#if defined(LTC_HASH_HELPERS)
|
||||||
" LTC_HASH_HELPERS "
|
" LTC_HASH_HELPERS "
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,4 +10,6 @@
|
|||||||
*/
|
*/
|
||||||
#include "tomcrypt.h"
|
#include "tomcrypt.h"
|
||||||
|
|
||||||
|
#ifdef LTC_PRNG_ENABLE_LTC_RNG
|
||||||
unsigned long (*ltc_rng)(unsigned char *out, unsigned long outlen, void (*callback)(void));
|
unsigned long (*ltc_rng)(unsigned char *out, unsigned long outlen, void (*callback)(void));
|
||||||
|
#endif
|
||||||
|
@ -135,12 +135,14 @@ unsigned long rng_get_bytes(unsigned char *out, unsigned long outlen,
|
|||||||
|
|
||||||
LTC_ARGCHK(out != NULL);
|
LTC_ARGCHK(out != NULL);
|
||||||
|
|
||||||
|
#ifdef LTC_PRNG_ENABLE_LTC_RNG
|
||||||
if (ltc_rng) {
|
if (ltc_rng) {
|
||||||
x = ltc_rng(out, outlen, callback);
|
x = ltc_rng(out, outlen, callback);
|
||||||
if (x != 0) {
|
if (x != 0) {
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(_WIN32_WCE)
|
#if defined(_WIN32) || defined(_WIN32_WCE)
|
||||||
x = rng_win32(out, outlen, callback); if (x != 0) { return x; }
|
x = rng_win32(out, outlen, callback); if (x != 0) { return x; }
|
||||||
|
@ -302,6 +302,8 @@ static void _unregister_all(void)
|
|||||||
#endif
|
#endif
|
||||||
} /* _cleanup() */
|
} /* _cleanup() */
|
||||||
|
|
||||||
|
#ifdef LTC_PRNG_ENABLE_LTC_RNG
|
||||||
|
|
||||||
static unsigned long my_test_rng_read;
|
static unsigned long my_test_rng_read;
|
||||||
|
|
||||||
static unsigned long my_test_rng(unsigned char *buf, unsigned long len,
|
static unsigned long my_test_rng(unsigned char *buf, unsigned long len,
|
||||||
@ -316,6 +318,8 @@ static unsigned long my_test_rng(unsigned char *buf, unsigned long len,
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
void reg_algs(void)
|
void reg_algs(void)
|
||||||
{
|
{
|
||||||
unsigned long before;
|
unsigned long before;
|
||||||
@ -456,6 +460,7 @@ register_prng(&rc4_desc);
|
|||||||
register_prng(&sober128_desc);
|
register_prng(&sober128_desc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef LTC_PRNG_ENABLE_LTC_RNG
|
||||||
ltc_rng = my_test_rng;
|
ltc_rng = my_test_rng;
|
||||||
|
|
||||||
before = my_test_rng_read;
|
before = my_test_rng_read;
|
||||||
@ -470,6 +475,7 @@ register_prng(&sober128_desc);
|
|||||||
}
|
}
|
||||||
|
|
||||||
ltc_rng = NULL;
|
ltc_rng = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
if ((err = rng_make_prng(128, find_prng("yarrow"), &yarrow_prng, NULL)) != CRYPT_OK) {
|
if ((err = rng_make_prng(128, find_prng("yarrow"), &yarrow_prng, NULL)) != CRYPT_OK) {
|
||||||
fprintf(stderr, "rng_make_prng failed: %s\n", error_to_string(err));
|
fprintf(stderr, "rng_make_prng failed: %s\n", error_to_string(err));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user