[Cryptech-Commits] [sw/libhal] 05/06: remove dependency on csprng

git at cryptech.is git at cryptech.is
Mon Nov 16 21:42:45 UTC 2015


This is an automated email from the git hooks/post-receive script.

paul at psgd.org pushed a commit to branch master
in repository sw/libhal.

commit eda8daef7822536a59642efc13bb5d0f6b0430ff
Author: Paul Selkirk <paul at psgd.org>
Date:   Mon Nov 16 14:29:29 2015 -0500

    remove dependency on csprng
---
 tests/test-bus.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/tests/test-bus.c b/tests/test-bus.c
index be0eadb..d30f3fc 100644
--- a/tests/test-bus.c
+++ b/tests/test-bus.c
@@ -45,24 +45,19 @@
 #define TEST_NUM_ROUNDS         2000000
 
 /*
- * Sanity test - are the cores present, and can we get a random number?
+ * Sanity test - can we read and write the dummy register?
  */
 
-static int sanity(const hal_core_t *board_core, const hal_core_t *csprng_core)
+static int sanity(const hal_core_t *board_core)
 {
-    uint32_t rnd, data;
+    uint32_t rnd = 0xdeadbeef, data;
     hal_error_t err;
 
-    if (board_core == NULL || csprng_core == NULL) {
+    if (board_core == NULL) {
         printf("initialization failed (is the bitstream loaded?)\n");
         return 1;
     }
 
-    if ((err = hal_get_random(csprng_core, (void *) &rnd, sizeof(rnd))) != HAL_OK) {
-        printf("reading CSPRNG: %s\n", hal_error_string(err));
-        return 1;
-    }
-
     if ((err = hal_io_write(board_core, 0xFF, (const uint8_t *) &rnd, sizeof(rnd))) != HAL_OK) {
         printf("writing dummy: %s\n", hal_error_string(err));
         return 1;
@@ -145,10 +140,9 @@ static int test_write(const hal_core_t *board_core)
 int main(void)
 {
     const hal_core_t *board_core = hal_core_find(NOVENA_BOARD_NAME, NULL);
-    const hal_core_t *csprng_core = hal_core_find(CSPRNG_NAME, NULL);
     int err = 0;
 
-    if (sanity(board_core, csprng_core) != 0)
+    if (sanity(board_core) != 0)
         return 1;
 
     time_check("read  ", test_read(board_core));



More information about the Commits mailing list