Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
random.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013-2014 Wind River Systems, Inc.
3 * Copyright (c) 2023 Intel Corporation
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
21#ifndef ZEPHYR_INCLUDE_RANDOM_RANDOM_H_
22#define ZEPHYR_INCLUDE_RANDOM_RANDOM_H_
23
24#include <zephyr/types.h>
25#include <stddef.h>
26#include <zephyr/kernel.h>
27
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41
53__syscall void sys_rand_get(void *dst, size_t len);
54
68__syscall int sys_csrand_get(void *dst, size_t len);
69
79static inline uint8_t sys_rand8_get(void)
80{
82
83 sys_rand_get(&ret, sizeof(ret));
84
85 return ret;
86}
87
97static inline uint16_t sys_rand16_get(void)
98{
100
101 sys_rand_get(&ret, sizeof(ret));
102
103 return ret;
104}
105
115static inline uint32_t sys_rand32_get(void)
116{
118
119 sys_rand_get(&ret, sizeof(ret));
120
121 return ret;
122}
123
133static inline uint64_t sys_rand64_get(void)
134{
136
137 sys_rand_get(&ret, sizeof(ret));
138
139 return ret;
140}
141
142#ifdef __cplusplus
143}
144#endif
145
150#include <zephyr/syscalls/random.h>
151#endif /* ZEPHYR_INCLUDE_RANDOM_RANDOM_H_ */
static uint64_t sys_rand64_get(void)
Return a 64-bit random value that should pass general randomness tests.
Definition random.h:133
static uint16_t sys_rand16_get(void)
Return a 16-bit random value that should pass general randomness tests.
Definition random.h:97
static uint32_t sys_rand32_get(void)
Return a 32-bit random value that should pass general randomness tests.
Definition random.h:115
static uint8_t sys_rand8_get(void)
Return a 8-bit random value that should pass general randomness tests.
Definition random.h:79
int sys_csrand_get(void *dst, size_t len)
Fill the destination buffer with cryptographically secure random data values.
void sys_rand_get(void *dst, size_t len)
Fill the destination buffer with random data values that should pass general randomness tests.
Public kernel APIs.
static ZTEST_BMEM int ret
Definition main.c:16
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89