LTC_CHACHA vs. LTC_CHACHA20_PRNG
This commit is contained in:
parent
2656a040e0
commit
ff5b02d371
@ -294,6 +294,9 @@
|
|||||||
/* The LTC_RC4 stream cipher */
|
/* The LTC_RC4 stream cipher */
|
||||||
#define LTC_RC4
|
#define LTC_RC4
|
||||||
|
|
||||||
|
/* The ChaCha20 stream cipher based PRNG */
|
||||||
|
#define LTC_CHACHA20_PRNG
|
||||||
|
|
||||||
/* Fortuna PRNG */
|
/* Fortuna PRNG */
|
||||||
#define LTC_FORTUNA
|
#define LTC_FORTUNA
|
||||||
|
|
||||||
@ -512,6 +515,10 @@
|
|||||||
#error LTC_CHACHA20POLY1305_MODE requires LTC_CHACHA + LTC_POLY1305
|
#error LTC_CHACHA20POLY1305_MODE requires LTC_CHACHA + LTC_POLY1305
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(LTC_CHACHA20_PRNG) && !defined(LTC_CHACHA)
|
||||||
|
#error LTC_CHACHA20_PRNG requires LTC_CHACHA
|
||||||
|
#endif
|
||||||
|
|
||||||
/* THREAD management */
|
/* THREAD management */
|
||||||
#ifdef LTC_PTHREAD
|
#ifdef LTC_PTHREAD
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ struct rc4_prng {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LTC_CHACHA
|
#ifdef LTC_CHACHA20_PRNG
|
||||||
struct chacha20_prng {
|
struct chacha20_prng {
|
||||||
chacha_state s; /* chacha state */
|
chacha_state s; /* chacha state */
|
||||||
unsigned char ent[40]; /* entropy buffer */
|
unsigned char ent[40]; /* entropy buffer */
|
||||||
@ -64,7 +64,7 @@ typedef union Prng_state {
|
|||||||
#ifdef LTC_RC4
|
#ifdef LTC_RC4
|
||||||
struct rc4_prng rc4;
|
struct rc4_prng rc4;
|
||||||
#endif
|
#endif
|
||||||
#ifdef LTC_CHACHA
|
#ifdef LTC_CHACHA20_PRNG
|
||||||
struct chacha20_prng chacha;
|
struct chacha20_prng chacha;
|
||||||
#endif
|
#endif
|
||||||
#ifdef LTC_FORTUNA
|
#ifdef LTC_FORTUNA
|
||||||
@ -166,7 +166,7 @@ int rc4_test(void);
|
|||||||
extern const struct ltc_prng_descriptor rc4_desc;
|
extern const struct ltc_prng_descriptor rc4_desc;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LTC_CHACHA
|
#ifdef LTC_CHACHA20_PRNG
|
||||||
int chacha_prng_start(prng_state *prng);
|
int chacha_prng_start(prng_state *prng);
|
||||||
int chacha_prng_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng);
|
int chacha_prng_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng);
|
||||||
int chacha_prng_ready(prng_state *prng);
|
int chacha_prng_ready(prng_state *prng);
|
||||||
|
@ -274,6 +274,9 @@ const char *crypt_build_settings =
|
|||||||
#if defined(LTC_RC4)
|
#if defined(LTC_RC4)
|
||||||
" RC4\n"
|
" RC4\n"
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(LTC_CHACHA20_PRNG)
|
||||||
|
" ChaCha20\n"
|
||||||
|
#endif
|
||||||
#if defined(LTC_FORTUNA)
|
#if defined(LTC_FORTUNA)
|
||||||
" Fortuna (" NAME_VALUE(LTC_FORTUNA_POOLS) ", " NAME_VALUE(LTC_FORTUNA_WD) ")\n"
|
" Fortuna (" NAME_VALUE(LTC_FORTUNA_POOLS) ", " NAME_VALUE(LTC_FORTUNA_WD) ")\n"
|
||||||
#endif
|
#endif
|
||||||
|
@ -223,7 +223,7 @@ static const crypt_size _crypt_sizes[] = {
|
|||||||
#ifdef LTC_FORTUNA
|
#ifdef LTC_FORTUNA
|
||||||
_SZ_STRINGIFY_S(fortuna_prng),
|
_SZ_STRINGIFY_S(fortuna_prng),
|
||||||
#endif
|
#endif
|
||||||
#ifdef LTC_CHACHA
|
#ifdef LTC_CHACHA20_PRNG
|
||||||
_SZ_STRINGIFY_S(chacha20_prng),
|
_SZ_STRINGIFY_S(chacha20_prng),
|
||||||
#endif
|
#endif
|
||||||
#ifdef LTC_RC4
|
#ifdef LTC_RC4
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include "tomcrypt.h"
|
#include "tomcrypt.h"
|
||||||
|
|
||||||
#ifdef LTC_CHACHA
|
#ifdef LTC_CHACHA20_PRNG
|
||||||
|
|
||||||
const struct ltc_prng_descriptor chacha_prng_desc =
|
const struct ltc_prng_descriptor chacha_prng_desc =
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user