summaryrefslogtreecommitdiff
path: root/src/librandom/unidevrandom.c
blob: fb7b6b8c5a199bc1d33c7b2eaf68c1a2485b7227 (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_HASDEVRANDOM

#include "random-internal.h"

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

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

#else

#include <errno.h>

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

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

#endif