random.c (ead5d1f4d877e92c051e1a1ade623d0d30e71619) random.c (7d866e38c7e9ece8a096d0d098fa9d92b9d4f97e)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2016 Linaro Ltd; <ard.biesheuvel@linaro.org>
4 */
5
6#include <linux/efi.h>
7#include <asm/efi.h>
8

--- 61 unchanged lines hidden (view full) ---

70 efi_rng_protocol_t *rng = NULL;
71 struct linux_efi_random_seed *seed = NULL;
72 efi_status_t status;
73
74 status = efi_bs_call(locate_protocol, &rng_proto, NULL, (void **)&rng);
75 if (status != EFI_SUCCESS)
76 return status;
77
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2016 Linaro Ltd; <ard.biesheuvel@linaro.org>
4 */
5
6#include <linux/efi.h>
7#include <asm/efi.h>
8

--- 61 unchanged lines hidden (view full) ---

70 efi_rng_protocol_t *rng = NULL;
71 struct linux_efi_random_seed *seed = NULL;
72 efi_status_t status;
73
74 status = efi_bs_call(locate_protocol, &rng_proto, NULL, (void **)&rng);
75 if (status != EFI_SUCCESS)
76 return status;
77
78 status = efi_bs_call(allocate_pool, EFI_RUNTIME_SERVICES_DATA,
78 /*
79 * Use EFI_ACPI_RECLAIM_MEMORY here so that it is guaranteed that the
80 * allocation will survive a kexec reboot (although we refresh the seed
81 * beforehand)
82 */
83 status = efi_bs_call(allocate_pool, EFI_ACPI_RECLAIM_MEMORY,
79 sizeof(*seed) + EFI_RANDOM_SEED_SIZE,
80 (void **)&seed);
81 if (status != EFI_SUCCESS)
82 return status;
83
84 status = efi_call_proto(rng, get_rng, &rng_algo_raw,
85 EFI_RANDOM_SEED_SIZE, seed->bits);
86

--- 22 unchanged lines hidden ---
84 sizeof(*seed) + EFI_RANDOM_SEED_SIZE,
85 (void **)&seed);
86 if (status != EFI_SUCCESS)
87 return status;
88
89 status = efi_call_proto(rng, get_rng, &rng_algo_raw,
90 EFI_RANDOM_SEED_SIZE, seed->bits);
91

--- 22 unchanged lines hidden ---