]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/RandomNumberGenerator/RngDxe/RdRand.h
SecurityPkg: Replace BSD License with BSD+Patent License
[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
289b714b 13SPDX-License-Identifier: BSD-2-Clause-Patent\r
3aa8dc6c
LQ
14\r
15**/\r
16\r
17#ifndef __RD_RAND_H__\r
18#define __RD_RAND_H__\r
19\r
20#include <Library/BaseLib.h>\r
21#include <Library/BaseMemoryLib.h>\r
22#include <Library/UefiBootServicesTableLib.h>\r
23#include <Library/TimerLib.h>\r
24#include <Protocol/Rng.h>\r
25\r
3aa8dc6c
LQ
26/**\r
27 Calls RDRAND to fill a buffer of arbitrary size with random bytes.\r
28\r
29 @param[in] Length Size of the buffer, in bytes, to fill with.\r
30 @param[out] RandBuffer Pointer to the buffer to store the random result.\r
31\r
32 @retval EFI_SUCCESS Random bytes generation succeeded.\r
33 @retval EFI_NOT_READY Failed to request random bytes.\r
34\r
35**/\r
36EFI_STATUS\r
37EFIAPI\r
38RdRandGetBytes (\r
39 IN UINTN Length,\r
40 OUT UINT8 *RandBuffer\r
41 );\r
42\r
43/**\r
44 Generate high-quality entropy source through RDRAND.\r
45\r
46 @param[in] Length Size of the buffer, in bytes, to fill with.\r
47 @param[out] Entropy Pointer to the buffer to store the entropy data.\r
48\r
49 @retval EFI_SUCCESS Entropy generation succeeded.\r
50 @retval EFI_NOT_READY Failed to request random data.\r
51\r
52**/\r
53EFI_STATUS\r
54EFIAPI\r
55RdRandGenerateEntropy (\r
56 IN UINTN Length,\r
57 OUT UINT8 *Entropy\r
58 );\r
59\r
3b60842c 60#endif // __RD_RAND_H__\r