randomness.c 1.17 KB
Newer Older
Niels Möller's avatar
Niels Möller committed
1
2
/* randomness.c
 *
3
 */
4
5
6

/* lsh, an implementation of the ssh protocol
 *
7
 * Copyright (C) 1998, 1999, 2000, Niels Möller
8
9
10
11
12
13
14
15
16
17
18
19
20
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
J.H.M. Dassen's avatar
J.H.M. Dassen committed
21
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
Niels Möller's avatar
Niels Möller committed
22
23
 */

24
25
26
27
#if HAVE_CONFIG_H
#include "config.h"
#endif

Niels Möller's avatar
Niels Möller committed
28
#include "randomness.h"
29
#include "xalloc.h"
Niels Möller's avatar
Niels Möller committed
30

31
#define GABA_DEFINE
32
#include "randomness.h.x"
33
#undef GABA_DEFINE
34

Niels Möller's avatar
Niels Möller committed
35
36
37
38
39
40
41
42
/* Wrapper for using lsh's randomness generator with nettle
 * functions. */
void
lsh_random(void *x, unsigned length, uint8_t *data)
{
  CAST_SUBTYPE(randomness, r, x);
  RANDOM(r, length, data);
}