From c48caf83239f971edf17c978ef7d0987e3aaa718 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Sun, 4 Oct 2015 23:04:33 -0400 Subject: Helps to select the CSPRNG core before trying to call it. --- csprng.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'csprng.c') diff --git a/csprng.c b/csprng.c index 08ca794..4fc80d0 100644 --- a/csprng.c +++ b/csprng.c @@ -50,6 +50,9 @@ hal_error_t hal_get_random(const hal_core_t *core, void *buffer, const size_t le hal_error_t err; size_t i; + if ((err = hal_core_check_name(&core, CSPRNG_NAME)) != HAL_OK) + return err; + for (i = 0; i < length; i += 4) { const int last = (length - i) < 4; -- cgit v1.2.3