]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/X86RdRand.c
2 IA-32/x64 AsmRdRandxx()
3 Generates random number through CPU RdRand instruction.
5 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include "BaseLibInternals.h"
19 Generates a 16-bit random number through RDRAND instruction.
21 if Rand is NULL, then ASSERT().
23 @param[out] Rand Buffer pointer to store the random result.
25 @retval TRUE RDRAND call was successful.
26 @retval FALSE Failed attempts to call RDRAND.
35 ASSERT (Rand
!= NULL
);
36 return InternalX86RdRand16 (Rand
);
40 Generates a 32-bit random number through RDRAND instruction.
42 if Rand is NULL, then ASSERT().
44 @param[out] Rand Buffer pointer to store the random result.
46 @retval TRUE RDRAND call was successful.
47 @retval FALSE Failed attempts to call RDRAND.
56 ASSERT (Rand
!= NULL
);
57 return InternalX86RdRand32 (Rand
);
61 Generates a 64-bit random number through RDRAND instruction.
63 if Rand is NULL, then ASSERT().
65 @param[out] Rand Buffer pointer to store the random result.
67 @retval TRUE RDRAND call was successful.
68 @retval FALSE Failed attempts to call RDRAND.
77 ASSERT (Rand
!= NULL
);
78 return InternalX86RdRand64 (Rand
);