@@ -54,31 +54,10 @@ struct sober128_prng {
54
54
};
55
55
#endif
56
56
57
- typedef struct {
58
- union {
59
- char dummy [1 ];
60
- #ifdef LTC_YARROW
61
- struct yarrow_prng yarrow ;
62
- #endif
63
- #ifdef LTC_RC4
64
- struct rc4_prng rc4 ;
65
- #endif
66
- #ifdef LTC_CHACHA20_PRNG
67
- struct chacha20_prng chacha ;
68
- #endif
69
- #ifdef LTC_FORTUNA
70
- struct fortuna_prng fortuna ;
71
- #endif
72
- #ifdef LTC_SOBER128
73
- struct sober128_prng sober128 ;
74
- #endif
75
- } u ;
76
- short ready ; /* ready flag 0-1 */
77
- LTC_MUTEX_TYPE (lock ) /* lock */
78
- } prng_state ;
57
+ typedef struct ltc_prng_state prng_state ;
79
58
80
59
/** PRNG descriptor */
81
- extern struct ltc_prng_descriptor {
60
+ struct ltc_prng_descriptor {
82
61
/** Name of the PRNG */
83
62
const char * name ;
84
63
/** size in bytes of exported state */
@@ -130,7 +109,31 @@ extern struct ltc_prng_descriptor {
130
109
@return CRYPT_OK if successful, CRYPT_NOP if self-testing has been disabled
131
110
*/
132
111
int (* test )(void );
133
- } prng_descriptor [];
112
+ };
113
+
114
+ struct ltc_prng_state {
115
+ union {
116
+ char dummy [1 ];
117
+ #ifdef LTC_YARROW
118
+ struct yarrow_prng yarrow ;
119
+ #endif
120
+ #ifdef LTC_RC4
121
+ struct rc4_prng rc4 ;
122
+ #endif
123
+ #ifdef LTC_CHACHA20_PRNG
124
+ struct chacha20_prng chacha ;
125
+ #endif
126
+ #ifdef LTC_FORTUNA
127
+ struct fortuna_prng fortuna ;
128
+ #endif
129
+ #ifdef LTC_SOBER128
130
+ struct sober128_prng sober128 ;
131
+ #endif
132
+ } u ;
133
+ short ready ; /* ready flag 0-1 */
134
+ struct ltc_prng_descriptor desc ;
135
+ LTC_MUTEX_TYPE (lock ) /* lock */
136
+ };
134
137
135
138
#ifdef LTC_YARROW
136
139
int yarrow_start (prng_state * prng );
@@ -141,7 +144,6 @@ int yarrow_done(prng_state *prng);
141
144
int yarrow_export (unsigned char * out , unsigned long * outlen , prng_state * prng );
142
145
int yarrow_import (const unsigned char * in , unsigned long inlen , prng_state * prng );
143
146
int yarrow_test (void );
144
- extern const struct ltc_prng_descriptor yarrow_desc ;
145
147
#endif
146
148
147
149
#ifdef LTC_FORTUNA
@@ -155,7 +157,6 @@ int fortuna_export(unsigned char *out, unsigned long *outlen, prng_state *prng);
155
157
int fortuna_import (const unsigned char * in , unsigned long inlen , prng_state * prng );
156
158
int fortuna_update_seed (const unsigned char * in , unsigned long inlen , prng_state * prng );
157
159
int fortuna_test (void );
158
- extern const struct ltc_prng_descriptor fortuna_desc ;
159
160
#endif
160
161
161
162
#ifdef LTC_RC4
@@ -167,7 +168,6 @@ int rc4_done(prng_state *prng);
167
168
int rc4_export (unsigned char * out , unsigned long * outlen , prng_state * prng );
168
169
int rc4_import (const unsigned char * in , unsigned long inlen , prng_state * prng );
169
170
int rc4_test (void );
170
- extern const struct ltc_prng_descriptor rc4_desc ;
171
171
#endif
172
172
173
173
#ifdef LTC_CHACHA20_PRNG
@@ -179,7 +179,6 @@ int chacha20_prng_done(prng_state *prng);
179
179
int chacha20_prng_export (unsigned char * out , unsigned long * outlen , prng_state * prng );
180
180
int chacha20_prng_import (const unsigned char * in , unsigned long inlen , prng_state * prng );
181
181
int chacha20_prng_test (void );
182
- extern const struct ltc_prng_descriptor chacha20_prng_desc ;
183
182
#endif
184
183
185
184
#ifdef LTC_SPRNG
@@ -191,7 +190,6 @@ int sprng_done(prng_state *prng);
191
190
int sprng_export (unsigned char * out , unsigned long * outlen , prng_state * prng );
192
191
int sprng_import (const unsigned char * in , unsigned long inlen , prng_state * prng );
193
192
int sprng_test (void );
194
- extern const struct ltc_prng_descriptor sprng_desc ;
195
193
#endif
196
194
197
195
#ifdef LTC_SOBER128
@@ -203,24 +201,16 @@ int sober128_done(prng_state *prng);
203
201
int sober128_export (unsigned char * out , unsigned long * outlen , prng_state * prng );
204
202
int sober128_import (const unsigned char * in , unsigned long inlen , prng_state * prng );
205
203
int sober128_test (void );
206
- extern const struct ltc_prng_descriptor sober128_desc ;
207
204
#endif
208
205
209
- int find_prng (const char * name );
210
- int register_prng (const struct ltc_prng_descriptor * prng );
211
- int unregister_prng (const struct ltc_prng_descriptor * prng );
212
- int register_all_prngs (void );
213
- int prng_is_valid (int idx );
214
- LTC_MUTEX_PROTO (ltc_prng_mutex )
215
-
216
206
/* Slow RNG you **might** be able to use to seed a PRNG with. Be careful as this
217
207
* might not work on all platforms as planned
218
208
*/
219
209
unsigned long rng_get_bytes (unsigned char * out ,
220
210
unsigned long outlen ,
221
211
void (* callback )(void ));
222
212
223
- int rng_make_prng (int bits , int wprng , prng_state * prng , void (* callback )(void ));
213
+ int rng_make_prng (int bits , prng_state * prng , void (* callback )(void ));
224
214
225
215
#ifdef LTC_PRNG_ENABLE_LTC_RNG
226
216
extern unsigned long (* ltc_rng )(unsigned char * out , unsigned long outlen ,
0 commit comments