]>
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_
13 #include <Protocol/Rng.h>
16 Returns information about the random number generation implementation.
18 @param[in] This A pointer to the EFI_RNG_PROTOCOL instance.
19 @param[in,out] RNGAlgorithmListSize On input, the size in bytes of RNGAlgorithmList.
20 On output with a return code of EFI_SUCCESS, the size
21 in bytes of the data returned in RNGAlgorithmList. On output
22 with a return code of EFI_BUFFER_TOO_SMALL,
23 the size of RNGAlgorithmList required to obtain the list.
24 @param[out] RNGAlgorithmList A caller-allocated memory buffer filled by the driver
25 with one EFI_RNG_ALGORITHM element for each supported
26 RNG algorithm. The list must not change across multiple
27 calls to the same driver. The first algorithm in the list
28 is the default algorithm for the driver.
30 @retval EFI_SUCCESS The RNG algorithm list was returned successfully.
31 @retval EFI_UNSUPPORTED The services is not supported by this driver.
32 @retval EFI_DEVICE_ERROR The list of algorithms could not be retrieved due to a
33 hardware or firmware error.
34 @retval EFI_INVALID_PARAMETER One or more of the parameters are incorrect.
35 @retval EFI_BUFFER_TOO_SMALL The buffer RNGAlgorithmList is too small to hold the result.
41 IN EFI_RNG_PROTOCOL
*This
,
42 IN OUT UINTN
*RNGAlgorithmListSize
,
43 OUT EFI_RNG_ALGORITHM
*RNGAlgorithmList
47 Produces and returns an RNG value using either the default or specified RNG algorithm.
49 @param[in] This A pointer to the EFI_RNG_PROTOCOL instance.
50 @param[in] RNGAlgorithm A pointer to the EFI_RNG_ALGORITHM that identifies the RNG
51 algorithm to use. May be NULL in which case the function will
52 use its default RNG algorithm.
53 @param[in] RNGValueLength The length in bytes of the memory buffer pointed to by
54 RNGValue. The driver shall return exactly this numbers of bytes.
55 @param[out] RNGValue A caller-allocated memory buffer filled by the driver with the
58 @retval EFI_SUCCESS The RNG value was returned successfully.
59 @retval EFI_UNSUPPORTED The algorithm specified by RNGAlgorithm is not supported by
61 @retval EFI_DEVICE_ERROR An RNG value could not be retrieved due to a hardware or
63 @retval EFI_NOT_READY There is not enough random data available to satisfy the length
64 requested by RNGValueLength.
65 @retval EFI_INVALID_PARAMETER RNGValue is NULL or RNGValueLength is zero.
71 IN EFI_RNG_PROTOCOL
*This
,
72 IN EFI_RNG_ALGORITHM
*RNGAlgorithm OPTIONAL
,
73 IN UINTN RNGValueLength
,
78 Runs CPU RNG instruction to fill a buffer of arbitrary size with random bytes.
80 @param[in] Length Size of the buffer, in bytes, to fill with.
81 @param[out] RandBuffer Pointer to the buffer to store the random result.
83 @retval EFI_SUCCESS Random bytes generation succeeded.
84 @retval EFI_NOT_READY Failed to request random bytes.
95 Generate high-quality entropy source using a TRNG or through RDRAND.
97 @param[in] Length Size of the buffer, in bytes, to fill with.
98 @param[out] Entropy Pointer to the buffer to store the entropy data.
100 @retval EFI_SUCCESS Entropy generation succeeded.
101 @retval EFI_NOT_READY Failed to request random data.
111 #endif // RNGDXE_INTERNALS_H_