mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 07:34:06 +02:00
SecurityPkg/RngDxe: Correctly update mAvailableAlgoArrayCount
mAvailableAlgoArrayCount holds the count of available RNG algorithms. In a following patch, its value will be used to prevent the EFI_RNG_PROTOCOL to be installed if no RNG algorithm is available. Correctly set/reset the value for all implementations. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
parent
aa1cd447b3
commit
bfb574db11
@ -40,6 +40,7 @@ FreeAvailableAlgorithms (
|
|||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
mAvailableAlgoArrayCount = 0;
|
||||||
FreePool (mAvailableAlgoArray);
|
FreePool (mAvailableAlgoArray);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,11 @@
|
|||||||
|
|
||||||
#include "RngDxeInternals.h"
|
#include "RngDxeInternals.h"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Count of Rng algorithms.
|
||||||
|
//
|
||||||
|
#define RNG_ALGORITHM_COUNT 2
|
||||||
|
|
||||||
/** Allocate and initialize mAvailableAlgoArray with the available
|
/** Allocate and initialize mAvailableAlgoArray with the available
|
||||||
Rng algorithms. Also update mAvailableAlgoArrayCount.
|
Rng algorithms. Also update mAvailableAlgoArrayCount.
|
||||||
|
|
||||||
@ -38,6 +43,7 @@ GetAvailableAlgorithms (
|
|||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
mAvailableAlgoArrayCount = RNG_ALGORITHM_COUNT;
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,6 +55,7 @@ FreeAvailableAlgorithms (
|
|||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
mAvailableAlgoArrayCount = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +171,7 @@ RngGetInfo (
|
|||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
RequiredSize = 2 * sizeof (EFI_RNG_ALGORITHM);
|
RequiredSize = RNG_ALGORITHM_COUNT * sizeof (EFI_RNG_ALGORITHM);
|
||||||
|
|
||||||
if (*RNGAlgorithmListSize < RequiredSize) {
|
if (*RNGAlgorithmListSize < RequiredSize) {
|
||||||
*RNGAlgorithmListSize = RequiredSize;
|
*RNGAlgorithmListSize = RequiredSize;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user