Skip to content

Commit 58ea18e

Browse files
committed
remove start() from prng state
1 parent d032c5c commit 58ea18e

File tree

10 files changed

+2
-17
lines changed

10 files changed

+2
-17
lines changed

demos/timing.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ static void time_prng(void)
647647
#undef DO2
648648
#undef DO1
649649

650-
#define DO1 tprng.desc.start(&tprng); tprng.desc.add_entropy(buf, 32, &tprng); tprng.desc.ready(&tprng); tprng.desc.done(&tprng);
650+
#define DO1 prng_start[x](&tprng); tprng.desc.add_entropy(buf, 32, &tprng); tprng.desc.ready(&tprng); tprng.desc.done(&tprng);
651651
#define DO2 DO1 DO1
652652
for (y = 0; y < 10000; y++) {
653653
t_start();

src/headers/tomcrypt_prng.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ struct ltc_prng_descriptor {
5656
const char *name;
5757
/** size in bytes of exported state */
5858
int export_size;
59-
/** Start a PRNG state
60-
@param prng [out] The state to initialize
61-
@return CRYPT_OK if successful
62-
*/
63-
int (*start)(prng_state *prng);
6459
/** Add entropy to the PRNG
6560
@param in The entropy
6661
@param inlen Length of the entropy (octets)\

src/prngs/chacha20.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ static const struct ltc_prng_descriptor chacha20_prng_desc =
1313
{
1414
"chacha20",
1515
40,
16-
&chacha20_prng_start,
1716
&chacha20_prng_add_entropy,
1817
&chacha20_prng_ready,
1918
&chacha20_prng_read,

src/prngs/fortuna.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ we reseed automatically when len(pool0) >= 64 or every LTC_FORTUNA_WD calls to t
5454
static const struct ltc_prng_descriptor fortuna_desc = {
5555
"fortuna",
5656
64,
57-
&fortuna_start,
5857
&fortuna_add_entropy,
5958
&fortuna_ready,
6059
&fortuna_read,

src/prngs/rc4.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ static const struct ltc_prng_descriptor rc4_desc =
1313
{
1414
"rc4",
1515
32,
16-
&rc4_start,
1716
&rc4_add_entropy,
1817
&rc4_ready,
1918
&rc4_read,

src/prngs/rng_make_prng.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ int rng_make_prng(int bits, prng_state *prng,
4040
import_entropy = prng->desc.add_entropy;
4141
}
4242

43-
if ((err = prng->desc.start(prng)) != CRYPT_OK) {
44-
return err;
45-
}
46-
4743
buf = XMALLOC(bytes);
4844
if (buf == NULL) {
4945
return CRYPT_MEM;

src/prngs/sober128.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ static const struct ltc_prng_descriptor sober128_desc =
1515
{
1616
"sober128",
1717
40,
18-
&sober128_start,
1918
&sober128_add_entropy,
2019
&sober128_ready,
2120
&sober128_read,

src/prngs/sprng.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
static const struct ltc_prng_descriptor sprng_desc =
1818
{
1919
"sprng", 0,
20-
&sprng_start,
2120
&sprng_add_entropy,
2221
&sprng_ready,
2322
&sprng_read,

src/prngs/yarrow.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
static const struct ltc_prng_descriptor yarrow_desc =
1313
{
1414
"yarrow", 64,
15-
&yarrow_start,
1615
&yarrow_add_entropy,
1716
&yarrow_ready,
1817
&yarrow_read,

tests/no_prng.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ static int no_prng_test(void)
144144
static const struct ltc_prng_descriptor no_prng_desc =
145145
{
146146
NULL, 0,
147-
&no_prng_start,
148147
&no_prng_add_entropy,
149148
&no_prng_ready,
150149
&no_prng_read,
@@ -166,6 +165,7 @@ prng_state* no_prng_desc_get(void)
166165
return NULL;
167166
}
168167
no_prng->state.desc.name = no_prng->name;
168+
no_prng_start(&no_prng->state);
169169
return &no_prng->state;
170170
}
171171

0 commit comments

Comments
 (0)