1 | /** @file
|
---|
2 |
|
---|
3 | Architecture specific interface to RNG functionality.
|
---|
4 |
|
---|
5 | Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>
|
---|
6 |
|
---|
7 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
8 |
|
---|
9 | **/
|
---|
10 |
|
---|
11 | #ifndef BASE_RNGLIB_INTERNALS_H_
|
---|
12 | #define BASE_RNGLIB_INTERNALS_H_
|
---|
13 |
|
---|
14 | /**
|
---|
15 | Generates a 16-bit random number.
|
---|
16 |
|
---|
17 | @param[out] Rand Buffer pointer to store the 16-bit random value.
|
---|
18 |
|
---|
19 | @retval TRUE Random number generated successfully.
|
---|
20 | @retval FALSE Failed to generate the random number.
|
---|
21 |
|
---|
22 | **/
|
---|
23 | BOOLEAN
|
---|
24 | EFIAPI
|
---|
25 | ArchGetRandomNumber16 (
|
---|
26 | OUT UINT16 *Rand
|
---|
27 | );
|
---|
28 |
|
---|
29 | /**
|
---|
30 | Generates a 32-bit random number.
|
---|
31 |
|
---|
32 | @param[out] Rand Buffer pointer to store the 32-bit random value.
|
---|
33 |
|
---|
34 | @retval TRUE Random number generated successfully.
|
---|
35 | @retval FALSE Failed to generate the random number.
|
---|
36 |
|
---|
37 | **/
|
---|
38 | BOOLEAN
|
---|
39 | EFIAPI
|
---|
40 | ArchGetRandomNumber32 (
|
---|
41 | OUT UINT32 *Rand
|
---|
42 | );
|
---|
43 |
|
---|
44 | /**
|
---|
45 | Generates a 64-bit random number.
|
---|
46 |
|
---|
47 | @param[out] Rand Buffer pointer to store the 64-bit random value.
|
---|
48 |
|
---|
49 | @retval TRUE Random number generated successfully.
|
---|
50 | @retval FALSE Failed to generate the random number.
|
---|
51 |
|
---|
52 | **/
|
---|
53 | BOOLEAN
|
---|
54 | EFIAPI
|
---|
55 | ArchGetRandomNumber64 (
|
---|
56 | OUT UINT64 *Rand
|
---|
57 | );
|
---|
58 |
|
---|
59 | /**
|
---|
60 | Checks whether the RNG instruction is supported.
|
---|
61 |
|
---|
62 | @retval TRUE RNG instruction is supported.
|
---|
63 | @retval FALSE RNG instruction is not supported.
|
---|
64 |
|
---|
65 | **/
|
---|
66 | BOOLEAN
|
---|
67 | EFIAPI
|
---|
68 | ArchIsRngSupported (
|
---|
69 | VOID
|
---|
70 | );
|
---|
71 |
|
---|
72 | #if defined (MDE_CPU_AARCH64)
|
---|
73 |
|
---|
74 | // RNDR, Random Number
|
---|
75 | #define RNDR S3_3_C2_C4_0
|
---|
76 |
|
---|
77 | #endif
|
---|
78 |
|
---|
79 | #endif // BASE_RNGLIB_INTERNALS_H_
|
---|