Initial revision
[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 void silc_rng_get_soft_noise(SilcRng rng);
38 void silc_rng_get_medium_noise(SilcRng rng);
39 void silc_rng_get_hard_noise(SilcRng rng);
40 void silc_rng_exec_command(SilcRng rng, char *command);
41 void silc_rng_add_noise(SilcRng rng, unsigned char *buffer, 
42                         unsigned int len);
43 void silc_rng_xor(SilcRng rng, unsigned int val, unsigned int pos);
44 void silc_rng_stir_pool(SilcRng rng);
45 unsigned int silc_rng_get_position(SilcRng rng);
46 unsigned char silc_rng_get_byte(SilcRng rng);
47 unsigned short silc_rng_get_rn16(SilcRng rng);
48 unsigned int silc_rng_get_rn32(SilcRng rng);
49 unsigned char *silc_rng_get_rn_string(SilcRng rng, unsigned int len);
50
51 #endif