Fix copyright date.
[become] / src / rand.h
CommitLineData
a62d3877 1/* -*-c-*-
2 *
c758e654 3 * $Id: rand.h,v 1.2 1998/01/12 16:46:24 mdw Exp $
a62d3877 4 *
5 * Random number generation
6 *
c758e654 7 * (c) 1998 EBI
a62d3877 8 */
9
10/*----- Licencing notice --------------------------------------------------*
11 *
12 * This file is part of Become.
13 *
14 * Become is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * Become is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with Become; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28
29/*----- Revision history --------------------------------------------------*
30 *
31 * $Log: rand.h,v $
c758e654 32 * Revision 1.2 1998/01/12 16:46:24 mdw
33 * Fix copyright date.
34 *
a62d3877 35 * Revision 1.1 1997/08/07 09:46:05 mdw
36 * New source file added to maintain a randomness pool.
37 *
38 */
39
40#ifndef RAND_H
41#define RAND_H
42
43#ifdef __cplusplus
44 extern "C" {
45#endif
46
47/*----- Required headers --------------------------------------------------*/
48
49#include <stdio.h>
50
51#ifndef ICRYPT_H
52# include "icrypt.h"
53#endif
54
55/*----- Functions provided ------------------------------------------------*/
56
57/* --- @rand_read@ --- *
58 *
59 * Arguments: @FILE *fp@ = pointer to file to read from
60 *
61 * Returns: ---
62 *
63 * Use: Reads a random number seed from the stream.
64 */
65
66extern void rand_read(FILE */*fp*/);
67
68/* --- @rand_write@ --- *
69 *
70 * Arguments: @FILE *fp@ = pointer to file to write on
71 *
72 * Returns: ---
73 *
74 * Use: Writes a random number seed back to the stream.
75 */
76
77extern void rand_write(FILE */*fp*/);
78
79/* --- @rand_clear@ --- *
80 *
81 * Arguments: ---
82 *
83 * Returns: ---
84 *
85 * Use: Clears the random number pool.
86 */
87
88extern void rand_clear(void);
89
90/* --- @rand_encrypt@ --- *
91 *
92 * Arguments: @icrypt_job *j@ = pointer to an encryption job to apply
93 *
94 * Returns: ---
95 *
96 * Use: Encrypts the randomness pool with a given key. This should
97 * be done before use, in case the pool gets compromised.
98 */
99
100extern void rand_encrypt(icrypt_job */*j*/);
101
102/* --- @rand_add@ --- *
103 *
104 * Arguments: @const void *p@ = pointer to some data
105 * @size_t sz@ = size of the data in bytes
106 *
107 * Returns: ---
108 *
109 * Use: Adds entropy to the pool.
110 */
111
112extern void rand_add(const void */*p*/, size_t /*sz*/);
113
114/* --- @rand_extract@ --- *
115 *
116 * Arguments: @unsigned char *b@ = pointer to output buffer
117 * @size_t sz@ = number of bytes wanted
118 *
119 * Returns: ---
120 *
121 * Use: Produces a number of random bytes.
122 */
123
124extern void rand_extract(unsigned char */*b*/, size_t /*sz*/);
125
126/* --- @rand_churn@ --- *
127 *
128 * Arguments: ---
129 *
130 * Returns: ---
131 *
132 * Use: Churns the randomness pool completely. The pool is replaced
133 * by repeated MD5-ings of itself.
134 */
135
136extern void rand_churn(void);
137
138/*----- That's all, folks -------------------------------------------------*/
139
140#ifdef __cplusplus
141 }
142#endif
143
144#endif