chiark / gitweb /
tree-wide: remove Lennart's copyright lines
[elogind.git] / src / basic / random-util.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 #include <stdbool.h>
5 #include <stddef.h>
6 #include <stdint.h>
7
8 int acquire_random_bytes(void *p, size_t n, bool high_quality_required);
9 void pseudorandom_bytes(void *p, size_t n);
10 void random_bytes(void *p, size_t n);
11 void initialize_srand(void);
12
13 static inline uint64_t random_u64(void) {
14         uint64_t u;
15         random_bytes(&u, sizeof(u));
16         return u;
17 }
18
19 static inline uint32_t random_u32(void) {
20         uint32_t u;
21         random_bytes(&u, sizeof(u));
22         return u;
23 }