Commit | Line | Data |
---|---|---|
bff8215a JG |
1 | /* |
2 | * Copyright (C) 2023 Jérémie Galarneau <jeremie.galarneau@efficios.com> | |
3 | * | |
4 | * SPDX-License-Identifier: LGPL-2.1-only | |
5 | * | |
6 | */ | |
7 | ||
8 | #ifndef LTTNG_RANDOM_H | |
9 | #define LTTNG_RANDOM_H | |
10 | ||
11 | #include <stddef.h> | |
12 | ||
13 | typedef unsigned int seed_t; | |
14 | ||
15 | /* | |
16 | * Get a seed from a reliable source of randomness without blocking. Returns 0 | |
17 | * on success, -1 on failure. | |
18 | */ | |
19 | int lttng_produce_true_random_seed(seed_t *out_seed); | |
20 | ||
21 | /* | |
22 | * Get a random seed making a best-effort to use a true randomness source, | |
23 | * but falling back to a pseudo-random seed based on the time and various system | |
24 | * configuration values on failure. Returns 0 on success, -1 on failure. | |
25 | */ | |
26 | int lttng_produce_best_effort_random_seed(seed_t *out_seed); | |
27 | ||
28 | #endif /* LTTNG_RANDOM_H */ |