aboutsummaryrefslogtreecommitdiff
path: root/csprng.c
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2015-10-04 22:31:47 -0400
committerRob Austein <sra@hactrn.net>2015-10-04 22:31:47 -0400
commitb3bbd3dbccef8c499e980490203cd5085dd13a98 (patch)
tree68091332d4e2429fcc9a8533bf2e26b2d49ab791 /csprng.c
parente164eecc55dd96efc98d2c723e96aaaecdcfda13 (diff)
Whack libhal API to use current configure_core_selector mechanism.
Compiles, not yet tested.
Diffstat (limited to 'csprng.c')
-rw-r--r--csprng.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/csprng.c b/csprng.c
index 235bd12..08ca794 100644
--- a/csprng.c
+++ b/csprng.c
@@ -38,12 +38,13 @@
#include <stdio.h>
#include "hal.h"
+#include "verilog_constants.h"
#ifndef WAIT_FOR_CSPRNG_VALID
#define WAIT_FOR_CSPRNG_VALID 0
#endif
-hal_error_t hal_get_random(void *buffer, const size_t length)
+hal_error_t hal_get_random(const hal_core_t *core, void *buffer, const size_t length)
{
uint8_t temp[4], *buf = buffer;
hal_error_t err;
@@ -52,10 +53,10 @@ hal_error_t hal_get_random(void *buffer, const size_t length)
for (i = 0; i < length; i += 4) {
const int last = (length - i) < 4;
- if (WAIT_FOR_CSPRNG_VALID && (err = hal_io_wait_valid(CSPRNG_ADDR_STATUS)) != HAL_OK)
+ if (WAIT_FOR_CSPRNG_VALID && (err = hal_io_wait_valid(core)) != HAL_OK)
return err;
- if ((err = hal_io_read(CSPRNG_ADDR_RANDOM, (last ? temp : &buf[i]), 4)) != HAL_OK)
+ if ((err = hal_io_read(core, CSPRNG_ADDR_RANDOM, (last ? temp : &buf[i]), 4)) != HAL_OK)
return err;
if (last)