Debian Codegraph @

src/crypto/crypto_ops_builder/include/sodium/randombytes.h

raw symbols SCIP
1
2 #ifndef randombytes_H
3 #define randombytes_H
4
5 #include <sys/types.h>
6
7 #include <stddef.h>
8 #include <stdint.h>
9
10 #include "export.h"
11
12 #ifdef __cplusplus
13 # if __GNUC__
14 # pragma GCC diagnostic ignored "-Wlong-long"
15 # endif
16 extern "C" {
17 #endif
18
19 typedef struct randombytes_implementation {
20 const char *(*implementation_name)(void); /* required */
21 uint32_t (*random)(void); /* required */
22 void (*stir)(void); /* optional */
23 uint32_t (*uniform)(const uint32_t upper_bound); /* optional, a default implementation will be used if NULL */
24 void (*buf)(void * const buf, const size_t size); /* required */
25 int (*close)(void); /* optional */
26 } randombytes_implementation;
27
28 SODIUM_EXPORT
29 void randombytes_buf(void * const buf, const size_t size);
30
31 SODIUM_EXPORT
32 uint32_t randombytes_random(void);
33
34 SODIUM_EXPORT
35 uint32_t randombytes_uniform(const uint32_t upper_bound);
36
37 SODIUM_EXPORT
38 void randombytes_stir(void);
39
40 SODIUM_EXPORT
41 int randombytes_close(void);
42
43 SODIUM_EXPORT
44 int randombytes_set_implementation(randombytes_implementation *impl);
45
46 SODIUM_EXPORT
47 const char *randombytes_implementation_name(void);
48
49 /* -- NaCl compatibility interface -- */
50
51 SODIUM_EXPORT
52 void randombytes(unsigned char * const buf, const unsigned long long buf_len);
53
54 #ifdef __cplusplus
55 }
56 #endif
57
58 #endif