Lines Matching +full:- +full:seed
1 // SPDX-License-Identifier: GPL-2.0
29 * efi_get_random_bytes() - fill a buffer with random bytes
53 * efi_random_get_seed() - provide random seed as configuration table
70 struct linux_efi_random_seed *prev_seed, *seed = NULL; in efi_random_get_seed() local
88 * Check whether a seed was provided by a prior boot stage. In that in efi_random_get_seed()
91 * Note that we should read the seed size with caution, in case the in efi_random_get_seed()
95 if (prev_seed && prev_seed->size <= 512U) { in efi_random_get_seed()
96 prev_seed_size = prev_seed->size; in efi_random_get_seed()
102 * allocation will survive a kexec reboot (although we refresh the seed in efi_random_get_seed()
106 struct_size(seed, bits, seed_size), in efi_random_get_seed()
107 (void **)&seed); in efi_random_get_seed()
109 efi_warn("Failed to allocate memory for RNG seed.\n"); in efi_random_get_seed()
115 EFI_RANDOM_SEED_SIZE, seed->bits); in efi_random_get_seed()
123 EFI_RANDOM_SEED_SIZE, seed->bits); in efi_random_get_seed()
131 &nv_seed_size, seed->bits + offset); in efi_random_get_seed()
135 * We delete the seed here, and /hope/ that this causes in efi_random_get_seed()
140 * instead, and write a new seed. in efi_random_get_seed()
148 memzero_explicit(seed->bits + offset, nv_seed_size); in efi_random_get_seed()
155 memcpy(seed->bits + offset, prev_seed->bits, prev_seed_size); in efi_random_get_seed()
159 seed->size = offset; in efi_random_get_seed()
160 status = efi_bs_call(install_configuration_table, &rng_table_guid, seed); in efi_random_get_seed()
165 /* wipe and free the old seed if we managed to install the new one */ in efi_random_get_seed()
166 memzero_explicit(prev_seed->bits, prev_seed_size); in efi_random_get_seed()
172 memzero_explicit(seed, struct_size(seed, bits, seed_size)); in efi_random_get_seed()
173 efi_bs_call(free_pool, seed); in efi_random_get_seed()
174 efi_warn("Failed to obtain seed from EFI_RNG_PROTOCOL or EFI variable\n"); in efi_random_get_seed()
177 efi_warn("Retaining bootloader-supplied seed only"); in efi_random_get_seed()