• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Provides random number generator services.
3 
4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution.  The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9 
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 #ifndef __RNG_LIB_H__
16 #define __RNG_LIB_H__
17 
18 /**
19   Generates a 16-bit random number.
20 
21   if Rand is NULL, then ASSERT().
22 
23   @param[out] Rand     Buffer pointer to store the 16-bit random value.
24 
25   @retval TRUE         Random number generated successfully.
26   @retval FALSE        Failed to generate the random number.
27 
28 **/
29 BOOLEAN
30 EFIAPI
31 GetRandomNumber16 (
32   OUT     UINT16                    *Rand
33   );
34 
35 /**
36   Generates a 32-bit random number.
37 
38   if Rand is NULL, then ASSERT().
39 
40   @param[out] Rand     Buffer pointer to store the 32-bit random value.
41 
42   @retval TRUE         Random number generated successfully.
43   @retval FALSE        Failed to generate the random number.
44 
45 **/
46 BOOLEAN
47 EFIAPI
48 GetRandomNumber32 (
49   OUT     UINT32                    *Rand
50   );
51 
52 /**
53   Generates a 64-bit random number.
54 
55   if Rand is NULL, then ASSERT().
56 
57   @param[out] Rand     Buffer pointer to store the 64-bit random value.
58 
59   @retval TRUE         Random number generated successfully.
60   @retval FALSE        Failed to generate the random number.
61 
62 **/
63 BOOLEAN
64 EFIAPI
65 GetRandomNumber64 (
66   OUT     UINT64                    *Rand
67   );
68 
69 /**
70   Generates a 128-bit random number.
71 
72   if Rand is NULL, then ASSERT().
73 
74   @param[out] Rand     Buffer pointer to store the 128-bit random value.
75 
76   @retval TRUE         Random number generated successfully.
77   @retval FALSE        Failed to generate the random number.
78 
79 **/
80 BOOLEAN
81 EFIAPI
82 GetRandomNumber128 (
83   OUT     UINT64                    *Rand
84   );
85 
86 #endif  // __RNG_LIB_H__
87