updates.
[silc.git] / lib / silccrypt / silcrng.h
1 /*
2
3   silcSilcRng.h
4
5   Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
6
7   Copyright (C) 1997 - 2000 Pekka Riikonen
8
9   This program is free software; you can redistribute it and/or modify
10   it under the terms of the GNU General Public License as published by
11   the Free Software Foundation; either version 2 of the License, or
12   (at your option) any later version.
13   
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License for more details.
18
19 */
20
21 #ifndef SILCRNG_H
22 #define SILCRNG_H
23
24 /* Forward declaration. Actual object is in source file. */
25 typedef struct SilcRngObjectStruct *SilcRng;
26
27 /* Number of states to fetch data from pool. */
28 #define SILC_RNG_STATE_NUM 4
29
30 /* Byte size of the random data pool. */
31 #define SILC_RNG_POOLSIZE 1024
32
33 /* Prototypes */
34 SilcRng silc_rng_alloc();
35 void silc_rng_free(SilcRng rng);
36 void silc_rng_init(SilcRng rng);
37 unsigned char silc_rng_get_byte(SilcRng rng);
38 unsigned short silc_rng_get_rn16(SilcRng rng);
39 unsigned int silc_rng_get_rn32(SilcRng rng);
40 unsigned char *silc_rng_get_rn_string(SilcRng rng, unsigned int len);
41 unsigned char *silc_rng_get_rn_data(SilcRng rng, unsigned int len);
42
43 int silc_rng_global_init(SilcRng rng);
44 int silc_rng_global_uninit();
45 unsigned char silc_rng_global_get_byte();
46 unsigned short silc_rng_global_get_rn16();
47 unsigned int silc_rng_global_get_rn32();
48 unsigned char *silc_rng_global_get_rn_string(unsigned int len);
49 unsigned char *silc_rng_global_get_rn_data(unsigned int len);
50
51 #endif