summaryrefslogtreecommitdiff
path: root/src/librandom/unidevurandom.c
blob: d601ea02fde4227e841ec0284082f88b748f0d6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* ISC license. */

#include <skalibs/sysdeps.h>
#include <skalibs/unirandomdev.h>
#include <skalibs/unirandom.h>

#ifdef SKALIBS_HASDEVURANDOM

#include "random-internal.h"

int unidevurandom_init (union unirandominfo *u)
{
  return unirandomdev_sinit(u, "/dev/urandom") ;
}

int unirandom_register_devurandom (unirandom *u)
{
  unirandom_register(u, &unidevurandom_init, &unirandomdev_finish, &unirandomdev_readb, &unirandomdev_readnb) ;
  return 1 ;
}

#else

#include <errno.h>

int unidevurandom_init (union unirandominfo *u)
{
  (void)u ;
  return (errno = ENOSYS, 0) ;
}

int unirandom_register_devurandom (unirandom *u)
{
  (void)u ;
  return (errno = ENOSYS, 0) ;
}

#endif