]> git.baikalelectronics.ru Git - uboot.git/commitdiff
efi_loader: initialize the RNG protocol after the TCC2
authorIlias Apalodimas <ilias.apalodimas@linaro.org>
Fri, 22 Jul 2022 16:02:03 +0000 (21:32 +0530)
committerIlias Apalodimas <ilias.apalodimas@linaro.org>
Tue, 2 Aug 2022 20:50:02 +0000 (23:50 +0300)
Due to U-Boot's lazy binding the RNG presented by the TCG is not available
until the EFI_TCG2 protocol has been initialized.  Since the TPM has a
built-in RNG device we can use for the OS randomization, move the RNG
protocol installation after the TCG.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
lib/efi_loader/efi_setup.c

index 492ecf4cb15c93bc00a8afbf4a3b251a5cabf1b4..751beda59025572065437a8af52b5cbeb1119ae6 100644 (file)
@@ -246,13 +246,6 @@ efi_status_t efi_init_obj_list(void)
        /* Set up console modes */
        efi_setup_console_size();
 
-       /* Install EFI_RNG_PROTOCOL */
-       if (IS_ENABLED(CONFIG_EFI_RNG_PROTOCOL)) {
-               ret = efi_rng_register();
-               if (ret != EFI_SUCCESS)
-                       goto out;
-       }
-
        /* Initialize variable services */
        ret = efi_init_variables();
        if (ret != EFI_SUCCESS)
@@ -289,6 +282,13 @@ efi_status_t efi_init_obj_list(void)
                        goto out;
        }
 
+       /* Install EFI_RNG_PROTOCOL */
+       if (IS_ENABLED(CONFIG_EFI_RNG_PROTOCOL)) {
+               ret = efi_rng_register();
+               if (ret != EFI_SUCCESS)
+                       goto out;
+       }
+
        if (IS_ENABLED(CONFIG_EFI_RISCV_BOOT_PROTOCOL)) {
                ret = efi_riscv_register();
                if (ret != EFI_SUCCESS)