aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eim/sw/trng_extractor_eim.c54
1 files changed, 53 insertions, 1 deletions
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)
{