TianoCore EDK2 master
Loading...
Searching...
No Matches
ArmAlgo.c
Go to the documentation of this file.
1
8#include <Library/BaseLib.h>
10#include <Library/DebugLib.h>
12#include <Library/ArmTrngLib.h>
13
14#include "RngDxeInternals.h"
15
16// Maximum number of Rng algorithms.
17#define RNG_AVAILABLE_ALGO_MAX 1
18
26EFIAPI
28 VOID
29 )
30{
31 UINT16 MajorRevision;
32 UINT16 MinorRevision;
33
34 // Rng algorithms 2 times, one for the allocation, one to populate.
35 mAvailableAlgoArray = AllocateZeroPool (RNG_AVAILABLE_ALGO_MAX * sizeof (EFI_RNG_ALGORITHM));
36 if (mAvailableAlgoArray == NULL) {
37 return EFI_OUT_OF_RESOURCES;
38 }
39
40 // Raw algorithm (Trng)
41 if (!EFI_ERROR (GetArmTrngVersion (&MajorRevision, &MinorRevision))) {
42 CopyMem (
43 &mAvailableAlgoArray[mAvailableAlgoArrayCount],
44 &gEfiRngAlgorithmRaw,
45 sizeof (EFI_RNG_ALGORITHM)
46 );
47 mAvailableAlgoArrayCount++;
48 }
49
50 return EFI_SUCCESS;
51}
EFI_STATUS EFIAPI GetAvailableAlgorithms(VOID)
Definition: ArmAlgo.c:27
RETURN_STATUS EFIAPI GetArmTrngVersion(OUT UINT16 *MajorRevision, OUT UINT16 *MinorRevision)
Definition: ArmTrngLib.c:82
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
#define NULL
Definition: Base.h:319
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
Definition: Base.h:213