1 | /** @file
|
---|
2 | Provides random number generator services.
|
---|
3 |
|
---|
4 | Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #ifndef __RNG_LIB_H__
|
---|
10 | #define __RNG_LIB_H__
|
---|
11 |
|
---|
12 | /**
|
---|
13 | Generates a 16-bit random number.
|
---|
14 |
|
---|
15 | if Rand is NULL, then ASSERT().
|
---|
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 | GetRandomNumber16 (
|
---|
26 | OUT UINT16 *Rand
|
---|
27 | );
|
---|
28 |
|
---|
29 | /**
|
---|
30 | Generates a 32-bit random number.
|
---|
31 |
|
---|
32 | if Rand is NULL, then ASSERT().
|
---|
33 |
|
---|
34 | @param[out] Rand Buffer pointer to store the 32-bit random value.
|
---|
35 |
|
---|
36 | @retval TRUE Random number generated successfully.
|
---|
37 | @retval FALSE Failed to generate the random number.
|
---|
38 |
|
---|
39 | **/
|
---|
40 | BOOLEAN
|
---|
41 | EFIAPI
|
---|
42 | GetRandomNumber32 (
|
---|
43 | OUT UINT32 *Rand
|
---|
44 | );
|
---|
45 |
|
---|
46 | /**
|
---|
47 | Generates a 64-bit random number.
|
---|
48 |
|
---|
49 | if Rand is NULL, then ASSERT().
|
---|
50 |
|
---|
51 | @param[out] Rand Buffer pointer to store the 64-bit random value.
|
---|
52 |
|
---|
53 | @retval TRUE Random number generated successfully.
|
---|
54 | @retval FALSE Failed to generate the random number.
|
---|
55 |
|
---|
56 | **/
|
---|
57 | BOOLEAN
|
---|
58 | EFIAPI
|
---|
59 | GetRandomNumber64 (
|
---|
60 | OUT UINT64 *Rand
|
---|
61 | );
|
---|
62 |
|
---|
63 | /**
|
---|
64 | Generates a 128-bit random number.
|
---|
65 |
|
---|
66 | if Rand is NULL, then ASSERT().
|
---|
67 |
|
---|
68 | @param[out] Rand Buffer pointer to store the 128-bit random value.
|
---|
69 |
|
---|
70 | @retval TRUE Random number generated successfully.
|
---|
71 | @retval FALSE Failed to generate the random number.
|
---|
72 |
|
---|
73 | **/
|
---|
74 | BOOLEAN
|
---|
75 | EFIAPI
|
---|
76 | GetRandomNumber128 (
|
---|
77 | OUT UINT64 *Rand
|
---|
78 | );
|
---|
79 |
|
---|
80 | #endif // __RNG_LIB_H__
|
---|