[Cryptech-Commits] [core/platform/novena] 01/01: Adding functions to check core strings as a way to detect that we can talk to the trng before extracting data.

git at cryptech.is git at cryptech.is
Mon Apr 20 15:14:20 UTC 2015


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

joachim at secworks.se pushed a commit to branch master
in repository core/platform/novena.

commit d488a7f93ec4952f606ba82a48f446b7d15659b7
Author: Joachim Strömbergson <joachim at secworks.se>
Date:   Mon Apr 20 17:14:11 2015 +0200

    Adding functions to check core strings as a way to detect that we can talk to the trng before extracting data.
---
 eim/sw/trng_extractor_eim.c | 54 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 53 insertions(+), 1 deletion(-)

diff --git a/eim/sw/trng_extractor_eim.c b/eim/sw/trng_extractor_eim.c
index be6ab16..36e653e 100644
--- a/eim/sw/trng_extractor_eim.c
+++ b/eim/sw/trng_extractor_eim.c
@@ -43,7 +43,7 @@
 #include "tc_eim.h"
 #include "cryptech_memory_map.h"
 
-char *usage = 
+char *usage =
 "%s [-a|r|c] [-n #] [-o file]\n\
 \n\
 -a      avalanche entropy\n\
@@ -55,6 +55,58 @@ char *usage =
 
 int debug = 0;          /* for dump() */
 
+
+// Check availability of avalanche entropy core by reading core name and version.
+uint32_t avalanche_check(void)
+{
+    uint8_t name0[4]   = "extn";
+    uint8_t name1[4]   = "oise";
+    uint8_t version[4] = "0.10";
+
+    printf("Reading name and version words from avalanche_entropy core.\n");
+
+    return
+        tc_expected(ENTROPY1_ADDR_NAME0, name0, 4) ||
+        tc_expected(ENTROPY1_ADDR_NAME1, name1, 4) ||
+        tc_expected(ENTROPY1_ADDR_VERSION, version, 4);
+}
+
+
+// check availability of rosc core by reading the core name and version.
+uint32_t rosc_check(void)
+{
+    uint8_t name0[4]   = "rosc";
+    uint8_t name1[4]   = " ent";
+    uint8_t version[4] = "0.10";
+
+    printf("Reading name and version words from rosc_entropy core.\n");
+
+    return
+        tc_expected(ENTROPY2_ADDR_NAME0, name0, 4) ||
+        tc_expected(ENTROPY2_ADDR_NAME1, name1, 4) ||
+        tc_expected(ENTROPY2_ADDR_VERSION, version, 4);
+}
+
+
+// Check availability of trng by reading core name and version.
+uint32_t trng_check(void)
+{
+//    uint8_t name0[4]   = "extn";
+//    uint8_t name1[4]   = "oise";
+//    uint8_t version[4] = "0.10";
+//
+//    if (!quiet)
+//        printf("TC2: Reading name and version words from avalanche_entropy core.\n");
+//
+//    return
+//        tc_expected(ENTROPY1_ADDR_NAME0, name0, 4) ||
+//        tc_expected(ENTROPY1_ADDR_NAME1, name1, 4) ||
+//        tc_expected(ENTROPY1_ADDR_VERSION, version, 4);
+
+  return (uint32_t) 0;
+}
+
+
 /* extract one data sample */
 static int extract(off_t status_addr, off_t data_addr, uint32_t *data)
 {



More information about the Commits mailing list