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