Skip to content

Commit

Permalink
remove start() from prng state
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaeckel committed Oct 21, 2019
1 parent d428083 commit 0050955
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 17 deletions.
2 changes: 1 addition & 1 deletion demos/timing.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ static void time_prng(void)
#undef DO2
#undef DO1

#define DO1 tprng.desc.start(&tprng); tprng.desc.add_entropy(buf, 32, &tprng); tprng.desc.ready(&tprng); tprng.desc.done(&tprng);
#define DO1 prng_start[x](&tprng); tprng.desc.add_entropy(buf, 32, &tprng); tprng.desc.ready(&tprng); tprng.desc.done(&tprng);
#define DO2 DO1 DO1
for (y = 0; y < 10000; y++) {
t_start();
Expand Down
5 changes: 0 additions & 5 deletions src/headers/tomcrypt_prng.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ struct ltc_prng_descriptor {
const char *name;
/** size in bytes of exported state */
int export_size;
/** Start a PRNG state
@param prng [out] The state to initialize
@return CRYPT_OK if successful
*/
int (*start)(prng_state *prng);
/** Add entropy to the PRNG
@param in The entropy
@param inlen Length of the entropy (octets)\
Expand Down
1 change: 0 additions & 1 deletion src/prngs/chacha20.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ static const struct ltc_prng_descriptor chacha20_prng_desc =
{
"chacha20",
40,
&chacha20_prng_start,
&chacha20_prng_add_entropy,
&chacha20_prng_ready,
&chacha20_prng_read,
Expand Down
1 change: 0 additions & 1 deletion src/prngs/fortuna.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ we reseed automatically when len(pool0) >= 64 or every LTC_FORTUNA_WD calls to t
static const struct ltc_prng_descriptor fortuna_desc = {
"fortuna",
64,
&fortuna_start,
&fortuna_add_entropy,
&fortuna_ready,
&fortuna_read,
Expand Down
1 change: 0 additions & 1 deletion src/prngs/rc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ static const struct ltc_prng_descriptor rc4_desc =
{
"rc4",
32,
&rc4_start,
&rc4_add_entropy,
&rc4_ready,
&rc4_read,
Expand Down
4 changes: 0 additions & 4 deletions src/prngs/rng_make_prng.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ int rng_make_prng(int bits, prng_state *prng,
import_entropy = prng->desc.add_entropy;
}

if ((err = prng->desc.start(prng)) != CRYPT_OK) {
return err;
}

buf = XMALLOC(bytes);
if (buf == NULL) {
return CRYPT_MEM;
Expand Down
1 change: 0 additions & 1 deletion src/prngs/sober128.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ static const struct ltc_prng_descriptor sober128_desc =
{
"sober128",
40,
&sober128_start,
&sober128_add_entropy,
&sober128_ready,
&sober128_read,
Expand Down
1 change: 0 additions & 1 deletion src/prngs/sprng.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
static const struct ltc_prng_descriptor sprng_desc =
{
"sprng", 0,
&sprng_start,
&sprng_add_entropy,
&sprng_ready,
&sprng_read,
Expand Down
1 change: 0 additions & 1 deletion src/prngs/yarrow.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
static const struct ltc_prng_descriptor yarrow_desc =
{
"yarrow", 64,
&yarrow_start,
&yarrow_add_entropy,
&yarrow_ready,
&yarrow_read,
Expand Down
2 changes: 1 addition & 1 deletion tests/no_prng.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ static int no_prng_test(void)
static const struct ltc_prng_descriptor no_prng_desc =
{
NULL, 0,
&no_prng_start,
&no_prng_add_entropy,
&no_prng_ready,
&no_prng_read,
Expand All @@ -172,6 +171,7 @@ prng_state* no_prng_desc_get(void)
return NULL;
}
no_prng->state.desc.name = no_prng->name;
no_prng_start(&no_prng->state);
return &no_prng->state;
}

Expand Down

0 comments on commit 0050955

Please sign in to comment.