1 /* A trivial implementation of hcrypto's RAND interface for
6 #include <evp-hcrypto.h>
9 #include <heim_threads.h>
12 * This mutex is used to synchronize hcrypto operations in the kernel.
13 * We cheat and assume that all access into hcrypto comes through routines
14 * in this file, so that we can ensure it is initialized before it is used.
16 afs_kmutex_t hckernel_mutex
;
18 /* Called from osi_Init(); will only run once. */
20 init_hckernel_mutex(void)
22 MUTEX_INIT(&hckernel_mutex
, "hckernel", MUTEX_DEFAULT
, 0);
26 RAND_seed(const void *indata
, size_t size
)
28 const RAND_METHOD
*m
= RAND_fortuna_method();
29 m
->seed(indata
, size
);
33 RAND_bytes(void *outdata
, size_t size
)
37 #if defined(AFS_AIX_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_SGI_ENV)
38 const RAND_METHOD
*m
= RAND_fortuna_method();
39 return m
->bytes(outdata
, size
);
41 if (osi_readRandom(outdata
, size
))