]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/RandomNumberGenerator/RngDxe/RdRand.h
SecurityPkg: Integrate new RngLib into RngDxe
[mirror_edk2.git] / SecurityPkg / RandomNumberGenerator / RngDxe / RdRand.h
CommitLineData
3aa8dc6c
LQ
1/** @file\r
2 Header for the RDRAND APIs used by RNG DXE driver.\r
3\r
4 Support API definitions for RDRAND instruction access, which will leverage\r
5 Intel Secure Key technology to provide high-quality random numbers for use\r
6 in applications, or entropy for seeding other random number generators.\r
7 Refer to http://software.intel.com/en-us/articles/intel-digital-random-number\r
8 -generator-drng-software-implementation-guide/ for more information about Intel\r
9 Secure Key technology.\r
10\r
11Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
3b60842c 12(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
3aa8dc6c
LQ
13This program and the accompanying materials\r
14are licensed and made available under the terms and conditions of the BSD License\r
15which accompanies this distribution. The full text of the license may be found at\r
16http://opensource.org/licenses/bsd-license.php\r
17\r
18THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
19WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
20\r
21**/\r
22\r
23#ifndef __RD_RAND_H__\r
24#define __RD_RAND_H__\r
25\r
26#include <Library/BaseLib.h>\r
27#include <Library/BaseMemoryLib.h>\r
28#include <Library/UefiBootServicesTableLib.h>\r
29#include <Library/TimerLib.h>\r
30#include <Protocol/Rng.h>\r
31\r
3aa8dc6c
LQ
32/**\r
33 Calls RDRAND to fill a buffer of arbitrary size with random bytes.\r
34\r
35 @param[in] Length Size of the buffer, in bytes, to fill with.\r
36 @param[out] RandBuffer Pointer to the buffer to store the random result.\r
37\r
38 @retval EFI_SUCCESS Random bytes generation succeeded.\r
39 @retval EFI_NOT_READY Failed to request random bytes.\r
40\r
41**/\r
42EFI_STATUS\r
43EFIAPI\r
44RdRandGetBytes (\r
45 IN UINTN Length,\r
46 OUT UINT8 *RandBuffer\r
47 );\r
48\r
49/**\r
50 Generate high-quality entropy source through RDRAND.\r
51\r
52 @param[in] Length Size of the buffer, in bytes, to fill with.\r
53 @param[out] Entropy Pointer to the buffer to store the entropy data.\r
54\r
55 @retval EFI_SUCCESS Entropy generation succeeded.\r
56 @retval EFI_NOT_READY Failed to request random data.\r
57\r
58**/\r
59EFI_STATUS\r
60EFIAPI\r
61RdRandGenerateEntropy (\r
62 IN UINTN Length,\r
63 OUT UINT8 *Entropy\r
64 );\r
65\r
3b60842c 66#endif // __RD_RAND_H__\r