diff options
author | Joachim StroĢmbergson <joachim@secworks.se> | 2015-04-29 16:39:21 +0200 |
---|---|---|
committer | Joachim StroĢmbergson <joachim@secworks.se> | 2015-04-29 16:39:21 +0200 |
commit | a6effa1995fb9500cc66c2584d5f28d7585bba1c (patch) | |
tree | 16599a9a57c946326accbccc08cee7c0e2af7ae4 | |
parent | eba69a11db55cbb6f09c3103f05247ce7b029df2 (diff) |
Trying to generalize more of addresses in the cores. Adding more defines for the modexp core.
-rw-r--r-- | sw/cryptech.h | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/sw/cryptech.h b/sw/cryptech.h index 5afd08c..a8efef4 100644 --- a/sw/cryptech.h +++ b/sw/cryptech.h @@ -46,10 +46,18 @@ #define SEGMENT_OFFSET_MATH 4 * SEGMENT_SIZE -// addresses and codes common to all cores +//------------------------------------------------------------------ +// Addresses and codes common to all cores +//------------------------------------------------------------------ #define ADDR_NAME0 0x00 #define ADDR_NAME1 0x01 #define ADDR_VERSION 0x02 +#define ADDR_CTRL 0x08 +#define CTRL_INIT_BIT 1 +#define CTRL_NEXT_BIT 2 +#define ADDR_STATUS 0x09 +#define STATUS_READY_BIT 1 +#define STATUS_VALID_BIT 2 // a handy macro from cryptlib @@ -94,15 +102,12 @@ #define HASH_CORE_SIZE 0x100 // addresses and codes common to all hash cores -#define ADDR_CTRL 0x8 #define CTRL_INIT_CMD 1 #define CTRL_NEXT_CMD 2 -#define ADDR_STATUS 0x9 -#define STATUS_READY_BIT 1 -#define STATUS_VALID_BIT 2 #define ADDR_BLOCK 0x10 #define ADDR_DIGEST 0x20 // except SHA512 + // addresses and codes for the specific hash cores. #define SHA1_ADDR_BASE SEGMENT_OFFSET_HASHES + (0 * HASH_CORE_SIZE) #define SHA1_ADDR_NAME0 SHA1_ADDR_BASE + ADDR_NAME0 @@ -247,17 +252,22 @@ // ----------------------------------------------------------------- // MATH segment. // ----------------------------------------------------------------- -#define MATH_CORE_SIZE 0x100 - -// addresses and codes for the MATH cores */ -#define MODEXP_ADDR_BASE SEGMENT_OFFSET_MATH + (0x00 * MATH_CORE_SIZE) +// Modexp core. +#define MODEXP_CORE_SIZE 0x1000 +#define GENERAL_PREFIX 0x000 +#define MODULUS_PREFIX 0x100 +#define EXPONENT_PREFIX 0x200 +#define MESSAGE_PREFIX 0x300 +#define RESULT_PREFIX 0x400 + +#define MODEXP_ADDR_BASE SEGMENT_OFFSET_MATH + (0x00 * MODEXP_CORE_SIZE) #define MODEXP_ADDR_NAME0 MODEXP_ADDR_BASE + ADDR_NAME0 #define MODEXP_ADDR_NAME1 MODEXP_ADDR_BASE + ADDR_NAME1 #define MODEXP_ADDR_VERSION MODEXP_ADDR_BASE + ADDR_VERSION -#define MODEXP_ADDR_CTRL MODEXP_ADDR_BASE + 0x08 -#define MODEXP_CTRL_INIT 1 -#define MODEXP_CTRL_NEXT 2 -#define MODEXP_ADDR_STATUS MODEXP_ADDR_BASE + 0x09 +#define MODEXP_ADDR_CTRL MODEXP_ADDR_BASE + ADDR_CTRL +#define MODEXP_CTRL_INIT_BIT 1 +#define MODEXP_CTRL_NEXT_BIT 2 +#define MODEXP_ADDR_STATUS MODEXP_ADDR_BASE + ADDR_STATUS #define MODEXP_ADDR_DELAY MODEXP_ADDR_BASE + 0x13 #define MODEXP_STATUS_READY 1 @@ -270,6 +280,7 @@ #define MODEXP_VERSION "0.50" + //------------------------------------------------------------------ // Test case public functions //------------------------------------------------------------------ |