From 7bc543a279dca902bbbefedb66e5f639b82de635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Stro=CC=88mbergson?= Date: Tue, 21 Apr 2015 15:08:16 +0200 Subject: (1) Changed to using symbolic defines for core name and version. (2) Minor cleanup of defines in header file. --- eim/sw/cryptech_memory_map.h | 20 +++++++++++++++++--- eim/sw/trng_extractor_eim.c | 12 ++++++------ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/eim/sw/cryptech_memory_map.h b/eim/sw/cryptech_memory_map.h index dd4dc36..1dea087 100644 --- a/eim/sw/cryptech_memory_map.h +++ b/eim/sw/cryptech_memory_map.h @@ -88,12 +88,11 @@ #define NOVENA_BOARD_NAME1 " "; #define NOVENA_BOARD_VERSION "0.10"; -#define EIM_INTERFACE_NAME0 "eim "; -#define EIM_INTERFACE_NAME1 " "; +#define EIM_INTERFACE_NAME0 "eim "; +#define EIM_INTERFACE_NAME1 " "; #define EIM_INTERFACE_VERSION "0.10"; - //------------------------------------------------------------------ // Hashes segment. //------------------------------------------------------------------ @@ -153,6 +152,18 @@ #define MODE_SHA_384 2 << 2 #define MODE_SHA_512 3 << 2 +#define SHA1_NAME0 "sha1" +#define SHA1_NAME1 " " +#define SHA1_VERSION "0.50" + +#define SHA256_NAME0 "sha2"; +#define SHA256_NAME1 "-256"; +#define SHA256_VERSION "0.80"; + +#define SHA512_NAME0 "sha2"; +#define SHA512_NAME1 "-512"; +#define SHA512_VERSION "0.80"; + // ----------------------------------------------------------------- // TRNG segment. @@ -221,6 +232,9 @@ #define CSPRNG_ADDR_NBLOCKS_LO CSPRNG_ADDR_BASE + ADDR(0x41) #define CSPRNG_ADDR_NBLOCKS_HI CSPRNG_ADDR_BASE + ADDR(0x42) +#define TRNG_NAME0 "trng"; +#define TRNG_NAME1 " "; +#define TRNG_VERSION "0.01"; #define AVALANCHE_ENTROPY_NAME0 "extn" #define AVALANCHE_ENTROPY_NAME1 "oise" diff --git a/eim/sw/trng_extractor_eim.c b/eim/sw/trng_extractor_eim.c index 36e653e..330c153 100644 --- a/eim/sw/trng_extractor_eim.c +++ b/eim/sw/trng_extractor_eim.c @@ -59,9 +59,9 @@ 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"; + uint8_t name0[4] = AVALANCHE_ENTROPY_NAME0; + uint8_t name1[4] = AVALANCHE_ENTROPY_NAME1; + uint8_t version[4] = AVALANCHE_ENTROPY_VERSION; printf("Reading name and version words from avalanche_entropy core.\n"); @@ -75,9 +75,9 @@ uint32_t avalanche_check(void) // 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"; + uint8_t name0[4] = ROSC_ENTROPY_NAME0; + uint8_t name1[4] = ROSC_ENTROPY_NAME1; + uint8_t version[4] = ROSC_ENTROPY_VERSION; printf("Reading name and version words from rosc_entropy core.\n"); -- cgit v1.2.3