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
38
extern
"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
79
static
inline
uint8_t
sys_rand8_get
(
void
)
80
{
81
uint8_t
ret
;
82
83
sys_rand_get
(&
ret
,
sizeof
(
ret
));
84
85
return
ret
;
86
}
87
97
static
inline
uint16_t
sys_rand16_get
(
void
)
98
{
99
uint16_t
ret
;
100
101
sys_rand_get
(&
ret
,
sizeof
(
ret
));
102
103
return
ret
;
104
}
105
115
static
inline
uint32_t
sys_rand32_get
(
void
)
116
{
117
uint32_t
ret
;
118
119
sys_rand_get
(&
ret
,
sizeof
(
ret
));
120
121
return
ret
;
122
}
123
133
static
inline
uint64_t
sys_rand64_get
(
void
)
134
{
135
uint64_t
ret
;
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_ */
sys_rand64_get
static uint64_t sys_rand64_get(void)
Return a 64-bit random value that should pass general randomness tests.
Definition
random.h:133
sys_rand16_get
static uint16_t sys_rand16_get(void)
Return a 16-bit random value that should pass general randomness tests.
Definition
random.h:97
sys_rand32_get
static uint32_t sys_rand32_get(void)
Return a 32-bit random value that should pass general randomness tests.
Definition
random.h:115
sys_rand8_get
static uint8_t sys_rand8_get(void)
Return a 8-bit random value that should pass general randomness tests.
Definition
random.h:79
sys_csrand_get
int sys_csrand_get(void *dst, size_t len)
Fill the destination buffer with cryptographically secure random data values.
sys_rand_get
void sys_rand_get(void *dst, size_t len)
Fill the destination buffer with random data values that should pass general randomness tests.
types.h
kernel.h
Public kernel APIs.
ret
static ZTEST_BMEM int ret
Definition
main.c:16
uint32_t
__UINT32_TYPE__ uint32_t
Definition
stdint.h:90
uint64_t
__UINT64_TYPE__ uint64_t
Definition
stdint.h:91
uint8_t
__UINT8_TYPE__ uint8_t
Definition
stdint.h:88
uint16_t
__UINT16_TYPE__ uint16_t
Definition
stdint.h:89
include
zephyr
random
random.h
Generated on Sun Sep 15 2024 17:01:30 for Zephyr Project API by
1.9.8