SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.c File Reference


Functions

EFI_STATUS EFIAPI RngGetInfo (IN EFI_RNG_PROTOCOL *This, IN OUT UINTN *RNGAlgorithmListSize, OUT EFI_RNG_ALGORITHM *RNGAlgorithmList)
EFI_STATUS EFIAPI RngGetRNG (IN EFI_RNG_PROTOCOL *This, IN EFI_RNG_ALGORITHM *RNGAlgorithm, IN UINTN RNGValueLength, OUT UINT8 *RNGValue)
EFI_STATUS EFIAPI RngDriverEntry (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)

Variables

EFI_RNG_ALGORITHM mSupportedRngAlgorithms []
EFI_RNG_PROTOCOL mRngRdRand

Detailed Description

RNG Driver to produce the UEFI Random Number Generator protocol.

The driver will use the new RDRAND instruction to produce high-quality, high-performance entropy and random number.

RNG Algoritnms defined in UEFI 2.4:

Copyright (c) 2013, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.


Function Documentation

EFI_STATUS EFIAPI RngDriverEntry ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE *  SystemTable 
)

The user Entry Point for the Random Number Generator (RNG) driver.

Parameters:
[in] ImageHandle The firmware allocated handle for the EFI image.
[in] SystemTable A pointer to the EFI System Table.
Return values:
EFI_SUCCESS The entry point is executed successfully.
EFI_NOT_SUPPORTED Platform does not support RNG.
Other Some error occurs when executing this entry point.

References EFI_STATUS(), IsRdRandSupported(), and mRngRdRand.

EFI_STATUS EFIAPI RngGetInfo ( IN EFI_RNG_PROTOCOL *  This,
IN OUT UINTN *  RNGAlgorithmListSize,
OUT EFI_RNG_ALGORITHM *  RNGAlgorithmList 
)

Returns information about the random number generation implementation.

Parameters:
[in] This A pointer to the EFI_RNG_PROTOCOL instance.
[in,out] RNGAlgorithmListSize On input, the size in bytes of RNGAlgorithmList. On output with a return code of EFI_SUCCESS, the size in bytes of the data returned in RNGAlgorithmList. On output with a return code of EFI_BUFFER_TOO_SMALL, the size of RNGAlgorithmList required to obtain the list.
[out] RNGAlgorithmList A caller-allocated memory buffer filled by the driver with one EFI_RNG_ALGORITHM element for each supported RNG algorithm. The list must not change across multiple calls to the same driver. The first algorithm in the list is the default algorithm for the driver.
Return values:
EFI_SUCCESS The RNG algorithm list was returned successfully.
EFI_UNSUPPORTED The services is not supported by this driver.
EFI_DEVICE_ERROR The list of algorithms could not be retrieved due to a hardware or firmware error.
EFI_INVALID_PARAMETER One or more of the parameters are incorrect.
EFI_BUFFER_TOO_SMALL The buffer RNGAlgorithmList is too small to hold the result.

References EFI_STATUS(), mSupportedRngAlgorithms, and UINTN().

EFI_STATUS EFIAPI RngGetRNG ( IN EFI_RNG_PROTOCOL *  This,
IN EFI_RNG_ALGORITHM *  RNGAlgorithm,
IN UINTN  RNGValueLength,
OUT UINT8 *  RNGValue 
)

Produces and returns an RNG value using either the default or specified RNG algorithm.

Parameters:
[in] This A pointer to the EFI_RNG_PROTOCOL instance.
[in] RNGAlgorithm A pointer to the EFI_RNG_ALGORITHM that identifies the RNG algorithm to use. May be NULL in which case the function will use its default RNG algorithm.
[in] RNGValueLength The length in bytes of the memory buffer pointed to by RNGValue. The driver shall return exactly this numbers of bytes.
[out] RNGValue A caller-allocated memory buffer filled by the driver with the resulting RNG value.
Return values:
EFI_SUCCESS The RNG value was returned successfully.
EFI_UNSUPPORTED The algorithm specified by RNGAlgorithm is not supported by this driver.
EFI_DEVICE_ERROR An RNG value could not be retrieved due to a hardware or firmware error.
EFI_NOT_READY There is not enough random data available to satisfy the length requested by RNGValueLength.
EFI_INVALID_PARAMETER RNGValue is NULL or RNGValueLength is zero.

References EFI_STATUS(), RdRandGenerateEntropy(), and RdRandGetBytes().


Variable Documentation

EFI_RNG_PROTOCOL mRngRdRand

Initial value:

Referenced by RngDriverEntry().

EFI_RNG_ALGORITHM mSupportedRngAlgorithms[]

Initial value:

 {
  EFI_RNG_ALGORITHM_SP800_90_CTR_256_GUID,
  EFI_RNG_ALGORITHM_RAW
}

Referenced by RngGetInfo().


Generated on Thu Sep 24 23:44:24 2015 for SecurityPkg[ALL] by  doxygen 1.5.7.1