Skip to content

Commit 990d623

Browse files
committed
remove start() from prng state
1 parent c176083 commit 990d623

File tree

10 files changed

+2
-17
lines changed

10 files changed

+2
-17
lines changed

demos/timing.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ static void time_prng(void)
649649
#undef DO2
650650
#undef DO1
651651

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

src/headers/tomcrypt_prng.h

-5
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@ struct ltc_prng_descriptor {
6262
const char *name;
6363
/** size in bytes of exported state */
6464
int export_size;
65-
/** Start a PRNG state
66-
@param prng [out] The state to initialize
67-
@return CRYPT_OK if successful
68-
*/
69-
int (*start)(prng_state *prng);
7065
/** Add entropy to the PRNG
7166
@param in The entropy
7267
@param inlen Length of the entropy (octets)\

src/prngs/chacha20.c

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ static const struct ltc_prng_descriptor chacha20_prng_desc =
1919
{
2020
"chacha20",
2121
40,
22-
&chacha20_prng_start,
2322
&chacha20_prng_add_entropy,
2423
&chacha20_prng_ready,
2524
&chacha20_prng_read,

src/prngs/fortuna.c

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ we reseed automatically when len(pool0) >= 64 or every LTC_FORTUNA_WD calls to t
4848
static const struct ltc_prng_descriptor fortuna_desc = {
4949
"fortuna",
5050
64,
51-
&fortuna_start,
5251
&fortuna_add_entropy,
5352
&fortuna_ready,
5453
&fortuna_read,

src/prngs/rc4.c

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ static const struct ltc_prng_descriptor rc4_desc =
1919
{
2020
"rc4",
2121
32,
22-
&rc4_start,
2322
&rc4_add_entropy,
2423
&rc4_ready,
2524
&rc4_read,

src/prngs/rng_make_prng.c

-4
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ int rng_make_prng(int bits, prng_state *prng,
4646
import_entropy = prng->desc.add_entropy;
4747
}
4848

49-
if ((err = prng->desc.start(prng)) != CRYPT_OK) {
50-
return err;
51-
}
52-
5349
buf = XMALLOC(bytes);
5450
if (buf == NULL) {
5551
return CRYPT_MEM;

src/prngs/sober128.c

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ static const struct ltc_prng_descriptor sober128_desc =
2121
{
2222
"sober128",
2323
40,
24-
&sober128_start,
2524
&sober128_add_entropy,
2625
&sober128_ready,
2726
&sober128_read,

src/prngs/sprng.c

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
static const struct ltc_prng_descriptor sprng_desc =
2424
{
2525
"sprng", 0,
26-
&sprng_start,
2726
&sprng_add_entropy,
2827
&sprng_ready,
2928
&sprng_read,

src/prngs/yarrow.c

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
static const struct ltc_prng_descriptor yarrow_desc =
1919
{
2020
"yarrow", 64,
21-
&yarrow_start,
2221
&yarrow_add_entropy,
2322
&yarrow_ready,
2423
&yarrow_read,

tests/no_prng.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ static int no_prng_test(void)
150150
static const struct ltc_prng_descriptor no_prng_desc =
151151
{
152152
NULL, 0,
153-
&no_prng_start,
154153
&no_prng_add_entropy,
155154
&no_prng_ready,
156155
&no_prng_read,
@@ -172,6 +171,7 @@ prng_state* no_prng_desc_get(void)
172171
return NULL;
173172
}
174173
no_prng->state.desc.name = no_prng->name;
174+
no_prng_start(&no_prng->state);
175175
return &no_prng->state;
176176
}
177177

0 commit comments

Comments
 (0)