aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim StroĢˆmbergson <joachim@secworks.se>2015-05-04 15:49:30 +0200
committerJoachim StroĢˆmbergson <joachim@secworks.se>2015-05-04 15:49:30 +0200
commit9e5270aa48b06490632546d0cb7f3a137d4e46a4 (patch)
treefcc892a25cfaaa643b56acec9f2aee8b03797b48
parentebdf59fa1ec26759a567cf93f35069992c9bc0df (diff)
(1) Added defines for the chacha stream cipher core. (2) Fixed incorrect define for AES.
-rw-r--r--sw/cryptech.h71
1 files changed, 70 insertions, 1 deletions
diff --git a/sw/cryptech.h b/sw/cryptech.h
index 83591eb..e36b71a 100644
--- a/sw/cryptech.h
+++ b/sw/cryptech.h
@@ -254,7 +254,7 @@
#define AES_ADDR_CTRL AES_ADDR_BASE + ADDR_CTRL
#define AES_CTRL_INIT_BIT CTRL_INIT_BIT
-#define AES_CTRL_NEXT_BIT CTRL_INIT_BIT
+#define AES_CTRL_NEXT_BIT CTRL_NEXT_BIT
#define AES_ADDR_STATUS AES_ADDR_BASE + ADDR_STATUS
#define AES_STATUS_READY_BIT STATUS_READY_BIT
@@ -288,6 +288,75 @@
#define AES_CORE_VERSION "0.80"
+// Chacha core
+#define CHACHA_ADDR_BASE SEGMENT_OFFSET_CIPHERS + (1 * CORE_SIZE)
+#define CHACHA_ADDR_NAME0 CHACHA_ADDR_BASE + ADDR_NAME0
+#define CHACHA_ADDR_NAME1 CHACHA_ADDR_BASE + ADDR_NAME1
+#define CHACHA_ADDR_VERSION CHACHA_ADDR_BASE + ADDR_VERSION
+
+#define CHACHA_ADDR_CTRL CHACHA_ADDR_BASE + ADDR_CTRL
+#define CHACHA_CTRL_INIT_BIT CTRL_INIT_BIT
+#define CHACHA_CTRL_NEXT_BIT CTRL_NEXT_BIT
+
+#define CHACHA_ADDR_STATUS CHACHA_ADDR_BASE + ADDR_STATUS
+#define CHACHA_STATUS_READY_BIT STATUS_READY_BIT
+#define CHACHA_STATUS_VALID_BIT STATUS_VALID_BIT
+
+#define CHACHA_ADDR_KEYLEN 0x0a
+#define CHACHA_KEYLEN_BIT 1
+
+#define CHACHA_ADDR_ROUNDS 0x0b
+
+#define CHACHA_ADDR_KEY0 0x10
+#define CHACHA_ADDR_KEY1 0x11
+#define CHACHA_ADDR_KEY2 0x12
+#define CHACHA_ADDR_KEY3 0x13
+#define CHACHA_ADDR_KEY4 0x14
+#define CHACHA_ADDR_KEY5 0x15
+#define CHACHA_ADDR_KEY6 0x16
+#define CHACHA_ADDR_KEY7 0x17
+
+#define CHACHA_ADDR_IV0 0x20
+#define CHACHA_ADDR_IV1 0x21
+
+#define CHACHA_ADDR_DATA_IN0 0x40
+#define CHACHA_ADDR_DATA_IN1 0x41
+#define CHACHA_ADDR_DATA_IN2 0x42
+#define CHACHA_ADDR_DATA_IN3 0x43
+#define CHACHA_ADDR_DATA_IN4 0x44
+#define CHACHA_ADDR_DATA_IN5 0x45
+#define CHACHA_ADDR_DATA_IN6 0x46
+#define CHACHA_ADDR_DATA_IN7 0x47
+#define CHACHA_ADDR_DATA_IN8 0x48
+#define CHACHA_ADDR_DATA_IN9 0x49
+#define CHACHA_ADDR_DATA_IN10 0x4a
+#define CHACHA_ADDR_DATA_IN11 0x4b
+#define CHACHA_ADDR_DATA_IN12 0x4c
+#define CHACHA_ADDR_DATA_IN13 0x4d
+#define CHACHA_ADDR_DATA_IN14 0x4e
+#define CHACHA_ADDR_DATA_IN15 0x4f
+
+#define CHACHA_ADDR_DATA_OUT0 0x80
+#define CHACHA_ADDR_DATA_OUT1 0x81
+#define CHACHA_ADDR_DATA_OUT2 0x82
+#define CHACHA_ADDR_DATA_OUT3 0x83
+#define CHACHA_ADDR_DATA_OUT4 0x84
+#define CHACHA_ADDR_DATA_OUT5 0x85
+#define CHACHA_ADDR_DATA_OUT6 0x86
+#define CHACHA_ADDR_DATA_OUT7 0x87
+#define CHACHA_ADDR_DATA_OUT8 0x88
+#define CHACHA_ADDR_DATA_OUT9 0x89
+#define CHACHA_ADDR_DATA_OUT10 0x8a
+#define CHACHA_ADDR_DATA_OUT11 0x8b
+#define CHACHA_ADDR_DATA_OUT12 0x8c
+#define CHACHA_ADDR_DATA_OUT13 0x8d
+#define CHACHA_ADDR_DATA_OUT14 0x8e
+#define CHACHA_ADDR_DATA_OUT15 0x8f
+
+#define CHACHA_NAME0 "chac"
+#define CHACHA_NAME1 "ha "
+#define CHACHA_VERSION "0.80"
+
// -----------------------------------------------------------------
// MATH segment.