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:
Родитель
aa1cd447b3
Коммит
bfb574db11
|
@ -40,6 +40,7 @@ FreeAvailableAlgorithms (
|
|||
VOID
|
||||
)
|
||||
{
|
||||
mAvailableAlgoArrayCount = 0;
|
||||
FreePool (mAvailableAlgoArray);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,11 @@
|
|||
|
||||
#include "RngDxeInternals.h"
|
||||
|
||||
//
|
||||
// Count of Rng algorithms.
|
||||
//
|
||||
#define RNG_ALGORITHM_COUNT 2
|
||||
|
||||
/** Allocate and initialize mAvailableAlgoArray with the available
|
||||
Rng algorithms. Also update mAvailableAlgoArrayCount.
|
||||
|
||||
|
@ -38,6 +43,7 @@ GetAvailableAlgorithms (
|
|||
VOID
|
||||
)
|
||||
{
|
||||
mAvailableAlgoArrayCount = RNG_ALGORITHM_COUNT;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -49,6 +55,7 @@ FreeAvailableAlgorithms (
|
|||
VOID
|
||||
)
|
||||
{
|
||||
mAvailableAlgoArrayCount = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -164,7 +171,7 @@ RngGetInfo (
|
|||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
RequiredSize = 2 * sizeof (EFI_RNG_ALGORITHM);
|
||||
RequiredSize = RNG_ALGORITHM_COUNT * sizeof (EFI_RNG_ALGORITHM);
|
||||
|
||||
if (*RNGAlgorithmListSize < RequiredSize) {
|
||||
*RNGAlgorithmListSize = RequiredSize;
|
||||
|
|
Загрузка…
Ссылка в новой задаче