]> git.proxmox.com Git - mirror_edk2.git/blob - SecurityPkg/RandomNumberGenerator/RngDxe/RdRand.h
SecurityPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / SecurityPkg / RandomNumberGenerator / RngDxe / RdRand.h
1 /** @file
2 Header for the RDRAND APIs used by RNG DXE driver.
3
4 Support API definitions for RDRAND instruction access, which will leverage
5 Intel Secure Key technology to provide high-quality random numbers for use
6 in applications, or entropy for seeding other random number generators.
7 Refer to http://software.intel.com/en-us/articles/intel-digital-random-number
8 -generator-drng-software-implementation-guide/ for more information about Intel
9 Secure Key technology.
10
11 Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
12 (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
13 SPDX-License-Identifier: BSD-2-Clause-Patent
14
15 **/
16
17 #ifndef __RD_RAND_H__
18 #define __RD_RAND_H__
19
20 #include <Library/BaseLib.h>
21 #include <Library/BaseMemoryLib.h>
22 #include <Library/UefiBootServicesTableLib.h>
23 #include <Library/TimerLib.h>
24 #include <Protocol/Rng.h>
25
26 /**
27 Calls RDRAND to fill a buffer of arbitrary size with random bytes.
28
29 @param[in] Length Size of the buffer, in bytes, to fill with.
30 @param[out] RandBuffer Pointer to the buffer to store the random result.
31
32 @retval EFI_SUCCESS Random bytes generation succeeded.
33 @retval EFI_NOT_READY Failed to request random bytes.
34
35 **/
36 EFI_STATUS
37 EFIAPI
38 RdRandGetBytes (
39 IN UINTN Length,
40 OUT UINT8 *RandBuffer
41 );
42
43 /**
44 Generate high-quality entropy source through RDRAND.
45
46 @param[in] Length Size of the buffer, in bytes, to fill with.
47 @param[out] Entropy Pointer to the buffer to store the entropy data.
48
49 @retval EFI_SUCCESS Entropy generation succeeded.
50 @retval EFI_NOT_READY Failed to request random data.
51
52 **/
53 EFI_STATUS
54 EFIAPI
55 RdRandGenerateEntropy (
56 IN UINTN Length,
57 OUT UINT8 *Entropy
58 );
59
60 #endif // __RD_RAND_H__