[PATCH v4 0/3] Add support for efi_rng_protocol

Heinrich Schuchardt xypron.glpk at gmx.de
Sat Dec 28 22:55:39 CET 2019


On 12/28/19 7:31 PM, Sughosh Ganu wrote:
> The patch series adds support for the EFI_RNG_PROTOCOL routines for
> qemu arm64 platform. The getrng routine, used to get the random bytes,
> uses the virtio-rng device found on the platform. The protocol, once
> installed, can be used by the efi stub in the kernel for getting
> random bytes needed for the kaslr feature.
>
> These patches apply on top of the patch series to add random number
> generator driver uclass[1]
>
> [1] - https://lists.denx.de/pipermail/u-boot/2019-December/394804.html
>
> Changes since V3:
> * Handle review comments from Heinrich Schuchardt related to calling
>    EFI_EXIT at the end of the efi_rng_protocol routines using a goto
>    label.
> * Add a weak function platform_get_rng_device based on review comment
>    from Heinrich Schuchardt.
>
> Changes since V2:
> * Based on review comments from Heinrich Schuchardt, the rng drivers
>    read all the bytes requested in the individual
>    drivers. Corresponding changes made in getrng routine to remove the
>    loop to read the bytes requested, since that would be handled in the
>    drivers.
>
> Changes since V1:
> * Handle review comments from Heinrich Schuchardt.
> * Change the logic in the getrng routine to implement a loop to read
>    the number of bytes requested. This change is needed to handle the
>    change in the rng uclass's read function, which now returns the
>    number of bytes read, which might be less than the number of bytes
>    requested.
>
>
> Sughosh Ganu (3):
>    efi_loader: Add guidcpy function
>    efi: qemu: arm64: Add efi_rng_protocol implementation for the platform
>    efi_rng_protocol: Install the efi_rng_protocol on the root node
>
>   board/emulation/qemu-arm/qemu-arm.c |  42 ++++++++++++++
>   include/efi_loader.h                |   9 +++
>   include/efi_rng.h                   |  32 ++++++++++
>   lib/efi_loader/Kconfig              |   8 +++
>   lib/efi_loader/Makefile             |   1 +
>   lib/efi_loader/efi_boottime.c       |   4 +-
>   lib/efi_loader/efi_rng.c            | 113 ++++++++++++++++++++++++++++++++++++
>   lib/efi_loader/efi_root_node.c      |   4 ++
>   8 files changed, 211 insertions(+), 2 deletions(-)
>   create mode 100644 include/efi_rng.h
>   create mode 100644 lib/efi_loader/efi_rng.c
>

After fixing the buffer overrun in the virtio_rng.c driver your code
passes the EDK II SCT tests without problems on qemu_arm64_defconfig.

Thanks for all the effort you have put into this.

Best regards

Heinrich


More information about the U-Boot mailing list