aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2015-10-04 23:04:33 -0400
committerRob Austein <sra@hactrn.net>2015-10-04 23:04:33 -0400
commitc48caf83239f971edf17c978ef7d0987e3aaa718 (patch)
tree6e057442a25000f48c59a5aba2dc70c96e2f5521
parentb3bbd3dbccef8c499e980490203cd5085dd13a98 (diff)
Helps to select the CSPRNG core before trying to call it.
-rw-r--r--csprng.c3
1 files changed, 3 insertions, 0 deletions
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;