From patchwork Thu Jan 9 19:58:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 239347 List-Id: U-Boot discussion From: xypron.glpk at gmx.de (Heinrich Schuchardt) Date: Thu, 9 Jan 2020 20:58:57 +0100 Subject: [PATCH 1/1] efi_loader: document functions in efi_rng.c Message-ID: <20200109195857.31259-1-xypron.glpk@gmx.de> Add the missing Sphinx documentation. Signed-off-by: Heinrich Schuchardt --- doc/api/efi.rst | 6 ++++++ lib/efi_loader/efi_rng.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) -- 2.24.1 diff --git a/doc/api/efi.rst b/doc/api/efi.rst index 2ca344932e..bc59382608 100644 --- a/doc/api/efi.rst +++ b/doc/api/efi.rst @@ -131,6 +131,12 @@ Network protocols .. kernel-doc:: lib/efi_loader/efi_net.c :internal: +Random number generator protocol +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. kernel-doc:: lib/efi_loader/efi_rng.c + :internal: + Text IO protocols ~~~~~~~~~~~~~~~~~ diff --git a/lib/efi_loader/efi_rng.c b/lib/efi_loader/efi_rng.c index 432c986204..a1d0ec842c 100644 --- a/lib/efi_loader/efi_rng.c +++ b/lib/efi_loader/efi_rng.c @@ -13,6 +13,17 @@ DECLARE_GLOBAL_DATA_PTR; const efi_guid_t efi_guid_rng_protocol = EFI_RNG_PROTOCOL_GUID; +/** + * platform_get_rng_device() - retrieve random number generator + * + * This function retrieves the udevice implementing a hardware random + * number generator. + * + * This function may be overridden if special initialization is needed. + * + * @dev: udevice + * Return: status code + */ __weak efi_status_t platform_get_rng_device(struct udevice **dev) { int ret; @@ -29,6 +40,18 @@ __weak efi_status_t platform_get_rng_device(struct udevice **dev) return EFI_SUCCESS; } +/** + * rng_getinfo() - get information about random number generation + * + * This function implement the GetInfo() service of the EFI random number + * generator protocol. See the UEFI spec for details. + * + * @this: random number generator protocol instance + * @rng_algorithm_list_size: number of random number generation algorithms + * @rng_algorithm_list: descriptions of random number generation + * algorithms + * Return: status code + */ static efi_status_t EFIAPI rng_getinfo(struct efi_rng_protocol *this, efi_uintn_t *rng_algorithm_list_size, efi_guid_t *rng_algorithm_list) @@ -64,6 +87,18 @@ back: return EFI_EXIT(ret); } +/** + * rng_getrng() - get random value + * + * This function implement the GetRng() service of the EFI random number + * generator protocol. See the UEFI spec for details. + * + * @this: random number generator protocol instance + * @rng_algorithm: random number generation algorithm + * @rng_value_length: number of random bytes to generate, buffer length + * @rng_value: buffer to receive random bytes + * Return: status code + */ static efi_status_t EFIAPI getrng(struct efi_rng_protocol *this, efi_guid_t *rng_algorithm, efi_uintn_t rng_value_length,