1 /***************************************************************************//**
2  * @file
3  * @brief Silicon Labs Secure Engine Manager API.
4  *******************************************************************************
5  * # License
6  * <b>Copyright 2020 Silicon Laboratories Inc. www.silabs.com</b>
7  *******************************************************************************
8  *
9  * SPDX-License-Identifier: Zlib
10  *
11  * The licensor of this software is Silicon Laboratories Inc.
12  *
13  * This software is provided 'as-is', without any express or implied
14  * warranty. In no event will the authors be held liable for any damages
15  * arising from the use of this software.
16  *
17  * Permission is granted to anyone to use this software for any purpose,
18  * including commercial applications, and to alter it and redistribute it
19  * freely, subject to the following restrictions:
20  *
21  * 1. The origin of this software must not be misrepresented; you must not
22  *    claim that you wrote the original software. If you use this software
23  *    in a product, an acknowledgment in the product documentation would be
24  *    appreciated but is not required.
25  * 2. Altered source versions must be plainly marked as such, and must not be
26  *    misrepresented as being the original software.
27  * 3. This notice may not be removed or altered from any source distribution.
28  *
29  ******************************************************************************/
30 #ifndef SL_SE_MANAGER_ENTROPY_H
31 #define SL_SE_MANAGER_ENTROPY_H
32 
33 #include "em_device.h"
34 
35 #if defined(SEMAILBOX_PRESENT) || defined(DOXYGEN)
36 
37 /// @addtogroup sl_se_manager
38 /// @{
39 
40 /***************************************************************************//**
41  * @addtogroup sl_se_manager_entropy Entropy
42  *
43  * @brief
44  *   Random number generators
45  * @details
46  *
47  *   API for getting randomness from the Secure Engine True Random Number
48  *   Generator (TRNG).
49  *
50  * @{
51  ******************************************************************************/
52 
53 #include "sl_se_manager_key_handling.h"
54 #include "sl_se_manager_types.h"
55 #include "em_se.h"
56 #include "sl_status.h"
57 #include <stdint.h>
58 #include <stdbool.h>
59 #include <stddef.h>
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 // -----------------------------------------------------------------------------
66 // Prototypes
67 
68 /***************************************************************************//**
69  * @brief
70  *   Get random data from hardware TRNG.
71  *
72  * @param[in] cmd_ctx
73  *   Pointer to an SE command context object.
74  *
75  * @param[out] data
76  *   Random data from TRNG.
77  *
78  * @param[in] num_bytes
79  *   Length of data request.
80  *
81  * @return
82  *   Status code, @ref sl_status.h.
83  ******************************************************************************/
84 sl_status_t sl_se_get_random(sl_se_command_context_t *cmd_ctx,
85                              void *data,
86                              uint32_t num_bytes);
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 
92 /// @} (end addtogroup sl_se_manager_entropy)
93 /// @} (end addtogroup sl_se)
94 
95 #endif // defined(SEMAILBOX_PRESENT)
96 
97 #endif // SL_SE_MANAGER_ENTROPY_H
98