kernel: random: Rename early random get function

Rename z_early_boot_rand_get with z_early_rand_get to get consistent
with other early functions.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2023-10-09 15:22:18 -07:00 committed by Johan Hedberg
commit f9c7a5e6fb
4 changed files with 9 additions and 9 deletions

View file

@ -149,7 +149,7 @@ extern void smp_timer_init(void);
#endif #endif
#endif #endif
extern void z_early_boot_rand_get(uint8_t *buf, size_t length); extern void z_early_rand_get(uint8_t *buf, size_t length);
#if CONFIG_STACK_POINTER_RANDOM #if CONFIG_STACK_POINTER_RANDOM
extern int z_stack_adjust_initialized; extern int z_stack_adjust_initialized;

View file

@ -510,7 +510,7 @@ static FUNC_NORETURN void switch_to_main_thread(char *stack_ptr)
#if defined(CONFIG_ENTROPY_HAS_DRIVER) || defined(CONFIG_TEST_RANDOM_GENERATOR) #if defined(CONFIG_ENTROPY_HAS_DRIVER) || defined(CONFIG_TEST_RANDOM_GENERATOR)
__boot_func __boot_func
void z_early_boot_rand_get(uint8_t *buf, size_t length) void z_early_rand_get(uint8_t *buf, size_t length)
{ {
#ifdef CONFIG_ENTROPY_HAS_DRIVER #ifdef CONFIG_ENTROPY_HAS_DRIVER
const struct device *const entropy = DEVICE_DT_GET_OR_NULL(DT_CHOSEN(zephyr_entropy)); const struct device *const entropy = DEVICE_DT_GET_OR_NULL(DT_CHOSEN(zephyr_entropy));
@ -592,7 +592,7 @@ FUNC_NORETURN void z_cstart(void)
#ifdef CONFIG_STACK_CANARIES #ifdef CONFIG_STACK_CANARIES
uintptr_t stack_guard; uintptr_t stack_guard;
z_early_boot_rand_get((uint8_t *)&stack_guard, sizeof(stack_guard)); z_early_rand_get((uint8_t *)&stack_guard, sizeof(stack_guard));
__stack_chk_guard = stack_guard; __stack_chk_guard = stack_guard;
__stack_chk_guard <<= 8; __stack_chk_guard <<= 8;
#endif /* CONFIG_STACK_CANARIES */ #endif /* CONFIG_STACK_CANARIES */

View file

@ -464,7 +464,7 @@ static size_t random_offset(size_t stack_size)
size_t random_val; size_t random_val;
if (!z_stack_adjust_initialized) { if (!z_stack_adjust_initialized) {
z_early_boot_rand_get((uint8_t *)&random_val, sizeof(random_val)); z_early_rand_get((uint8_t *)&random_val, sizeof(random_val));
} else { } else {
sys_rand_get((uint8_t *)&random_val, sizeof(random_val)); sys_rand_get((uint8_t *)&random_val, sizeof(random_val));
} }

View file

@ -8,7 +8,7 @@
/* /*
* This tests the following random number routines: * This tests the following random number routines:
* void z_early_boot_rand_get(uint8_t *buf, size_t length) * void z_early_rand_get(uint8_t *buf, size_t length)
* uint32_t sys_rand32_get(void); * uint32_t sys_rand32_get(void);
*/ */
@ -35,11 +35,11 @@ ZTEST(rand32_common, test_rand32)
/* Test early boot random number generation function */ /* Test early boot random number generation function */
/* Cover the case, where argument "length" is < size of "size_t" */ /* Cover the case, where argument "length" is < size of "size_t" */
z_early_boot_rand_get((uint8_t *)&tmp, (size_t)1); z_early_rand_get((uint8_t *)&tmp, (size_t)1);
z_early_boot_rand_get((uint8_t *)&last_gen, sizeof(last_gen)); z_early_rand_get((uint8_t *)&last_gen, sizeof(last_gen));
z_early_boot_rand_get((uint8_t *)&gen, sizeof(gen)); z_early_rand_get((uint8_t *)&gen, sizeof(gen));
zassert_true(last_gen != gen && last_gen != tmp && tmp != gen, zassert_true(last_gen != gen && last_gen != tmp && tmp != gen,
"z_early_boot_rand_get failed"); "z_early_rand_get failed");
/* /*
* Test subsequently calls sys_rand32_get(), checking * Test subsequently calls sys_rand32_get(), checking