]>
git.proxmox.com Git - mirror_edk2.git/blob - SecurityPkg/RandomNumberGenerator/RngDxe/RngDxeInternals.h
2 Function prototypes for UEFI Random Number Generator protocol support.
4 Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef RNGDXE_INTERNALS_H_
11 #define RNGDXE_INTERNALS_H_
14 Returns information about the random number generation implementation.
16 @param[in] This A pointer to the EFI_RNG_PROTOCOL instance.
17 @param[in,out] RNGAlgorithmListSize On input, the size in bytes of RNGAlgorithmList.
18 On output with a return code of EFI_SUCCESS, the size
19 in bytes of the data returned in RNGAlgorithmList. On output
20 with a return code of EFI_BUFFER_TOO_SMALL,
21 the size of RNGAlgorithmList required to obtain the list.
22 @param[out] RNGAlgorithmList A caller-allocated memory buffer filled by the driver
23 with one EFI_RNG_ALGORITHM element for each supported
24 RNG algorithm. The list must not change across multiple
25 calls to the same driver. The first algorithm in the list
26 is the default algorithm for the driver.
28 @retval EFI_SUCCESS The RNG algorithm list was returned successfully.
29 @retval EFI_UNSUPPORTED The services is not supported by this driver.
30 @retval EFI_DEVICE_ERROR The list of algorithms could not be retrieved due to a
31 hardware or firmware error.
32 @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.
33 @retval EFI_BUFFER_TOO_SMALL The buffer RNGAlgorithmList is too small to hold the result.
39 IN EFI_RNG_PROTOCOL
*This
,
40 IN OUT UINTN
*RNGAlgorithmListSize
,
41 OUT EFI_RNG_ALGORITHM
*RNGAlgorithmList
45 Produces and returns an RNG value using either the default or specified RNG algorithm.
47 @param[in] This A pointer to the EFI_RNG_PROTOCOL instance.
48 @param[in] RNGAlgorithm A pointer to the EFI_RNG_ALGORITHM that identifies the RNG
49 algorithm to use. May be NULL in which case the function will
50 use its default RNG algorithm.
51 @param[in] RNGValueLength The length in bytes of the memory buffer pointed to by
52 RNGValue. The driver shall return exactly this numbers of bytes.
53 @param[out] RNGValue A caller-allocated memory buffer filled by the driver with the
56 @retval EFI_SUCCESS The RNG value was returned successfully.
57 @retval EFI_UNSUPPORTED The algorithm specified by RNGAlgorithm is not supported by
59 @retval EFI_DEVICE_ERROR An RNG value could not be retrieved due to a hardware or
61 @retval EFI_NOT_READY There is not enough random data available to satisfy the length
62 requested by RNGValueLength.
63 @retval EFI_INVALID_PARAMETER RNGValue is NULL or RNGValueLength is zero.
69 IN EFI_RNG_PROTOCOL
*This
,
70 IN EFI_RNG_ALGORITHM
*RNGAlgorithm
, OPTIONAL
71 IN UINTN RNGValueLength
,
76 Returns information about the random number generation implementation.
78 @param[in,out] RNGAlgorithmListSize On input, the size in bytes of RNGAlgorithmList.
79 On output with a return code of EFI_SUCCESS, the size
80 in bytes of the data returned in RNGAlgorithmList. On output
81 with a return code of EFI_BUFFER_TOO_SMALL,
82 the size of RNGAlgorithmList required to obtain the list.
83 @param[out] RNGAlgorithmList A caller-allocated memory buffer filled by the driver
84 with one EFI_RNG_ALGORITHM element for each supported
85 RNG algorithm. The list must not change across multiple
86 calls to the same driver. The first algorithm in the list
87 is the default algorithm for the driver.
89 @retval EFI_SUCCESS The RNG algorithm list was returned successfully.
90 @retval EFI_BUFFER_TOO_SMALL The buffer RNGAlgorithmList is too small to hold the result.
95 ArchGetSupportedRngAlgorithms (
96 IN OUT UINTN
*RNGAlgorithmListSize
,
97 OUT EFI_RNG_ALGORITHM
*RNGAlgorithmList
101 Runs CPU RNG instruction to fill a buffer of arbitrary size with random bytes.
103 @param[in] Length Size of the buffer, in bytes, to fill with.
104 @param[out] RandBuffer Pointer to the buffer to store the random result.
106 @retval EFI_SUCCESS Random bytes generation succeeded.
107 @retval EFI_NOT_READY Failed to request random bytes.
114 OUT UINT8
*RandBuffer
117 #endif // RNGDXE_INTERNALS_H_