VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseLib/X86RdRand.c@ 80924

Last change on this file since 80924 was 80721, checked in by vboxsync, 6 years ago

Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1/** @file
2 IA-32/x64 AsmRdRandxx()
3 Generates random number through CPU RdRand instruction.
4
5 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8**/
9
10#include "BaseLibInternals.h"
11
12/**
13 Generates a 16-bit random number through RDRAND instruction.
14
15 if Rand is NULL, then ASSERT().
16
17 @param[out] Rand Buffer pointer to store the random result.
18
19 @retval TRUE RDRAND call was successful.
20 @retval FALSE Failed attempts to call RDRAND.
21
22 **/
23BOOLEAN
24EFIAPI
25AsmRdRand16 (
26 OUT UINT16 *Rand
27 )
28{
29 ASSERT (Rand != NULL);
30 return InternalX86RdRand16 (Rand);
31}
32
33/**
34 Generates a 32-bit random number through RDRAND instruction.
35
36 if Rand is NULL, then ASSERT().
37
38 @param[out] Rand Buffer pointer to store the random result.
39
40 @retval TRUE RDRAND call was successful.
41 @retval FALSE Failed attempts to call RDRAND.
42
43**/
44BOOLEAN
45EFIAPI
46AsmRdRand32 (
47 OUT UINT32 *Rand
48 )
49{
50 ASSERT (Rand != NULL);
51 return InternalX86RdRand32 (Rand);
52}
53
54/**
55 Generates a 64-bit random number through RDRAND instruction.
56
57 if Rand is NULL, then ASSERT().
58
59 @param[out] Rand Buffer pointer to store the random result.
60
61 @retval TRUE RDRAND call was successful.
62 @retval FALSE Failed attempts to call RDRAND.
63
64**/
65BOOLEAN
66EFIAPI
67AsmRdRand64 (
68 OUT UINT64 *Rand
69 )
70{
71 ASSERT (Rand != NULL);
72 return InternalX86RdRand64 (Rand);
73}
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette