diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2019-11-12 11:20:17 +0100 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2019-11-12 11:20:17 +0100 |
commit | 2278f452a12d5b5b01f96441a7a4336710365022 (patch) | |
tree | a45a45d098ccecd7edfc3303e38ab4699568e8f5 /drivers/firmware/efi/libstub/random.c | |
parent | a99d8080aaf358d5d23581244e5da23b35e340b9 (diff) | |
parent | d99c1ba6a73b9e93e2884b7893fe19e3c082ba03 (diff) |
Merge tag 'efi-next' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi into efi/core
Pull EFI changes for v5.5 from Ard Biesheuvel:
- Change my email address to @kernel.org so I am no longer at the mercy of
useless corporate email infrastructure
- Wire up the EFI RNG code for x86. This enables an additional source of
entropy during early boot.
- Enable the TPM event log code on ARM platforms.
Diffstat (limited to 'drivers/firmware/efi/libstub/random.c')
-rw-r--r-- | drivers/firmware/efi/libstub/random.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/firmware/efi/libstub/random.c b/drivers/firmware/efi/libstub/random.c index b4b1d1dcb5fd..53f1466f7de6 100644 --- a/drivers/firmware/efi/libstub/random.c +++ b/drivers/firmware/efi/libstub/random.c @@ -9,6 +9,18 @@ #include "efistub.h" +typedef struct efi_rng_protocol efi_rng_protocol_t; + +typedef struct { + u32 get_info; + u32 get_rng; +} efi_rng_protocol_32_t; + +typedef struct { + u64 get_info; + u64 get_rng; +} efi_rng_protocol_64_t; + struct efi_rng_protocol { efi_status_t (*get_info)(struct efi_rng_protocol *, unsigned long *, efi_guid_t *); @@ -28,7 +40,7 @@ efi_status_t efi_get_random_bytes(efi_system_table_t *sys_table_arg, if (status != EFI_SUCCESS) return status; - return rng->get_rng(rng, NULL, size, out); + return efi_call_proto(efi_rng_protocol, get_rng, rng, NULL, size, out); } /* @@ -161,15 +173,16 @@ efi_status_t efi_random_get_seed(efi_system_table_t *sys_table_arg) if (status != EFI_SUCCESS) return status; - status = rng->get_rng(rng, &rng_algo_raw, EFI_RANDOM_SEED_SIZE, - seed->bits); + status = efi_call_proto(efi_rng_protocol, get_rng, rng, &rng_algo_raw, + EFI_RANDOM_SEED_SIZE, seed->bits); + if (status == EFI_UNSUPPORTED) /* * Use whatever algorithm we have available if the raw algorithm * is not implemented. */ - status = rng->get_rng(rng, NULL, EFI_RANDOM_SEED_SIZE, - seed->bits); + status = efi_call_proto(efi_rng_protocol, get_rng, rng, NULL, + EFI_RANDOM_SEED_SIZE, seed->bits); if (status != EFI_SUCCESS) goto err_freepool; |