]>
git.proxmox.com Git - mirror_edk2.git/blob - SecurityPkg/RandomNumberGenerator/RngDxe/Arm/ArmAlgo.c
4 Copyright (c) 2022, Arm Limited. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
8 #include <Library/BaseLib.h>
9 #include <Library/BaseMemoryLib.h>
10 #include <Library/DebugLib.h>
11 #include <Library/MemoryAllocationLib.h>
12 #include <Library/ArmTrngLib.h>
14 #include "RngDxeInternals.h"
16 // Maximum number of Rng algorithms.
17 #define RNG_AVAILABLE_ALGO_MAX 1
19 /** Allocate and initialize mAvailableAlgoArray with the available
20 Rng algorithms. Also update mAvailableAlgoArrayCount.
22 @retval EFI_SUCCESS The function completed successfully.
23 @retval EFI_OUT_OF_RESOURCES Could not allocate memory.
27 GetAvailableAlgorithms (
34 // Rng algorithms 2 times, one for the allocation, one to populate.
35 mAvailableAlgoArray
= AllocateZeroPool (RNG_AVAILABLE_ALGO_MAX
);
36 if (mAvailableAlgoArray
== NULL
) {
37 return EFI_OUT_OF_RESOURCES
;
40 // Raw algorithm (Trng)
41 if (!EFI_ERROR (GetArmTrngVersion (&MajorRevision
, &MinorRevision
))) {
43 &mAvailableAlgoArray
[mAvailableAlgoArrayCount
],
45 sizeof (EFI_RNG_ALGORITHM
)
47 mAvailableAlgoArrayCount
++;