summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library/BaseRngLibTimerLib/RngLibTimer.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Library/BaseRngLibTimerLib/RngLibTimer.c')
-rw-r--r--MdeModulePkg/Library/BaseRngLibTimerLib/RngLibTimer.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/MdeModulePkg/Library/BaseRngLibTimerLib/RngLibTimer.c b/MdeModulePkg/Library/BaseRngLibTimerLib/RngLibTimer.c
index 980854d67b..28ff46c71f 100644
--- a/MdeModulePkg/Library/BaseRngLibTimerLib/RngLibTimer.c
+++ b/MdeModulePkg/Library/BaseRngLibTimerLib/RngLibTimer.c
@@ -2,14 +2,18 @@
BaseRng Library that uses the TimerLib to provide reasonably random numbers.
Do not use this on a production system.
+ Copyright (c) 2023, Arm Limited. All rights reserved.
Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <Base.h>
+#include <Uefi.h>
#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/TimerLib.h>
+#include <Guid/RngAlgorithm.h>
#define DEFAULT_DELAY_TIME_IN_MICROSECONDS 10
@@ -190,3 +194,27 @@ GetRandomNumber128 (
// Read second 64 bits
return GetRandomNumber64 (++Rand);
}
+
+/**
+ Get a GUID identifying the RNG algorithm implementation.
+
+ @param [out] RngGuid If success, contains the GUID identifying
+ the RNG algorithm implementation.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_UNSUPPORTED Not supported.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+EFI_STATUS
+EFIAPI
+GetRngGuid (
+ GUID *RngGuid
+ )
+{
+ if (RngGuid == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ CopyMem (RngGuid, &gEdkiiRngAlgorithmUnSafe, sizeof (*RngGuid));
+ return EFI_SUCCESS;
+}