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