-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rand32.h does not make much sense, since the random subsystem provides more APIs than just getting a random 32 bits value. Rename it to random.h and get consistently with other subsystems. Signed-off-by: Flavio Ceolin <[email protected]>
- Loading branch information
Showing
133 changed files
with
225 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,15 @@ | ||
/* | ||
* Copyright (c) 2013-2014 Wind River Systems, Inc. | ||
* Copyright (c) 2023 Intel Corporation | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/** | ||
* @file | ||
* @brief Random number generator header file | ||
* | ||
* This header file declares prototypes for the kernel's random number | ||
* generator APIs. | ||
* | ||
* Typically, a platform enables the appropriate source for the random | ||
* number generation based on the hardware platform's capabilities or | ||
* (for testing purposes only) enables the TEST_RANDOM_GENERATOR | ||
* configuration option. | ||
*/ | ||
|
||
#ifndef ZEPHYR_INCLUDE_RANDOM_RAND32_H_ | ||
#define ZEPHYR_INCLUDE_RANDOM_RAND32_H_ | ||
|
||
#include <zephyr/types.h> | ||
#include <stddef.h> | ||
#include <zephyr/kernel.h> | ||
|
||
/** | ||
* @brief Random Function APIs | ||
* @defgroup random_api Random Function APIs | ||
* @ingroup crypto | ||
* @{ | ||
*/ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @brief Return a 32-bit random value that should pass general | ||
* randomness tests. | ||
* | ||
* @note The random value returned is not a cryptographically secure | ||
* random number value. | ||
* | ||
* @return 32-bit random value. | ||
*/ | ||
__syscall uint32_t sys_rand32_get(void); | ||
|
||
/** | ||
* @brief Fill the destination buffer with random data values that should | ||
* pass general randomness tests. | ||
* | ||
* @note The random values returned are not considered cryptographically | ||
* secure random number values. | ||
* | ||
* @param [out] dst destination buffer to fill with random data. | ||
* @param len size of the destination buffer. | ||
* | ||
*/ | ||
__syscall void sys_rand_get(void *dst, size_t len); | ||
|
||
/** | ||
* @brief Fill the destination buffer with cryptographically secure | ||
* random data values. | ||
* | ||
* @note If the random values requested do not need to be cryptographically | ||
* secure then use sys_rand_get() instead. | ||
* | ||
* @param [out] dst destination buffer to fill. | ||
* @param len size of the destination buffer. | ||
* | ||
* @return 0 if success, -EIO if entropy reseed error | ||
* | ||
*/ | ||
__syscall int sys_csrand_get(void *dst, size_t len); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
#include <zephyr/random/random.h> | ||
|
||
/** | ||
* @} | ||
*/ | ||
#warning "<zephyr/random/rand32.h> is deprecated, include <zephyr/random/random.h> instead" | ||
|
||
#include <syscalls/rand32.h> | ||
#endif /* ZEPHYR_INCLUDE_RANDOM_RAND32_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* | ||
* Copyright (c) 2013-2014 Wind River Systems, Inc. | ||
* Copyright (c) 2023 Intel Corporation | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/** | ||
* @file | ||
* @brief Random number generator header file | ||
* | ||
* This header file declares prototypes for the kernel's random number | ||
* generator APIs. | ||
* | ||
* Typically, a platform enables the appropriate source for the random | ||
* number generation based on the hardware platform's capabilities or | ||
* (for testing purposes only) enables the TEST_RANDOM_GENERATOR | ||
* configuration option. | ||
*/ | ||
|
||
#ifndef ZEPHYR_INCLUDE_RANDOM_RANDOM_H_ | ||
#define ZEPHYR_INCLUDE_RANDOM_RANDOM_H_ | ||
|
||
#include <zephyr/types.h> | ||
#include <stddef.h> | ||
#include <zephyr/kernel.h> | ||
|
||
/** | ||
* @brief Random Function APIs | ||
* @defgroup random_api Random Function APIs | ||
* @ingroup crypto | ||
* @{ | ||
*/ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @brief Return a 32-bit random value that should pass general | ||
* randomness tests. | ||
* | ||
* @note The random value returned is not a cryptographically secure | ||
* random number value. | ||
* | ||
* @return 32-bit random value. | ||
*/ | ||
__syscall uint32_t sys_rand32_get(void); | ||
|
||
/** | ||
* @brief Fill the destination buffer with random data values that should | ||
* pass general randomness tests. | ||
* | ||
* @note The random values returned are not considered cryptographically | ||
* secure random number values. | ||
* | ||
* @param [out] dst destination buffer to fill with random data. | ||
* @param len size of the destination buffer. | ||
* | ||
*/ | ||
__syscall void sys_rand_get(void *dst, size_t len); | ||
|
||
/** | ||
* @brief Fill the destination buffer with cryptographically secure | ||
* random data values. | ||
* | ||
* @note If the random values requested do not need to be cryptographically | ||
* secure then use sys_rand_get() instead. | ||
* | ||
* @param [out] dst destination buffer to fill. | ||
* @param len size of the destination buffer. | ||
* | ||
* @return 0 if success, -EIO if entropy reseed error | ||
* | ||
*/ | ||
__syscall int sys_csrand_get(void *dst, size_t len); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
/** | ||
* @} | ||
*/ | ||
|
||
#include <syscalls/random.h> | ||
#endif /* ZEPHYR_INCLUDE_RANDOM_RANDOM_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.