summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2009-10-29 21:23:44 +0000
committerrrs <rrs@FreeBSD.org>2009-10-29 21:23:44 +0000
commit11d8357e78118beca190a7457de4b89f67c0613d (patch)
treef1e083f21196dc1d4b526306d6878eec45fbcb3e /sys/dev
parentf1119cbccbb2e4f188f24cdedec8cb9046a6e563 (diff)
downloadFreeBSD-src-11d8357e78118beca190a7457de4b89f67c0613d.zip
FreeBSD-src-11d8357e78118beca190a7457de4b89f67c0613d.tar.gz
white space changes
Diffstat (limited to 'sys/dev')
-rwxr-xr-xsys/dev/rmi/sec/desc.h2075
-rw-r--r--sys/dev/rmi/sec/rmilib.c5839
-rw-r--r--sys/dev/rmi/sec/rmilib.h730
-rw-r--r--sys/dev/rmi/sec/rmisec.c868
4 files changed, 4742 insertions, 4770 deletions
diff --git a/sys/dev/rmi/sec/desc.h b/sys/dev/rmi/sec/desc.h
index cb76637..5757e13 100755
--- a/sys/dev/rmi/sec/desc.h
+++ b/sys/dev/rmi/sec/desc.h
@@ -70,7 +70,7 @@
(word) |= (((value) & (field ## _BITS)) << (field ## _LSB)); }
/*
- * NOTE: May be used to build value specific mask
+ * NOTE: May be used to build value specific mask
* (e.g. GEN_MASK(CTL_DSC_CPHR_3DES,CTL_DSC_CPHR_LSB)
*/
#define GEN_MASK(bits,lsb) ((bits) << (lsb))
@@ -122,7 +122,7 @@
* | Ctrl | Destination Id | 2'b00 | Desc Ctrl | 1'b0 | Data Error | Address of packet descriptor data structure |
* ----------------------------------------------------------------------------------------------------------------------------
*
- * The Instruction and Data Error codes are enumerated in the
+ * The Instruction and Data Error codes are enumerated in the
* ControlDescriptor and PacketDescriptor sections below
*
*/
@@ -132,12 +132,12 @@
* Operating assumptions
* =====================
*
- *
+ *
* -> For all IpSec ops, I assume that all the IP/IPSec/TCP headers
* and the data are present at the specified source addresses.
* I also assume that all necessary header data already exists
* at the destination. Additionally, in AH I assume that all
- * mutable fields (IP.{TOS, Flags, Offset, TTL, Header_Checksum})
+ * mutable fields (IP.{TOS, Flags, Offset, TTL, Header_Checksum})
* and the AH.Authentication_Data have been zeroed by the client.
*
*
@@ -183,9 +183,9 @@
*
* A) Rebuilding packets from fragments on dword boundaries. The discussion
* below is exemplified by tests memcpy_all_off_frags and memcpy_same_off_frags
- *
+ *
* 1) The Offset before data/iv on first fragment is ALWAYS written back
- * Non-zero dst dword or global offsets may cause more data to be
+ * Non-zero dst dword or global offsets may cause more data to be
* written than the user-specified length.
*
*
@@ -217,7 +217,7 @@
* Cipher_Offset = 3
* IV_Offset = 3
* Use_IV = ANY
- *
+ *
*
*
* 3 2 1 0 3 2 1 0
@@ -228,7 +228,7 @@
* ----------------------- -----------------------
* | | | | D05 | | | | D05 | D04 |
* ----------------------- -----------------------
- *
+ *
* 2) On fragments following the first, IV_Offset is overloaded to mean data offset
* (number of dwords to skip from beginning of cacheline before starting processing)
* and Use_IV is overloaded to mean do writeback the offset (in the clear).
@@ -253,7 +253,7 @@
* Packet_Legth = 104 Dst_dword_offset = 1
* IV_Offset = 1
* Use_IV = 0
- *
+ *
*
*
* 3 2 1 0 3 2 1 0
@@ -275,7 +275,7 @@
* engine always writes full lines, therefore ADD1 + 0x20 will be re-written. Setting Use_IV to 0
* will allow the sec pipe write back buffer to preserve D04, D05 from previous frag and only
* receive D10, D11 thereby preserving the integrity of the previous data.
- *
+ *
* 3) On fragments following the first, !UseIV in combination w/ Dst_dword_offset >= (4 - IV_Offset)
* will cause a wraparound of the write thus achieving all 16 possible (Initial_Location, Final_Location)
* combinations for the data.
@@ -284,7 +284,7 @@
* Example:
* --------
*
- * Contiguously merging 2 data sets above with a third located at ADD3. If this is the last fragment,
+ * Contiguously merging 2 data sets above with a third located at ADD3. If this is the last fragment,
* reset its Next bit.
*
*
@@ -295,7 +295,7 @@
* Packet_Legth = 152 Dst_dword_offset = 3
* IV_Offset = 3
* Use_IV = 0
- *
+ *
*
*
* 3 2 1 0 3 2 1 0
@@ -312,13 +312,13 @@
* ----------------------- -----------------------
* | D21 | D20 | D1b | D1a | <- ADD1 + 0x80
* -----------------------
- * | D25 | D24 | D23 | D22 |
+ * | D25 | D24 | D23 | D22 |
* -----------------------
- * | D29 | D28 | D27 | D26 |
+ * | D29 | D28 | D27 | D26 |
* -----------------------
- * | D2d | D2c | D2b | D2a |
+ * | D2d | D2c | D2b | D2a |
* -----------------------
- * |(D2d)|(D2c)| D2f | D2e |
+ * |(D2d)|(D2c)| D2f | D2e |
* -----------------------
*
* It is worth noticing that always writing full-lines causes the last 2 dwords in the reconstituted
@@ -327,7 +327,7 @@
*
*
* B) Implications of fragmentation on AES
- *
+ *
* 1) AES is a 128 bit block cipher; therefore it requires an even dword total data length
* Data fragments (provided there are more than 1) are allowed to have odd dword
* data lengths provided the total length (cumulated over fragments) is an even dword
@@ -354,9 +354,9 @@
* Use_IV = 1
* Cipher = Any AES
* Next = 1
- *
*
- *
+ *
+ *
*
* 3 2 1 0 3 2 1 0
* ----------------------- -----------------------
@@ -396,7 +396,7 @@
/* #define MSG_CMD_CTL_ADDR */
-#define MSG_CMD_CTL_ADDR_LSB 0
+#define MSG_CMD_CTL_ADDR_LSB 0
#define MSG_CMD_CTL_ADDR_BITS FOURTY_BITS
#define MSG_CMD_CTL_ADDR_MASK (MSG_CMD_CTL_ADDR_BITS << MSG_CMD_CTL_ADDR_LSB)
@@ -419,8 +419,8 @@
#define MSG_CMD_DATA_LEN_MASK (MSG_CMD_DATA_LEN_BITS << MSG_CMD_DATA_LEN_LSB)
/* #define MSG_CMD_DATA_ADDR */
-#define MSG_CMD_DATA_ADDR_LSB 0
-#define MSG_CMD_DATA_ADDR_BITS FOURTY_BITS
+#define MSG_CMD_DATA_ADDR_LSB 0
+#define MSG_CMD_DATA_ADDR_BITS FOURTY_BITS
#define MSG_CMD_DATA_ADDR_MASK (MSG_CMD_DATA_ADDR_BITS << MSG_CMD_DATA_ADDR_LSB)
#define MSG_CMD_DATA_MASK (MSG_CMD_DATA_CTL_MASK | \
@@ -620,7 +620,7 @@
* For ARC4, IFetch/IDecode will always read exactly 4
* consecutive dwords into its CipherKey{0,3} regardless
* of this quantity; it will however only use the specified
- * number of bytes.
+ * number of bytes.
* Cipher = 3'b000 Bypass
* 3'b001 DES
* 3'b010 3DES
@@ -642,7 +642,7 @@
* and recalculate the Arc4 Sbox if Arc4 Cipher chosen;
* This overrides LoadArc4State setting.
* HASH.HMAC = 1'b0 Hash without HMAC
- * 1'b1 Hash with HMAC
+ * 1'b1 Hash with HMAC
* Needs to be set to 0 for GCM and Kasumi F9 authenticators
* otherwise unpredictable results will be generated
* Hash = 2'b00 Hash NOP
@@ -712,7 +712,7 @@
#define CTL_DSC_ARC4_KEYLEN_MASK (CTL_DSC_ARC4_KEYLEN_BITS << CTL_DSC_ARC4_KEYLEN_LSB)
/* #define CTL_DSC_CPHR (cipher) */
-#define CTL_DSC_CPHR_BYPASS 0 /* undefined */
+#define CTL_DSC_CPHR_BYPASS 0 /* undefined */
#define CTL_DSC_CPHR_DES 1
#define CTL_DSC_CPHR_3DES 2
#define CTL_DSC_CPHR_AES128 3
@@ -736,8 +736,8 @@
#define CTL_DSC_MODE_MASK (CTL_DSC_MODE_BITS << CTL_DSC_MODE_LSB)
/* #define CTL_DSC_ICPHR */
-#define CTL_DSC_ICPHR_OKY 0 /* Old Keys */
-#define CTL_DSC_ICPHR_NKY 1 /* New Keys */
+#define CTL_DSC_ICPHR_OKY 0 /* Old Keys */
+#define CTL_DSC_ICPHR_NKY 1 /* New Keys */
#define CTL_DSC_ICPHR_LSB 28
#define CTL_DSC_ICPHR_BITS ONE_BIT
#define CTL_DSC_ICPHR_MASK (CTL_DSC_ICPHR_BITS << CTL_DSC_ICPHR_LSB)
@@ -788,1075 +788,1075 @@
/* AES256, (ECB, CBC, OFB, CTR, CFB), HMAC (MD5, SHA-1, SHA-256) - 96 bytes */
typedef struct AES256HMAC_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKey3;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
-} AES256HMAC_t, *AES256HMAC_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKey3;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+} AES256HMAC_t, *AES256HMAC_pt;
/* AES256, (ECB, CBC, OFB, CTR, CFB), HMAC (SHA-384, SHA-512) - 160 bytes */
typedef struct AES256HMAC2_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKey3;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
- uint64_t hmacKey8;
- uint64_t hmacKey9;
- uint64_t hmacKey10;
- uint64_t hmacKey11;
- uint64_t hmacKey12;
- uint64_t hmacKey13;
- uint64_t hmacKey14;
- uint64_t hmacKey15;
-} AES256HMAC2_t, *AES256HMAC2_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKey3;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+ uint64_t hmacKey8;
+ uint64_t hmacKey9;
+ uint64_t hmacKey10;
+ uint64_t hmacKey11;
+ uint64_t hmacKey12;
+ uint64_t hmacKey13;
+ uint64_t hmacKey14;
+ uint64_t hmacKey15;
+} AES256HMAC2_t, *AES256HMAC2_pt;
/* AES256, (ECB, CBC, OFB, CTR, CFB), GCM - 56 bytes */
typedef struct AES256GCM_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKey3;
- uint64_t GCMH0;
- uint64_t GCMH1;
- uint64_t GCMSCI;
-} AES256GCM_t, *AES256GCM_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKey3;
+ uint64_t GCMH0;
+ uint64_t GCMH1;
+ uint64_t GCMSCI;
+} AES256GCM_t, *AES256GCM_pt;
/* AES256, (ECB, CBC, OFB, CTR, CFB), F9 - 56 bytes */
typedef struct AES256F9_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKey3;
- uint64_t authKey0;
- uint64_t authKey1;
-} AES256F9_t, *AES256F9_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKey3;
+ uint64_t authKey0;
+ uint64_t authKey1;
+} AES256F9_t, *AES256F9_pt;
/* AES256, (ECB, CBC, OFB, CTR, CFB), Non-HMAC (MD5, SHA-1, SHA-256) - 32 bytes */
typedef struct AES256_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKey3;
-} AES256_t, *AES256_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKey3;
+} AES256_t, *AES256_pt;
/* All AES192 possibilities */
/* AES192, (ECB, CBC, OFB, CTR, CFB), HMAC (MD5, SHA-1, SHA-192) - 88 bytes */
typedef struct AES192HMAC_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
-} AES192HMAC_t, *AES192HMAC_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+} AES192HMAC_t, *AES192HMAC_pt;
/* AES192, (ECB, CBC, OFB, CTR, CFB), HMAC (SHA-384, SHA-512) - 152 bytes */
typedef struct AES192HMAC2_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
- uint64_t hmacKey8;
- uint64_t hmacKey9;
- uint64_t hmacKey10;
- uint64_t hmacKey11;
- uint64_t hmacKey12;
- uint64_t hmacKey13;
- uint64_t hmacKey14;
- uint64_t hmacKey15;
-} AES192HMAC2_t, *AES192HMAC2_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+ uint64_t hmacKey8;
+ uint64_t hmacKey9;
+ uint64_t hmacKey10;
+ uint64_t hmacKey11;
+ uint64_t hmacKey12;
+ uint64_t hmacKey13;
+ uint64_t hmacKey14;
+ uint64_t hmacKey15;
+} AES192HMAC2_t, *AES192HMAC2_pt;
/* AES192, (ECB, CBC, OFB, CTR, CFB), GCM - 48 bytes */
typedef struct AES192GCM_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t GCMH0;
- uint64_t GCMH1;
- uint64_t GCMSCI;
-} AES192GCM_t, *AES192GCM_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t GCMH0;
+ uint64_t GCMH1;
+ uint64_t GCMSCI;
+} AES192GCM_t, *AES192GCM_pt;
/* AES192, (ECB, CBC, OFB, CTR, CFB), F9 - 48 bytes */
typedef struct AES192F9_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t authKey0;
- uint64_t authKey1;
-} AES192F9_t, *AES192F9_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t authKey0;
+ uint64_t authKey1;
+} AES192F9_t, *AES192F9_pt;
/* AES192, (ECB, CBC, OFB, CTR, CFB), Non-HMAC (MD5, SHA-1, SHA-192) - 24 bytes */
typedef struct AES192_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
-} AES192_t, *AES192_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+} AES192_t, *AES192_pt;
/* All AES128 possibilities */
/* AES128, (ECB, CBC, OFB, CTR, CFB), HMAC (MD5, SHA-1, SHA-128) - 80 bytes */
typedef struct AES128HMAC_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
-} AES128HMAC_t, *AES128HMAC_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+} AES128HMAC_t, *AES128HMAC_pt;
/* AES128, (ECB, CBC, OFB, CTR, CFB), HMAC (SHA-384, SHA-612) - 144 bytes */
typedef struct AES128HMAC2_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
- uint64_t hmacKey8;
- uint64_t hmacKey9;
- uint64_t hmacKey10;
- uint64_t hmacKey11;
- uint64_t hmacKey12;
- uint64_t hmacKey13;
- uint64_t hmacKey14;
- uint64_t hmacKey15;
-} AES128HMAC2_t, *AES128HMAC2_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+ uint64_t hmacKey8;
+ uint64_t hmacKey9;
+ uint64_t hmacKey10;
+ uint64_t hmacKey11;
+ uint64_t hmacKey12;
+ uint64_t hmacKey13;
+ uint64_t hmacKey14;
+ uint64_t hmacKey15;
+} AES128HMAC2_t, *AES128HMAC2_pt;
/* AES128, (ECB, CBC, OFB, CTR, CFB), GCM - 40 bytes */
typedef struct AES128GCM_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t GCMH0;
- uint64_t GCMH1;
- uint64_t GCMSCI;
-} AES128GCM_t, *AES128GCM_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t GCMH0;
+ uint64_t GCMH1;
+ uint64_t GCMSCI;
+} AES128GCM_t, *AES128GCM_pt;
/* AES128, (ECB, CBC, OFB, CTR, CFB), F9 - 48 bytes */
typedef struct AES128F9_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t authKey0;
- uint64_t authKey1;
-} AES128F9_t, *AES128F9_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t authKey0;
+ uint64_t authKey1;
+} AES128F9_t, *AES128F9_pt;
/* AES128, (ECB, CBC, OFB, CTR, CFB), Non-HMAC (MD5, SHA-1, SHA-128) - 16 bytes */
typedef struct AES128_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
-} AES128_t, *AES128_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+} AES128_t, *AES128_pt;
/* AES128, (OFB F8), Non-HMAC (MD5, SHA-1, SHA-256) - 32 bytes */
typedef struct AES128F8_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKeyMask0;
- uint64_t cipherKeyMask1;
-} AES128F8_t, *AES128F8_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKeyMask0;
+ uint64_t cipherKeyMask1;
+} AES128F8_t, *AES128F8_pt;
/* AES128, (OFB F8), HMAC (MD5, SHA-1, SHA-256) - 96 bytes */
typedef struct AES128F8HMAC_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKeyMask0;
- uint64_t cipherKeyMask1;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
-} AES128F8HMAC_t, *AES128F8HMAC_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKeyMask0;
+ uint64_t cipherKeyMask1;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+} AES128F8HMAC_t, *AES128F8HMAC_pt;
/* AES128, (OFB F8), HMAC (SHA-384, SHA-512) - 160 bytes */
typedef struct AES128F8HMAC2_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKeyMask0;
- uint64_t cipherKeyMask1;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
- uint64_t hmacKey8;
- uint64_t hmacKey9;
- uint64_t hmacKey10;
- uint64_t hmacKey11;
- uint64_t hmacKey12;
- uint64_t hmacKey13;
- uint64_t hmacKey14;
- uint64_t hmacKey15;
-} AES128F8HMAC2_t, *AES128F8HMAC2_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKeyMask0;
+ uint64_t cipherKeyMask1;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+ uint64_t hmacKey8;
+ uint64_t hmacKey9;
+ uint64_t hmacKey10;
+ uint64_t hmacKey11;
+ uint64_t hmacKey12;
+ uint64_t hmacKey13;
+ uint64_t hmacKey14;
+ uint64_t hmacKey15;
+} AES128F8HMAC2_t, *AES128F8HMAC2_pt;
/* AES192, (OFB F8), Non-HMAC (MD5, SHA-1, SHA-256) - 48 bytes */
typedef struct AES192F8_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKeyMask0;
- uint64_t cipherKeyMask1;
- uint64_t cipherKeyMask2;
-} AES192F8_t, *AES192F8_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKeyMask0;
+ uint64_t cipherKeyMask1;
+ uint64_t cipherKeyMask2;
+} AES192F8_t, *AES192F8_pt;
/* AES192, (OFB F8), HMAC (MD5, SHA-1, SHA-256) - 112 bytes */
typedef struct AES192F8HMAC_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKeyMask0;
- uint64_t cipherKeyMask1;
- uint64_t cipherKeyMask2;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
-} AES192F8HMAC_t, *AES192F8HMAC_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKeyMask0;
+ uint64_t cipherKeyMask1;
+ uint64_t cipherKeyMask2;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+} AES192F8HMAC_t, *AES192F8HMAC_pt;
/* AES192, (OFB F8), HMAC (SHA-384, SHA-512) - 176 bytes */
typedef struct AES192F8HMAC2_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKeyMask0;
- uint64_t cipherKeyMask1;
- uint64_t cipherKeyMask2;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
- uint64_t hmacKey8;
- uint64_t hmacKey9;
- uint64_t hmacKey10;
- uint64_t hmacKey11;
- uint64_t hmacKey12;
- uint64_t hmacKey13;
- uint64_t hmacKey14;
- uint64_t hmacKey15;
-} AES192F8HMAC2_t, *AES192F8HMAC2_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKeyMask0;
+ uint64_t cipherKeyMask1;
+ uint64_t cipherKeyMask2;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+ uint64_t hmacKey8;
+ uint64_t hmacKey9;
+ uint64_t hmacKey10;
+ uint64_t hmacKey11;
+ uint64_t hmacKey12;
+ uint64_t hmacKey13;
+ uint64_t hmacKey14;
+ uint64_t hmacKey15;
+} AES192F8HMAC2_t, *AES192F8HMAC2_pt;
/* AES256, (OFB F8), Non-HMAC (MD5, SHA-1, SHA-256) - 64 bytes */
typedef struct AES256F8_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKey3;
- uint64_t cipherKeyMask0;
- uint64_t cipherKeyMask1;
- uint64_t cipherKeyMask2;
- uint64_t cipherKeyMask3;
-} AES256F8_t, *AES256F8_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKey3;
+ uint64_t cipherKeyMask0;
+ uint64_t cipherKeyMask1;
+ uint64_t cipherKeyMask2;
+ uint64_t cipherKeyMask3;
+} AES256F8_t, *AES256F8_pt;
/* AES256, (OFB F8), HMAC (MD5, SHA-1, SHA-256) - 128 bytes */
typedef struct AES256F8HMAC_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKey3;
- uint64_t cipherKeyMask0;
- uint64_t cipherKeyMask1;
- uint64_t cipherKeyMask2;
- uint64_t cipherKeyMask3;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
-} AES256F8HMAC_t, *AES256F8HMAC_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKey3;
+ uint64_t cipherKeyMask0;
+ uint64_t cipherKeyMask1;
+ uint64_t cipherKeyMask2;
+ uint64_t cipherKeyMask3;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+} AES256F8HMAC_t, *AES256F8HMAC_pt;
/* AES256, (OFB F8), HMAC (SHA-384, SHA-512) - 192 bytes */
typedef struct AES256F8HMAC2_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKey3;
- uint64_t cipherKeyMask0;
- uint64_t cipherKeyMask1;
- uint64_t cipherKeyMask2;
- uint64_t cipherKeyMask3;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
- uint64_t hmacKey8;
- uint64_t hmacKey9;
- uint64_t hmacKey10;
- uint64_t hmacKey11;
- uint64_t hmacKey12;
- uint64_t hmacKey13;
- uint64_t hmacKey14;
- uint64_t hmacKey15;
-} AES256F8HMAC2_t, *AES256F8HMAC2_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKey3;
+ uint64_t cipherKeyMask0;
+ uint64_t cipherKeyMask1;
+ uint64_t cipherKeyMask2;
+ uint64_t cipherKeyMask3;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+ uint64_t hmacKey8;
+ uint64_t hmacKey9;
+ uint64_t hmacKey10;
+ uint64_t hmacKey11;
+ uint64_t hmacKey12;
+ uint64_t hmacKey13;
+ uint64_t hmacKey14;
+ uint64_t hmacKey15;
+} AES256F8HMAC2_t, *AES256F8HMAC2_pt;
/* AES256, (F8), GCM - 40 bytes */
typedef struct AES128F8GCM_s {
- uint64_t cipherKey0;
- uint64_t cipherKey2;
- uint64_t GCMH0;
- uint64_t GCMH1;
- uint64_t GCMSCI;
-} AES128F8GCM_t, *AES128F8GCM_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey2;
+ uint64_t GCMH0;
+ uint64_t GCMH1;
+ uint64_t GCMSCI;
+} AES128F8GCM_t, *AES128F8GCM_pt;
/* AES256, (F8), GCM - 48 bytes */
typedef struct AES192F8GCM_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t GCMH0;
- uint64_t GCMH1;
- uint64_t GCMSCI;
-} AES192F8GCM_t, *AES192F8GCM_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t GCMH0;
+ uint64_t GCMH1;
+ uint64_t GCMSCI;
+} AES192F8GCM_t, *AES192F8GCM_pt;
/* AES256, (F8), GCM - 56 bytes */
typedef struct AES256F8GCM_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKey3;
- uint64_t GCMH0;
- uint64_t GCMH1;
- uint64_t GCMSCI;
-} AES256F8GCM_t, *AES256F8GCM_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKey3;
+ uint64_t GCMH0;
+ uint64_t GCMH1;
+ uint64_t GCMSCI;
+} AES256F8GCM_t, *AES256F8GCM_pt;
/* AES256, (F8), F9 - 40 bytes */
typedef struct AES128F8F9_s {
- uint64_t cipherKey0;
- uint64_t cipherKey2;
- uint64_t authKey0;
- uint64_t authKey1;
-} AES128F8F9_t, *AES128F8F9_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey2;
+ uint64_t authKey0;
+ uint64_t authKey1;
+} AES128F8F9_t, *AES128F8F9_pt;
/* AES256, (F8), F9 - 48 bytes */
typedef struct AES192F8F9_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t authKey0;
- uint64_t authKey1;
-} AES192F8F9_t, *AES192F8F9_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t authKey0;
+ uint64_t authKey1;
+} AES192F8F9_t, *AES192F8F9_pt;
/* AES256F8, (F8), F9 - 56 bytes */
typedef struct AES256F8F9_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKey3;
- uint64_t authKey0;
- uint64_t authKey1;
-} AES256F8F9_t, *AES256F8F9_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKey3;
+ uint64_t authKey0;
+ uint64_t authKey1;
+} AES256F8F9_t, *AES256F8F9_pt;
/* All DES possibilities */
/* DES, (ECB, CBC), HMAC (MD5, SHA-1, SHA-128) - 72 bytes */
typedef struct DESHMAC_s {
- uint64_t cipherKey0;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
-} DESHMAC_t, *DESHMAC_pt;
+ uint64_t cipherKey0;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+} DESHMAC_t, *DESHMAC_pt;
/* DES, (ECB, CBC), HMAC (SHA-384, SHA-512) - 136 bytes */
typedef struct DESHMAC2_s {
- uint64_t cipherKey0;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
- uint64_t hmacKey8;
- uint64_t hmacKey9;
- uint64_t hmacKey10;
- uint64_t hmacKey11;
- uint64_t hmacKey12;
- uint64_t hmacKey13;
- uint64_t hmacKey14;
- uint64_t hmacKey15;
-} DESHMAC2_t, *DESHMAC2_pt;
+ uint64_t cipherKey0;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+ uint64_t hmacKey8;
+ uint64_t hmacKey9;
+ uint64_t hmacKey10;
+ uint64_t hmacKey11;
+ uint64_t hmacKey12;
+ uint64_t hmacKey13;
+ uint64_t hmacKey14;
+ uint64_t hmacKey15;
+} DESHMAC2_t, *DESHMAC2_pt;
/* DES, (ECB, CBC), GCM - 32 bytes */
typedef struct DESGCM_s {
- uint64_t cipherKey0;
- uint64_t GCMH0;
- uint64_t GCMH1;
- uint64_t GCMSCI;
-} DESGCM_t, *DESGCM_pt;
+ uint64_t cipherKey0;
+ uint64_t GCMH0;
+ uint64_t GCMH1;
+ uint64_t GCMSCI;
+} DESGCM_t, *DESGCM_pt;
/* DES, (ECB, CBC), F9 - 32 bytes */
typedef struct DESF9_s {
- uint64_t cipherKey0;
- uint64_t authKey0;
- uint64_t authKey1;
-} DESF9_t, *DESF9_pt;
+ uint64_t cipherKey0;
+ uint64_t authKey0;
+ uint64_t authKey1;
+} DESF9_t, *DESF9_pt;
/* DES, (ECB, CBC), Non-HMAC (MD5, SHA-1, SHA-128) - 9 bytes */
typedef struct DES_s {
- uint64_t cipherKey0;
-} DES_t, *DES_pt;
+ uint64_t cipherKey0;
+} DES_t, *DES_pt;
/* All 3DES possibilities */
/* 3DES, (ECB, CBC), HMAC (MD5, SHA-1, SHA-128) - 88 bytes */
typedef struct DES3HMAC_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
-} DES3HMAC_t, *DES3HMAC_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+} DES3HMAC_t, *DES3HMAC_pt;
/* 3DES, (ECB, CBC), HMAC (SHA-384, SHA-512) - 152 bytes */
typedef struct DES3HMAC2_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
- uint64_t hmacKey8;
- uint64_t hmacKey9;
- uint64_t hmacKey10;
- uint64_t hmacKey11;
- uint64_t hmacKey12;
- uint64_t hmacKey13;
- uint64_t hmacKey14;
- uint64_t hmacKey15;
-} DES3HMAC2_t, *DES3HMAC2_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+ uint64_t hmacKey8;
+ uint64_t hmacKey9;
+ uint64_t hmacKey10;
+ uint64_t hmacKey11;
+ uint64_t hmacKey12;
+ uint64_t hmacKey13;
+ uint64_t hmacKey14;
+ uint64_t hmacKey15;
+} DES3HMAC2_t, *DES3HMAC2_pt;
/* 3DES, (ECB, CBC), GCM - 48 bytes */
typedef struct DES3GCM_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t GCMH0;
- uint64_t GCMH1;
- uint64_t GCMSCI;
-} DES3GCM_t, *DES3GCM_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t GCMH0;
+ uint64_t GCMH1;
+ uint64_t GCMSCI;
+} DES3GCM_t, *DES3GCM_pt;
/* 3DES, (ECB, CBC), GCM - 48 bytes */
typedef struct DES3F9_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t authKey0;
- uint64_t authKey1;
-} DES3F9_t, *DES3F9_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t authKey0;
+ uint64_t authKey1;
+} DES3F9_t, *DES3F9_pt;
/* 3DES, (ECB, CBC), Non-HMAC (MD5, SHA-1, SHA-128) - 24 bytes */
typedef struct DES3_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
-} DES3_t, *DES3_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+} DES3_t, *DES3_pt;
/* HMAC only - no cipher */
/* HMAC (MD5, SHA-1, SHA-128) - 64 bytes */
typedef struct HMAC_s {
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
-} HMAC_t, *HMAC_pt;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+} HMAC_t, *HMAC_pt;
/* HMAC (SHA-384, SHA-512) - 128 bytes */
typedef struct HMAC2_s {
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
- uint64_t hmacKey8;
- uint64_t hmacKey9;
- uint64_t hmacKey10;
- uint64_t hmacKey11;
- uint64_t hmacKey12;
- uint64_t hmacKey13;
- uint64_t hmacKey14;
- uint64_t hmacKey15;
-} HMAC2_t, *HMAC2_pt;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+ uint64_t hmacKey8;
+ uint64_t hmacKey9;
+ uint64_t hmacKey10;
+ uint64_t hmacKey11;
+ uint64_t hmacKey12;
+ uint64_t hmacKey13;
+ uint64_t hmacKey14;
+ uint64_t hmacKey15;
+} HMAC2_t, *HMAC2_pt;
/* GCM - 24 bytes */
typedef struct GCM_s {
- uint64_t GCMH0;
- uint64_t GCMH1;
- uint64_t GCMSCI;
-} GCM_t, *GCM_pt;
+ uint64_t GCMH0;
+ uint64_t GCMH1;
+ uint64_t GCMSCI;
+} GCM_t, *GCM_pt;
/* F9 - 24 bytes */
typedef struct F9_s {
- uint64_t authKey0;
- uint64_t authKey1;
-} F9_t, *F9_pt;
+ uint64_t authKey0;
+ uint64_t authKey1;
+} F9_t, *F9_pt;
/* All ARC4 possibilities */
/* ARC4, HMAC (MD5, SHA-1, SHA-256) - 96 bytes */
typedef struct ARC4HMAC_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKey3;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
-} ARC4HMAC_t, *ARC4HMAC_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKey3;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+} ARC4HMAC_t, *ARC4HMAC_pt;
/* ARC4, HMAC (SHA-384, SHA-512) - 160 bytes */
typedef struct ARC4HMAC2_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKey3;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
- uint64_t hmacKey8;
- uint64_t hmacKey9;
- uint64_t hmacKey10;
- uint64_t hmacKey11;
- uint64_t hmacKey12;
- uint64_t hmacKey13;
- uint64_t hmacKey14;
- uint64_t hmacKey15;
-} ARC4HMAC2_t, *ARC4HMAC2_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKey3;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+ uint64_t hmacKey8;
+ uint64_t hmacKey9;
+ uint64_t hmacKey10;
+ uint64_t hmacKey11;
+ uint64_t hmacKey12;
+ uint64_t hmacKey13;
+ uint64_t hmacKey14;
+ uint64_t hmacKey15;
+} ARC4HMAC2_t, *ARC4HMAC2_pt;
/* ARC4, GCM - 56 bytes */
typedef struct ARC4GCM_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKey3;
- uint64_t GCMH0;
- uint64_t GCMH1;
- uint64_t GCMSCI;
-} ARC4GCM_t, *ARC4GCM_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKey3;
+ uint64_t GCMH0;
+ uint64_t GCMH1;
+ uint64_t GCMSCI;
+} ARC4GCM_t, *ARC4GCM_pt;
/* ARC4, F9 - 56 bytes */
typedef struct ARC4F9_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKey3;
- uint64_t authKey0;
- uint64_t authKey1;
-} ARC4F9_t, *ARC4F9_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKey3;
+ uint64_t authKey0;
+ uint64_t authKey1;
+} ARC4F9_t, *ARC4F9_pt;
/* ARC4, HMAC (MD5, SHA-1, SHA-256) - 408 bytes (not including 8 bytes from instruction) */
typedef struct ARC4StateHMAC_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKey3;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
- uint64_t PAD0;
- uint64_t PAD1;
- uint64_t PAD2;
- uint64_t Arc4SboxData0;
- uint64_t Arc4SboxData1;
- uint64_t Arc4SboxData2;
- uint64_t Arc4SboxData3;
- uint64_t Arc4SboxData4;
- uint64_t Arc4SboxData5;
- uint64_t Arc4SboxData6;
- uint64_t Arc4SboxData7;
- uint64_t Arc4SboxData8;
- uint64_t Arc4SboxData9;
- uint64_t Arc4SboxData10;
- uint64_t Arc4SboxData11;
- uint64_t Arc4SboxData12;
- uint64_t Arc4SboxData13;
- uint64_t Arc4SboxData14;
- uint64_t Arc4SboxData15;
- uint64_t Arc4SboxData16;
- uint64_t Arc4SboxData17;
- uint64_t Arc4SboxData18;
- uint64_t Arc4SboxData19;
- uint64_t Arc4SboxData20;
- uint64_t Arc4SboxData21;
- uint64_t Arc4SboxData22;
- uint64_t Arc4SboxData23;
- uint64_t Arc4SboxData24;
- uint64_t Arc4SboxData25;
- uint64_t Arc4SboxData26;
- uint64_t Arc4SboxData27;
- uint64_t Arc4SboxData28;
- uint64_t Arc4SboxData29;
- uint64_t Arc4SboxData30;
- uint64_t Arc4SboxData31;
- uint64_t Arc4IJData;
- uint64_t PAD3;
- uint64_t PAD4;
- uint64_t PAD5;
-} ARC4StateHMAC_t, *ARC4StateHMAC_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKey3;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+ uint64_t PAD0;
+ uint64_t PAD1;
+ uint64_t PAD2;
+ uint64_t Arc4SboxData0;
+ uint64_t Arc4SboxData1;
+ uint64_t Arc4SboxData2;
+ uint64_t Arc4SboxData3;
+ uint64_t Arc4SboxData4;
+ uint64_t Arc4SboxData5;
+ uint64_t Arc4SboxData6;
+ uint64_t Arc4SboxData7;
+ uint64_t Arc4SboxData8;
+ uint64_t Arc4SboxData9;
+ uint64_t Arc4SboxData10;
+ uint64_t Arc4SboxData11;
+ uint64_t Arc4SboxData12;
+ uint64_t Arc4SboxData13;
+ uint64_t Arc4SboxData14;
+ uint64_t Arc4SboxData15;
+ uint64_t Arc4SboxData16;
+ uint64_t Arc4SboxData17;
+ uint64_t Arc4SboxData18;
+ uint64_t Arc4SboxData19;
+ uint64_t Arc4SboxData20;
+ uint64_t Arc4SboxData21;
+ uint64_t Arc4SboxData22;
+ uint64_t Arc4SboxData23;
+ uint64_t Arc4SboxData24;
+ uint64_t Arc4SboxData25;
+ uint64_t Arc4SboxData26;
+ uint64_t Arc4SboxData27;
+ uint64_t Arc4SboxData28;
+ uint64_t Arc4SboxData29;
+ uint64_t Arc4SboxData30;
+ uint64_t Arc4SboxData31;
+ uint64_t Arc4IJData;
+ uint64_t PAD3;
+ uint64_t PAD4;
+ uint64_t PAD5;
+} ARC4StateHMAC_t, *ARC4StateHMAC_pt;
/* ARC4, HMAC (SHA-384, SHA-512) - 480 bytes (not including 8 bytes from instruction) */
typedef struct ARC4StateHMAC2_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKey3;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
- uint64_t hmacKey8;
- uint64_t hmacKey9;
- uint64_t hmacKey10;
- uint64_t hmacKey11;
- uint64_t hmacKey12;
- uint64_t hmacKey13;
- uint64_t hmacKey14;
- uint64_t hmacKey15;
- uint64_t PAD0;
- uint64_t PAD1;
- uint64_t PAD2;
- uint64_t Arc4SboxData0;
- uint64_t Arc4SboxData1;
- uint64_t Arc4SboxData2;
- uint64_t Arc4SboxData3;
- uint64_t Arc4SboxData4;
- uint64_t Arc4SboxData5;
- uint64_t Arc4SboxData6;
- uint64_t Arc4SboxData7;
- uint64_t Arc4SboxData8;
- uint64_t Arc4SboxData9;
- uint64_t Arc4SboxData10;
- uint64_t Arc4SboxData11;
- uint64_t Arc4SboxData12;
- uint64_t Arc4SboxData13;
- uint64_t Arc4SboxData14;
- uint64_t Arc4SboxData15;
- uint64_t Arc4SboxData16;
- uint64_t Arc4SboxData17;
- uint64_t Arc4SboxData18;
- uint64_t Arc4SboxData19;
- uint64_t Arc4SboxData20;
- uint64_t Arc4SboxData21;
- uint64_t Arc4SboxData22;
- uint64_t Arc4SboxData23;
- uint64_t Arc4SboxData24;
- uint64_t Arc4SboxData25;
- uint64_t Arc4SboxData26;
- uint64_t Arc4SboxData27;
- uint64_t Arc4SboxData28;
- uint64_t Arc4SboxData29;
- uint64_t Arc4SboxData30;
- uint64_t Arc4SboxData31;
- uint64_t Arc4IJData;
- uint64_t PAD3;
- uint64_t PAD4;
- uint64_t PAD5;
-} ARC4StateHMAC2_t, *ARC4StateHMAC2_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKey3;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+ uint64_t hmacKey8;
+ uint64_t hmacKey9;
+ uint64_t hmacKey10;
+ uint64_t hmacKey11;
+ uint64_t hmacKey12;
+ uint64_t hmacKey13;
+ uint64_t hmacKey14;
+ uint64_t hmacKey15;
+ uint64_t PAD0;
+ uint64_t PAD1;
+ uint64_t PAD2;
+ uint64_t Arc4SboxData0;
+ uint64_t Arc4SboxData1;
+ uint64_t Arc4SboxData2;
+ uint64_t Arc4SboxData3;
+ uint64_t Arc4SboxData4;
+ uint64_t Arc4SboxData5;
+ uint64_t Arc4SboxData6;
+ uint64_t Arc4SboxData7;
+ uint64_t Arc4SboxData8;
+ uint64_t Arc4SboxData9;
+ uint64_t Arc4SboxData10;
+ uint64_t Arc4SboxData11;
+ uint64_t Arc4SboxData12;
+ uint64_t Arc4SboxData13;
+ uint64_t Arc4SboxData14;
+ uint64_t Arc4SboxData15;
+ uint64_t Arc4SboxData16;
+ uint64_t Arc4SboxData17;
+ uint64_t Arc4SboxData18;
+ uint64_t Arc4SboxData19;
+ uint64_t Arc4SboxData20;
+ uint64_t Arc4SboxData21;
+ uint64_t Arc4SboxData22;
+ uint64_t Arc4SboxData23;
+ uint64_t Arc4SboxData24;
+ uint64_t Arc4SboxData25;
+ uint64_t Arc4SboxData26;
+ uint64_t Arc4SboxData27;
+ uint64_t Arc4SboxData28;
+ uint64_t Arc4SboxData29;
+ uint64_t Arc4SboxData30;
+ uint64_t Arc4SboxData31;
+ uint64_t Arc4IJData;
+ uint64_t PAD3;
+ uint64_t PAD4;
+ uint64_t PAD5;
+} ARC4StateHMAC2_t, *ARC4StateHMAC2_pt;
/* ARC4, GCM - 408 bytes (not including 8 bytes from instruction) */
typedef struct ARC4StateGCM_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKey3;
- uint64_t GCMH0;
- uint64_t GCMH1;
- uint64_t GCMSCI;
- uint64_t PAD0;
- uint64_t PAD1;
- uint64_t PAD2;
- uint64_t PAD3;
- uint64_t PAD4;
- uint64_t PAD5;
- uint64_t PAD6;
- uint64_t PAD7;
- uint64_t Arc4SboxData0;
- uint64_t Arc4SboxData1;
- uint64_t Arc4SboxData2;
- uint64_t Arc4SboxData3;
- uint64_t Arc4SboxData4;
- uint64_t Arc4SboxData5;
- uint64_t Arc4SboxData6;
- uint64_t Arc4SboxData7;
- uint64_t Arc4SboxData8;
- uint64_t Arc4SboxData9;
- uint64_t Arc4SboxData10;
- uint64_t Arc4SboxData11;
- uint64_t Arc4SboxData12;
- uint64_t Arc4SboxData13;
- uint64_t Arc4SboxData14;
- uint64_t Arc4SboxData15;
- uint64_t Arc4SboxData16;
- uint64_t Arc4SboxData17;
- uint64_t Arc4SboxData18;
- uint64_t Arc4SboxData19;
- uint64_t Arc4SboxData20;
- uint64_t Arc4SboxData21;
- uint64_t Arc4SboxData22;
- uint64_t Arc4SboxData23;
- uint64_t Arc4SboxData24;
- uint64_t Arc4SboxData25;
- uint64_t Arc4SboxData26;
- uint64_t Arc4SboxData27;
- uint64_t Arc4SboxData28;
- uint64_t Arc4SboxData29;
- uint64_t Arc4SboxData30;
- uint64_t Arc4SboxData31;
- uint64_t Arc4IJData;
- uint64_t PAD8;
- uint64_t PAD9;
- uint64_t PAD10;
-} ARC4StateGCM_t, *ARC4StateGCM_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKey3;
+ uint64_t GCMH0;
+ uint64_t GCMH1;
+ uint64_t GCMSCI;
+ uint64_t PAD0;
+ uint64_t PAD1;
+ uint64_t PAD2;
+ uint64_t PAD3;
+ uint64_t PAD4;
+ uint64_t PAD5;
+ uint64_t PAD6;
+ uint64_t PAD7;
+ uint64_t Arc4SboxData0;
+ uint64_t Arc4SboxData1;
+ uint64_t Arc4SboxData2;
+ uint64_t Arc4SboxData3;
+ uint64_t Arc4SboxData4;
+ uint64_t Arc4SboxData5;
+ uint64_t Arc4SboxData6;
+ uint64_t Arc4SboxData7;
+ uint64_t Arc4SboxData8;
+ uint64_t Arc4SboxData9;
+ uint64_t Arc4SboxData10;
+ uint64_t Arc4SboxData11;
+ uint64_t Arc4SboxData12;
+ uint64_t Arc4SboxData13;
+ uint64_t Arc4SboxData14;
+ uint64_t Arc4SboxData15;
+ uint64_t Arc4SboxData16;
+ uint64_t Arc4SboxData17;
+ uint64_t Arc4SboxData18;
+ uint64_t Arc4SboxData19;
+ uint64_t Arc4SboxData20;
+ uint64_t Arc4SboxData21;
+ uint64_t Arc4SboxData22;
+ uint64_t Arc4SboxData23;
+ uint64_t Arc4SboxData24;
+ uint64_t Arc4SboxData25;
+ uint64_t Arc4SboxData26;
+ uint64_t Arc4SboxData27;
+ uint64_t Arc4SboxData28;
+ uint64_t Arc4SboxData29;
+ uint64_t Arc4SboxData30;
+ uint64_t Arc4SboxData31;
+ uint64_t Arc4IJData;
+ uint64_t PAD8;
+ uint64_t PAD9;
+ uint64_t PAD10;
+} ARC4StateGCM_t, *ARC4StateGCM_pt;
/* ARC4, F9 - 408 bytes (not including 8 bytes from instruction) */
typedef struct ARC4StateF9_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKey3;
- uint64_t authKey0;
- uint64_t authKey1;
- uint64_t PAD0;
- uint64_t PAD1;
- uint64_t PAD2;
- uint64_t PAD3;
- uint64_t PAD4;
- uint64_t PAD5;
- uint64_t PAD6;
- uint64_t PAD7;
- uint64_t PAD8;
- uint64_t Arc4SboxData0;
- uint64_t Arc4SboxData1;
- uint64_t Arc4SboxData2;
- uint64_t Arc4SboxData3;
- uint64_t Arc4SboxData4;
- uint64_t Arc4SboxData5;
- uint64_t Arc4SboxData6;
- uint64_t Arc4SboxData7;
- uint64_t Arc4SboxData8;
- uint64_t Arc4SboxData9;
- uint64_t Arc4SboxData10;
- uint64_t Arc4SboxData11;
- uint64_t Arc4SboxData12;
- uint64_t Arc4SboxData13;
- uint64_t Arc4SboxData14;
- uint64_t Arc4SboxData15;
- uint64_t Arc4SboxData16;
- uint64_t Arc4SboxData17;
- uint64_t Arc4SboxData18;
- uint64_t Arc4SboxData19;
- uint64_t Arc4SboxData20;
- uint64_t Arc4SboxData21;
- uint64_t Arc4SboxData22;
- uint64_t Arc4SboxData23;
- uint64_t Arc4SboxData24;
- uint64_t Arc4SboxData25;
- uint64_t Arc4SboxData26;
- uint64_t Arc4SboxData27;
- uint64_t Arc4SboxData28;
- uint64_t Arc4SboxData29;
- uint64_t Arc4SboxData30;
- uint64_t Arc4SboxData31;
- uint64_t Arc4IJData;
- uint64_t PAD9;
- uint64_t PAD10;
- uint64_t PAD11;
-} ARC4StateF9_t, *ARC4StateF9_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKey3;
+ uint64_t authKey0;
+ uint64_t authKey1;
+ uint64_t PAD0;
+ uint64_t PAD1;
+ uint64_t PAD2;
+ uint64_t PAD3;
+ uint64_t PAD4;
+ uint64_t PAD5;
+ uint64_t PAD6;
+ uint64_t PAD7;
+ uint64_t PAD8;
+ uint64_t Arc4SboxData0;
+ uint64_t Arc4SboxData1;
+ uint64_t Arc4SboxData2;
+ uint64_t Arc4SboxData3;
+ uint64_t Arc4SboxData4;
+ uint64_t Arc4SboxData5;
+ uint64_t Arc4SboxData6;
+ uint64_t Arc4SboxData7;
+ uint64_t Arc4SboxData8;
+ uint64_t Arc4SboxData9;
+ uint64_t Arc4SboxData10;
+ uint64_t Arc4SboxData11;
+ uint64_t Arc4SboxData12;
+ uint64_t Arc4SboxData13;
+ uint64_t Arc4SboxData14;
+ uint64_t Arc4SboxData15;
+ uint64_t Arc4SboxData16;
+ uint64_t Arc4SboxData17;
+ uint64_t Arc4SboxData18;
+ uint64_t Arc4SboxData19;
+ uint64_t Arc4SboxData20;
+ uint64_t Arc4SboxData21;
+ uint64_t Arc4SboxData22;
+ uint64_t Arc4SboxData23;
+ uint64_t Arc4SboxData24;
+ uint64_t Arc4SboxData25;
+ uint64_t Arc4SboxData26;
+ uint64_t Arc4SboxData27;
+ uint64_t Arc4SboxData28;
+ uint64_t Arc4SboxData29;
+ uint64_t Arc4SboxData30;
+ uint64_t Arc4SboxData31;
+ uint64_t Arc4IJData;
+ uint64_t PAD9;
+ uint64_t PAD10;
+ uint64_t PAD11;
+} ARC4StateF9_t, *ARC4StateF9_pt;
/* ARC4, Non-HMAC (MD5, SHA-1, SHA-256) - 32 bytes */
typedef struct ARC4_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKey3;
-} ARC4_t, *ARC4_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKey3;
+} ARC4_t, *ARC4_pt;
/* ARC4, Non-HMAC (MD5, SHA-1, SHA-256) - 344 bytes (not including 8 bytes from instruction) */
typedef struct ARC4State_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t cipherKey2;
- uint64_t cipherKey3;
- uint64_t PAD0;
- uint64_t PAD1;
- uint64_t PAD2;
- uint64_t Arc4SboxData0;
- uint64_t Arc4SboxData1;
- uint64_t Arc4SboxData2;
- uint64_t Arc4SboxData3;
- uint64_t Arc4SboxData4;
- uint64_t Arc4SboxData5;
- uint64_t Arc4SboxData6;
- uint64_t Arc4SboxData7;
- uint64_t Arc4SboxData8;
- uint64_t Arc4SboxData9;
- uint64_t Arc4SboxData10;
- uint64_t Arc4SboxData11;
- uint64_t Arc4SboxData12;
- uint64_t Arc4SboxData13;
- uint64_t Arc4SboxData14;
- uint64_t Arc4SboxData15;
- uint64_t Arc4SboxData16;
- uint64_t Arc4SboxData17;
- uint64_t Arc4SboxData18;
- uint64_t Arc4SboxData19;
- uint64_t Arc4SboxData20;
- uint64_t Arc4SboxData21;
- uint64_t Arc4SboxData22;
- uint64_t Arc4SboxData23;
- uint64_t Arc4SboxData24;
- uint64_t Arc4SboxData25;
- uint64_t Arc4SboxData26;
- uint64_t Arc4SboxData27;
- uint64_t Arc4SboxData28;
- uint64_t Arc4SboxData29;
- uint64_t Arc4SboxData30;
- uint64_t Arc4SboxData31;
- uint64_t Arc4IJData;
- uint64_t PAD3;
- uint64_t PAD4;
- uint64_t PAD5;
-} ARC4State_t, *ARC4State_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t cipherKey2;
+ uint64_t cipherKey3;
+ uint64_t PAD0;
+ uint64_t PAD1;
+ uint64_t PAD2;
+ uint64_t Arc4SboxData0;
+ uint64_t Arc4SboxData1;
+ uint64_t Arc4SboxData2;
+ uint64_t Arc4SboxData3;
+ uint64_t Arc4SboxData4;
+ uint64_t Arc4SboxData5;
+ uint64_t Arc4SboxData6;
+ uint64_t Arc4SboxData7;
+ uint64_t Arc4SboxData8;
+ uint64_t Arc4SboxData9;
+ uint64_t Arc4SboxData10;
+ uint64_t Arc4SboxData11;
+ uint64_t Arc4SboxData12;
+ uint64_t Arc4SboxData13;
+ uint64_t Arc4SboxData14;
+ uint64_t Arc4SboxData15;
+ uint64_t Arc4SboxData16;
+ uint64_t Arc4SboxData17;
+ uint64_t Arc4SboxData18;
+ uint64_t Arc4SboxData19;
+ uint64_t Arc4SboxData20;
+ uint64_t Arc4SboxData21;
+ uint64_t Arc4SboxData22;
+ uint64_t Arc4SboxData23;
+ uint64_t Arc4SboxData24;
+ uint64_t Arc4SboxData25;
+ uint64_t Arc4SboxData26;
+ uint64_t Arc4SboxData27;
+ uint64_t Arc4SboxData28;
+ uint64_t Arc4SboxData29;
+ uint64_t Arc4SboxData30;
+ uint64_t Arc4SboxData31;
+ uint64_t Arc4IJData;
+ uint64_t PAD3;
+ uint64_t PAD4;
+ uint64_t PAD5;
+} ARC4State_t, *ARC4State_pt;
/* Kasumi f8 - 32 bytes */
typedef struct KASUMIF8_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
-} KASUMIF8_t, *KASUMIF8_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+} KASUMIF8_t, *KASUMIF8_pt;
/* Kasumi f8 + HMAC (MD5, SHA-1, SHA-256) - 80 bytes */
typedef struct KASUMIF8HMAC_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
-} KASUMIF8HMAC_t, *KASUMIF8HMAC_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+} KASUMIF8HMAC_t, *KASUMIF8HMAC_pt;
/* Kasumi f8 + HMAC (SHA-384, SHA-512) - 144 bytes */
typedef struct KASUMIF8HMAC2_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t hmacKey0;
- uint64_t hmacKey1;
- uint64_t hmacKey2;
- uint64_t hmacKey3;
- uint64_t hmacKey4;
- uint64_t hmacKey5;
- uint64_t hmacKey6;
- uint64_t hmacKey7;
- uint64_t hmacKey8;
- uint64_t hmacKey9;
- uint64_t hmacKey10;
- uint64_t hmacKey11;
- uint64_t hmacKey12;
- uint64_t hmacKey13;
- uint64_t hmacKey14;
- uint64_t hmacKey15;
-} KASUMIF8HMAC2_t, *KASUMIF8HMAC2_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t hmacKey0;
+ uint64_t hmacKey1;
+ uint64_t hmacKey2;
+ uint64_t hmacKey3;
+ uint64_t hmacKey4;
+ uint64_t hmacKey5;
+ uint64_t hmacKey6;
+ uint64_t hmacKey7;
+ uint64_t hmacKey8;
+ uint64_t hmacKey9;
+ uint64_t hmacKey10;
+ uint64_t hmacKey11;
+ uint64_t hmacKey12;
+ uint64_t hmacKey13;
+ uint64_t hmacKey14;
+ uint64_t hmacKey15;
+} KASUMIF8HMAC2_t, *KASUMIF8HMAC2_pt;
/* Kasumi f8 + GCM - 144 bytes */
typedef struct KASUMIF8GCM_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t GCMH0;
- uint64_t GCMH1;
- uint64_t GCMSCI;
-} KASUMIF8GCM_t, *KASUMIF8GCM_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t GCMH0;
+ uint64_t GCMH1;
+ uint64_t GCMSCI;
+} KASUMIF8GCM_t, *KASUMIF8GCM_pt;
/* Kasumi f8 + f9 - 32 bytes */
typedef struct KASUMIF8F9_s {
- uint64_t cipherKey0;
- uint64_t cipherKey1;
- uint64_t authKey0;
- uint64_t authKey1;
-} KASUMIF8F9_t, *KASUMIF8F9_pt;
+ uint64_t cipherKey0;
+ uint64_t cipherKey1;
+ uint64_t authKey0;
+ uint64_t authKey1;
+} KASUMIF8F9_t, *KASUMIF8F9_pt;
typedef union CipherHashInfo_u {
- AES256HMAC_t infoAES256HMAC;
- AES256_t infoAES256;
- AES192HMAC_t infoAES192HMAC;
- AES192_t infoAES192;
- AES128HMAC_t infoAES128HMAC;
- AES128_t infoAES128;
- DESHMAC_t infoDESHMAC;
- DES_t infoDES;
- DES3HMAC_t info3DESHMAC;
- DES3_t info3DES;
- HMAC_t infoHMAC;
- /* ARC4 */
- ARC4HMAC_t infoARC4HMAC;
- ARC4StateHMAC_t infoARC4StateHMAC;
- ARC4_t infoARC4;
- ARC4State_t infoARC4State;
- /* AES mode F8 */
- AES256F8HMAC_t infoAES256F8HMAC;
- AES256F8_t infoAES256F8;
- AES192F8HMAC_t infoAES192F8HMAC;
- AES192F8_t infoAES192F8;
- AES128F8HMAC_t infoAES128F8HMAC;
- AES128F8_t infoAES128F8;
- /* KASUMI F8 */
- KASUMIF8HMAC_t infoKASUMIF8HMAC;
- KASUMIF8_t infoKASUMIF8;
- /* GCM */
- GCM_t infoGCM;
- AES256F8GCM_t infoAES256F8GCM;
- AES192F8GCM_t infoAES192F8GCM;
- AES128F8GCM_t infoAES128F8GCM;
- AES256GCM_t infoAES256GCM;
- AES192GCM_t infoAES192GCM;
- AES128GCM_t infoAES128GCM;
- DESGCM_t infoDESGCM;
- DES3GCM_t info3DESGCM;
- ARC4GCM_t infoARC4GCM;
- ARC4StateGCM_t infoARC4StateGCM;
- KASUMIF8GCM_t infoKASUMIF8GCM;
- /* HMAC2 */
- HMAC2_t infoHMAC2;
- AES256F8HMAC2_t infoAES256F8HMAC2;
- AES192F8HMAC2_t infoAES192F8HMAC2;
- AES128F8HMAC2_t infoAES128F8HMAC2;
- AES256HMAC2_t infoAES256HMAC2;
- AES192HMAC2_t infoAES192HMAC2;
- AES128HMAC2_t infoAES128HMAC2;
- DESHMAC2_t infoDESHMAC2;
- DES3HMAC2_t info3DESHMAC2;
- ARC4HMAC2_t infoARC4HMAC2;
- ARC4StateHMAC2_t infoARC4StateHMAC2;
- KASUMIF8HMAC2_t infoKASUMIF8HMAC2;
- /* F9 */
- F9_t infoF9;
- AES256F8F9_t infoAES256F8F9;
- AES192F8F9_t infoAES192F8F9;
- AES128F8F9_t infoAES128F8F9;
- AES256F9_t infoAES256F9;
- AES192F9_t infoAES192F9;
- AES128F9_t infoAES128F9;
- DESF9_t infoDESF9;
- DES3F9_t info3DESF9;
- ARC4F9_t infoARC4F9;
- ARC4StateF9_t infoARC4StateF9;
- KASUMIF8F9_t infoKASUMIF8F9;
-} CipherHashInfo_t, *CipherHashInfo_pt;
-
-
-/*
- *
- * ControlDescriptor_s datastructure
- *
+ AES256HMAC_t infoAES256HMAC;
+ AES256_t infoAES256;
+ AES192HMAC_t infoAES192HMAC;
+ AES192_t infoAES192;
+ AES128HMAC_t infoAES128HMAC;
+ AES128_t infoAES128;
+ DESHMAC_t infoDESHMAC;
+ DES_t infoDES;
+ DES3HMAC_t info3DESHMAC;
+ DES3_t info3DES;
+ HMAC_t infoHMAC;
+ /* ARC4 */
+ ARC4HMAC_t infoARC4HMAC;
+ ARC4StateHMAC_t infoARC4StateHMAC;
+ ARC4_t infoARC4;
+ ARC4State_t infoARC4State;
+ /* AES mode F8 */
+ AES256F8HMAC_t infoAES256F8HMAC;
+ AES256F8_t infoAES256F8;
+ AES192F8HMAC_t infoAES192F8HMAC;
+ AES192F8_t infoAES192F8;
+ AES128F8HMAC_t infoAES128F8HMAC;
+ AES128F8_t infoAES128F8;
+ /* KASUMI F8 */
+ KASUMIF8HMAC_t infoKASUMIF8HMAC;
+ KASUMIF8_t infoKASUMIF8;
+ /* GCM */
+ GCM_t infoGCM;
+ AES256F8GCM_t infoAES256F8GCM;
+ AES192F8GCM_t infoAES192F8GCM;
+ AES128F8GCM_t infoAES128F8GCM;
+ AES256GCM_t infoAES256GCM;
+ AES192GCM_t infoAES192GCM;
+ AES128GCM_t infoAES128GCM;
+ DESGCM_t infoDESGCM;
+ DES3GCM_t info3DESGCM;
+ ARC4GCM_t infoARC4GCM;
+ ARC4StateGCM_t infoARC4StateGCM;
+ KASUMIF8GCM_t infoKASUMIF8GCM;
+ /* HMAC2 */
+ HMAC2_t infoHMAC2;
+ AES256F8HMAC2_t infoAES256F8HMAC2;
+ AES192F8HMAC2_t infoAES192F8HMAC2;
+ AES128F8HMAC2_t infoAES128F8HMAC2;
+ AES256HMAC2_t infoAES256HMAC2;
+ AES192HMAC2_t infoAES192HMAC2;
+ AES128HMAC2_t infoAES128HMAC2;
+ DESHMAC2_t infoDESHMAC2;
+ DES3HMAC2_t info3DESHMAC2;
+ ARC4HMAC2_t infoARC4HMAC2;
+ ARC4StateHMAC2_t infoARC4StateHMAC2;
+ KASUMIF8HMAC2_t infoKASUMIF8HMAC2;
+ /* F9 */
+ F9_t infoF9;
+ AES256F8F9_t infoAES256F8F9;
+ AES192F8F9_t infoAES192F8F9;
+ AES128F8F9_t infoAES128F8F9;
+ AES256F9_t infoAES256F9;
+ AES192F9_t infoAES192F9;
+ AES128F9_t infoAES128F9;
+ DESF9_t infoDESF9;
+ DES3F9_t info3DESF9;
+ ARC4F9_t infoARC4F9;
+ ARC4StateF9_t infoARC4StateF9;
+ KASUMIF8F9_t infoKASUMIF8F9;
+} CipherHashInfo_t, *CipherHashInfo_pt;
+
+
+/*
+ *
+ * ControlDescriptor_s datastructure
+ *
*/
typedef struct ControlDescriptor_s {
- uint64_t instruction;
- CipherHashInfo_t cipherHashInfo;
-} ControlDescriptor_t, *ControlDescriptor_pt;
+ uint64_t instruction;
+ CipherHashInfo_t cipherHashInfo;
+} ControlDescriptor_t, *ControlDescriptor_pt;
@@ -1877,7 +1877,7 @@ typedef struct ControlDescriptor_s {
* PacketDescriptor_t.srcLengthIVOffUseIVNext
* ------------------------------------------
*
- * 63 62 61 59 58 57 56 54 53 43
+ * 63 62 61 59 58 57 56 54 53 43
* ------------------------------------------------------------------------------------------------
* || Load HMAC key || Pad Hash || Hash Byte Count || Next || Use IV || IV Offset || Packet length || ... CONT ...
* ------------------------------------------------------------------------------------------------
@@ -1920,7 +1920,7 @@ typedef struct ControlDescriptor_s {
* On subsequent frags: Do write out to DST the (dword) offset data
* IV Offset = On first frag: Offset IN NB OF 8 BYTE WORDS (dwords) from beginning of packet
* (i.e. (Potentially byte-shifted) Segment address) to cipher IV
- * On subsequent frags: Offset to beginning of data to process; data to offset won't
+ * On subsequent frags: Offset to beginning of data to process; data to offset won't
* be given to engines and will be written out to dst in the clear.
* ON SUBSEQUENT FRAGS, IV_Offset MAY NOT EXCEED 3; LARGER VALUES WILL CAUSE AN ERROR
* SEE ERROR CONDITIONS BELOW
@@ -1977,17 +1977,17 @@ typedef struct ControlDescriptor_s {
* E/D = 1'b0 Decrypt
* 1'b1 Encrypt
* Overloaded to also mean IV byte offset for first frag
- * Cipher_Offset = Nb of words between the first data segment
+ * Cipher_Offset = Nb of words between the first data segment
* and word on which to start cipher operation
* (64 BIT WORDS !!!)
* Hash_Offset = Nb of words between the first data segment
- * and word on which to start hashing
+ * and word on which to start hashing
* (64 bit words)
* Hash_Src = 1'b0 DMA channel
- * 1'b1 Cipher if word count exceeded Cipher_Offset;
+ * 1'b1 Cipher if word count exceeded Cipher_Offset;
* DMA channel otherwise
- * CkSum_Offset = Nb of words between the first data segment
- * and word on which to start
+ * CkSum_Offset = Nb of words between the first data segment
+ * and word on which to start
* checksum calculation (32 BIT WORDS !!!)
* CkSum_Src = 1'b0 DMA channel
* 1'b1 Cipher if word count exceeded Cipher_Offset
@@ -2000,7 +2000,7 @@ typedef struct ControlDescriptor_s {
* PacketDescriptor_t.authDstNonceLow
* ----------------------------------
*
- * 63 40 39 5 4 0
+ * 63 40 39 5 4 0
* -----------------------------------------------------
* || Nonce_Low || Auth_dst_address || Cipher_Offset_Hi ||
* -----------------------------------------------------
@@ -2070,7 +2070,7 @@ ected) regular CTR
/* #define PKT_DSC_PADHASH */
#define PKT_DSC_PADHASH_PADDED 0
-#define PKT_DSC_PADHASH_PAD 1 /* requires padding */
+#define PKT_DSC_PADHASH_PAD 1 /* requires padding */
#define PKT_DSC_PADHASH_LSB 62
#define PKT_DSC_PADHASH_BITS ONE_BIT
#define PKT_DSC_PADHASH_MASK (PKT_DSC_PADHASH_BITS << PKT_DSC_PADHASH_LSB)
@@ -2128,7 +2128,7 @@ ected) regular CTR
#define PKT_DSC_WAIT_MASK (PKT_DSC_WAIT_BITS << PKT_DSC_WAIT_LSB)
/* #define PKT_DSC_SEGADDR */
-#define PKT_DSC_SEGADDR_LSB 5
+#define PKT_DSC_SEGADDR_LSB 5
#define PKT_DSC_SEGADDR_BITS FOURTY_BITS
#define PKT_DSC_SEGADDR_MASK \
(PKT_DSC_SEGADDR_BITS << PKT_DSC_SEGADDR_LSB)
@@ -2156,24 +2156,24 @@ ected) regular CTR
#define PKT_DSC_ARC4BYTECOUNT_LSB 60
#define PKT_DSC_ARC4BYTECOUNT_BITS THREE_BITS
#define PKT_DSC_ARC4BYTECOUNT_MASK (PKT_DSC_ARC4BYTECOUNT_BITS << PKT_DSC_ARC4BYTECOUNT_LSB)
-
+
/* #define PKT_DSC_SYM_OP (symmetric key operation) */
#define PKT_DSC_SYM_OP_DECRYPT 0
#define PKT_DSC_SYM_OP_ENCRYPT 1
#define PKT_DSC_SYM_OP_LSB 59
#define PKT_DSC_SYM_OP_BITS ONE_BIT
#define PKT_DSC_SYM_OP_MASK (PKT_DSC_SYM_OP_BITS << PKT_DSC_SYM_OP_LSB)
-
+
/* #define PKT_DSC_CPHROFF */
#define PKT_DSC_CPHROFF_LSB 56
#define PKT_DSC_CPHROFF_BITS THREE_BITS
#define PKT_DSC_CPHROFF_MASK (PKT_DSC_CPHROFF_BITS << PKT_DSC_CPHROFF_LSB)
-
+
/* #define PKT_DSC_HASHOFF */
#define PKT_DSC_HASHOFF_LSB 54
#define PKT_DSC_HASHOFF_BITS TWO_BITS
#define PKT_DSC_HASHOFF_MASK (PKT_DSC_HASHOFF_BITS << PKT_DSC_HASHOFF_LSB)
-
+
/* #define PKT_DSC_HASHSRC */
#define PKT_DSC_HASHSRC_DMA 0
#define PKT_DSC_HASHSRC_CIPHER 1
@@ -2185,7 +2185,7 @@ ected) regular CTR
#define PKT_DSC_CKSUMOFF_LSB 41
#define PKT_DSC_CKSUMOFF_BITS TWELVE_BITS
#define PKT_DSC_CKSUMOFF_MASK (PKT_DSC_CKSUMOFF_BITS << PKT_DSC_CKSUMOFF_LSB)
-
+
/* #define PKT_DSC_CKSUMSRC */
#define PKT_DSC_CKSUMSRC_DMA 0
#define PKT_DSC_CKSUMSRC_CIPHER 1
@@ -2254,12 +2254,12 @@ ected) regular CTR
#define PKT_DSC_LASTWORD_LSB 56
#define PKT_DSC_LASTWORD_BITS TWO_BITS
#define PKT_DSC_LASTWORD_MASK (PKT_DSC_LASTWORD_BITS << PKT_DSC_LASTWORD_LSB)
-
+
/* #define PKT_DSC_CFB_MASK */
#define PKT_DSC_CFB_MASK_LSB 48
#define PKT_DSC_CFB_MASK_BITS EIGHT_BITS
#define PKT_DSC_CFB_MASK_MASK (PKT_DSC_CFB_MASK_BITS << PKT_DSC_CFB_MASK_LSB)
-
+
/* #define PKT_DSC_NONCE_HI */
#define PKT_DSC_NONCE_HI_LSB 40
#define PKT_DSC_NONCE_HI_BITS EIGHT_BITS
@@ -2280,100 +2280,100 @@ ected) regular CTR
* Control Error Code and Conditions
* ******************************************************************
*/
-#define CTL_ERR_NONE 0x0000 /* No Error */
-#define CTL_ERR_CIPHER_OP 0x0001 /* Unknown Cipher Op */
-#define CTL_ERR_MODE 0x0002 /* Unknown or Not Allowed Mode */
-#define CTL_ERR_CHKSUM_SRC 0x0004 /* Unknown CkSum Src - UNUSED */
-#define CTL_ERR_CFB_MASK 0x0008 /* Forbidden CFB Mask - UNUSED */
-#define CTL_ERR_OP 0x0010 /* Unknown Ctrl Op - UNUSED */
-#define CTL_ERR_UNDEF1 0x0020 /* UNUSED */
-#define CTL_ERR_UNDEF2 0x0040 /* UNUSED */
-#define CTL_ERR_DATA_READ 0x0080 /* Data Read Error */
-#define CTL_ERR_DESC_CTRL 0x0100 /* Descriptor Ctrl Field Error */
-
-#define CTL_ERR_TIMEOUT 0x1000 /* Message Response Timeout */
+#define CTL_ERR_NONE 0x0000 /* No Error */
+#define CTL_ERR_CIPHER_OP 0x0001 /* Unknown Cipher Op */
+#define CTL_ERR_MODE 0x0002 /* Unknown or Not Allowed Mode */
+#define CTL_ERR_CHKSUM_SRC 0x0004 /* Unknown CkSum Src - UNUSED */
+#define CTL_ERR_CFB_MASK 0x0008 /* Forbidden CFB Mask - UNUSED */
+#define CTL_ERR_OP 0x0010 /* Unknown Ctrl Op - UNUSED */
+#define CTL_ERR_UNDEF1 0x0020 /* UNUSED */
+#define CTL_ERR_UNDEF2 0x0040 /* UNUSED */
+#define CTL_ERR_DATA_READ 0x0080 /* Data Read Error */
+#define CTL_ERR_DESC_CTRL 0x0100 /* Descriptor Ctrl Field Error */
+
+#define CTL_ERR_TIMEOUT 0x1000 /* Message Response Timeout */
/* ******************************************************************
* Data Error Code and Conditions
* ******************************************************************
*/
-#define DATA_ERR_NONE 0x0000 /* No Error */
-#define DATA_ERR_LEN_CIPHER 0x0001 /* Not Enough Data To Cipher */
-#define DATA_ERR_IV_ADDR 0x0002 /* Illegal IV Loacation */
-#define DATA_ERR_WD_LEN_AES 0x0004 /* Illegal Nb Words To AES */
-#define DATA_ERR_BYTE_COUNT 0x0008 /* Illegal Pad And ByteCount Spec */
-#define DATA_ERR_LEN_CKSUM 0x0010 /* Not Enough Data To CkSum */
-#define DATA_ERR_OP 0x0020 /* Unknown Data Op */
-#define DATA_ERR_UNDEF1 0x0040 /* UNUSED */
-#define DATA_ERR_READ 0x0080 /* Data Read Error */
-#define DATA_ERR_WRITE 0x0100 /* Data Write Error */
+#define DATA_ERR_NONE 0x0000 /* No Error */
+#define DATA_ERR_LEN_CIPHER 0x0001 /* Not Enough Data To Cipher */
+#define DATA_ERR_IV_ADDR 0x0002 /* Illegal IV Loacation */
+#define DATA_ERR_WD_LEN_AES 0x0004 /* Illegal Nb Words To AES */
+#define DATA_ERR_BYTE_COUNT 0x0008 /* Illegal Pad And ByteCount Spec */
+#define DATA_ERR_LEN_CKSUM 0x0010 /* Not Enough Data To CkSum */
+#define DATA_ERR_OP 0x0020 /* Unknown Data Op */
+#define DATA_ERR_UNDEF1 0x0040 /* UNUSED */
+#define DATA_ERR_READ 0x0080 /* Data Read Error */
+#define DATA_ERR_WRITE 0x0100 /* Data Write Error */
/*
- * Common Descriptor
+ * Common Descriptor
* NOTE: Size of struct is size of cacheline.
*/
typedef struct OperationDescriptor_s {
- uint64_t phys_self;
- uint32_t stn_id;
- uint32_t flags;
- uint32_t cpu;
- uint32_t seq_num;
- uint64_t reserved;
-} OperationDescriptor_t, *OperationDescriptor_pt;
+ uint64_t phys_self;
+ uint32_t stn_id;
+ uint32_t flags;
+ uint32_t cpu;
+ uint32_t seq_num;
+ uint64_t reserved;
+} OperationDescriptor_t, *OperationDescriptor_pt;
/*
* This defines the security data descriptor format
*/
typedef struct PacketDescriptor_s {
- uint64_t srcLengthIVOffUseIVNext;
- uint64_t dstDataSettings;
- uint64_t authDstNonceLow;
- uint64_t ckSumDstNonceHiCFBMaskLLWMask;
-} PacketDescriptor_t, *PacketDescriptor_pt;
+ uint64_t srcLengthIVOffUseIVNext;
+ uint64_t dstDataSettings;
+ uint64_t authDstNonceLow;
+ uint64_t ckSumDstNonceHiCFBMaskLLWMask;
+} PacketDescriptor_t, *PacketDescriptor_pt;
typedef struct {
- uint8_t *user_auth;
- uint8_t *user_src;
- uint8_t *user_dest;
- uint8_t *user_state;
- uint8_t *kern_auth;
- uint8_t *kern_src;
- uint8_t *kern_dest;
- uint8_t *kern_state;
- uint8_t *aligned_auth;
- uint8_t *aligned_src;
- uint8_t *aligned_dest;
- uint8_t *aligned_state;
-} xlr_sec_drv_user_t, *xlr_sec_drv_user_pt;
+ uint8_t *user_auth;
+ uint8_t *user_src;
+ uint8_t *user_dest;
+ uint8_t *user_state;
+ uint8_t *kern_auth;
+ uint8_t *kern_src;
+ uint8_t *kern_dest;
+ uint8_t *kern_state;
+ uint8_t *aligned_auth;
+ uint8_t *aligned_src;
+ uint8_t *aligned_dest;
+ uint8_t *aligned_state;
+} xlr_sec_drv_user_t, *xlr_sec_drv_user_pt;
typedef struct symkey_desc {
- OperationDescriptor_t op_ctl; /* size is cacheline */
- PacketDescriptor_t pkt_desc[2]; /* size is cacheline */
- ControlDescriptor_t ctl_desc; /* makes this aligned */
- uint64_t control; /* message word0 */
- uint64_t data; /* message word1 */
- uint64_t ctl_result;
- uint64_t data_result;
- struct symkey_desc *alloc; /* real allocated addr */
- xlr_sec_drv_user_t user;
-// volatile atomic_t flag_complete;
-// struct semaphore sem_complete;
-// wait_queue_t submit_wait;
-
- uint8_t *next_src_buf;
- uint32_t next_src_len;
-
- uint8_t *next_dest_buf;
- uint32_t next_dest_len;
-
- uint8_t* next_auth_dest;
- uint8_t* next_cksum_dest;
-
- void* ses;
-} symkey_desc_t, *symkey_desc_pt;
+ OperationDescriptor_t op_ctl; /* size is cacheline */
+ PacketDescriptor_t pkt_desc[2]; /* size is cacheline */
+ ControlDescriptor_t ctl_desc; /* makes this aligned */
+ uint64_t control; /* message word0 */
+ uint64_t data; /* message word1 */
+ uint64_t ctl_result;
+ uint64_t data_result;
+ struct symkey_desc *alloc; /* real allocated addr */
+ xlr_sec_drv_user_t user;
+ //volatile atomic_t flag_complete;
+ //struct semaphore sem_complete;
+ //wait_queue_t submit_wait;
+
+ uint8_t *next_src_buf;
+ uint32_t next_src_len;
+
+ uint8_t *next_dest_buf;
+ uint32_t next_dest_len;
+
+ uint8_t *next_auth_dest;
+ uint8_t *next_cksum_dest;
+
+ void *ses;
+} symkey_desc_t, *symkey_desc_pt;
/*
@@ -2406,7 +2406,7 @@ typedef struct symkey_desc {
* Op Class = 7'h0_0 Modular exponentiation
* 7'h0_1 ECC (including prime modular ops and binary GF ops)
* REMAINDER UNDEF
- *
+ *
* Valid Op = 1'b1 Will cause operation to start; descriptors sent back at end of operation
* 1'b0 No operation performed; descriptors sent back right away
*
@@ -2420,7 +2420,7 @@ typedef struct symkey_desc {
* Block Width = 1'b1 1024 bit op
* = 1'b0 512 bit op
* Load Constant = 1'b1 Load constant from data structure
- * 1'b0 Preserve old constant (this assumes
+ * 1'b0 Preserve old constant (this assumes
* Source Addr points to RSAData_pt->Exponent
* or that the length of Constant is 0)
* Exponent Width = 11-bit expression of exponent width EXPRESSED IN NUMBER OF BITS
@@ -2483,11 +2483,11 @@ typedef struct symkey_desc {
* Software Scratch1 = Two bit field ignored by engine and returned as is in free descriptor
*
* Global dst data offset = Nb BYTES to left-shift (double-word boundary aligned) data by before writing it to memory
- *
+ *
*
*/
-/*
+/*
* ECC data formats
*/
@@ -2510,8 +2510,8 @@ typedef struct symkey_desc {
* 224, 256) or 8 dwords (384, 512)
*
* The total lengths in dwords that are read and in
- * bytes that are written, for each operation and
- * length group, are specified at the bottom of each
+ * bytes that are written, for each operation and
+ * length group, are specified at the bottom of each
* datastructure.
*
* In all that follows, m is the modulus and cst is the constant,
@@ -2538,7 +2538,7 @@ typedef struct symkey_desc {
* y_p 2x(3/4/6/8)=
* y_p 6/8/12/16 dw
* a
- * k
+ * k
* m
* cst
* 7x(3/4/6/8)+(4/4/8/8)=
@@ -2705,7 +2705,7 @@ typedef struct symkey_desc {
*/
/*
- * IMPORTANT NOTE:
+ * IMPORTANT NOTE:
*
* As specified in the datastructures below,
* the engine assumes all data (including
@@ -2847,13 +2847,13 @@ typedef struct symkey_desc {
(PUBKEY_CTL_EXPWIDTH_BITS << PUBKEY_CTL_EXPWIDTH_LSB)
/* #define PUBKEY_CTL_SRCADDR */
-#define PUBKEY_CTL_SRCADDR_LSB 0
+#define PUBKEY_CTL_SRCADDR_LSB 0
#define PUBKEY_CTL_SRCADDR_BITS FOURTY_BITS
#define PUBKEY_CTL_SRCADDR_MASK \
(PUBKEY_CTL_SRCADDR_BITS << PUBKEY_CTL_SRCADDR_LSB)
/* #define PUBKEY_CTL_SRC_OFFSET */
-#define PUBKEY_CTL_SRC_OFFSET_LSB 0
+#define PUBKEY_CTL_SRC_OFFSET_LSB 0
#define PUBKEY_CTL_SRC_OFFSET_BITS THREE_BITS
#define PUBKEY_CTL_SRC_OFFSET_MASK \
(PUBKEY_CTL_SRC_OFFSET_BITS << PUBKEY_CTL_SRC_OFFSET_LSB)
@@ -2865,7 +2865,7 @@ typedef struct symkey_desc {
#define PUBKEY_CTL1_CTL_MASK (PUBKEY_CTL_CTL_BITS << PUBKEY_CTL_CTL_LSB)
/* #define PUBKEY_CTL1_MODWIDTH */
-#define PUBKEY_CTL1_MODWIDTH_LSB 40
+#define PUBKEY_CTL1_MODWIDTH_LSB 40
#define PUBKEY_CTL1_MODWIDTH_BITS ELEVEN_BITS
#define PUBKEY_CTL1_MODWIDTH_MASK \
(PUBKEY_CTL1_MODWIDTH_BITS << PUBKEY_CTL1_MODWIDTH_LSB)
@@ -2953,13 +2953,13 @@ typedef struct symkey_desc {
#define PUBKEY_RSLT_CTL_ERROR_BITS NINE_BITS
#define PUBKEY_RSLT_CTL_ERROR_MASK \
(PUBKEY_RSLT_CTL_ERROR_BITS << PUBKEY_RSLT_CTL_ERROR_LSB)
-
+
/* #define PUBKEY_RSLT_CTL_SRCADDR */
#define PUBKEY_RSLT_CTL_SRCADDR_LSB 0
#define PUBKEY_RSLT_CTL_SRCADDR_BITS FOURTY_BITS
#define PUBKEY_RSLT_CTL_SRCADDR_MASK \
(PUBKEY_RSLT_CTL_SRCADDR_BITS << PUBKEY_RSLT_CTL_SRCADDR_LSB)
-
+
/* #define PUBKEY_RSLT_DATA_CTL */
#define PUBKEY_RSLT_DATA_CTL_LSB 61
@@ -2984,32 +2984,33 @@ typedef struct symkey_desc {
#define PUBKEY_RSLT_DATA_ERROR_BITS NINE_BITS
#define PUBKEY_RSLT_DATA_ERROR_MASK \
(PUBKEY_RSLT_DATA_ERROR_BITS << PUBKEY_RSLT_DATA_ERROR_LSB)
-
+
/* #define PUBKEY_RSLT_DATA_DSTADDR */
#define PUBKEY_RSLT_DATA_DSTADDR_LSB 40
#define PUBKEY_RSLT_DATA_DSTADDR_BITS FOURTY_BITS
#define PUBKEY_RSLT_DATA_DSTADDR_MASK \
(PUBKEY_RSLT_DATA_DSTADDR_BITS << PUBKEY_RSLT_DATA_DSTADDR_LSB)
-/*
+/*
* ******************************************************************
* RSA Block - Data Error Code and Conditions
* ******************************************************************
*/
-#define PK_CTL_ERR_NONE 0x0000 /* No Error */
-#define PK_CTL_ERR_OP_CLASS 0x0001 /* Undefined Op Class */
-#define PK_CTL_ERR_ECC_TYPE 0x0002 /* Undefined ECC TYPE (ECC only) */
-#define PK_CTL_ERR_ECC_FUNCT 0x0004 /* Undefined ECC FUNCTION (ECC only) */
-#define PK_CTL_ERR_ECC_TIMEOUT 0x0008 /* ECC timeout (ECC only) */
-#define PK_CTL_ERR_READ 0x0080 /* Data Read Error */
-#define PK_CTL_ERR_DESC 0x0100 /* Descriptor Ctrl Field Error (D0.Ctrl != SOP || D1.Ctrl != EOP) */
-#define PK_CTL_ERR_TIMEOUT 0x1000 /* Message Responce Timeout */
+#define PK_CTL_ERR_NONE 0x0000 /* No Error */
+#define PK_CTL_ERR_OP_CLASS 0x0001 /* Undefined Op Class */
+#define PK_CTL_ERR_ECC_TYPE 0x0002 /* Undefined ECC TYPE (ECC only) */
+#define PK_CTL_ERR_ECC_FUNCT 0x0004 /* Undefined ECC FUNCTION (ECC only) */
+#define PK_CTL_ERR_ECC_TIMEOUT 0x0008 /* ECC timeout (ECC only) */
+#define PK_CTL_ERR_READ 0x0080 /* Data Read Error */
+#define PK_CTL_ERR_DESC 0x0100 /* Descriptor Ctrl Field Error
+ * (D0.Ctrl != SOP || D1.Ctrl != EOP) */
+#define PK_CTL_ERR_TIMEOUT 0x1000 /* Message Responce Timeout */
-#define PK_DATA_ERR_NONE 0x0000 /* No Error */
-#define PK_DATA_ERR_EXP_WIDTH 0x0001 /* Exponent Width > Block Width */
-#define PK_DATA_ERR_MOD_WIDTH 0x0002 /* Modulus Width > Block Width */
-#define PK_DATA_ERR_READ 0x0080 /* Data Read Error */
+#define PK_DATA_ERR_NONE 0x0000 /* No Error */
+#define PK_DATA_ERR_EXP_WIDTH 0x0001 /* Exponent Width > Block Width */
+#define PK_DATA_ERR_MOD_WIDTH 0x0002 /* Modulus Width > Block Width */
+#define PK_DATA_ERR_READ 0x0080 /* Data Read Error */
/*
@@ -3028,25 +3029,25 @@ typedef struct symkey_desc {
*/
typedef struct UserPubData_s {
- uint8_t *source;
- uint8_t *user_result;
- uint32_t result_length;
-} UserPubData_t, *UserPubData_pt;
+ uint8_t *source;
+ uint8_t *user_result;
+ uint32_t result_length;
+} UserPubData_t, *UserPubData_pt;
typedef struct pubkey_desc {
- OperationDescriptor_t op_ctl; /* size is cacheline */
- uint8_t source[1024];
- uint8_t dest[256]; /* 1024 makes cacheline-aligned */
- uint64_t control0;
- uint64_t control1;
- uint64_t ctl_result;
- uint64_t data_result;
- struct pubkey_desc *alloc;
- UserPubData_t kern; /* ptrs for temp buffers */
-// volatile atomic_t flag_complete;
-// struct semaphore sem_complete;
-// wait_queue_t submit_wait;
-} pubkey_desc_t, *pubkey_desc_pt;
+ OperationDescriptor_t op_ctl; /* size is cacheline */
+ uint8_t source[1024];
+ uint8_t dest[256]; /* 1024 makes cacheline-aligned */
+ uint64_t control0;
+ uint64_t control1;
+ uint64_t ctl_result;
+ uint64_t data_result;
+ struct pubkey_desc *alloc;
+ UserPubData_t kern; /* ptrs for temp buffers */
+ //volatile atomic_t flag_complete;
+ //struct semaphore sem_complete;
+ //wait_queue_t submit_wait;
+} pubkey_desc_t, *pubkey_desc_pt;
/*
* KASUMI F8 and F9 use the IV0/IV1 fields :
@@ -3054,7 +3055,7 @@ typedef struct pubkey_desc {
* 63 41 40 39 37 36 32 31 0
* ----------------------------------------------------------------------------
* | |FX/DIRECTION| | F8/BEARER | F8/COUNT | IV0
- * ----------------------------------------------------------------------------
+ * ----------------------------------------------------------------------------
* 1 5 32
*
* 63 32 31 0
@@ -3063,4 +3064,4 @@ typedef struct pubkey_desc {
* ----------------------------------------------------------------------------
* 32 32
*/
-#endif /* _XLR_SEC_DESC_H_ */
+#endif /* _XLR_SEC_DESC_H_ */
diff --git a/sys/dev/rmi/sec/rmilib.c b/sys/dev/rmi/sec/rmilib.c
index a2eda2b..219ef6c 100644
--- a/sys/dev/rmi/sec/rmilib.c
+++ b/sys/dev/rmi/sec/rmilib.c
@@ -58,67 +58,74 @@
#include <dev/rmi/sec/desc.h>
-//static int msgrng_stnid_pk0 = MSGRNG_STNID_PK0;
+// static int msgrng_stnid_pk0 = MSGRNG_STNID_PK0;
+
/*#define RMI_SEC_DEBUG */
#define SMP_CACHE_BYTES XLR_CACHELINE_SIZE
#define NUM_CHUNKS(size, bits) ( ((size)>>(bits)) + (((size)&((1<<(bits))-1))?1:0) )
static const char nib2hex[] = "0123456789ABCDEF";
-symkey_desc_pt g_desc;
-struct xlr_sec_command *g_cmd;
+symkey_desc_pt g_desc;
+struct xlr_sec_command *g_cmd;
#ifdef XLR_SEC_CMD_DEBUG
static void
-decode_symkey_desc (symkey_desc_pt desc, uint32_t cfg_vector);
+ decode_symkey_desc(symkey_desc_pt desc, uint32_t cfg_vector);
+
#endif
-void print_buf (char *desc, void *data, int len);
+void print_buf(char *desc, void *data, int len);
static int
-xlr_sec_cipher_hash_command(xlr_sec_io_pt op, symkey_desc_pt desc, uint8_t );
+ xlr_sec_cipher_hash_command(xlr_sec_io_pt op, symkey_desc_pt desc, uint8_t);
-static xlr_sec_error_t
-xlr_sec_setup_descriptor (xlr_sec_io_pt op,
- unsigned int flags,
- symkey_desc_pt desc,
- uint32_t *cfg_vector);
+static xlr_sec_error_t
+xlr_sec_setup_descriptor(xlr_sec_io_pt op,
+ unsigned int flags,
+ symkey_desc_pt desc,
+ uint32_t * cfg_vector);
static
-xlr_sec_error_t xlr_sec_setup_packet (xlr_sec_io_pt op,
- symkey_desc_pt desc,
- unsigned int flags,
- uint64_t *data,
- PacketDescriptor_pt pkt_desc,
- ControlDescriptor_pt ctl_desc,
- uint32_t vector,
- PacketDescriptor_pt next_pkt_desc,
- uint8_t multi_frag_flag);
-
-static int
-xlr_sec_submit_message(symkey_desc_pt desc, uint32_t cfg_vector);
+xlr_sec_error_t
+xlr_sec_setup_packet(xlr_sec_io_pt op,
+ symkey_desc_pt desc,
+ unsigned int flags,
+ uint64_t * data,
+ PacketDescriptor_pt pkt_desc,
+ ControlDescriptor_pt ctl_desc,
+ uint32_t vector,
+ PacketDescriptor_pt next_pkt_desc,
+ uint8_t multi_frag_flag);
+
+static int
+ xlr_sec_submit_message(symkey_desc_pt desc, uint32_t cfg_vector);
static
-xlr_sec_error_t xlr_sec_setup_cipher(xlr_sec_io_pt op,
- ControlDescriptor_pt ctl_desc,
- uint32_t *vector);
+xlr_sec_error_t
+xlr_sec_setup_cipher(xlr_sec_io_pt op,
+ ControlDescriptor_pt ctl_desc,
+ uint32_t * vector);
static
-xlr_sec_error_t xlr_sec_setup_digest(xlr_sec_io_pt op,
- ControlDescriptor_pt ctl_desc,
- uint32_t *vector);
+xlr_sec_error_t
+xlr_sec_setup_digest(xlr_sec_io_pt op,
+ ControlDescriptor_pt ctl_desc,
+ uint32_t * vector);
static
-xlr_sec_error_t xlr_sec_setup_cksum(xlr_sec_io_pt op,
- ControlDescriptor_pt ctl_desc);
+xlr_sec_error_t
+xlr_sec_setup_cksum(xlr_sec_io_pt op,
+ ControlDescriptor_pt ctl_desc);
static
-xlr_sec_error_t xlr_sec_control_setup (xlr_sec_io_pt op,
- unsigned int flags,
- uint64_t *control,
- ControlDescriptor_pt ctl_desc,
- xlr_sec_drv_user_t *user,
- uint32_t vector);
+xlr_sec_error_t
+xlr_sec_control_setup(xlr_sec_io_pt op,
+ unsigned int flags,
+ uint64_t * control,
+ ControlDescriptor_pt ctl_desc,
+ xlr_sec_drv_user_t * user,
+ uint32_t vector);
xlr_sec_error_t
@@ -126,3068 +133,3040 @@ xlr_sec_submit_op(symkey_desc_pt desc);
static void xlr_sec_free_desc(symkey_desc_pt desc);
-void xlr_sec_msgring_handler(int bucket, int size, int code, int stid,
- struct msgrng_msg *msg, void *data);
+void
+xlr_sec_msgring_handler(int bucket, int size, int code, int stid,
+ struct msgrng_msg *msg, void *data);
-void xlr_sec_init( struct xlr_sec_softc *sc)
+void
+xlr_sec_init(struct xlr_sec_softc *sc)
{
- unsigned int i;
- xlr_reg_t* mmio;
+ unsigned int i;
+ xlr_reg_t *mmio;
- mmio = sc->mmio = xlr_io_mmio( XLR_IO_SECURITY_OFFSET ) ;
+ mmio = sc->mmio = xlr_io_mmio(XLR_IO_SECURITY_OFFSET);
- xlr_write_reg(mmio, SEC_DMA_CREDIT, SEC_DMA_CREDIT_CONFIG);
+ xlr_write_reg(mmio, SEC_DMA_CREDIT, SEC_DMA_CREDIT_CONFIG);
- xlr_write_reg(mmio, SEC_CONFIG2, SEC_CFG2_ROUND_ROBIN_ON);
+ xlr_write_reg(mmio, SEC_CONFIG2, SEC_CFG2_ROUND_ROBIN_ON);
- for(i = 0; i < 8; i++)
- xlr_write_reg (mmio,
- SEC_MSG_BUCKET0_SIZE + i,
- xlr_is_xls() ?
- xls_bucket_sizes.bucket[MSGRNG_STNID_SEC + i]:
- bucket_sizes.bucket[MSGRNG_STNID_SEC + i]);
+ for (i = 0; i < 8; i++)
+ xlr_write_reg(mmio,
+ SEC_MSG_BUCKET0_SIZE + i,
+ xlr_is_xls() ?
+ xls_bucket_sizes.bucket[MSGRNG_STNID_SEC + i] :
+ bucket_sizes.bucket[MSGRNG_STNID_SEC + i]);
- for(i = 0; i < 128; i++)
- xlr_write_reg (mmio,
- SEC_CC_CPU0_0 + i,
- xlr_is_xls() ?
- xls_cc_table_sec.counters[i>>3][i&0x07]:
- cc_table_sec.counters[i>>3][i&0x07]);
+ for (i = 0; i < 128; i++)
+ xlr_write_reg(mmio,
+ SEC_CC_CPU0_0 + i,
+ xlr_is_xls() ?
+ xls_cc_table_sec.counters[i >> 3][i & 0x07] :
+ cc_table_sec.counters[i >> 3][i & 0x07]);
- /*
- * Register a bucket handler with the phoenix messaging subsystem
- * For now, register handler for bucket 0->5 in msg stn 0
- */
- if (register_msgring_handler(TX_STN_SAE, xlr_sec_msgring_handler,NULL)) {
- panic("Couldn't register msgring handler 0\n");
- }
-
- return ;
+ /*
+ * Register a bucket handler with the phoenix messaging subsystem
+ * For now, register handler for bucket 0->5 in msg stn 0
+ */
+ if (register_msgring_handler(TX_STN_SAE, xlr_sec_msgring_handler, NULL)) {
+ panic("Couldn't register msgring handler 0\n");
+ }
+ return;
}
-int xlr_sec_setup( struct xlr_sec_session* ses,
- struct xlr_sec_command *cmd,
- symkey_desc_pt desc
- )
+int
+xlr_sec_setup(struct xlr_sec_session *ses,
+ struct xlr_sec_command *cmd,
+ symkey_desc_pt desc
+)
{
- xlr_sec_io_pt op;
- int size, ret_val;
- int iv_len;
-
-
- desc->ses = ses;
- op = &cmd->op ;
- if(op == NULL)
- return (-ENOMEM);
-
-
-
- desc->ctl_desc.instruction = 0;
- memset(&desc->ctl_desc.cipherHashInfo ,0 , sizeof(CipherHashInfo_t));
- desc->control = 0;
-
- desc->pkt_desc[0].srcLengthIVOffUseIVNext = 0;
- desc->pkt_desc[0].dstDataSettings = 0;
- desc->pkt_desc[0].authDstNonceLow = 0;
- desc->pkt_desc[0].ckSumDstNonceHiCFBMaskLLWMask = 0;
- desc->pkt_desc[1].srcLengthIVOffUseIVNext = 0;
- desc->pkt_desc[1].dstDataSettings = 0;
- desc->pkt_desc[1].authDstNonceLow = 0;
- desc->pkt_desc[1].ckSumDstNonceHiCFBMaskLLWMask = 0;
-
- desc->data = 0;
- desc->ctl_result = 0;
- desc->data_result = 0;
-
-
- if (op->flags & XLR_SEC_FLAGS_HIGH_PRIORITY)
- if (!xlr_is_xls())
- desc->op_ctl.stn_id++;
-
- desc->user.user_src = (uint8_t *)(unsigned long)op->source_buf;
- desc->user.user_dest = (uint8_t *)(unsigned long)op->dest_buf;
- desc->user.user_auth = (uint8_t *)(unsigned long)op->auth_dest;
-
-
- if ((op->cipher_type == XLR_SEC_CIPHER_TYPE_ARC4) &&
- (!op->rc4_state && (op->rc4_loadstate || op->rc4_savestate))) {
- printf(" ** Load/Save State and no State **");
- xlr_sec_free_desc(desc);
- return (-EINVAL);
- }
- desc->user.user_state = (uint8_t *)(unsigned long)op->rc4_state;
-
-
- switch (op->cipher_type) {
- case XLR_SEC_CIPHER_TYPE_NONE:
- iv_len = 0;
- break;
- case XLR_SEC_CIPHER_TYPE_DES:
- case XLR_SEC_CIPHER_TYPE_3DES:
- iv_len = XLR_SEC_DES_IV_LENGTH;
- break;
- case XLR_SEC_CIPHER_TYPE_AES128:
- case XLR_SEC_CIPHER_TYPE_AES192:
- case XLR_SEC_CIPHER_TYPE_AES256:
- iv_len = XLR_SEC_AES_IV_LENGTH;
- break;
- case XLR_SEC_CIPHER_TYPE_ARC4:
- iv_len = XLR_SEC_ARC4_IV_LENGTH;
- break;
- case XLR_SEC_CIPHER_TYPE_KASUMI_F8:
- iv_len = XLR_SEC_KASUMI_F8_IV_LENGTH;
- break;
-
- default:
- printf(" ** Undefined Cipher Type **");
- xlr_sec_free_desc(desc);
- return (-EINVAL);
- }
-
-
-
-
- size = op->source_buf_size + iv_len;
-
- /* make sure that there are enough bytes for aes based stream ciphers */
- if (op->cipher_mode == XLR_SEC_CIPHER_MODE_F8 ||
- op->cipher_mode == XLR_SEC_CIPHER_MODE_CTR)
- size += XLR_SEC_AES_BLOCK_SIZE - 1;
-
- if (op->cipher_type == XLR_SEC_CIPHER_TYPE_NONE) {
- if(op->source_buf_size != 0){
- memcpy(desc->user.aligned_src,(uint8_t *)(unsigned long)op->source_buf,
- op->source_buf_size);
- }
- }
- else {
- if(ses->multi_frag_flag){
- /* copy IV into temporary kernel source buffer */
- memcpy (desc->user.aligned_src, &op->initial_vector[0], iv_len);
-
- /* copy input data to temporary kernel source buffer */
- memcpy((uint8_t *) (desc->user.aligned_src + iv_len),
- (uint8_t *)(unsigned long)op->source_buf, SEC_MAX_FRAG_LEN);
-
- desc->next_src_len = op->source_buf_size - SEC_MAX_FRAG_LEN;
- memcpy((uint8_t *) (desc->next_src_buf ),
- (uint8_t *)(unsigned long)(op->source_buf + SEC_MAX_FRAG_LEN),
- desc->next_src_len );
-
- op->source_buf_size = SEC_MAX_FRAG_LEN ;
- op->source_buf_size += iv_len;
- }
- else{
- /* copy IV into temporary kernel source buffer */
- memcpy (desc->user.aligned_src, &op->initial_vector[0], iv_len);
-
- /* copy input data to temporary kernel source buffer */
- memcpy((uint8_t *) (desc->user.aligned_src + iv_len),
- (uint8_t *)(unsigned long)op->source_buf,op->source_buf_size);
- op->source_buf_size += iv_len;
- }
- }
-
-
-
- /* Set source to new kernel space */
- op->source_buf = (uint64_t)(unsigned long)desc->user.aligned_src;
-
-
- /*
- * Build new dest buffer, for Cipher output only
- */
- if (op->cipher_type == XLR_SEC_CIPHER_TYPE_NONE) {
- /*
- * Digest Engine *NEEDS* this,
- * otherwise it will write at 0[x]
- */
- op->dest_buf = (uint64_t)(unsigned long)desc->user.aligned_src;
- }
- else {
- /* DEBUG -dpk */
- XLR_SEC_CMD_DIAG("dest_buf_size = %d \n", op->dest_buf_size);
-
- size = op->dest_buf_size + iv_len;
-
- /* make sure that there are enough bytes for aes based stream ciphers */
- if (op->cipher_mode == XLR_SEC_CIPHER_MODE_F8 ||
- op->cipher_mode == XLR_SEC_CIPHER_MODE_CTR)
- size += XLR_SEC_AES_BLOCK_SIZE - 1;
- op->dest_buf = (uint64_t)(unsigned long)desc->user.aligned_dest;
-
- }
-
- ret_val = xlr_sec_cipher_hash_command (op, desc, ses->multi_frag_flag);
-
- return (ret_val);
+ xlr_sec_io_pt op;
+ int size, ret_val;
+ int iv_len;
+
+
+ desc->ses = ses;
+ op = &cmd->op;
+ if (op == NULL)
+ return (-ENOMEM);
+
+
+
+ desc->ctl_desc.instruction = 0;
+ memset(&desc->ctl_desc.cipherHashInfo, 0, sizeof(CipherHashInfo_t));
+ desc->control = 0;
+
+ desc->pkt_desc[0].srcLengthIVOffUseIVNext = 0;
+ desc->pkt_desc[0].dstDataSettings = 0;
+ desc->pkt_desc[0].authDstNonceLow = 0;
+ desc->pkt_desc[0].ckSumDstNonceHiCFBMaskLLWMask = 0;
+ desc->pkt_desc[1].srcLengthIVOffUseIVNext = 0;
+ desc->pkt_desc[1].dstDataSettings = 0;
+ desc->pkt_desc[1].authDstNonceLow = 0;
+ desc->pkt_desc[1].ckSumDstNonceHiCFBMaskLLWMask = 0;
+
+ desc->data = 0;
+ desc->ctl_result = 0;
+ desc->data_result = 0;
+
+
+ if (op->flags & XLR_SEC_FLAGS_HIGH_PRIORITY)
+ if (!xlr_is_xls())
+ desc->op_ctl.stn_id++;
+
+ desc->user.user_src = (uint8_t *) (unsigned long)op->source_buf;
+ desc->user.user_dest = (uint8_t *) (unsigned long)op->dest_buf;
+ desc->user.user_auth = (uint8_t *) (unsigned long)op->auth_dest;
+
+
+ if ((op->cipher_type == XLR_SEC_CIPHER_TYPE_ARC4) &&
+ (!op->rc4_state && (op->rc4_loadstate || op->rc4_savestate))) {
+ printf(" ** Load/Save State and no State **");
+ xlr_sec_free_desc(desc);
+ return (-EINVAL);
+ }
+ desc->user.user_state = (uint8_t *) (unsigned long)op->rc4_state;
+
+
+ switch (op->cipher_type) {
+ case XLR_SEC_CIPHER_TYPE_NONE:
+ iv_len = 0;
+ break;
+ case XLR_SEC_CIPHER_TYPE_DES:
+ case XLR_SEC_CIPHER_TYPE_3DES:
+ iv_len = XLR_SEC_DES_IV_LENGTH;
+ break;
+ case XLR_SEC_CIPHER_TYPE_AES128:
+ case XLR_SEC_CIPHER_TYPE_AES192:
+ case XLR_SEC_CIPHER_TYPE_AES256:
+ iv_len = XLR_SEC_AES_IV_LENGTH;
+ break;
+ case XLR_SEC_CIPHER_TYPE_ARC4:
+ iv_len = XLR_SEC_ARC4_IV_LENGTH;
+ break;
+ case XLR_SEC_CIPHER_TYPE_KASUMI_F8:
+ iv_len = XLR_SEC_KASUMI_F8_IV_LENGTH;
+ break;
+
+ default:
+ printf(" ** Undefined Cipher Type **");
+ xlr_sec_free_desc(desc);
+ return (-EINVAL);
+ }
+
+
+
+
+ size = op->source_buf_size + iv_len;
+
+ /*
+ * make sure that there are enough bytes for aes based stream
+ * ciphers
+ */
+ if (op->cipher_mode == XLR_SEC_CIPHER_MODE_F8 ||
+ op->cipher_mode == XLR_SEC_CIPHER_MODE_CTR)
+ size += XLR_SEC_AES_BLOCK_SIZE - 1;
+
+ if (op->cipher_type == XLR_SEC_CIPHER_TYPE_NONE) {
+ if (op->source_buf_size != 0) {
+ memcpy(desc->user.aligned_src, (uint8_t *) (unsigned long)op->source_buf,
+ op->source_buf_size);
+ }
+ } else {
+ if (ses->multi_frag_flag) {
+ /* copy IV into temporary kernel source buffer */
+ memcpy(desc->user.aligned_src, &op->initial_vector[0], iv_len);
+
+ /* copy input data to temporary kernel source buffer */
+ memcpy((uint8_t *) (desc->user.aligned_src + iv_len),
+ (uint8_t *) (unsigned long)op->source_buf, SEC_MAX_FRAG_LEN);
+
+ desc->next_src_len = op->source_buf_size - SEC_MAX_FRAG_LEN;
+ memcpy((uint8_t *) (desc->next_src_buf),
+ (uint8_t *) (unsigned long)(op->source_buf + SEC_MAX_FRAG_LEN),
+ desc->next_src_len);
+
+ op->source_buf_size = SEC_MAX_FRAG_LEN;
+ op->source_buf_size += iv_len;
+ } else {
+ /* copy IV into temporary kernel source buffer */
+ memcpy(desc->user.aligned_src, &op->initial_vector[0], iv_len);
+
+ /* copy input data to temporary kernel source buffer */
+ memcpy((uint8_t *) (desc->user.aligned_src + iv_len),
+ (uint8_t *) (unsigned long)op->source_buf, op->source_buf_size);
+ op->source_buf_size += iv_len;
+ }
+ }
+
+
+
+ /* Set source to new kernel space */
+ op->source_buf = (uint64_t) (unsigned long)desc->user.aligned_src;
+
+
+ /*
+ * Build new dest buffer, for Cipher output only
+ */
+ if (op->cipher_type == XLR_SEC_CIPHER_TYPE_NONE) {
+ /*
+ * Digest Engine *NEEDS* this, otherwise it will write at
+ * 0[x]
+ */
+ op->dest_buf = (uint64_t) (unsigned long)desc->user.aligned_src;
+ } else {
+ /* DEBUG -dpk */
+ XLR_SEC_CMD_DIAG("dest_buf_size = %d \n", op->dest_buf_size);
+
+ size = op->dest_buf_size + iv_len;
+
+ /*
+ * make sure that there are enough bytes for aes based
+ * stream ciphers
+ */
+ if (op->cipher_mode == XLR_SEC_CIPHER_MODE_F8 ||
+ op->cipher_mode == XLR_SEC_CIPHER_MODE_CTR)
+ size += XLR_SEC_AES_BLOCK_SIZE - 1;
+ op->dest_buf = (uint64_t) (unsigned long)desc->user.aligned_dest;
+
+ }
+
+ ret_val = xlr_sec_cipher_hash_command(op, desc, ses->multi_frag_flag);
+
+ return (ret_val);
}
static int
-xlr_sec_cipher_hash_command(xlr_sec_io_pt op, symkey_desc_pt desc,
- uint8_t multi_frag_flag)
+xlr_sec_cipher_hash_command(xlr_sec_io_pt op, symkey_desc_pt desc,
+ uint8_t multi_frag_flag)
{
- xlr_sec_error_t err;
- uint32_t cfg_vector;
- unsigned int setup_flags = 0;
-
- err = XLR_SEC_ERR_NONE;
- cfg_vector = 0;
-
- if ((op->digest_type == XLR_SEC_DIGEST_TYPE_NONE) &&
- (op->cipher_type != XLR_SEC_CIPHER_TYPE_ARC4) &&
- (op->cipher_mode != XLR_SEC_CIPHER_MODE_F8) &&
- (op->cipher_type != XLR_SEC_CIPHER_TYPE_KASUMI_F8) &&
- (op->source_buf_size & 0x7)) {
- printf("Invalid Cipher Block Size, data len=%d\n",
- op->source_buf_size);
- return (-EINVAL);
- }
-
- do {
-
- if ((op->cipher_type == XLR_SEC_CIPHER_TYPE_3DES) &&
- (op->cipher_op == XLR_SEC_CIPHER_OP_DECRYPT))
- setup_flags = XLR_SEC_SETUP_OP_FLIP_3DES_KEY;
-
- err = xlr_sec_setup_descriptor(op,
- setup_flags,
- desc, &cfg_vector);
- if (err != XLR_SEC_ERR_NONE)
- break;
-
- err = xlr_sec_setup_packet(op,
- desc,
- op->digest_type != XLR_SEC_DIGEST_TYPE_NONE ?
- XLR_SEC_SETUP_OP_CIPHER_HMAC : 0,
- &desc->data,
- &desc->pkt_desc[0],
- &desc->ctl_desc,
- cfg_vector,
- &desc->pkt_desc[1],
- multi_frag_flag);
- if (err != XLR_SEC_ERR_NONE)
- break;
- } while(0);
- if (err != XLR_SEC_ERR_NONE) {
- return (EINVAL);
- }
-
- err = xlr_sec_submit_message(desc, cfg_vector);
- return err;
+ xlr_sec_error_t err;
+ uint32_t cfg_vector;
+ unsigned int setup_flags = 0;
+
+ err = XLR_SEC_ERR_NONE;
+ cfg_vector = 0;
+
+ if ((op->digest_type == XLR_SEC_DIGEST_TYPE_NONE) &&
+ (op->cipher_type != XLR_SEC_CIPHER_TYPE_ARC4) &&
+ (op->cipher_mode != XLR_SEC_CIPHER_MODE_F8) &&
+ (op->cipher_type != XLR_SEC_CIPHER_TYPE_KASUMI_F8) &&
+ (op->source_buf_size & 0x7)) {
+ printf("Invalid Cipher Block Size, data len=%d\n",
+ op->source_buf_size);
+ return (-EINVAL);
+ }
+ do {
+
+ if ((op->cipher_type == XLR_SEC_CIPHER_TYPE_3DES) &&
+ (op->cipher_op == XLR_SEC_CIPHER_OP_DECRYPT))
+ setup_flags = XLR_SEC_SETUP_OP_FLIP_3DES_KEY;
+
+ err = xlr_sec_setup_descriptor(op,
+ setup_flags,
+ desc, &cfg_vector);
+ if (err != XLR_SEC_ERR_NONE)
+ break;
+
+ err = xlr_sec_setup_packet(op,
+ desc,
+ op->digest_type != XLR_SEC_DIGEST_TYPE_NONE ?
+ XLR_SEC_SETUP_OP_CIPHER_HMAC : 0,
+ &desc->data,
+ &desc->pkt_desc[0],
+ &desc->ctl_desc,
+ cfg_vector,
+ &desc->pkt_desc[1],
+ multi_frag_flag);
+ if (err != XLR_SEC_ERR_NONE)
+ break;
+ } while (0);
+ if (err != XLR_SEC_ERR_NONE) {
+ return (EINVAL);
+ }
+ err = xlr_sec_submit_message(desc, cfg_vector);
+ return err;
}
static xlr_sec_error_t
-xlr_sec_setup_descriptor (xlr_sec_io_pt op,
- unsigned int flags,
- symkey_desc_pt desc,
- uint32_t *cfg_vector)
+xlr_sec_setup_descriptor(xlr_sec_io_pt op,
+ unsigned int flags,
+ symkey_desc_pt desc,
+ uint32_t * cfg_vector)
{
- xlr_sec_error_t err;
-
- XLR_SEC_CMD_DIAG("xlr_sec_setup_descriptor: ENTER\n");
-
-
- if ((err=xlr_sec_setup_cipher(op,&desc->ctl_desc,cfg_vector)) != XLR_SEC_ERR_NONE) {
- XLR_SEC_CMD_DIAG("xlr_sec_setup_descriptor: xlr_sec_setup_cipher done err %d\n",
- (int)err);
- return err;
- }
-
- if (op->digest_type != XLR_SEC_DIGEST_TYPE_NONE) {
- if ((err=xlr_sec_setup_digest(op,&desc->ctl_desc,cfg_vector)) != XLR_SEC_ERR_NONE) {
- XLR_SEC_CMD_DIAG("xlr_sec_setup_descriptor: xlr_sec_setup_digest done err %d\n",
- (int)err);
- return err;
- }
- }
-
- if ((err = xlr_sec_setup_cksum(op, &desc->ctl_desc)) != XLR_SEC_ERR_NONE) {
- XLR_SEC_CMD_DIAG("xlr_sec_setup_descriptor: xlr_sec_setup_cksum done err %d\n",
- (int)err);
- return err;
- }
-
- if ((err = xlr_sec_control_setup(op,
- flags,
- &desc->control,
- &desc->ctl_desc,
- &desc->user,
- *cfg_vector)) != XLR_SEC_ERR_NONE) {
- XLR_SEC_CMD_DIAG("xlr_sec_setup_descriptor: xlr_sec_control_setup done err %d\n",
- (int)err);
- return err;
- }
-
- XLR_SEC_CMD_DIAG("xlr_sec_setup_descriptor: DONE\n");
- return err;
+ xlr_sec_error_t err;
+
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_descriptor: ENTER\n");
+
+
+ if ((err = xlr_sec_setup_cipher(op, &desc->ctl_desc, cfg_vector)) != XLR_SEC_ERR_NONE) {
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_descriptor: xlr_sec_setup_cipher done err %d\n",
+ (int)err);
+ return err;
+ }
+ if (op->digest_type != XLR_SEC_DIGEST_TYPE_NONE) {
+ if ((err = xlr_sec_setup_digest(op, &desc->ctl_desc, cfg_vector)) != XLR_SEC_ERR_NONE) {
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_descriptor: xlr_sec_setup_digest done err %d\n",
+ (int)err);
+ return err;
+ }
+ }
+ if ((err = xlr_sec_setup_cksum(op, &desc->ctl_desc)) != XLR_SEC_ERR_NONE) {
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_descriptor: xlr_sec_setup_cksum done err %d\n",
+ (int)err);
+ return err;
+ }
+ if ((err = xlr_sec_control_setup(op,
+ flags,
+ &desc->control,
+ &desc->ctl_desc,
+ &desc->user,
+ *cfg_vector)) != XLR_SEC_ERR_NONE) {
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_descriptor: xlr_sec_control_setup done err %d\n",
+ (int)err);
+ return err;
+ }
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_descriptor: DONE\n");
+ return err;
}
static
-xlr_sec_error_t xlr_sec_setup_packet (xlr_sec_io_pt op,
- symkey_desc_pt desc,
- unsigned int flags,
- uint64_t *data,
- PacketDescriptor_pt pkt_desc,
- ControlDescriptor_pt ctl_desc,
- uint32_t vector,
- PacketDescriptor_pt next_pkt_desc,
- uint8_t multi_frag_flag)
+xlr_sec_error_t
+xlr_sec_setup_packet(xlr_sec_io_pt op,
+ symkey_desc_pt desc,
+ unsigned int flags,
+ uint64_t * data,
+ PacketDescriptor_pt pkt_desc,
+ ControlDescriptor_pt ctl_desc,
+ uint32_t vector,
+ PacketDescriptor_pt next_pkt_desc,
+ uint8_t multi_frag_flag)
{
- uint32_t len, next_len = 0, len_dwords, last_u64_bytes;
- uint64_t addr;
- uint64_t seg_addr, next_seg_addr = 0;
- uint64_t byte_offset, global_offset;
- uint32_t cipher_offset_dwords;
-
- XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: ENTER vector = %04x\n", vector);
-
- /* physical address of the source buffer */
- addr = (uint64_t)vtophys((void*)(unsigned long)op->source_buf);
- /* cache-aligned base of the source buffer */
- seg_addr = (addr & ~(SMP_CACHE_BYTES - 1));
- /* offset in bytes to the source buffer start from the segment base */
- byte_offset = addr - seg_addr;
- /* global offset: 0-7 bytes */
- global_offset = byte_offset & 0x7;
-
-
- /*
- * op->source_buf_size is expected to be the Nb double words to stream
- * in (Including Segment address->CP/IV/Auth/CkSum offsets)
- */
-
- /* adjusted length of the whole thing, accounting for the added head,
- sans global_offset (per Paul S.)
- */
-
- len = op->source_buf_size + byte_offset - global_offset;
- if(multi_frag_flag){
- next_seg_addr = (uint64_t)vtophys((void*)(unsigned long)(desc->next_src_buf) );
- next_seg_addr = (next_seg_addr & ~(SMP_CACHE_BYTES - 1));
- next_len = desc->next_src_len;
- }
-
- /* length of the whole thing in dwords */
- len_dwords = NUM_CHUNKS(len, 3);
- /* number of bytes in the last chunk (len % 8) */
- last_u64_bytes = len & 0x07;
-
- if (op->cipher_offset & 0x7) {
- printf("** cipher_offset(%d) fails 64-bit word alignment **",
- op->cipher_offset);
-
- return XLR_SEC_ERR_CIPHER_MODE; /* ! fix ! */
- }
-
- /* global_offset is only three bits, so work the number of the whole
- 8-byte words into the global offset.
- both offset and cipher_offset are byte counts
- */
- cipher_offset_dwords = (op->iv_offset + byte_offset) >> 3;
-
-
- if (op->cipher_mode == XLR_SEC_CIPHER_MODE_F8 ||
- op->cipher_mode == XLR_SEC_CIPHER_MODE_CTR) {
- if(multi_frag_flag){
- int nlhmac = ((op->source_buf_size + global_offset + 7 - op->cipher_offset) >> 3) & 1;
- pkt_desc->srcLengthIVOffUseIVNext =
-
- FIELD_VALUE(PKT_DSC_HASHBYTES, len & 7) |
- FIELD_VALUE(PKT_DSC_IVOFF, cipher_offset_dwords) |
- FIELD_VALUE(PKT_DSC_PKTLEN, nlhmac + ((len + 7) >> 3)) |
- FIELD_VALUE(PKT_DSC_NLHMAC, nlhmac) |
- FIELD_VALUE(PKT_DSC_BREAK, 0) |
- FIELD_VALUE(PKT_DSC_WAIT, 1) |
- FIELD_VALUE(PKT_DSC_NEXT, 1) |
- FIELD_VALUE(PKT_DSC_SEGADDR, seg_addr >> (PKT_DSC_SEGADDR_LSB)) |
- FIELD_VALUE(PKT_DSC_SEGOFFSET, global_offset);
- }
- else{
- int nlhmac = ((op->source_buf_size + global_offset + 7 - op->cipher_offset) >> 3) & 1;
- pkt_desc->srcLengthIVOffUseIVNext =
- FIELD_VALUE(PKT_DSC_HASHBYTES, len & 7) |
- FIELD_VALUE(PKT_DSC_IVOFF, cipher_offset_dwords) |
- FIELD_VALUE(PKT_DSC_PKTLEN, nlhmac + ((len + 7) >> 3)) |
- FIELD_VALUE(PKT_DSC_NLHMAC, nlhmac) |
- FIELD_VALUE(PKT_DSC_BREAK, 0) |
- FIELD_VALUE(PKT_DSC_WAIT, 0) |
- FIELD_VALUE(PKT_DSC_SEGADDR, seg_addr >> (PKT_DSC_SEGADDR_LSB)) |
- FIELD_VALUE(PKT_DSC_SEGOFFSET, global_offset);
-
- }
- }
- else{
- if(multi_frag_flag){
- pkt_desc->srcLengthIVOffUseIVNext =
-
- FIELD_VALUE(PKT_DSC_HASHBYTES, len & 7) |
- FIELD_VALUE(PKT_DSC_IVOFF, cipher_offset_dwords) |
- FIELD_VALUE(PKT_DSC_PKTLEN, (len + 7) >> 3) |
- FIELD_VALUE(PKT_DSC_BREAK, 0) |
- FIELD_VALUE(PKT_DSC_WAIT, 0) |
- FIELD_VALUE(PKT_DSC_NEXT, 1) |
- FIELD_VALUE(PKT_DSC_SEGADDR, seg_addr >> (PKT_DSC_SEGADDR_LSB)) |
- FIELD_VALUE(PKT_DSC_SEGOFFSET, global_offset);
-
-
- next_pkt_desc->srcLengthIVOffUseIVNext =
- FIELD_VALUE(PKT_DSC_HASHBYTES, (next_len & 7)) |
- FIELD_VALUE(PKT_DSC_IVOFF, 0) |
- FIELD_VALUE(PKT_DSC_PKTLEN, (next_len + 7) >> 3) |
- FIELD_VALUE(PKT_DSC_BREAK, 0) |
- FIELD_VALUE(PKT_DSC_WAIT, 0) |
- FIELD_VALUE(PKT_DSC_NEXT, 0) |
- FIELD_VALUE(PKT_DSC_SEGADDR, next_seg_addr >> (PKT_DSC_SEGADDR_LSB)) |
- FIELD_VALUE(PKT_DSC_SEGOFFSET, 0);
-
-
- }
- else{
- pkt_desc->srcLengthIVOffUseIVNext =
- FIELD_VALUE(PKT_DSC_HASHBYTES, len & 7) |
- FIELD_VALUE(PKT_DSC_IVOFF, cipher_offset_dwords) |
- FIELD_VALUE(PKT_DSC_PKTLEN, (len + 7) >> 3) |
- FIELD_VALUE(PKT_DSC_BREAK, 0) |
- FIELD_VALUE(PKT_DSC_WAIT, 0) |
- FIELD_VALUE(PKT_DSC_SEGADDR, seg_addr >> (PKT_DSC_SEGADDR_LSB)) |
- FIELD_VALUE(PKT_DSC_SEGOFFSET, global_offset);
-
-
- }
- }
-
- switch (op->pkt_hmac) {
- case XLR_SEC_LOADHMACKEY_MODE_OLD:
- CLEAR_SET_FIELD(pkt_desc->srcLengthIVOffUseIVNext,
- PKT_DSC_LOADHMACKEY, PKT_DSC_LOADHMACKEY_OLD);
- if(multi_frag_flag){
- CLEAR_SET_FIELD(next_pkt_desc->srcLengthIVOffUseIVNext,
- PKT_DSC_LOADHMACKEY, PKT_DSC_LOADHMACKEY_OLD);
-
- }
- break;
- case XLR_SEC_LOADHMACKEY_MODE_LOAD:
- CLEAR_SET_FIELD(pkt_desc->srcLengthIVOffUseIVNext,
- PKT_DSC_LOADHMACKEY, PKT_DSC_LOADHMACKEY_LOAD);
- if(multi_frag_flag){
- CLEAR_SET_FIELD(next_pkt_desc->srcLengthIVOffUseIVNext,
- PKT_DSC_LOADHMACKEY, PKT_DSC_LOADHMACKEY_LOAD);
-
- }
- break;
- default:
- if (vector & (XLR_SEC_VECTOR_HMAC | XLR_SEC_VECTOR_HMAC2 | XLR_SEC_VECTOR_GCM | XLR_SEC_VECTOR_F9)) {
- XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: ERR_LOADHMACKEY_MODE EXIT\n");
- return XLR_SEC_ERR_LOADHMACKEY_MODE;
- }
- break;
- }
-
- switch (op->pkt_hash) {
- case XLR_SEC_PADHASH_PADDED:
- CLEAR_SET_FIELD(pkt_desc->srcLengthIVOffUseIVNext,
- PKT_DSC_PADHASH, PKT_DSC_PADHASH_PADDED);
- if(multi_frag_flag){
- CLEAR_SET_FIELD(next_pkt_desc->srcLengthIVOffUseIVNext,
- PKT_DSC_PADHASH, PKT_DSC_PADHASH_PADDED);
- }
- break;
- case XLR_SEC_PADHASH_PAD:
- CLEAR_SET_FIELD(pkt_desc->srcLengthIVOffUseIVNext,
- PKT_DSC_PADHASH, PKT_DSC_PADHASH_PAD);
- if(multi_frag_flag){
- CLEAR_SET_FIELD(next_pkt_desc->srcLengthIVOffUseIVNext,
- PKT_DSC_PADHASH, PKT_DSC_PADHASH_PAD);
- }
- break;
- default:
- if (vector & (XLR_SEC_VECTOR_MAC | XLR_SEC_VECTOR_HMAC | XLR_SEC_VECTOR_HMAC2)) {
- XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: ERR_PADHASH_MODE EXIT\n");
- return XLR_SEC_ERR_PADHASH_MODE;
- }
- break;
- }
-
- switch (op->pkt_iv) {
- case XLR_SEC_PKT_IV_OLD:
- CLEAR_SET_FIELD(pkt_desc->srcLengthIVOffUseIVNext,
- PKT_DSC_IV, PKT_DSC_IV_OLD);
- if(multi_frag_flag){
- CLEAR_SET_FIELD(next_pkt_desc->srcLengthIVOffUseIVNext,
- PKT_DSC_IV, PKT_DSC_IV_OLD);
-
- }
- break;
- case XLR_SEC_PKT_IV_NEW:
- CLEAR_SET_FIELD(pkt_desc->srcLengthIVOffUseIVNext,
- PKT_DSC_IV, PKT_DSC_IV_NEW);
- if(multi_frag_flag){
- CLEAR_SET_FIELD(next_pkt_desc->srcLengthIVOffUseIVNext,
- PKT_DSC_IV, PKT_DSC_IV_NEW);
-
- }
- break;
- default:
- if (vector & XLR_SEC_VECTOR_CIPHER) {
- XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: ERR_PKT_IV_MODE EXIT\n");
- return XLR_SEC_ERR_PKT_IV_MODE;
- }
- break;
- }
-
- XLR_SEC_CMD_DIAG ("xlr_sec_setup_packet: src_buf=%llx phys_src_buf=%llx \n",
- (unsigned long long)op->source_buf, (unsigned long long)addr);
-
- XLR_SEC_CMD_DIAG ("xlr_sec_setup_packet: seg_addr=%llx offset=%lld\n",
- (unsigned long long)seg_addr, (unsigned long long)byte_offset);
-
- XLR_SEC_CMD_DIAG ("xlr_sec_setup_packet: global src offset: %d, iv_offset=%d\n",
- cipher_offset_dwords, op->iv_offset);
-
- XLR_SEC_CMD_DIAG ("xlr_sec_setup_packet: src_buf_sz=%d PKT_LEN=%d\n",
- op->source_buf_size, len_dwords);
-
- /* same operation with the destination.
- cipher offset affects this, as well
- */
- if(multi_frag_flag){
- next_seg_addr = (uint64_t)vtophys((void*)(unsigned long)(desc->next_dest_buf) );
- next_seg_addr = (next_seg_addr & ~(SMP_CACHE_BYTES - 1));
- }
-
- addr = (uint64_t)vtophys((void*)(unsigned long)op->dest_buf);
- seg_addr = (addr & ~(SMP_CACHE_BYTES - 1));
- byte_offset = addr - seg_addr;
- global_offset = byte_offset & 0x7;
-
- XLR_SEC_CMD_DIAG ("xlr_sec_setup_packet: dest_buf=%llx phys_dest_buf=%llx \n",
- (unsigned long long)op->dest_buf, (unsigned long long)addr);
-
- XLR_SEC_CMD_DIAG ("xlr_sec_setup_packet: seg_addr=%llx offset=%lld\n",
- (unsigned long long)seg_addr, (unsigned long long)byte_offset);
-
- /*
- * Dest Address =
- * (Cipher Dest Address) + (Cipher Offset) + (Global Dest Data Offset)
- *
- * Cipher Dest Address - Cache-line (0xffffffffe0)
- * Cipher Offset - Which (64-bit) Word in Cacheline (0-3)
- * Global Dest Data Offset - Number of Bytes in (64-bit) Word before data
- *
- * It must be set for Digest-only Ops, since
- * the Digest engine will write data to this address.
- */
- cipher_offset_dwords = (op->cipher_offset + byte_offset) >> 3;
-
-
- pkt_desc->dstDataSettings =
- /* SYM_OP, HASHSRC */
- FIELD_VALUE(PKT_DSC_CPHROFF, cipher_offset_dwords) |
- FIELD_VALUE(PKT_DSC_HASHOFF, (op->digest_offset + byte_offset) >> 3) |
- FIELD_VALUE(PKT_DSC_CPHR_DST_ADDR, seg_addr) |
- FIELD_VALUE(PKT_DSC_CPHR_DST_DWOFFSET, 0) |
- FIELD_VALUE(PKT_DSC_CPHR_DST_OFFSET, global_offset);
-
- if(multi_frag_flag){
- next_pkt_desc->dstDataSettings =
- /* SYM_OP, HASHSRC */
- FIELD_VALUE(PKT_DSC_CPHROFF, cipher_offset_dwords) |
- FIELD_VALUE(PKT_DSC_HASHOFF, (op->digest_offset + byte_offset) >> 3) |
- FIELD_VALUE(PKT_DSC_CPHR_DST_ADDR, next_seg_addr) |
- FIELD_VALUE(PKT_DSC_CPHR_DST_DWOFFSET, 0) |
- FIELD_VALUE(PKT_DSC_CPHR_DST_OFFSET, global_offset);
-
- }
-
- if (op->cipher_type == XLR_SEC_CIPHER_TYPE_ARC4)
- pkt_desc->dstDataSettings |= FIELD_VALUE(PKT_DSC_ARC4BYTECOUNT, last_u64_bytes);
-
- if (op->cipher_type != XLR_SEC_CIPHER_TYPE_NONE) {
- switch (op->cipher_op) {
- case XLR_SEC_CIPHER_OP_ENCRYPT:
- CLEAR_SET_FIELD(pkt_desc->dstDataSettings,
- PKT_DSC_SYM_OP, PKT_DSC_SYM_OP_ENCRYPT);
- if(multi_frag_flag){
- CLEAR_SET_FIELD(next_pkt_desc->dstDataSettings,
- PKT_DSC_SYM_OP, PKT_DSC_SYM_OP_ENCRYPT);
-
- }
- break;
- case XLR_SEC_CIPHER_OP_DECRYPT:
- CLEAR_SET_FIELD(pkt_desc->dstDataSettings,
- PKT_DSC_SYM_OP, PKT_DSC_SYM_OP_DECRYPT);
- if(multi_frag_flag){
- CLEAR_SET_FIELD(next_pkt_desc->dstDataSettings,
- PKT_DSC_SYM_OP, PKT_DSC_SYM_OP_DECRYPT);
-
- }
- break;
- default:
- XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: ERR_CIPHER_OP EXIT\n");
- return XLR_SEC_ERR_CIPHER_OP;
- }
- }
- if (flags & XLR_SEC_SETUP_OP_HMAC) {
- switch (op->digest_src) {
- case XLR_SEC_DIGEST_SRC_DMA:
- CLEAR_SET_FIELD(pkt_desc->dstDataSettings,
- PKT_DSC_HASHSRC, PKT_DSC_HASHSRC_DMA);
- if(multi_frag_flag){
- CLEAR_SET_FIELD(next_pkt_desc->dstDataSettings,
- PKT_DSC_HASHSRC, PKT_DSC_HASHSRC_DMA);
-
- }
- break;
- case XLR_SEC_DIGEST_SRC_CPHR:
- CLEAR_SET_FIELD(pkt_desc->dstDataSettings,
- PKT_DSC_HASHSRC, PKT_DSC_HASHSRC_CIPHER);
- if(multi_frag_flag){
- CLEAR_SET_FIELD(next_pkt_desc->dstDataSettings,
- PKT_DSC_HASHSRC, PKT_DSC_HASHSRC_CIPHER);
- }
- break;
- default:
- XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: ERR_DIGEST_SRC EXIT\n");
- return XLR_SEC_ERR_DIGEST_SRC;
- }
- }
- if (op->cksum_type != XLR_SEC_CKSUM_TYPE_NOP) {
- switch (op->cksum_src) {
- case XLR_SEC_CKSUM_SRC_DMA:
- CLEAR_SET_FIELD(pkt_desc->dstDataSettings,
- PKT_DSC_CKSUMSRC, PKT_DSC_CKSUMSRC_DMA);
- if(multi_frag_flag){
- CLEAR_SET_FIELD(next_pkt_desc->dstDataSettings,
- PKT_DSC_CKSUMSRC, PKT_DSC_CKSUMSRC_DMA);
- }
- break;
- case XLR_SEC_CKSUM_SRC_CIPHER:
- CLEAR_SET_FIELD(next_pkt_desc->dstDataSettings,
- PKT_DSC_CKSUMSRC, PKT_DSC_CKSUMSRC_CIPHER);
- if(multi_frag_flag){
- CLEAR_SET_FIELD(next_pkt_desc->dstDataSettings,
- PKT_DSC_CKSUMSRC, PKT_DSC_CKSUMSRC_CIPHER);
- }
- break;
- default:
- XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: ERR_CKSUM_SRC EXIT\n");
- return XLR_SEC_ERR_CKSUM_SRC;
- }
- }
-
- pkt_desc->ckSumDstNonceHiCFBMaskLLWMask =
- FIELD_VALUE(PKT_DSC_HASH_BYTE_OFF, (op->digest_offset & 0x7)) |
- FIELD_VALUE(PKT_DSC_PKTLEN_BYTES, 0) |
- /* NONCE_HI, PKT_DSC_LASTWORD, CFB_MASK, CKSUM_DST_ADDR */
- FIELD_VALUE(PKT_DSC_IV_OFF_HI, 0);
-
- if(multi_frag_flag){
- next_pkt_desc->ckSumDstNonceHiCFBMaskLLWMask =
- FIELD_VALUE(PKT_DSC_HASH_BYTE_OFF, (op->digest_offset & 0x7)) |
- FIELD_VALUE(PKT_DSC_PKTLEN_BYTES, 0) |
- /* NONCE_HI, PKT_DSC_LASTWORD, CFB_MASK, CKSUM_DST_ADDR */
- FIELD_VALUE(PKT_DSC_IV_OFF_HI, 0);
-
- }
- switch (op->pkt_lastword) {
- case XLR_SEC_LASTWORD_128:
- CLEAR_SET_FIELD(pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
- PKT_DSC_LASTWORD, PKT_DSC_LASTWORD_128);
- if(multi_frag_flag){
- CLEAR_SET_FIELD(next_pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
- PKT_DSC_LASTWORD, PKT_DSC_LASTWORD_128);
-
- }
- break;
- case XLR_SEC_LASTWORD_96MASK:
- CLEAR_SET_FIELD(pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
- PKT_DSC_LASTWORD, PKT_DSC_LASTWORD_96MASK);
- if(multi_frag_flag){
- CLEAR_SET_FIELD(next_pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
- PKT_DSC_LASTWORD, PKT_DSC_LASTWORD_96MASK);
- }
- break;
- case XLR_SEC_LASTWORD_64MASK:
- CLEAR_SET_FIELD(pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
- PKT_DSC_LASTWORD, PKT_DSC_LASTWORD_64MASK);
- if(multi_frag_flag){
- CLEAR_SET_FIELD(next_pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
- PKT_DSC_LASTWORD, PKT_DSC_LASTWORD_64MASK);
- }
- break;
- case XLR_SEC_LASTWORD_32MASK:
- CLEAR_SET_FIELD(pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
- PKT_DSC_LASTWORD, PKT_DSC_LASTWORD_32MASK);
- if(multi_frag_flag){
- CLEAR_SET_FIELD(next_pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
- PKT_DSC_LASTWORD, PKT_DSC_LASTWORD_32MASK);
- }
- break;
- default:
- XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: ERR_LASTWORD_MODE EXIT\n");
- return XLR_SEC_ERR_LASTWORD_MODE;
- }
- CLEAR_SET_FIELD(pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
- PKT_DSC_CFB_MASK, op->cfb_mask);
- CLEAR_SET_FIELD(pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
- PKT_DSC_NONCE_HI, htonl(op->nonce)>>24);
- CLEAR_SET_FIELD(pkt_desc->authDstNonceLow,
- PKT_DSC_NONCE_LOW, htonl(op->nonce)&0xffffff);
-
- if(multi_frag_flag){
- CLEAR_SET_FIELD(next_pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
- PKT_DSC_CFB_MASK, op->cfb_mask);
- CLEAR_SET_FIELD(next_pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
- PKT_DSC_NONCE_HI, htonl(op->nonce)>>24);
- CLEAR_SET_FIELD(next_pkt_desc->authDstNonceLow,
- PKT_DSC_NONCE_LOW, htonl(op->nonce)&0xffffff);
-
-
- }
-
- /* Auth Dest Address must be Cacheline aligned on input */
- if (vector & (XLR_SEC_VECTOR_MAC | XLR_SEC_VECTOR_HMAC | XLR_SEC_VECTOR_HMAC2 | XLR_SEC_VECTOR_GCM | XLR_SEC_VECTOR_F9)){
- pkt_desc->authDstNonceLow |=
- /* NONCE_LOW */
- FIELD_VALUE(PKT_DSC_AUTH_DST_ADDR,
- (uint64_t) vtophys((void*)(unsigned long)op->auth_dest)) |
- FIELD_VALUE(PKT_DSC_CIPH_OFF_HI, 0);
-
-
- if(multi_frag_flag){
- next_pkt_desc->authDstNonceLow |=
- /* NONCE_LOW */
- FIELD_VALUE(PKT_DSC_AUTH_DST_ADDR,
- (uint64_t) vtophys((void*)(unsigned long)desc->next_auth_dest)) |
- FIELD_VALUE(PKT_DSC_CIPH_OFF_HI, 0);
-
-
- }
-
-
- }
-
-
- /* CkSum Dest Address must be Cacheline aligned on input */
- if (op->cksum_type == XLR_SEC_CKSUM_TYPE_IP){
- CLEAR_SET_FIELD(pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
- PKT_DSC_CKSUM_DST_ADDR,
- (uint64_t)vtophys((void*)(unsigned long)op->cksum_dest));
-
- if(multi_frag_flag){
- CLEAR_SET_FIELD(next_pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
- PKT_DSC_CKSUM_DST_ADDR,
- (uint64_t)vtophys((void*)(unsigned long)desc->next_cksum_dest));
-
- }
-
- }
- /*
- XLR_SEC_CMD_DIAG (" xlr_sec_setup_packet(): pkt_desc=%llx phys_pkt_desc=%llx \n",
- (unsigned long long)pkt_desc, (unsigned long long)virt_to_phys(pkt_desc));
- (unsigned long long)pkt_desc, (unsigned long long)vtophys(pkt_desc));
- */
- XLR_SEC_CMD_DIAG (" xlr_sec_setup_packet(): pkt_desc=%p phys_pkt_desc=%llx \n",
- pkt_desc, (unsigned long long)vtophys(pkt_desc));
-
-
-
- CLEAR_SET_FIELD(*data, MSG_CMD_DATA_ADDR, ((uint64_t)vtophys(pkt_desc)));
- CLEAR_SET_FIELD(*data, MSG_CMD_DATA_CTL, SEC_EOP);
- CLEAR_SET_FIELD(*data, MSG_CMD_DATA_LEN, MSG_CMD_DATA_LEN_LOAD);
-
-
- XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: DONE\n");
+ uint32_t len, next_len = 0, len_dwords, last_u64_bytes;
+ uint64_t addr;
+ uint64_t seg_addr, next_seg_addr = 0;
+ uint64_t byte_offset, global_offset;
+ uint32_t cipher_offset_dwords;
+
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: ENTER vector = %04x\n", vector);
+
+ /* physical address of the source buffer */
+ addr = (uint64_t) vtophys((void *)(unsigned long)op->source_buf);
+ /* cache-aligned base of the source buffer */
+ seg_addr = (addr & ~(SMP_CACHE_BYTES - 1));
+ /* offset in bytes to the source buffer start from the segment base */
+ byte_offset = addr - seg_addr;
+ /* global offset: 0-7 bytes */
+ global_offset = byte_offset & 0x7;
+
+
+ /*
+ * op->source_buf_size is expected to be the Nb double words to
+ * stream in (Including Segment address->CP/IV/Auth/CkSum offsets)
+ */
+
+ /*
+ * adjusted length of the whole thing, accounting for the added
+ * head, sans global_offset (per Paul S.)
+ */
+
+ len = op->source_buf_size + byte_offset - global_offset;
+ if (multi_frag_flag) {
+ next_seg_addr = (uint64_t) vtophys((void *)(unsigned long)(desc->next_src_buf));
+ next_seg_addr = (next_seg_addr & ~(SMP_CACHE_BYTES - 1));
+ next_len = desc->next_src_len;
+ }
+ /* length of the whole thing in dwords */
+ len_dwords = NUM_CHUNKS(len, 3);
+ /* number of bytes in the last chunk (len % 8) */
+ last_u64_bytes = len & 0x07;
-#ifdef RMI_SEC_DEBUG
+ if (op->cipher_offset & 0x7) {
+ printf("** cipher_offset(%d) fails 64-bit word alignment **",
+ op->cipher_offset);
+
+ return XLR_SEC_ERR_CIPHER_MODE; /* ! fix ! */
+ }
+ /*
+ * global_offset is only three bits, so work the number of the whole
+ * 8-byte words into the global offset. both offset and
+ * cipher_offset are byte counts
+ */
+ cipher_offset_dwords = (op->iv_offset + byte_offset) >> 3;
+
+
+ if (op->cipher_mode == XLR_SEC_CIPHER_MODE_F8 ||
+ op->cipher_mode == XLR_SEC_CIPHER_MODE_CTR) {
+ if (multi_frag_flag) {
+ int nlhmac = ((op->source_buf_size + global_offset + 7 - op->cipher_offset) >> 3) & 1;
+
+ pkt_desc->srcLengthIVOffUseIVNext =
+
+ FIELD_VALUE(PKT_DSC_HASHBYTES, len & 7) |
+ FIELD_VALUE(PKT_DSC_IVOFF, cipher_offset_dwords) |
+ FIELD_VALUE(PKT_DSC_PKTLEN, nlhmac + ((len + 7) >> 3)) |
+ FIELD_VALUE(PKT_DSC_NLHMAC, nlhmac) |
+ FIELD_VALUE(PKT_DSC_BREAK, 0) |
+ FIELD_VALUE(PKT_DSC_WAIT, 1) |
+ FIELD_VALUE(PKT_DSC_NEXT, 1) |
+ FIELD_VALUE(PKT_DSC_SEGADDR, seg_addr >> (PKT_DSC_SEGADDR_LSB)) |
+ FIELD_VALUE(PKT_DSC_SEGOFFSET, global_offset);
+ } else {
+ int nlhmac = ((op->source_buf_size + global_offset + 7 - op->cipher_offset) >> 3) & 1;
+
+ pkt_desc->srcLengthIVOffUseIVNext =
+ FIELD_VALUE(PKT_DSC_HASHBYTES, len & 7) |
+ FIELD_VALUE(PKT_DSC_IVOFF, cipher_offset_dwords) |
+ FIELD_VALUE(PKT_DSC_PKTLEN, nlhmac + ((len + 7) >> 3)) |
+ FIELD_VALUE(PKT_DSC_NLHMAC, nlhmac) |
+ FIELD_VALUE(PKT_DSC_BREAK, 0) |
+ FIELD_VALUE(PKT_DSC_WAIT, 0) |
+ FIELD_VALUE(PKT_DSC_SEGADDR, seg_addr >> (PKT_DSC_SEGADDR_LSB)) |
+ FIELD_VALUE(PKT_DSC_SEGOFFSET, global_offset);
+
+ }
+ } else {
+ if (multi_frag_flag) {
+ pkt_desc->srcLengthIVOffUseIVNext =
+
+ FIELD_VALUE(PKT_DSC_HASHBYTES, len & 7) |
+ FIELD_VALUE(PKT_DSC_IVOFF, cipher_offset_dwords) |
+ FIELD_VALUE(PKT_DSC_PKTLEN, (len + 7) >> 3) |
+ FIELD_VALUE(PKT_DSC_BREAK, 0) |
+ FIELD_VALUE(PKT_DSC_WAIT, 0) |
+ FIELD_VALUE(PKT_DSC_NEXT, 1) |
+ FIELD_VALUE(PKT_DSC_SEGADDR, seg_addr >> (PKT_DSC_SEGADDR_LSB)) |
+ FIELD_VALUE(PKT_DSC_SEGOFFSET, global_offset);
+
+
+ next_pkt_desc->srcLengthIVOffUseIVNext =
+ FIELD_VALUE(PKT_DSC_HASHBYTES, (next_len & 7)) |
+ FIELD_VALUE(PKT_DSC_IVOFF, 0) |
+ FIELD_VALUE(PKT_DSC_PKTLEN, (next_len + 7) >> 3) |
+ FIELD_VALUE(PKT_DSC_BREAK, 0) |
+ FIELD_VALUE(PKT_DSC_WAIT, 0) |
+ FIELD_VALUE(PKT_DSC_NEXT, 0) |
+ FIELD_VALUE(PKT_DSC_SEGADDR, next_seg_addr >> (PKT_DSC_SEGADDR_LSB)) |
+ FIELD_VALUE(PKT_DSC_SEGOFFSET, 0);
+
+
+ } else {
+ pkt_desc->srcLengthIVOffUseIVNext =
+ FIELD_VALUE(PKT_DSC_HASHBYTES, len & 7) |
+ FIELD_VALUE(PKT_DSC_IVOFF, cipher_offset_dwords) |
+ FIELD_VALUE(PKT_DSC_PKTLEN, (len + 7) >> 3) |
+ FIELD_VALUE(PKT_DSC_BREAK, 0) |
+ FIELD_VALUE(PKT_DSC_WAIT, 0) |
+ FIELD_VALUE(PKT_DSC_SEGADDR, seg_addr >> (PKT_DSC_SEGADDR_LSB)) |
+ FIELD_VALUE(PKT_DSC_SEGOFFSET, global_offset);
+
+
+ }
+ }
+
+ switch (op->pkt_hmac) {
+ case XLR_SEC_LOADHMACKEY_MODE_OLD:
+ CLEAR_SET_FIELD(pkt_desc->srcLengthIVOffUseIVNext,
+ PKT_DSC_LOADHMACKEY, PKT_DSC_LOADHMACKEY_OLD);
+ if (multi_frag_flag) {
+ CLEAR_SET_FIELD(next_pkt_desc->srcLengthIVOffUseIVNext,
+ PKT_DSC_LOADHMACKEY, PKT_DSC_LOADHMACKEY_OLD);
+
+ }
+ break;
+ case XLR_SEC_LOADHMACKEY_MODE_LOAD:
+ CLEAR_SET_FIELD(pkt_desc->srcLengthIVOffUseIVNext,
+ PKT_DSC_LOADHMACKEY, PKT_DSC_LOADHMACKEY_LOAD);
+ if (multi_frag_flag) {
+ CLEAR_SET_FIELD(next_pkt_desc->srcLengthIVOffUseIVNext,
+ PKT_DSC_LOADHMACKEY, PKT_DSC_LOADHMACKEY_LOAD);
+
+ }
+ break;
+ default:
+ if (vector & (XLR_SEC_VECTOR_HMAC | XLR_SEC_VECTOR_HMAC2 | XLR_SEC_VECTOR_GCM | XLR_SEC_VECTOR_F9)) {
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: ERR_LOADHMACKEY_MODE EXIT\n");
+ return XLR_SEC_ERR_LOADHMACKEY_MODE;
+ }
+ break;
+ }
+
+ switch (op->pkt_hash) {
+ case XLR_SEC_PADHASH_PADDED:
+ CLEAR_SET_FIELD(pkt_desc->srcLengthIVOffUseIVNext,
+ PKT_DSC_PADHASH, PKT_DSC_PADHASH_PADDED);
+ if (multi_frag_flag) {
+ CLEAR_SET_FIELD(next_pkt_desc->srcLengthIVOffUseIVNext,
+ PKT_DSC_PADHASH, PKT_DSC_PADHASH_PADDED);
+ }
+ break;
+ case XLR_SEC_PADHASH_PAD:
+ CLEAR_SET_FIELD(pkt_desc->srcLengthIVOffUseIVNext,
+ PKT_DSC_PADHASH, PKT_DSC_PADHASH_PAD);
+ if (multi_frag_flag) {
+ CLEAR_SET_FIELD(next_pkt_desc->srcLengthIVOffUseIVNext,
+ PKT_DSC_PADHASH, PKT_DSC_PADHASH_PAD);
+ }
+ break;
+ default:
+ if (vector & (XLR_SEC_VECTOR_MAC | XLR_SEC_VECTOR_HMAC | XLR_SEC_VECTOR_HMAC2)) {
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: ERR_PADHASH_MODE EXIT\n");
+ return XLR_SEC_ERR_PADHASH_MODE;
+ }
+ break;
+ }
+
+ switch (op->pkt_iv) {
+ case XLR_SEC_PKT_IV_OLD:
+ CLEAR_SET_FIELD(pkt_desc->srcLengthIVOffUseIVNext,
+ PKT_DSC_IV, PKT_DSC_IV_OLD);
+ if (multi_frag_flag) {
+ CLEAR_SET_FIELD(next_pkt_desc->srcLengthIVOffUseIVNext,
+ PKT_DSC_IV, PKT_DSC_IV_OLD);
+
+ }
+ break;
+ case XLR_SEC_PKT_IV_NEW:
+ CLEAR_SET_FIELD(pkt_desc->srcLengthIVOffUseIVNext,
+ PKT_DSC_IV, PKT_DSC_IV_NEW);
+ if (multi_frag_flag) {
+ CLEAR_SET_FIELD(next_pkt_desc->srcLengthIVOffUseIVNext,
+ PKT_DSC_IV, PKT_DSC_IV_NEW);
+
+ }
+ break;
+ default:
+ if (vector & XLR_SEC_VECTOR_CIPHER) {
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: ERR_PKT_IV_MODE EXIT\n");
+ return XLR_SEC_ERR_PKT_IV_MODE;
+ }
+ break;
+ }
+
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: src_buf=%llx phys_src_buf=%llx \n",
+ (unsigned long long)op->source_buf, (unsigned long long)addr);
+
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: seg_addr=%llx offset=%lld\n",
+ (unsigned long long)seg_addr, (unsigned long long)byte_offset);
+
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: global src offset: %d, iv_offset=%d\n",
+ cipher_offset_dwords, op->iv_offset);
+
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: src_buf_sz=%d PKT_LEN=%d\n",
+ op->source_buf_size, len_dwords);
+
+ /*
+ * same operation with the destination. cipher offset affects this,
+ * as well
+ */
+ if (multi_frag_flag) {
+ next_seg_addr = (uint64_t) vtophys((void *)(unsigned long)(desc->next_dest_buf));
+ next_seg_addr = (next_seg_addr & ~(SMP_CACHE_BYTES - 1));
+ }
+ addr = (uint64_t) vtophys((void *)(unsigned long)op->dest_buf);
+ seg_addr = (addr & ~(SMP_CACHE_BYTES - 1));
+ byte_offset = addr - seg_addr;
+ global_offset = byte_offset & 0x7;
+
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: dest_buf=%llx phys_dest_buf=%llx \n",
+ (unsigned long long)op->dest_buf, (unsigned long long)addr);
+
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: seg_addr=%llx offset=%lld\n",
+ (unsigned long long)seg_addr, (unsigned long long)byte_offset);
+
+ /*
+ * Dest Address = (Cipher Dest Address) + (Cipher Offset) + (Global
+ * Dest Data Offset)
+ *
+ * Cipher Dest Address - Cache-line (0xffffffffe0) Cipher Offset -
+ * Which (64-bit) Word in Cacheline (0-3) Global Dest Data Offset -
+ * Number of Bytes in (64-bit) Word before data
+ *
+ * It must be set for Digest-only Ops, since the Digest engine will
+ * write data to this address.
+ */
+ cipher_offset_dwords = (op->cipher_offset + byte_offset) >> 3;
+
+
+ pkt_desc->dstDataSettings =
+ /* SYM_OP, HASHSRC */
+ FIELD_VALUE(PKT_DSC_CPHROFF, cipher_offset_dwords) |
+ FIELD_VALUE(PKT_DSC_HASHOFF, (op->digest_offset + byte_offset) >> 3) |
+ FIELD_VALUE(PKT_DSC_CPHR_DST_ADDR, seg_addr) |
+ FIELD_VALUE(PKT_DSC_CPHR_DST_DWOFFSET, 0) |
+ FIELD_VALUE(PKT_DSC_CPHR_DST_OFFSET, global_offset);
+
+ if (multi_frag_flag) {
+ next_pkt_desc->dstDataSettings =
+ /* SYM_OP, HASHSRC */
+ FIELD_VALUE(PKT_DSC_CPHROFF, cipher_offset_dwords) |
+ FIELD_VALUE(PKT_DSC_HASHOFF, (op->digest_offset + byte_offset) >> 3) |
+ FIELD_VALUE(PKT_DSC_CPHR_DST_ADDR, next_seg_addr) |
+ FIELD_VALUE(PKT_DSC_CPHR_DST_DWOFFSET, 0) |
+ FIELD_VALUE(PKT_DSC_CPHR_DST_OFFSET, global_offset);
+
+ }
+ if (op->cipher_type == XLR_SEC_CIPHER_TYPE_ARC4)
+ pkt_desc->dstDataSettings |= FIELD_VALUE(PKT_DSC_ARC4BYTECOUNT, last_u64_bytes);
+
+ if (op->cipher_type != XLR_SEC_CIPHER_TYPE_NONE) {
+ switch (op->cipher_op) {
+ case XLR_SEC_CIPHER_OP_ENCRYPT:
+ CLEAR_SET_FIELD(pkt_desc->dstDataSettings,
+ PKT_DSC_SYM_OP, PKT_DSC_SYM_OP_ENCRYPT);
+ if (multi_frag_flag) {
+ CLEAR_SET_FIELD(next_pkt_desc->dstDataSettings,
+ PKT_DSC_SYM_OP, PKT_DSC_SYM_OP_ENCRYPT);
+
+ }
+ break;
+ case XLR_SEC_CIPHER_OP_DECRYPT:
+ CLEAR_SET_FIELD(pkt_desc->dstDataSettings,
+ PKT_DSC_SYM_OP, PKT_DSC_SYM_OP_DECRYPT);
+ if (multi_frag_flag) {
+ CLEAR_SET_FIELD(next_pkt_desc->dstDataSettings,
+ PKT_DSC_SYM_OP, PKT_DSC_SYM_OP_DECRYPT);
+
+ }
+ break;
+ default:
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: ERR_CIPHER_OP EXIT\n");
+ return XLR_SEC_ERR_CIPHER_OP;
+ }
+ }
+ if (flags & XLR_SEC_SETUP_OP_HMAC) {
+ switch (op->digest_src) {
+ case XLR_SEC_DIGEST_SRC_DMA:
+ CLEAR_SET_FIELD(pkt_desc->dstDataSettings,
+ PKT_DSC_HASHSRC, PKT_DSC_HASHSRC_DMA);
+ if (multi_frag_flag) {
+ CLEAR_SET_FIELD(next_pkt_desc->dstDataSettings,
+ PKT_DSC_HASHSRC, PKT_DSC_HASHSRC_DMA);
+
+ }
+ break;
+ case XLR_SEC_DIGEST_SRC_CPHR:
+ CLEAR_SET_FIELD(pkt_desc->dstDataSettings,
+ PKT_DSC_HASHSRC, PKT_DSC_HASHSRC_CIPHER);
+ if (multi_frag_flag) {
+ CLEAR_SET_FIELD(next_pkt_desc->dstDataSettings,
+ PKT_DSC_HASHSRC, PKT_DSC_HASHSRC_CIPHER);
+ }
+ break;
+ default:
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: ERR_DIGEST_SRC EXIT\n");
+ return XLR_SEC_ERR_DIGEST_SRC;
+ }
+ }
+ if (op->cksum_type != XLR_SEC_CKSUM_TYPE_NOP) {
+ switch (op->cksum_src) {
+ case XLR_SEC_CKSUM_SRC_DMA:
+ CLEAR_SET_FIELD(pkt_desc->dstDataSettings,
+ PKT_DSC_CKSUMSRC, PKT_DSC_CKSUMSRC_DMA);
+ if (multi_frag_flag) {
+ CLEAR_SET_FIELD(next_pkt_desc->dstDataSettings,
+ PKT_DSC_CKSUMSRC, PKT_DSC_CKSUMSRC_DMA);
+ }
+ break;
+ case XLR_SEC_CKSUM_SRC_CIPHER:
+ CLEAR_SET_FIELD(next_pkt_desc->dstDataSettings,
+ PKT_DSC_CKSUMSRC, PKT_DSC_CKSUMSRC_CIPHER);
+ if (multi_frag_flag) {
+ CLEAR_SET_FIELD(next_pkt_desc->dstDataSettings,
+ PKT_DSC_CKSUMSRC, PKT_DSC_CKSUMSRC_CIPHER);
+ }
+ break;
+ default:
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: ERR_CKSUM_SRC EXIT\n");
+ return XLR_SEC_ERR_CKSUM_SRC;
+ }
+ }
+ pkt_desc->ckSumDstNonceHiCFBMaskLLWMask =
+ FIELD_VALUE(PKT_DSC_HASH_BYTE_OFF, (op->digest_offset & 0x7)) |
+ FIELD_VALUE(PKT_DSC_PKTLEN_BYTES, 0) |
+ /* NONCE_HI, PKT_DSC_LASTWORD, CFB_MASK, CKSUM_DST_ADDR */
+ FIELD_VALUE(PKT_DSC_IV_OFF_HI, 0);
+
+ if (multi_frag_flag) {
+ next_pkt_desc->ckSumDstNonceHiCFBMaskLLWMask =
+ FIELD_VALUE(PKT_DSC_HASH_BYTE_OFF, (op->digest_offset & 0x7)) |
+ FIELD_VALUE(PKT_DSC_PKTLEN_BYTES, 0) |
+ /* NONCE_HI, PKT_DSC_LASTWORD, CFB_MASK, CKSUM_DST_ADDR */
+ FIELD_VALUE(PKT_DSC_IV_OFF_HI, 0);
+
+ }
+ switch (op->pkt_lastword) {
+ case XLR_SEC_LASTWORD_128:
+ CLEAR_SET_FIELD(pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
+ PKT_DSC_LASTWORD, PKT_DSC_LASTWORD_128);
+ if (multi_frag_flag) {
+ CLEAR_SET_FIELD(next_pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
+ PKT_DSC_LASTWORD, PKT_DSC_LASTWORD_128);
+
+ }
+ break;
+ case XLR_SEC_LASTWORD_96MASK:
+ CLEAR_SET_FIELD(pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
+ PKT_DSC_LASTWORD, PKT_DSC_LASTWORD_96MASK);
+ if (multi_frag_flag) {
+ CLEAR_SET_FIELD(next_pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
+ PKT_DSC_LASTWORD, PKT_DSC_LASTWORD_96MASK);
+ }
+ break;
+ case XLR_SEC_LASTWORD_64MASK:
+ CLEAR_SET_FIELD(pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
+ PKT_DSC_LASTWORD, PKT_DSC_LASTWORD_64MASK);
+ if (multi_frag_flag) {
+ CLEAR_SET_FIELD(next_pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
+ PKT_DSC_LASTWORD, PKT_DSC_LASTWORD_64MASK);
+ }
+ break;
+ case XLR_SEC_LASTWORD_32MASK:
+ CLEAR_SET_FIELD(pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
+ PKT_DSC_LASTWORD, PKT_DSC_LASTWORD_32MASK);
+ if (multi_frag_flag) {
+ CLEAR_SET_FIELD(next_pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
+ PKT_DSC_LASTWORD, PKT_DSC_LASTWORD_32MASK);
+ }
+ break;
+ default:
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: ERR_LASTWORD_MODE EXIT\n");
+ return XLR_SEC_ERR_LASTWORD_MODE;
+ }
+ CLEAR_SET_FIELD(pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
+ PKT_DSC_CFB_MASK, op->cfb_mask);
+ CLEAR_SET_FIELD(pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
+ PKT_DSC_NONCE_HI, htonl(op->nonce) >> 24);
+ CLEAR_SET_FIELD(pkt_desc->authDstNonceLow,
+ PKT_DSC_NONCE_LOW, htonl(op->nonce) & 0xffffff);
+
+ if (multi_frag_flag) {
+ CLEAR_SET_FIELD(next_pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
+ PKT_DSC_CFB_MASK, op->cfb_mask);
+ CLEAR_SET_FIELD(next_pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
+ PKT_DSC_NONCE_HI, htonl(op->nonce) >> 24);
+ CLEAR_SET_FIELD(next_pkt_desc->authDstNonceLow,
+ PKT_DSC_NONCE_LOW, htonl(op->nonce) & 0xffffff);
+
+
+ }
+ /* Auth Dest Address must be Cacheline aligned on input */
+ if (vector & (XLR_SEC_VECTOR_MAC | XLR_SEC_VECTOR_HMAC | XLR_SEC_VECTOR_HMAC2 | XLR_SEC_VECTOR_GCM | XLR_SEC_VECTOR_F9)) {
+ pkt_desc->authDstNonceLow |=
+ /* NONCE_LOW */
+ FIELD_VALUE(PKT_DSC_AUTH_DST_ADDR,
+ (uint64_t) vtophys((void *)(unsigned long)op->auth_dest)) |
+ FIELD_VALUE(PKT_DSC_CIPH_OFF_HI, 0);
+
+
+ if (multi_frag_flag) {
+ next_pkt_desc->authDstNonceLow |=
+ /* NONCE_LOW */
+ FIELD_VALUE(PKT_DSC_AUTH_DST_ADDR,
+ (uint64_t) vtophys((void *)(unsigned long)desc->next_auth_dest)) |
+ FIELD_VALUE(PKT_DSC_CIPH_OFF_HI, 0);
- {
- printf("data desc\n");
- printf("srcLengthIVOffUseIVNext = 0x%llx\n",pkt_desc->srcLengthIVOffUseIVNext );
- printf("dstDataSettings = 0x%llx\n", pkt_desc->dstDataSettings);
- printf("authDstNonceLow = 0x%llx\n", pkt_desc->authDstNonceLow);
- printf("ckSumDstNonceHiCFBMaskLLWMask = 0x%llx\n", pkt_desc->ckSumDstNonceHiCFBMaskLLWMask);
- }
- if(multi_frag_flag){
+ }
+ }
+ /* CkSum Dest Address must be Cacheline aligned on input */
+ if (op->cksum_type == XLR_SEC_CKSUM_TYPE_IP) {
+ CLEAR_SET_FIELD(pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
+ PKT_DSC_CKSUM_DST_ADDR,
+ (uint64_t) vtophys((void *)(unsigned long)op->cksum_dest));
+
+ if (multi_frag_flag) {
+ CLEAR_SET_FIELD(next_pkt_desc->ckSumDstNonceHiCFBMaskLLWMask,
+ PKT_DSC_CKSUM_DST_ADDR,
+ (uint64_t) vtophys((void *)(unsigned long)desc->next_cksum_dest));
+
+ }
+ }
+ /*
+ * XLR_SEC_CMD_DIAG (" xlr_sec_setup_packet(): pkt_desc=%llx
+ * phys_pkt_desc=%llx \n", (unsigned long long)pkt_desc, (unsigned
+ * long long)virt_to_phys(pkt_desc)); (unsigned long long)pkt_desc,
+ * (unsigned long long)vtophys(pkt_desc));
+ */
+ XLR_SEC_CMD_DIAG(" xlr_sec_setup_packet(): pkt_desc=%p phys_pkt_desc=%llx \n",
+ pkt_desc, (unsigned long long)vtophys(pkt_desc));
+
+
+
+ CLEAR_SET_FIELD(*data, MSG_CMD_DATA_ADDR, ((uint64_t) vtophys(pkt_desc)));
+ CLEAR_SET_FIELD(*data, MSG_CMD_DATA_CTL, SEC_EOP);
+ CLEAR_SET_FIELD(*data, MSG_CMD_DATA_LEN, MSG_CMD_DATA_LEN_LOAD);
- printf("next data desc\n");
- printf("srcLengthIVOffUseIVNext = 0x%llx\n",next_pkt_desc->srcLengthIVOffUseIVNext );
- printf("dstDataSettings = 0x%llx\n", next_pkt_desc->dstDataSettings);
- printf("authDstNonceLow = 0x%llx\n", next_pkt_desc->authDstNonceLow);
- printf("ckSumDstNonceHiCFBMaskLLWMask = 0x%llx\n", next_pkt_desc->ckSumDstNonceHiCFBMaskLLWMask);
- }
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_packet: DONE\n");
+
+#ifdef RMI_SEC_DEBUG
+
+ {
+ printf("data desc\n");
+ printf("srcLengthIVOffUseIVNext = 0x%llx\n", pkt_desc->srcLengthIVOffUseIVNext);
+ printf("dstDataSettings = 0x%llx\n", pkt_desc->dstDataSettings);
+ printf("authDstNonceLow = 0x%llx\n", pkt_desc->authDstNonceLow);
+ printf("ckSumDstNonceHiCFBMaskLLWMask = 0x%llx\n", pkt_desc->ckSumDstNonceHiCFBMaskLLWMask);
+ }
+
+ if (multi_frag_flag) {
+
+ printf("next data desc\n");
+ printf("srcLengthIVOffUseIVNext = 0x%llx\n", next_pkt_desc->srcLengthIVOffUseIVNext);
+ printf("dstDataSettings = 0x%llx\n", next_pkt_desc->dstDataSettings);
+ printf("authDstNonceLow = 0x%llx\n", next_pkt_desc->authDstNonceLow);
+ printf("ckSumDstNonceHiCFBMaskLLWMask = 0x%llx\n", next_pkt_desc->ckSumDstNonceHiCFBMaskLLWMask);
+ }
#endif
#ifdef SYMBOL
- if (op->cipher_type == XLR_SEC_CIPHER_TYPE_ARC4) {
- op->source_buf -= 0;
- op->source_buf_size += 0;
- op->dest_buf -= 0;
- }
+ if (op->cipher_type == XLR_SEC_CIPHER_TYPE_ARC4) {
+ op->source_buf -= 0;
+ op->source_buf_size += 0;
+ op->dest_buf -= 0;
+ }
#endif
- return XLR_SEC_ERR_NONE;
+ return XLR_SEC_ERR_NONE;
}
-static int identify_symkey_ctl_error(uint32_t code, xlr_sec_error_t err)
+static int
+identify_symkey_ctl_error(uint32_t code, xlr_sec_error_t err)
{
- int ret_val = EINVAL;
-
- switch(code) {
- case CTL_ERR_NONE:
- XLR_SEC_CMD_DIAG("XLR_SEC_SEC: CTL Error: No Error\n");
- ret_val = 0;
- break;
- case CTL_ERR_CIPHER_OP:
- XLR_SEC_CMD_DIAG("XLR_SEC_SEC: CTL Error(CTL_ERR_CIPHER_OP) - Unknown Cipher Op \n");
- break;
- case CTL_ERR_MODE:
- XLR_SEC_CMD_DIAG("XLR_SEC_SEC: CTL Error(CTL_ERR_MODE) - "
- "Unknown or Not Allowed Mode \n");
- break;
- case CTL_ERR_CHKSUM_SRC:
- XLR_SEC_CMD_DIAG("XLR_SEC_SEC: CTL Error(CTL_ERR_CHKSUM_SRC) - Unknown CkSum Src\n");
- break;
- case CTL_ERR_CFB_MASK:
- XLR_SEC_CMD_DIAG("XLR_SEC_SEC: CTL Error(CTL_ERR_CFB_MASK) - Forbidden CFB Mask \n");
- break;
- case CTL_ERR_OP:
- XLR_SEC_CMD_DIAG("XLR_SEC_SEC: CTL Error(CTL_ERR_OP) - Unknown Ctrl Op \n");
- break;
- case CTL_ERR_DATA_READ:
- XLR_SEC_CMD_DIAG("XLR_SEC_SEC: CTL Error(CTL_ERR_DATA_READ) - Data Read Error\n");
- break;
- case CTL_ERR_DESC_CTRL:
- XLR_SEC_CMD_DIAG("XLR_SEC_SEC: CTL Error(CTL_ERR_DESC_CTRL) - "
- "Descriptor Ctrl Field Error \n");
- break;
- case CTL_ERR_UNDEF1:
- case CTL_ERR_UNDEF2:
- default:
- XLR_SEC_CMD_DIAG("XLR_SEC_SEC: CTL Error: UNKNOWN CODE=%d \n", code);
- break;
- }
- return ret_val;
+ int ret_val = EINVAL;
+
+ switch (code) {
+ case CTL_ERR_NONE:
+ XLR_SEC_CMD_DIAG("XLR_SEC_SEC: CTL Error: No Error\n");
+ ret_val = 0;
+ break;
+ case CTL_ERR_CIPHER_OP:
+ XLR_SEC_CMD_DIAG("XLR_SEC_SEC: CTL Error(CTL_ERR_CIPHER_OP) - Unknown Cipher Op \n");
+ break;
+ case CTL_ERR_MODE:
+ XLR_SEC_CMD_DIAG("XLR_SEC_SEC: CTL Error(CTL_ERR_MODE) - "
+ "Unknown or Not Allowed Mode \n");
+ break;
+ case CTL_ERR_CHKSUM_SRC:
+ XLR_SEC_CMD_DIAG("XLR_SEC_SEC: CTL Error(CTL_ERR_CHKSUM_SRC) - Unknown CkSum Src\n");
+ break;
+ case CTL_ERR_CFB_MASK:
+ XLR_SEC_CMD_DIAG("XLR_SEC_SEC: CTL Error(CTL_ERR_CFB_MASK) - Forbidden CFB Mask \n");
+ break;
+ case CTL_ERR_OP:
+ XLR_SEC_CMD_DIAG("XLR_SEC_SEC: CTL Error(CTL_ERR_OP) - Unknown Ctrl Op \n");
+ break;
+ case CTL_ERR_DATA_READ:
+ XLR_SEC_CMD_DIAG("XLR_SEC_SEC: CTL Error(CTL_ERR_DATA_READ) - Data Read Error\n");
+ break;
+ case CTL_ERR_DESC_CTRL:
+ XLR_SEC_CMD_DIAG("XLR_SEC_SEC: CTL Error(CTL_ERR_DESC_CTRL) - "
+ "Descriptor Ctrl Field Error \n");
+ break;
+ case CTL_ERR_UNDEF1:
+ case CTL_ERR_UNDEF2:
+ default:
+ XLR_SEC_CMD_DIAG("XLR_SEC_SEC: CTL Error: UNKNOWN CODE=%d \n", code);
+ break;
+ }
+ return ret_val;
}
static
-int identify_symkey_data_error(uint32_t code, xlr_sec_error_t err)
+int
+identify_symkey_data_error(uint32_t code, xlr_sec_error_t err)
{
- int ret_val = -EINVAL;
-
- switch(code) {
- case DATA_ERR_NONE:
- XLR_SEC_CMD_DIAG("XLR_SEC_SEC: DATA Error No Error\n");
- ret_val = 0;
- break;
- case DATA_ERR_LEN_CIPHER:
- XLR_SEC_CMD_DIAG("XLR_SEC_SEC: DATA Error() - Not Enough Data To Cipher\n");
- break;
- case DATA_ERR_IV_ADDR:
- XLR_SEC_CMD_DIAG("XLR_SEC_SEC: DATA Error() - Illegal IV Loacation\n");
- break;
- case DATA_ERR_WD_LEN_AES:
- XLR_SEC_CMD_DIAG("XLR_SEC_SEC: DATA Error() - Illegal Nb Words To AES\n");
- break;
- case DATA_ERR_BYTE_COUNT:
- XLR_SEC_CMD_DIAG("XLR_SEC_SEC: DATA Error() - Illegal Pad And ByteCount Spec\n");
- break;
- case DATA_ERR_LEN_CKSUM:
- XLR_SEC_CMD_DIAG("XLR_SEC_SEC: DATA Error() - Not Enough Data To CkSum\n");
- break;
- case DATA_ERR_OP:
- XLR_SEC_CMD_DIAG("XLR_SEC_SEC: DATA Error() - Unknown Data Op \n");
- break;
- case DATA_ERR_READ:
- XLR_SEC_CMD_DIAG("XLR_SEC_SEC: DATA Error() - Data Read Error \n");
- break;
- case DATA_ERR_WRITE:
- XLR_SEC_CMD_DIAG("XLR_SEC_SEC: DATA Error() - Data Write Error \n");
- break;
- case DATA_ERR_UNDEF1:
- default:
- XLR_SEC_CMD_DIAG("XLR_SEC_SEC: DATA Error - UNKNOWN CODE=%d \n", code);
- break;
- }
- return ret_val;
+ int ret_val = -EINVAL;
+
+ switch (code) {
+ case DATA_ERR_NONE:
+ XLR_SEC_CMD_DIAG("XLR_SEC_SEC: DATA Error No Error\n");
+ ret_val = 0;
+ break;
+ case DATA_ERR_LEN_CIPHER:
+ XLR_SEC_CMD_DIAG("XLR_SEC_SEC: DATA Error() - Not Enough Data To Cipher\n");
+ break;
+ case DATA_ERR_IV_ADDR:
+ XLR_SEC_CMD_DIAG("XLR_SEC_SEC: DATA Error() - Illegal IV Loacation\n");
+ break;
+ case DATA_ERR_WD_LEN_AES:
+ XLR_SEC_CMD_DIAG("XLR_SEC_SEC: DATA Error() - Illegal Nb Words To AES\n");
+ break;
+ case DATA_ERR_BYTE_COUNT:
+ XLR_SEC_CMD_DIAG("XLR_SEC_SEC: DATA Error() - Illegal Pad And ByteCount Spec\n");
+ break;
+ case DATA_ERR_LEN_CKSUM:
+ XLR_SEC_CMD_DIAG("XLR_SEC_SEC: DATA Error() - Not Enough Data To CkSum\n");
+ break;
+ case DATA_ERR_OP:
+ XLR_SEC_CMD_DIAG("XLR_SEC_SEC: DATA Error() - Unknown Data Op \n");
+ break;
+ case DATA_ERR_READ:
+ XLR_SEC_CMD_DIAG("XLR_SEC_SEC: DATA Error() - Data Read Error \n");
+ break;
+ case DATA_ERR_WRITE:
+ XLR_SEC_CMD_DIAG("XLR_SEC_SEC: DATA Error() - Data Write Error \n");
+ break;
+ case DATA_ERR_UNDEF1:
+ default:
+ XLR_SEC_CMD_DIAG("XLR_SEC_SEC: DATA Error - UNKNOWN CODE=%d \n", code);
+ break;
+ }
+ return ret_val;
}
static int
xlr_sec_submit_message(symkey_desc_pt desc, uint32_t cfg_vector)
{
- xlr_sec_error_t err;
- uint32_t ctl_error, data_error;
- int ret_val = 0;
+ xlr_sec_error_t err;
+ uint32_t ctl_error, data_error;
+ int ret_val = 0;
- XLR_SEC_CMD_DIAG("xlr_sec_submit_message: ENTER\n");
-
- err = XLR_SEC_ERR_NONE;
+ XLR_SEC_CMD_DIAG("xlr_sec_submit_message: ENTER\n");
- XLR_SEC_CMD_DIAG_SYM_DESC(desc, cfg_vector);
+ err = XLR_SEC_ERR_NONE;
- do {
- /* For now, send message and wait for response */
- err = xlr_sec_submit_op(desc);
+ XLR_SEC_CMD_DIAG_SYM_DESC(desc, cfg_vector);
- XLR_SEC_CMD_DIAG("xlr_sec_submit_message: err = %d \n", (uint32_t)err);
+ do {
+ /* For now, send message and wait for response */
+ err = xlr_sec_submit_op(desc);
- if( err != XLR_SEC_ERR_NONE ) {
- ret_val = (EINVAL);
- break;
- }
+ XLR_SEC_CMD_DIAG("xlr_sec_submit_message: err = %d \n", (uint32_t) err);
- ctl_error = desc->ctl_result;
- data_error = desc->data_result;
-
- XLR_SEC_CMD_DIAG("xlr_sec_submit_message: ctl_error = %x data_error = %x\n",
- ctl_error, data_error);
+ if (err != XLR_SEC_ERR_NONE) {
+ ret_val = (EINVAL);
+ break;
+ }
+ ctl_error = desc->ctl_result;
+ data_error = desc->data_result;
- if ((ret_val = identify_symkey_ctl_error(ctl_error, err)) == 0)
- ret_val = identify_symkey_data_error(data_error, err);
+ XLR_SEC_CMD_DIAG("xlr_sec_submit_message: ctl_error = %x data_error = %x\n",
+ ctl_error, data_error);
- XLR_SEC_CMD_DIAG("xlr_sec_submit_message: identify error = %d \n", ret_val );
+ if ((ret_val = identify_symkey_ctl_error(ctl_error, err)) == 0)
+ ret_val = identify_symkey_data_error(data_error, err);
- } while( 0 );
+ XLR_SEC_CMD_DIAG("xlr_sec_submit_message: identify error = %d \n", ret_val);
- XLR_SEC_CMD_DIAG("xlr_sec_submit_message: DONE\n");
- return (ret_val);
+ } while (0);
+
+ XLR_SEC_CMD_DIAG("xlr_sec_submit_message: DONE\n");
+ return (ret_val);
}
static
-xlr_sec_error_t xlr_sec_setup_cipher(xlr_sec_io_pt op,
- ControlDescriptor_pt ctl_desc,
- uint32_t *vector)
+xlr_sec_error_t
+xlr_sec_setup_cipher(xlr_sec_io_pt op,
+ ControlDescriptor_pt ctl_desc,
+ uint32_t * vector)
{
- uint32_t aes_flag = 0;
- uint32_t cipher_vector = 0;
-
- XLR_SEC_CMD_DIAG("xlr_sec_setup_cipher: ENTER vector = %04x\n", *vector);
-
- switch (op->cipher_type) {
- case XLR_SEC_CIPHER_TYPE_NONE:
- SET_FIELD(ctl_desc->instruction, CTL_DSC_CPHR, CTL_DSC_CPHR_BYPASS);
- XLR_SEC_CMD_DIAG("xlr_sec_setup_cipher: CIPHER_TYPE_NONE EXIT\n");
- return XLR_SEC_ERR_NONE;
- case XLR_SEC_CIPHER_TYPE_DES:
- cipher_vector |= XLR_SEC_VECTOR_CIPHER_DES;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_CPHR, CTL_DSC_CPHR_DES);
- break;
- case XLR_SEC_CIPHER_TYPE_3DES:
- cipher_vector |= XLR_SEC_VECTOR_CIPHER_3DES;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_CPHR, CTL_DSC_CPHR_3DES);
- break;
- case XLR_SEC_CIPHER_TYPE_AES128:
- aes_flag = 1;
- cipher_vector |= XLR_SEC_VECTOR_CIPHER_AES128;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_CPHR, CTL_DSC_CPHR_AES128);
- break;
- case XLR_SEC_CIPHER_TYPE_AES192:
- aes_flag = 1;
- cipher_vector |= XLR_SEC_VECTOR_CIPHER_AES192;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_CPHR, CTL_DSC_CPHR_AES192);
- break;
- case XLR_SEC_CIPHER_TYPE_AES256:
- aes_flag = 1;
- cipher_vector |= XLR_SEC_VECTOR_CIPHER_AES256;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_CPHR, CTL_DSC_CPHR_AES256);
- break;
- case XLR_SEC_CIPHER_TYPE_ARC4:
- cipher_vector |= XLR_SEC_VECTOR_CIPHER_ARC4;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_CPHR, CTL_DSC_CPHR_ARC4);
- SET_FIELD(ctl_desc->instruction, CTL_DSC_ARC4_KEYLEN,
- op->rc4_key_len);
- SET_FIELD(ctl_desc->instruction, CTL_DSC_ARC4_LOADSTATE,
- op->rc4_loadstate);
- SET_FIELD(ctl_desc->instruction, CTL_DSC_ARC4_SAVESTATE,
- op->rc4_savestate);
- if (op->rc4_loadstate || op->rc4_savestate)
- cipher_vector |= XLR_SEC_VECTOR_STATE;
- break;
- case XLR_SEC_CIPHER_TYPE_KASUMI_F8:
- aes_flag = 1;
- cipher_vector |= XLR_SEC_VECTOR_CIPHER_KASUMI_F8;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_CPHR, CTL_DSC_CPHR_KASUMI_F8);
- break;
- default:
- XLR_SEC_CMD_DIAG("xlr_sec_setup_cipher: ERR_CIPHER_TYPE EXIT\n");
- return XLR_SEC_ERR_CIPHER_TYPE;
- }
-
- switch (op->cipher_mode) {
- case XLR_SEC_CIPHER_MODE_ECB:
- if (aes_flag == 1)
- cipher_vector |= XLR_SEC_VECTOR_MODE_ECB_CBC_OFB;
- else
- cipher_vector |= XLR_SEC_VECTOR_MODE_ECB_CBC;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_MODE, CTL_DSC_MODE_ECB);
- break;
- case XLR_SEC_CIPHER_MODE_CBC:
- if (aes_flag == 1)
- cipher_vector |= XLR_SEC_VECTOR_MODE_ECB_CBC_OFB;
- else
- cipher_vector |= XLR_SEC_VECTOR_MODE_ECB_CBC;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_MODE, CTL_DSC_MODE_CBC);
- break;
- case XLR_SEC_CIPHER_MODE_OFB:
- if (aes_flag == 0) {
- XLR_SEC_CMD_DIAG("xlr_sec_setup_cipher: ERR_CIPHER_MODE EXIT\n");
- return XLR_SEC_ERR_CIPHER_MODE;
- }
- cipher_vector |= XLR_SEC_VECTOR_MODE_ECB_CBC_OFB;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_MODE, CTL_DSC_MODE_OFB);
- break;
- case XLR_SEC_CIPHER_MODE_CTR:
- if (aes_flag == 0) {
- XLR_SEC_CMD_DIAG("xlr_sec_setup_cipher: ERR_CIPHER_MODE EXIT\n");
- return XLR_SEC_ERR_CIPHER_MODE;
- }
- cipher_vector |= XLR_SEC_VECTOR_MODE_CTR_CFB;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_MODE, CTL_DSC_MODE_CTR);
- break;
- case XLR_SEC_CIPHER_MODE_CFB:
- if (aes_flag == 0) {
- XLR_SEC_CMD_DIAG("xlr_sec_setup_cipher: ERR_CIPHER_MODE EXIT\n");
- return XLR_SEC_ERR_CIPHER_MODE;
- }
- cipher_vector |= XLR_SEC_VECTOR_MODE_CTR_CFB;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_MODE, CTL_DSC_MODE_CFB);
- break;
- case XLR_SEC_CIPHER_MODE_F8:
- if (aes_flag == 0) {
- XLR_SEC_CMD_DIAG("xlr_sec_setup_cipher: ERR_CIPHER_MODE EXIT\n");
- return XLR_SEC_ERR_CIPHER_MODE;
- }
- cipher_vector |= XLR_SEC_VECTOR_MODE_F8;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_MODE, CTL_DSC_MODE_F8);
- break;
- default:
- if (!(cipher_vector & (XLR_SEC_VECTOR_CIPHER_ARC4 | XLR_SEC_VECTOR_CIPHER_KASUMI_F8))) {
- XLR_SEC_CMD_DIAG("xlr_sec_setup_cipher: ERR_CIPHER_MODE EXIT\n");
- return XLR_SEC_ERR_CIPHER_MODE;
+ uint32_t aes_flag = 0;
+ uint32_t cipher_vector = 0;
+
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_cipher: ENTER vector = %04x\n", *vector);
+
+ switch (op->cipher_type) {
+ case XLR_SEC_CIPHER_TYPE_NONE:
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_CPHR, CTL_DSC_CPHR_BYPASS);
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_cipher: CIPHER_TYPE_NONE EXIT\n");
+ return XLR_SEC_ERR_NONE;
+ case XLR_SEC_CIPHER_TYPE_DES:
+ cipher_vector |= XLR_SEC_VECTOR_CIPHER_DES;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_CPHR, CTL_DSC_CPHR_DES);
+ break;
+ case XLR_SEC_CIPHER_TYPE_3DES:
+ cipher_vector |= XLR_SEC_VECTOR_CIPHER_3DES;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_CPHR, CTL_DSC_CPHR_3DES);
+ break;
+ case XLR_SEC_CIPHER_TYPE_AES128:
+ aes_flag = 1;
+ cipher_vector |= XLR_SEC_VECTOR_CIPHER_AES128;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_CPHR, CTL_DSC_CPHR_AES128);
+ break;
+ case XLR_SEC_CIPHER_TYPE_AES192:
+ aes_flag = 1;
+ cipher_vector |= XLR_SEC_VECTOR_CIPHER_AES192;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_CPHR, CTL_DSC_CPHR_AES192);
+ break;
+ case XLR_SEC_CIPHER_TYPE_AES256:
+ aes_flag = 1;
+ cipher_vector |= XLR_SEC_VECTOR_CIPHER_AES256;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_CPHR, CTL_DSC_CPHR_AES256);
+ break;
+ case XLR_SEC_CIPHER_TYPE_ARC4:
+ cipher_vector |= XLR_SEC_VECTOR_CIPHER_ARC4;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_CPHR, CTL_DSC_CPHR_ARC4);
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_ARC4_KEYLEN,
+ op->rc4_key_len);
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_ARC4_LOADSTATE,
+ op->rc4_loadstate);
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_ARC4_SAVESTATE,
+ op->rc4_savestate);
+ if (op->rc4_loadstate || op->rc4_savestate)
+ cipher_vector |= XLR_SEC_VECTOR_STATE;
+ break;
+ case XLR_SEC_CIPHER_TYPE_KASUMI_F8:
+ aes_flag = 1;
+ cipher_vector |= XLR_SEC_VECTOR_CIPHER_KASUMI_F8;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_CPHR, CTL_DSC_CPHR_KASUMI_F8);
+ break;
+ default:
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_cipher: ERR_CIPHER_TYPE EXIT\n");
+ return XLR_SEC_ERR_CIPHER_TYPE;
}
- }
- switch (op->cipher_init) {
- case XLR_SEC_CIPHER_INIT_OK:
- SET_FIELD(ctl_desc->instruction,
- CTL_DSC_ICPHR, CTL_DSC_ICPHR_OKY);
- break;
+ switch (op->cipher_mode) {
+ case XLR_SEC_CIPHER_MODE_ECB:
+ if (aes_flag == 1)
+ cipher_vector |= XLR_SEC_VECTOR_MODE_ECB_CBC_OFB;
+ else
+ cipher_vector |= XLR_SEC_VECTOR_MODE_ECB_CBC;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_MODE, CTL_DSC_MODE_ECB);
+ break;
+ case XLR_SEC_CIPHER_MODE_CBC:
+ if (aes_flag == 1)
+ cipher_vector |= XLR_SEC_VECTOR_MODE_ECB_CBC_OFB;
+ else
+ cipher_vector |= XLR_SEC_VECTOR_MODE_ECB_CBC;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_MODE, CTL_DSC_MODE_CBC);
+ break;
+ case XLR_SEC_CIPHER_MODE_OFB:
+ if (aes_flag == 0) {
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_cipher: ERR_CIPHER_MODE EXIT\n");
+ return XLR_SEC_ERR_CIPHER_MODE;
+ }
+ cipher_vector |= XLR_SEC_VECTOR_MODE_ECB_CBC_OFB;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_MODE, CTL_DSC_MODE_OFB);
+ break;
+ case XLR_SEC_CIPHER_MODE_CTR:
+ if (aes_flag == 0) {
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_cipher: ERR_CIPHER_MODE EXIT\n");
+ return XLR_SEC_ERR_CIPHER_MODE;
+ }
+ cipher_vector |= XLR_SEC_VECTOR_MODE_CTR_CFB;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_MODE, CTL_DSC_MODE_CTR);
+ break;
+ case XLR_SEC_CIPHER_MODE_CFB:
+ if (aes_flag == 0) {
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_cipher: ERR_CIPHER_MODE EXIT\n");
+ return XLR_SEC_ERR_CIPHER_MODE;
+ }
+ cipher_vector |= XLR_SEC_VECTOR_MODE_CTR_CFB;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_MODE, CTL_DSC_MODE_CFB);
+ break;
+ case XLR_SEC_CIPHER_MODE_F8:
+ if (aes_flag == 0) {
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_cipher: ERR_CIPHER_MODE EXIT\n");
+ return XLR_SEC_ERR_CIPHER_MODE;
+ }
+ cipher_vector |= XLR_SEC_VECTOR_MODE_F8;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_MODE, CTL_DSC_MODE_F8);
+ break;
+ default:
+ if (!(cipher_vector & (XLR_SEC_VECTOR_CIPHER_ARC4 | XLR_SEC_VECTOR_CIPHER_KASUMI_F8))) {
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_cipher: ERR_CIPHER_MODE EXIT\n");
+ return XLR_SEC_ERR_CIPHER_MODE;
+ }
+ }
- case XLR_SEC_CIPHER_INIT_NK:
- SET_FIELD(ctl_desc->instruction,
- CTL_DSC_ICPHR, CTL_DSC_ICPHR_NKY);
- break;
- default:
- XLR_SEC_CMD_DIAG("xlr_sec_setup_cipher: ERR_CIPHER_INIT EXIT\n");
- return XLR_SEC_ERR_CIPHER_INIT;
- }
+ switch (op->cipher_init) {
+ case XLR_SEC_CIPHER_INIT_OK:
+ SET_FIELD(ctl_desc->instruction,
+ CTL_DSC_ICPHR, CTL_DSC_ICPHR_OKY);
+ break;
+
+ case XLR_SEC_CIPHER_INIT_NK:
+ SET_FIELD(ctl_desc->instruction,
+ CTL_DSC_ICPHR, CTL_DSC_ICPHR_NKY);
+ break;
+ default:
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_cipher: ERR_CIPHER_INIT EXIT\n");
+ return XLR_SEC_ERR_CIPHER_INIT;
+ }
- *vector |= cipher_vector;
+ *vector |= cipher_vector;
- XLR_SEC_CMD_DIAG("xlr_sec_setup_cipher: EXIT vector = %04x\n", *vector);
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_cipher: EXIT vector = %04x\n", *vector);
- return XLR_SEC_ERR_NONE;
+ return XLR_SEC_ERR_NONE;
}
static
-xlr_sec_error_t xlr_sec_setup_digest(xlr_sec_io_pt op,
- ControlDescriptor_pt ctl_desc,
- uint32_t *vector)
+xlr_sec_error_t
+xlr_sec_setup_digest(xlr_sec_io_pt op,
+ ControlDescriptor_pt ctl_desc,
+ uint32_t * vector)
{
- uint32_t hash_flag = 0;
- uint32_t hmac_flag = 0;
- uint32_t digest_vector = 0;
-
- XLR_SEC_CMD_DIAG("xlr_sec_setup_digest: ENTER vector = %04x\n", *vector);
-
- switch (op->digest_type) {
- case XLR_SEC_DIGEST_TYPE_MD5:
- digest_vector |= XLR_SEC_VECTOR_MAC;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_MD5);
- break;
- case XLR_SEC_DIGEST_TYPE_SHA1:
- digest_vector |= XLR_SEC_VECTOR_MAC;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_SHA1);
- break;
- case XLR_SEC_DIGEST_TYPE_SHA256:
- digest_vector |= XLR_SEC_VECTOR_MAC;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_SHA256);
- break;
- case XLR_SEC_DIGEST_TYPE_SHA384:
- digest_vector |= XLR_SEC_VECTOR_MAC;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_HASHHI, CTL_DSC_HASH_SHA384>>2);
- SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_SHA384);
- break;
- case XLR_SEC_DIGEST_TYPE_SHA512:
- digest_vector |= XLR_SEC_VECTOR_MAC;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_HASHHI, CTL_DSC_HASH_SHA512>>2);
- SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_SHA512);
- break;
- case XLR_SEC_DIGEST_TYPE_GCM:
- hash_flag = 1;
- digest_vector |= XLR_SEC_VECTOR_GCM;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_HASHHI, CTL_DSC_HASH_GCM>>2);
- SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_GCM);
- break;
- case XLR_SEC_DIGEST_TYPE_KASUMI_F9:
- hash_flag = 1;
- digest_vector |= XLR_SEC_VECTOR_F9;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_HASHHI, CTL_DSC_HASH_KASUMI_F9>>2);
- SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_KASUMI_F9);
- break;
- case XLR_SEC_DIGEST_TYPE_HMAC_MD5:
- hmac_flag = 1;
- digest_vector |= XLR_SEC_VECTOR_HMAC;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_MD5);
- break;
- case XLR_SEC_DIGEST_TYPE_HMAC_SHA1:
- hmac_flag = 1;
- digest_vector |= XLR_SEC_VECTOR_HMAC;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_SHA1);
- break;
- case XLR_SEC_DIGEST_TYPE_HMAC_SHA256:
- hmac_flag = 1;
- digest_vector |= XLR_SEC_VECTOR_HMAC;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_SHA256);
- break;
- case XLR_SEC_DIGEST_TYPE_HMAC_SHA384:
- hmac_flag = 1;
- digest_vector |= XLR_SEC_VECTOR_HMAC2;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_HASHHI, CTL_DSC_HASH_SHA384>>2);
- SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_SHA384);
- break;
- case XLR_SEC_DIGEST_TYPE_HMAC_SHA512:
- hmac_flag = 1;
- digest_vector |= XLR_SEC_VECTOR_HMAC2;
- SET_FIELD(ctl_desc->instruction, CTL_DSC_HASHHI, CTL_DSC_HASH_SHA512>>2);
- SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_SHA512);
- break;
- default:
- return XLR_SEC_ERR_DIGEST_TYPE;
- }
-
- if (hmac_flag == 1) {
- SET_FIELD(ctl_desc->instruction, CTL_DSC_HMAC, CTL_DSC_HMAC_ON);
-
- }
- if (hmac_flag || hash_flag) {
- switch (op->digest_init) {
- case XLR_SEC_DIGEST_INIT_OLDKEY:
- SET_FIELD(ctl_desc->instruction, CTL_DSC_IHASH, CTL_DSC_IHASH_OLD);
- break;
- case XLR_SEC_DIGEST_INIT_NEWKEY:
- SET_FIELD(ctl_desc->instruction, CTL_DSC_IHASH, CTL_DSC_IHASH_NEW);
- break;
- default:
- return XLR_SEC_ERR_DIGEST_INIT;
- }
- } /* hmac_flag */
-
- *vector |= digest_vector;
-
- XLR_SEC_CMD_DIAG("xlr_sec_setup_digest: EXIT vector = %04x\n", *vector);
-
- return XLR_SEC_ERR_NONE;
+ uint32_t hash_flag = 0;
+ uint32_t hmac_flag = 0;
+ uint32_t digest_vector = 0;
+
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_digest: ENTER vector = %04x\n", *vector);
+
+ switch (op->digest_type) {
+ case XLR_SEC_DIGEST_TYPE_MD5:
+ digest_vector |= XLR_SEC_VECTOR_MAC;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_MD5);
+ break;
+ case XLR_SEC_DIGEST_TYPE_SHA1:
+ digest_vector |= XLR_SEC_VECTOR_MAC;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_SHA1);
+ break;
+ case XLR_SEC_DIGEST_TYPE_SHA256:
+ digest_vector |= XLR_SEC_VECTOR_MAC;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_SHA256);
+ break;
+ case XLR_SEC_DIGEST_TYPE_SHA384:
+ digest_vector |= XLR_SEC_VECTOR_MAC;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_HASHHI, CTL_DSC_HASH_SHA384 >> 2);
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_SHA384);
+ break;
+ case XLR_SEC_DIGEST_TYPE_SHA512:
+ digest_vector |= XLR_SEC_VECTOR_MAC;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_HASHHI, CTL_DSC_HASH_SHA512 >> 2);
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_SHA512);
+ break;
+ case XLR_SEC_DIGEST_TYPE_GCM:
+ hash_flag = 1;
+ digest_vector |= XLR_SEC_VECTOR_GCM;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_HASHHI, CTL_DSC_HASH_GCM >> 2);
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_GCM);
+ break;
+ case XLR_SEC_DIGEST_TYPE_KASUMI_F9:
+ hash_flag = 1;
+ digest_vector |= XLR_SEC_VECTOR_F9;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_HASHHI, CTL_DSC_HASH_KASUMI_F9 >> 2);
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_KASUMI_F9);
+ break;
+ case XLR_SEC_DIGEST_TYPE_HMAC_MD5:
+ hmac_flag = 1;
+ digest_vector |= XLR_SEC_VECTOR_HMAC;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_MD5);
+ break;
+ case XLR_SEC_DIGEST_TYPE_HMAC_SHA1:
+ hmac_flag = 1;
+ digest_vector |= XLR_SEC_VECTOR_HMAC;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_SHA1);
+ break;
+ case XLR_SEC_DIGEST_TYPE_HMAC_SHA256:
+ hmac_flag = 1;
+ digest_vector |= XLR_SEC_VECTOR_HMAC;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_SHA256);
+ break;
+ case XLR_SEC_DIGEST_TYPE_HMAC_SHA384:
+ hmac_flag = 1;
+ digest_vector |= XLR_SEC_VECTOR_HMAC2;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_HASHHI, CTL_DSC_HASH_SHA384 >> 2);
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_SHA384);
+ break;
+ case XLR_SEC_DIGEST_TYPE_HMAC_SHA512:
+ hmac_flag = 1;
+ digest_vector |= XLR_SEC_VECTOR_HMAC2;
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_HASHHI, CTL_DSC_HASH_SHA512 >> 2);
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_HASH, CTL_DSC_HASH_SHA512);
+ break;
+ default:
+ return XLR_SEC_ERR_DIGEST_TYPE;
+ }
+
+ if (hmac_flag == 1) {
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_HMAC, CTL_DSC_HMAC_ON);
+
+ }
+ if (hmac_flag || hash_flag) {
+ switch (op->digest_init) {
+ case XLR_SEC_DIGEST_INIT_OLDKEY:
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_IHASH, CTL_DSC_IHASH_OLD);
+ break;
+ case XLR_SEC_DIGEST_INIT_NEWKEY:
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_IHASH, CTL_DSC_IHASH_NEW);
+ break;
+ default:
+ return XLR_SEC_ERR_DIGEST_INIT;
+ }
+ } /* hmac_flag */
+ *vector |= digest_vector;
+
+ XLR_SEC_CMD_DIAG("xlr_sec_setup_digest: EXIT vector = %04x\n", *vector);
+
+ return XLR_SEC_ERR_NONE;
}
static
-xlr_sec_error_t xlr_sec_setup_cksum(xlr_sec_io_pt op,
- ControlDescriptor_pt ctl_desc)
+xlr_sec_error_t
+xlr_sec_setup_cksum(xlr_sec_io_pt op,
+ ControlDescriptor_pt ctl_desc)
{
- switch (op->cksum_type) {
- case XLR_SEC_CKSUM_TYPE_NOP:
- SET_FIELD(ctl_desc->instruction, CTL_DSC_CKSUM, CTL_DSC_CKSUM_NOP);
- return XLR_SEC_ERR_NONE;
- case XLR_SEC_CKSUM_TYPE_IP:
- SET_FIELD(ctl_desc->instruction, CTL_DSC_CKSUM, CTL_DSC_CKSUM_IP);
- break;
- default:
- return XLR_SEC_ERR_CKSUM_TYPE;
- }
-
- return XLR_SEC_ERR_NONE;
+ switch (op->cksum_type) {
+ case XLR_SEC_CKSUM_TYPE_NOP:
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_CKSUM, CTL_DSC_CKSUM_NOP);
+ return XLR_SEC_ERR_NONE;
+ case XLR_SEC_CKSUM_TYPE_IP:
+ SET_FIELD(ctl_desc->instruction, CTL_DSC_CKSUM, CTL_DSC_CKSUM_IP);
+ break;
+ default:
+ return XLR_SEC_ERR_CKSUM_TYPE;
+ }
+
+ return XLR_SEC_ERR_NONE;
}
static
-xlr_sec_error_t xlr_sec_control_setup (xlr_sec_io_pt op,
- unsigned int flags,
- uint64_t *control,
- ControlDescriptor_pt ctl_desc,
- xlr_sec_drv_user_t *user,
- uint32_t vector)
+xlr_sec_error_t
+xlr_sec_control_setup(xlr_sec_io_pt op,
+ unsigned int flags,
+ uint64_t * control,
+ ControlDescriptor_pt ctl_desc,
+ xlr_sec_drv_user_t * user,
+ uint32_t vector)
{
- uint64_t *hmac_key = NULL;
- uint64_t *cipher_key = NULL;
- uint64_t *cipher_state = NULL;
- uint32_t ctl_size = 0;
- uint64_t ctl_addr = 0;
- uint32_t cipher_keylen = 0;
- uint32_t hmac_keylen = 0;
- uint32_t ctl_len;
+ uint64_t *hmac_key = NULL;
+ uint64_t *cipher_key = NULL;
+ uint64_t *cipher_state = NULL;
+ uint32_t ctl_size = 0;
+ uint64_t ctl_addr = 0;
+ uint32_t cipher_keylen = 0;
+ uint32_t hmac_keylen = 0;
+ uint32_t ctl_len;
#ifdef SYM_DEBUG
- XLR_SEC_CMD_DIAG(" ENTER vector = %04x\n", vector);
+ XLR_SEC_CMD_DIAG(" ENTER vector = %04x\n", vector);
#endif
- switch (vector) {
- case XLR_SEC_VECTOR_MAC:
- XLR_SEC_CMD_DIAG(" XLR_SEC_VECTOR_MAC \n");
- ctl_size = sizeof(HMAC_t);
- break;
- case XLR_SEC_VECTOR_HMAC:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_HMAC \n");
- hmac_key = &ctl_desc->cipherHashInfo.infoHMAC.hmacKey0;
- hmac_keylen = sizeof(HMAC_t);
- ctl_size = sizeof(HMAC_t);
- break;
- case XLR_SEC_VECTOR_CIPHER_ARC4:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_ARC4\n");
- cipher_key = &ctl_desc->cipherHashInfo.infoARC4.cipherKey0;
- cipher_keylen = op->rc4_key_len;
- ctl_size = sizeof(ARC4_t);
- break;
- case XLR_SEC_VECTOR_CIPHER_ARC4__HMAC:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_ARC4__HMAC\n");
- cipher_key = &ctl_desc->cipherHashInfo.infoARC4HMAC.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoARC4HMAC.hmacKey0;
- cipher_keylen = op->rc4_key_len;
- hmac_keylen = sizeof(HMAC_t);
- ctl_size = sizeof(ARC4HMAC_t);
- break;
- case XLR_SEC_VECTOR_CIPHER_ARC4__STATE:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_ARC4__STATE\n");
- cipher_key = &ctl_desc->cipherHashInfo.infoARC4State.cipherKey0;
- cipher_state =
- &ctl_desc->cipherHashInfo.infoARC4State.Arc4SboxData0;
- cipher_keylen = op->rc4_key_len;
- ctl_size = sizeof(ARC4State_t);
- break;
- case XLR_SEC_VECTOR_CIPHER_ARC4__HMAC__STATE:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_ARC4__HMAC__STATE\n");
- cipher_key = &ctl_desc->cipherHashInfo.infoARC4StateHMAC.cipherKey0;
- cipher_state =
- &ctl_desc->cipherHashInfo.infoARC4StateHMAC.Arc4SboxData0;
- hmac_key = &ctl_desc->cipherHashInfo.infoARC4StateHMAC.hmacKey0;
- cipher_keylen = op->rc4_key_len;
- hmac_keylen = sizeof(HMAC_t);
- ctl_size = sizeof(ARC4StateHMAC_t);
- break;
- case XLR_SEC_VECTOR_CIPHER_KASUMI_F8:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_KASUMI_F8\n");
- cipher_key = &ctl_desc->cipherHashInfo.infoKASUMIF8.cipherKey0;
- cipher_keylen = XLR_SEC_KASUMI_F8_KEY_LENGTH;
- ctl_size = sizeof(KASUMIF8_t);
- break;
- case XLR_SEC_VECTOR_CIPHER_KASUMI_F8__HMAC:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_KASUMI_F8__HMAC\n");
- cipher_key = &ctl_desc->cipherHashInfo.infoKASUMIF8HMAC.cipherKey0;
- cipher_keylen = XLR_SEC_KASUMI_F8_KEY_LENGTH;
- hmac_key = &ctl_desc->cipherHashInfo.infoKASUMIF8HMAC.hmacKey0;
- hmac_keylen = sizeof(HMAC_t);
- ctl_size = sizeof(KASUMIF8HMAC_t);
- break;
- case XLR_SEC_VECTOR_CIPHER_KASUMI_F8__HMAC2:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_KASUMI_F8__HMAC2\n");
- cipher_key = &ctl_desc->cipherHashInfo.infoKASUMIF8HMAC2.cipherKey0;
- cipher_keylen = XLR_SEC_KASUMI_F8_KEY_LENGTH;
- hmac_key = &ctl_desc->cipherHashInfo.infoKASUMIF8HMAC2.hmacKey0;
- hmac_keylen = sizeof(HMAC2_t);
- ctl_size = sizeof(KASUMIF8HMAC2_t);
- break;
- case XLR_SEC_VECTOR_CIPHER_KASUMI_F8__GCM:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_KASUMI_F8__GCM\n");
- cipher_key = &ctl_desc->cipherHashInfo.infoKASUMIF8GCM.cipherKey0;
- cipher_keylen = XLR_SEC_KASUMI_F8_KEY_LENGTH;
- hmac_key = &ctl_desc->cipherHashInfo.infoKASUMIF8GCM.GCMH0;
- hmac_keylen = sizeof(GCM_t);
- ctl_size = sizeof(KASUMIF8GCM_t);
- break;
- case XLR_SEC_VECTOR_CIPHER_KASUMI_F8__F9:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_KASUMI_F8__F9\n");
- cipher_key = &ctl_desc->cipherHashInfo.infoKASUMIF8F9.cipherKey0;
- cipher_keylen = XLR_SEC_KASUMI_F8_KEY_LENGTH;
- hmac_key = &ctl_desc->cipherHashInfo.infoKASUMIF8F9.authKey0;
- hmac_keylen = sizeof(F9_t);
- ctl_size = sizeof(KASUMIF8F9_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_DES__HMAC__MODE_ECB_CBC:
- XLR_SEC_CMD_DIAG(" XLR_SEC_VECTOR__CIPHER_DES__HMAC__MODE_ECB_CBC \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoDESHMAC.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoDESHMAC.hmacKey0;
- hmac_keylen = sizeof(HMAC_t);
- cipher_keylen = XLR_SEC_DES_KEY_LENGTH;
- ctl_size = sizeof(DESHMAC_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_DES__MODE_ECB_CBC:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_DES__MODE_ECB_CBC \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoDES.cipherKey0;
- cipher_keylen = XLR_SEC_DES_KEY_LENGTH;
- ctl_size = sizeof(DES_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_3DES__HMAC__MODE_ECB_CBC:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_3DES__HMAC__MODE_ECB_CBC \n");
- cipher_key = &ctl_desc->cipherHashInfo.info3DESHMAC.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.info3DESHMAC.hmacKey0;
- cipher_keylen = XLR_SEC_3DES_KEY_LENGTH;
- hmac_keylen = sizeof(HMAC_t);
- ctl_size = sizeof(DES3HMAC_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_3DES__MODE_ECB_CBC:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_3DES__MODE_ECB_CBC \n");
- cipher_key = &ctl_desc->cipherHashInfo.info3DES.cipherKey0;
- cipher_keylen = XLR_SEC_3DES_KEY_LENGTH;
- ctl_size = sizeof(DES3_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_CTR_CFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_CTR_CFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES128HMAC.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES128HMAC.hmacKey0;
- cipher_keylen = XLR_SEC_AES128_KEY_LENGTH;
- hmac_keylen = sizeof(HMAC_t);
- ctl_size = sizeof(AES128HMAC_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__MODE_CTR_CFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__MODE_CTR_CFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES128.cipherKey0;
- cipher_keylen = XLR_SEC_AES128_KEY_LENGTH;
- ctl_size = sizeof(AES128_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_ECB_CBC_OFB:
- XLR_SEC_CMD_DIAG(" XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_ECB_CBC_OFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES128HMAC.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES128HMAC.hmacKey0;
- cipher_keylen = XLR_SEC_AES128_KEY_LENGTH;
- hmac_keylen = sizeof(HMAC_t);
- ctl_size = sizeof(AES128HMAC_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__MODE_ECB_CBC_OFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__MODE_ECB_CBC_OFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES128.cipherKey0;
- cipher_keylen = XLR_SEC_AES128_KEY_LENGTH;
- ctl_size = sizeof(AES128_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_F8:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_F8 \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES128F8HMAC.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES128F8HMAC.hmacKey0;
- cipher_keylen = XLR_SEC_AES128F8_KEY_LENGTH;
- hmac_keylen = sizeof(HMAC_t);
- ctl_size = sizeof(AES128F8HMAC_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__MODE_F8:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__MODE_F8 \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES128F8.cipherKey0;
- cipher_keylen = XLR_SEC_AES128F8_KEY_LENGTH;
- ctl_size = sizeof(AES128F8_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_CTR_CFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_CTR_CFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES192HMAC.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES192HMAC.hmacKey0;
- cipher_keylen = XLR_SEC_AES192_KEY_LENGTH;
- hmac_keylen = sizeof(HMAC_t);
- ctl_size = sizeof(AES192HMAC_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__MODE_CTR_CFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__MODE_CTR_CFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES192.cipherKey0;
- cipher_keylen = XLR_SEC_AES192_KEY_LENGTH;
- ctl_size = sizeof(AES192_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_ECB_CBC_OFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_ECB_CBC_OFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES192HMAC.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES192HMAC.hmacKey0;
- cipher_keylen = XLR_SEC_AES192_KEY_LENGTH;
- hmac_keylen = sizeof(HMAC_t);
- ctl_size = sizeof(AES192HMAC_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__MODE_ECB_CBC_OFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__MODE_ECB_CBC_OFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES192.cipherKey0;
- cipher_keylen = XLR_SEC_AES192_KEY_LENGTH;
- ctl_size = sizeof(AES192_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_F8:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_F8 \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES192F8HMAC.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES192F8HMAC.hmacKey0;
- cipher_keylen = XLR_SEC_AES192F8_KEY_LENGTH;
- hmac_keylen = sizeof(HMAC_t);
- ctl_size = sizeof(AES192F8HMAC_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__MODE_F8:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__MODE_F8 \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES192F8.cipherKey0;
- cipher_keylen = XLR_SEC_AES192F8_KEY_LENGTH;
- ctl_size = sizeof(AES192F8_t);
- break;
-
- case XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_CTR_CFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_CTR_CFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES256HMAC.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES256HMAC.hmacKey0;
- cipher_keylen = XLR_SEC_AES256_KEY_LENGTH;
- hmac_keylen = sizeof(HMAC_t);
- ctl_size = sizeof(AES256HMAC_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__MODE_CTR_CFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__MODE_CTR_CFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES256.cipherKey0;
- cipher_keylen = XLR_SEC_AES256_KEY_LENGTH;
- ctl_size = sizeof(AES256_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_ECB_CBC_OFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_ECB_CBC_OFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES256HMAC.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES256HMAC.hmacKey0;
- cipher_keylen = XLR_SEC_AES256_KEY_LENGTH;
- hmac_keylen = sizeof(HMAC_t);
- ctl_size = sizeof(AES256HMAC_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__MODE_ECB_CBC_OFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__MODE_ECB_CBC_OFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES256.cipherKey0;
- cipher_keylen = XLR_SEC_AES256_KEY_LENGTH;
- ctl_size = sizeof(AES256_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_F8:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_F8 \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES256F8HMAC.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES256F8HMAC.hmacKey0;
- cipher_keylen = XLR_SEC_AES256F8_KEY_LENGTH;
- hmac_keylen = sizeof(HMAC_t);
- ctl_size = sizeof(AES256F8HMAC_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__MODE_F8:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__MODE_F8 \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES256F8.cipherKey0;
- cipher_keylen = XLR_SEC_AES256F8_KEY_LENGTH;
- ctl_size = sizeof(AES256F8_t);
- break;
- case XLR_SEC_VECTOR_HMAC2:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_HMAC2 \n");
- hmac_key = &ctl_desc->cipherHashInfo.infoHMAC2.hmacKey0;
- hmac_keylen = sizeof(HMAC2_t);
- ctl_size = sizeof(HMAC2_t);
- break;
- case XLR_SEC_VECTOR_CIPHER_ARC4__HMAC2:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_ARC4__HMAC2\n");
- cipher_key = &ctl_desc->cipherHashInfo.infoARC4HMAC2.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoARC4HMAC2.hmacKey0;
- cipher_keylen = op->rc4_key_len;
- hmac_keylen = sizeof(HMAC2_t);
- ctl_size = sizeof(ARC4HMAC2_t);
- break;
- case XLR_SEC_VECTOR_CIPHER_ARC4__HMAC2__STATE:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_ARC4__HMAC2__STATE\n");
- cipher_key = &ctl_desc->cipherHashInfo.infoARC4StateHMAC2.cipherKey0;
- cipher_state =
- &ctl_desc->cipherHashInfo.infoARC4StateHMAC2.Arc4SboxData0;
- hmac_key = &ctl_desc->cipherHashInfo.infoARC4StateHMAC2.hmacKey0;
- cipher_keylen = op->rc4_key_len;
- hmac_keylen = sizeof(HMAC2_t);
- ctl_size = sizeof(ARC4StateHMAC2_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_DES__HMAC2__MODE_ECB_CBC:
- XLR_SEC_CMD_DIAG(" XLR_SEC_VECTOR__CIPHER_DES__HMAC2__MODE_ECB_CBC \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoDESHMAC2.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoDESHMAC2.hmacKey0;
- hmac_keylen = sizeof(HMAC2_t);
- cipher_keylen = XLR_SEC_DES_KEY_LENGTH;
- ctl_size = sizeof(DESHMAC2_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_3DES__HMAC2__MODE_ECB_CBC:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_3DES__HMAC2__MODE_ECB_CBC \n");
- cipher_key = &ctl_desc->cipherHashInfo.info3DESHMAC2.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.info3DESHMAC2.hmacKey0;
- cipher_keylen = XLR_SEC_3DES_KEY_LENGTH;
- hmac_keylen = sizeof(HMAC2_t);
- ctl_size = sizeof(DES3HMAC2_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_CTR_CFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_CTR_CFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES128HMAC2.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES128HMAC2.hmacKey0;
- cipher_keylen = XLR_SEC_AES128_KEY_LENGTH;
- hmac_keylen = sizeof(HMAC2_t);
- ctl_size = sizeof(AES128HMAC2_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_ECB_CBC_OFB:
- XLR_SEC_CMD_DIAG(" XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_ECB_CBC_OFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES128HMAC2.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES128HMAC2.hmacKey0;
- cipher_keylen = XLR_SEC_AES128_KEY_LENGTH;
- hmac_keylen = sizeof(HMAC2_t);
- ctl_size = sizeof(AES128HMAC2_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_F8:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_F8 \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES128F8HMAC2.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES128F8HMAC2.hmacKey0;
- cipher_keylen = XLR_SEC_AES128F8_KEY_LENGTH;
- hmac_keylen = sizeof(HMAC2_t);
- ctl_size = sizeof(AES128F8HMAC2_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_CTR_CFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_CTR_CFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES192HMAC2.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES192HMAC2.hmacKey0;
- cipher_keylen = XLR_SEC_AES192_KEY_LENGTH;
- hmac_keylen = sizeof(HMAC2_t);
- ctl_size = sizeof(AES192HMAC2_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_ECB_CBC_OFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_ECB_CBC_OFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES192HMAC2.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES192HMAC2.hmacKey0;
- cipher_keylen = XLR_SEC_AES192_KEY_LENGTH;
- hmac_keylen = sizeof(HMAC2_t);
- ctl_size = sizeof(AES192HMAC2_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_F8:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_F8 \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES192F8HMAC2.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES192F8HMAC2.hmacKey0;
- cipher_keylen = XLR_SEC_AES192F8_KEY_LENGTH;
- hmac_keylen = sizeof(HMAC2_t);
- ctl_size = sizeof(AES192F8HMAC2_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_CTR_CFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_CTR_CFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES256HMAC2.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES256HMAC2.hmacKey0;
- cipher_keylen = XLR_SEC_AES256_KEY_LENGTH;
- hmac_keylen = sizeof(HMAC2_t);
- ctl_size = sizeof(AES256HMAC2_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_ECB_CBC_OFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_ECB_CBC_OFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES256HMAC2.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES256HMAC2.hmacKey0;
- cipher_keylen = XLR_SEC_AES256_KEY_LENGTH;
- hmac_keylen = sizeof(HMAC2_t);
- ctl_size = sizeof(AES256HMAC2_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_F8:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_F8 \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES256F8HMAC2.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES256F8HMAC2.hmacKey0;
- cipher_keylen = XLR_SEC_AES256F8_KEY_LENGTH;
- hmac_keylen = sizeof(HMAC2_t);
- ctl_size = sizeof(AES256F8HMAC2_t);
- break;
- case XLR_SEC_VECTOR_GCM:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_GCM \n");
- hmac_key = &ctl_desc->cipherHashInfo.infoGCM.GCMH0;
- hmac_keylen = sizeof(GCM_t);
- ctl_size = sizeof(GCM_t);
- break;
- case XLR_SEC_VECTOR_CIPHER_ARC4__GCM:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_ARC4__GCM\n");
- cipher_key = &ctl_desc->cipherHashInfo.infoARC4GCM.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoARC4GCM.GCMH0;
- cipher_keylen = op->rc4_key_len;
- hmac_keylen = sizeof(GCM_t);
- ctl_size = sizeof(ARC4GCM_t);
- break;
- case XLR_SEC_VECTOR_CIPHER_ARC4__GCM__STATE:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_ARC4__GCM__STATE\n");
- cipher_key = &ctl_desc->cipherHashInfo.infoARC4StateGCM.cipherKey0;
- cipher_state =
- &ctl_desc->cipherHashInfo.infoARC4StateGCM.Arc4SboxData0;
- hmac_key = &ctl_desc->cipherHashInfo.infoARC4StateGCM.GCMH0;
- cipher_keylen = op->rc4_key_len;
- hmac_keylen = sizeof(GCM_t);
- ctl_size = sizeof(ARC4StateGCM_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_DES__GCM__MODE_ECB_CBC:
- XLR_SEC_CMD_DIAG(" XLR_SEC_VECTOR__CIPHER_DES__GCM__MODE_ECB_CBC \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoDESGCM.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoDESGCM.GCMH0;
- hmac_keylen = sizeof(GCM_t);
- cipher_keylen = XLR_SEC_DES_KEY_LENGTH;
- ctl_size = sizeof(DESGCM_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_3DES__GCM__MODE_ECB_CBC:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_3DES__GCM__MODE_ECB_CBC \n");
- cipher_key = &ctl_desc->cipherHashInfo.info3DESGCM.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.info3DESGCM.GCMH0;
- cipher_keylen = XLR_SEC_3DES_KEY_LENGTH;
- hmac_keylen = sizeof(GCM_t);
- ctl_size = sizeof(DES3GCM_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_CTR_CFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_CTR_CFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES128GCM.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES128GCM.GCMH0;
- cipher_keylen = XLR_SEC_AES128_KEY_LENGTH;
- hmac_keylen = sizeof(GCM_t);
- ctl_size = sizeof(AES128GCM_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_ECB_CBC_OFB:
- XLR_SEC_CMD_DIAG(" XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_ECB_CBC_OFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES128GCM.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES128GCM.GCMH0;
- cipher_keylen = XLR_SEC_AES128_KEY_LENGTH;
- hmac_keylen = sizeof(GCM_t);
- ctl_size = sizeof(AES128GCM_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_F8:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_F8 \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES128F8GCM.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES128F8GCM.GCMH0;
- cipher_keylen = XLR_SEC_AES128F8_KEY_LENGTH;
- hmac_keylen = sizeof(GCM_t);
- ctl_size = sizeof(AES128F8GCM_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_CTR_CFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_CTR_CFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES192GCM.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES192GCM.GCMH0;
- cipher_keylen = XLR_SEC_AES192_KEY_LENGTH;
- hmac_keylen = sizeof(GCM_t);
- ctl_size = sizeof(AES192GCM_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_ECB_CBC_OFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_ECB_CBC_OFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES192GCM.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES192GCM.GCMH0;
- cipher_keylen = XLR_SEC_AES192_KEY_LENGTH;
- hmac_keylen = sizeof(GCM_t);
- ctl_size = sizeof(AES192GCM_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_F8:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_F8 \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES192F8GCM.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES192F8GCM.GCMH0;
- cipher_keylen = XLR_SEC_AES192F8_KEY_LENGTH;
- hmac_keylen = sizeof(GCM_t);
- ctl_size = sizeof(AES192F8GCM_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_CTR_CFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_CTR_CFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES256GCM.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES256GCM.GCMH0;
- cipher_keylen = XLR_SEC_AES256_KEY_LENGTH;
- hmac_keylen = sizeof(GCM_t);
- ctl_size = sizeof(AES256GCM_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_ECB_CBC_OFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_ECB_CBC_OFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES256GCM.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES256GCM.GCMH0;
- cipher_keylen = XLR_SEC_AES256_KEY_LENGTH;
- hmac_keylen = sizeof(GCM_t);
- ctl_size = sizeof(AES256GCM_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_F8:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_F8 \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES256F8GCM.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES256F8GCM.GCMH0;
- cipher_keylen = XLR_SEC_AES256F8_KEY_LENGTH;
- hmac_keylen = sizeof(GCM_t);
- ctl_size = sizeof(AES256F8GCM_t);
- break;
- case XLR_SEC_VECTOR_F9:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_F9 \n");
- hmac_key = &ctl_desc->cipherHashInfo.infoF9.authKey0;
- hmac_keylen = sizeof(F9_t);
- ctl_size = sizeof(F9_t);
- break;
- case XLR_SEC_VECTOR_CIPHER_ARC4__F9:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_ARC4__F9\n");
- cipher_key = &ctl_desc->cipherHashInfo.infoARC4F9.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoARC4F9.authKey0;
- cipher_keylen = op->rc4_key_len;
- hmac_keylen = sizeof(F9_t);
- ctl_size = sizeof(ARC4F9_t);
- break;
- case XLR_SEC_VECTOR_CIPHER_ARC4__F9__STATE:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_ARC4__F9__STATE\n");
- cipher_key = &ctl_desc->cipherHashInfo.infoARC4StateF9.cipherKey0;
- cipher_state =
- &ctl_desc->cipherHashInfo.infoARC4StateF9.Arc4SboxData0;
- hmac_key = &ctl_desc->cipherHashInfo.infoARC4StateF9.authKey0;
- cipher_keylen = op->rc4_key_len;
- hmac_keylen = sizeof(F9_t);
- ctl_size = sizeof(ARC4StateF9_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_DES__F9__MODE_ECB_CBC:
- XLR_SEC_CMD_DIAG(" XLR_SEC_VECTOR__CIPHER_DES__F9__MODE_ECB_CBC \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoDESF9.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoDESF9.authKey0;
- hmac_keylen = sizeof(F9_t);
- cipher_keylen = XLR_SEC_DES_KEY_LENGTH;
- ctl_size = sizeof(DESF9_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_3DES__F9__MODE_ECB_CBC:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_3DES__F9__MODE_ECB_CBC \n");
- cipher_key = &ctl_desc->cipherHashInfo.info3DESF9.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.info3DESF9.authKey0;
- cipher_keylen = XLR_SEC_3DES_KEY_LENGTH;
- hmac_keylen = sizeof(F9_t);
- ctl_size = sizeof(DES3F9_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_CTR_CFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_CTR_CFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES128F9.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES128F9.authKey0;
- cipher_keylen = XLR_SEC_AES128_KEY_LENGTH;
- hmac_keylen = sizeof(F9_t);
- ctl_size = sizeof(AES128F9_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_ECB_CBC_OFB:
- XLR_SEC_CMD_DIAG(" XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_ECB_CBC_OFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES128F9.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES128F9.authKey0;
- cipher_keylen = XLR_SEC_AES128_KEY_LENGTH;
- hmac_keylen = sizeof(F9_t);
- ctl_size = sizeof(AES128F9_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_F8:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_F8 \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES128F8F9.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES128F8F9.authKey0;
- cipher_keylen = XLR_SEC_AES128F8_KEY_LENGTH;
- hmac_keylen = sizeof(F9_t);
- ctl_size = sizeof(AES128F8F9_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_CTR_CFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_CTR_CFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES192F9.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES192F9.authKey0;
- cipher_keylen = XLR_SEC_AES192_KEY_LENGTH;
- hmac_keylen = sizeof(F9_t);
- ctl_size = sizeof(AES192F9_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_ECB_CBC_OFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_ECB_CBC_OFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES192F9.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES192F9.authKey0;
- cipher_keylen = XLR_SEC_AES192_KEY_LENGTH;
- hmac_keylen = sizeof(F9_t);
- ctl_size = sizeof(AES192F9_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_F8:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_F8 \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES192F8F9.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES192F8F9.authKey0;
- cipher_keylen = XLR_SEC_AES192F8_KEY_LENGTH;
- hmac_keylen = sizeof(F9_t);
- ctl_size = sizeof(AES192F8F9_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_CTR_CFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_CTR_CFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES256F9.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES256F9.authKey0;
- cipher_keylen = XLR_SEC_AES256_KEY_LENGTH;
- hmac_keylen = sizeof(F9_t);
- ctl_size = sizeof(AES256F9_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_ECB_CBC_OFB:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_ECB_CBC_OFB \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES256F9.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES256F9.authKey0;
- cipher_keylen = XLR_SEC_AES256_KEY_LENGTH;
- hmac_keylen = sizeof(F9_t);
- ctl_size = sizeof(AES256F9_t);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_F8:
- XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_F8 \n");
- cipher_key = &ctl_desc->cipherHashInfo.infoAES256F8F9.cipherKey0;
- hmac_key = &ctl_desc->cipherHashInfo.infoAES256F8F9.authKey0;
- cipher_keylen = XLR_SEC_AES256F8_KEY_LENGTH;
- hmac_keylen = sizeof(F9_t);
- ctl_size = sizeof(AES256F8F9_t);
- break;
-
- default:
- XLR_SEC_CMD_DIAG("default \n");
- return XLR_SEC_ERR_CONTROL_VECTOR;
- }
-
- if ((cipher_key != NULL) && !(flags & XLR_SEC_SETUP_OP_PRESERVE_CIPHER_KEY))
- memcpy(cipher_key, &op->crypt_key[0], cipher_keylen);
-
- if ((hmac_key != NULL) && !(flags & XLR_SEC_SETUP_OP_PRESERVE_HMAC_KEY))
- memcpy(hmac_key, &op->mac_key[0], hmac_keylen);
- if (cipher_state) {
- if (op->rc4_loadstate)
- memcpy(cipher_state, (void *)(unsigned long)op->rc4_state,
- XLR_SEC_MAX_RC4_STATE_SIZE);
- if (op->rc4_savestate)
- user->aligned_state = (char *)cipher_state;
- }
-
- if (flags & XLR_SEC_SETUP_OP_FLIP_3DES_KEY) {
- uint64_t temp;
-
- temp = ctl_desc->cipherHashInfo.info3DES.cipherKey0;
- ctl_desc->cipherHashInfo.info3DES.cipherKey0 =
- ctl_desc->cipherHashInfo.info3DES.cipherKey2;
- ctl_desc->cipherHashInfo.info3DES.cipherKey2 = temp;
- }
-
- /*
- * Control length is the number of control cachelines to be read so
- * user needs to round up the control length to closest integer
- * multiple of 32 bytes.
- */
- ctl_size += sizeof(ctl_desc->instruction);
- ctl_len = NUM_CHUNKS(ctl_size, 5);
- XLR_SEC_CMD_DIAG("ctl_size in bytes: %u, in cachelines: %u\n", ctl_size, ctl_len);
- CLEAR_SET_FIELD(*control, MSG_CMD_CTL_LEN, ctl_len);
-
- ctl_addr = (uint64_t)vtophys(ctl_desc);
- CLEAR_SET_FIELD(*control, MSG_CMD_CTL_ADDR, ctl_addr);
-
- XLR_SEC_CMD_DIAG(" xlr_sec_control_setup(): ctl_desc=%p ctl_addr=%llx \n",
- ctl_desc, (unsigned long long)ctl_addr);
-
- CLEAR_SET_FIELD(*control, MSG_CMD_CTL_CTL, SEC_SOP);
-
- return XLR_SEC_ERR_NONE;
-}
-
+ switch (vector) {
+ case XLR_SEC_VECTOR_MAC:
+ XLR_SEC_CMD_DIAG(" XLR_SEC_VECTOR_MAC \n");
+ ctl_size = sizeof(HMAC_t);
+ break;
+ case XLR_SEC_VECTOR_HMAC:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_HMAC \n");
+ hmac_key = &ctl_desc->cipherHashInfo.infoHMAC.hmacKey0;
+ hmac_keylen = sizeof(HMAC_t);
+ ctl_size = sizeof(HMAC_t);
+ break;
+ case XLR_SEC_VECTOR_CIPHER_ARC4:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_ARC4\n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoARC4.cipherKey0;
+ cipher_keylen = op->rc4_key_len;
+ ctl_size = sizeof(ARC4_t);
+ break;
+ case XLR_SEC_VECTOR_CIPHER_ARC4__HMAC:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_ARC4__HMAC\n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoARC4HMAC.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoARC4HMAC.hmacKey0;
+ cipher_keylen = op->rc4_key_len;
+ hmac_keylen = sizeof(HMAC_t);
+ ctl_size = sizeof(ARC4HMAC_t);
+ break;
+ case XLR_SEC_VECTOR_CIPHER_ARC4__STATE:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_ARC4__STATE\n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoARC4State.cipherKey0;
+ cipher_state =
+ &ctl_desc->cipherHashInfo.infoARC4State.Arc4SboxData0;
+ cipher_keylen = op->rc4_key_len;
+ ctl_size = sizeof(ARC4State_t);
+ break;
+ case XLR_SEC_VECTOR_CIPHER_ARC4__HMAC__STATE:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_ARC4__HMAC__STATE\n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoARC4StateHMAC.cipherKey0;
+ cipher_state =
+ &ctl_desc->cipherHashInfo.infoARC4StateHMAC.Arc4SboxData0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoARC4StateHMAC.hmacKey0;
+ cipher_keylen = op->rc4_key_len;
+ hmac_keylen = sizeof(HMAC_t);
+ ctl_size = sizeof(ARC4StateHMAC_t);
+ break;
+ case XLR_SEC_VECTOR_CIPHER_KASUMI_F8:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_KASUMI_F8\n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoKASUMIF8.cipherKey0;
+ cipher_keylen = XLR_SEC_KASUMI_F8_KEY_LENGTH;
+ ctl_size = sizeof(KASUMIF8_t);
+ break;
+ case XLR_SEC_VECTOR_CIPHER_KASUMI_F8__HMAC:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_KASUMI_F8__HMAC\n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoKASUMIF8HMAC.cipherKey0;
+ cipher_keylen = XLR_SEC_KASUMI_F8_KEY_LENGTH;
+ hmac_key = &ctl_desc->cipherHashInfo.infoKASUMIF8HMAC.hmacKey0;
+ hmac_keylen = sizeof(HMAC_t);
+ ctl_size = sizeof(KASUMIF8HMAC_t);
+ break;
+ case XLR_SEC_VECTOR_CIPHER_KASUMI_F8__HMAC2:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_KASUMI_F8__HMAC2\n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoKASUMIF8HMAC2.cipherKey0;
+ cipher_keylen = XLR_SEC_KASUMI_F8_KEY_LENGTH;
+ hmac_key = &ctl_desc->cipherHashInfo.infoKASUMIF8HMAC2.hmacKey0;
+ hmac_keylen = sizeof(HMAC2_t);
+ ctl_size = sizeof(KASUMIF8HMAC2_t);
+ break;
+ case XLR_SEC_VECTOR_CIPHER_KASUMI_F8__GCM:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_KASUMI_F8__GCM\n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoKASUMIF8GCM.cipherKey0;
+ cipher_keylen = XLR_SEC_KASUMI_F8_KEY_LENGTH;
+ hmac_key = &ctl_desc->cipherHashInfo.infoKASUMIF8GCM.GCMH0;
+ hmac_keylen = sizeof(GCM_t);
+ ctl_size = sizeof(KASUMIF8GCM_t);
+ break;
+ case XLR_SEC_VECTOR_CIPHER_KASUMI_F8__F9:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_KASUMI_F8__F9\n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoKASUMIF8F9.cipherKey0;
+ cipher_keylen = XLR_SEC_KASUMI_F8_KEY_LENGTH;
+ hmac_key = &ctl_desc->cipherHashInfo.infoKASUMIF8F9.authKey0;
+ hmac_keylen = sizeof(F9_t);
+ ctl_size = sizeof(KASUMIF8F9_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_DES__HMAC__MODE_ECB_CBC:
+ XLR_SEC_CMD_DIAG(" XLR_SEC_VECTOR__CIPHER_DES__HMAC__MODE_ECB_CBC \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoDESHMAC.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoDESHMAC.hmacKey0;
+ hmac_keylen = sizeof(HMAC_t);
+ cipher_keylen = XLR_SEC_DES_KEY_LENGTH;
+ ctl_size = sizeof(DESHMAC_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_DES__MODE_ECB_CBC:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_DES__MODE_ECB_CBC \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoDES.cipherKey0;
+ cipher_keylen = XLR_SEC_DES_KEY_LENGTH;
+ ctl_size = sizeof(DES_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_3DES__HMAC__MODE_ECB_CBC:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_3DES__HMAC__MODE_ECB_CBC \n");
+ cipher_key = &ctl_desc->cipherHashInfo.info3DESHMAC.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.info3DESHMAC.hmacKey0;
+ cipher_keylen = XLR_SEC_3DES_KEY_LENGTH;
+ hmac_keylen = sizeof(HMAC_t);
+ ctl_size = sizeof(DES3HMAC_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_3DES__MODE_ECB_CBC:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_3DES__MODE_ECB_CBC \n");
+ cipher_key = &ctl_desc->cipherHashInfo.info3DES.cipherKey0;
+ cipher_keylen = XLR_SEC_3DES_KEY_LENGTH;
+ ctl_size = sizeof(DES3_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_CTR_CFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_CTR_CFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES128HMAC.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES128HMAC.hmacKey0;
+ cipher_keylen = XLR_SEC_AES128_KEY_LENGTH;
+ hmac_keylen = sizeof(HMAC_t);
+ ctl_size = sizeof(AES128HMAC_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__MODE_CTR_CFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__MODE_CTR_CFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES128.cipherKey0;
+ cipher_keylen = XLR_SEC_AES128_KEY_LENGTH;
+ ctl_size = sizeof(AES128_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_ECB_CBC_OFB:
+ XLR_SEC_CMD_DIAG(" XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_ECB_CBC_OFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES128HMAC.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES128HMAC.hmacKey0;
+ cipher_keylen = XLR_SEC_AES128_KEY_LENGTH;
+ hmac_keylen = sizeof(HMAC_t);
+ ctl_size = sizeof(AES128HMAC_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__MODE_ECB_CBC_OFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__MODE_ECB_CBC_OFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES128.cipherKey0;
+ cipher_keylen = XLR_SEC_AES128_KEY_LENGTH;
+ ctl_size = sizeof(AES128_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_F8:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_F8 \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES128F8HMAC.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES128F8HMAC.hmacKey0;
+ cipher_keylen = XLR_SEC_AES128F8_KEY_LENGTH;
+ hmac_keylen = sizeof(HMAC_t);
+ ctl_size = sizeof(AES128F8HMAC_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__MODE_F8:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__MODE_F8 \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES128F8.cipherKey0;
+ cipher_keylen = XLR_SEC_AES128F8_KEY_LENGTH;
+ ctl_size = sizeof(AES128F8_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_CTR_CFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_CTR_CFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES192HMAC.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES192HMAC.hmacKey0;
+ cipher_keylen = XLR_SEC_AES192_KEY_LENGTH;
+ hmac_keylen = sizeof(HMAC_t);
+ ctl_size = sizeof(AES192HMAC_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__MODE_CTR_CFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__MODE_CTR_CFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES192.cipherKey0;
+ cipher_keylen = XLR_SEC_AES192_KEY_LENGTH;
+ ctl_size = sizeof(AES192_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_ECB_CBC_OFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_ECB_CBC_OFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES192HMAC.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES192HMAC.hmacKey0;
+ cipher_keylen = XLR_SEC_AES192_KEY_LENGTH;
+ hmac_keylen = sizeof(HMAC_t);
+ ctl_size = sizeof(AES192HMAC_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__MODE_ECB_CBC_OFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__MODE_ECB_CBC_OFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES192.cipherKey0;
+ cipher_keylen = XLR_SEC_AES192_KEY_LENGTH;
+ ctl_size = sizeof(AES192_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_F8:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_F8 \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES192F8HMAC.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES192F8HMAC.hmacKey0;
+ cipher_keylen = XLR_SEC_AES192F8_KEY_LENGTH;
+ hmac_keylen = sizeof(HMAC_t);
+ ctl_size = sizeof(AES192F8HMAC_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__MODE_F8:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__MODE_F8 \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES192F8.cipherKey0;
+ cipher_keylen = XLR_SEC_AES192F8_KEY_LENGTH;
+ ctl_size = sizeof(AES192F8_t);
+ break;
+
+ case XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_CTR_CFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_CTR_CFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES256HMAC.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES256HMAC.hmacKey0;
+ cipher_keylen = XLR_SEC_AES256_KEY_LENGTH;
+ hmac_keylen = sizeof(HMAC_t);
+ ctl_size = sizeof(AES256HMAC_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__MODE_CTR_CFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__MODE_CTR_CFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES256.cipherKey0;
+ cipher_keylen = XLR_SEC_AES256_KEY_LENGTH;
+ ctl_size = sizeof(AES256_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_ECB_CBC_OFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_ECB_CBC_OFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES256HMAC.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES256HMAC.hmacKey0;
+ cipher_keylen = XLR_SEC_AES256_KEY_LENGTH;
+ hmac_keylen = sizeof(HMAC_t);
+ ctl_size = sizeof(AES256HMAC_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__MODE_ECB_CBC_OFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__MODE_ECB_CBC_OFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES256.cipherKey0;
+ cipher_keylen = XLR_SEC_AES256_KEY_LENGTH;
+ ctl_size = sizeof(AES256_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_F8:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_F8 \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES256F8HMAC.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES256F8HMAC.hmacKey0;
+ cipher_keylen = XLR_SEC_AES256F8_KEY_LENGTH;
+ hmac_keylen = sizeof(HMAC_t);
+ ctl_size = sizeof(AES256F8HMAC_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__MODE_F8:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__MODE_F8 \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES256F8.cipherKey0;
+ cipher_keylen = XLR_SEC_AES256F8_KEY_LENGTH;
+ ctl_size = sizeof(AES256F8_t);
+ break;
+ case XLR_SEC_VECTOR_HMAC2:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_HMAC2 \n");
+ hmac_key = &ctl_desc->cipherHashInfo.infoHMAC2.hmacKey0;
+ hmac_keylen = sizeof(HMAC2_t);
+ ctl_size = sizeof(HMAC2_t);
+ break;
+ case XLR_SEC_VECTOR_CIPHER_ARC4__HMAC2:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_ARC4__HMAC2\n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoARC4HMAC2.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoARC4HMAC2.hmacKey0;
+ cipher_keylen = op->rc4_key_len;
+ hmac_keylen = sizeof(HMAC2_t);
+ ctl_size = sizeof(ARC4HMAC2_t);
+ break;
+ case XLR_SEC_VECTOR_CIPHER_ARC4__HMAC2__STATE:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_ARC4__HMAC2__STATE\n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoARC4StateHMAC2.cipherKey0;
+ cipher_state =
+ &ctl_desc->cipherHashInfo.infoARC4StateHMAC2.Arc4SboxData0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoARC4StateHMAC2.hmacKey0;
+ cipher_keylen = op->rc4_key_len;
+ hmac_keylen = sizeof(HMAC2_t);
+ ctl_size = sizeof(ARC4StateHMAC2_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_DES__HMAC2__MODE_ECB_CBC:
+ XLR_SEC_CMD_DIAG(" XLR_SEC_VECTOR__CIPHER_DES__HMAC2__MODE_ECB_CBC \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoDESHMAC2.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoDESHMAC2.hmacKey0;
+ hmac_keylen = sizeof(HMAC2_t);
+ cipher_keylen = XLR_SEC_DES_KEY_LENGTH;
+ ctl_size = sizeof(DESHMAC2_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_3DES__HMAC2__MODE_ECB_CBC:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_3DES__HMAC2__MODE_ECB_CBC \n");
+ cipher_key = &ctl_desc->cipherHashInfo.info3DESHMAC2.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.info3DESHMAC2.hmacKey0;
+ cipher_keylen = XLR_SEC_3DES_KEY_LENGTH;
+ hmac_keylen = sizeof(HMAC2_t);
+ ctl_size = sizeof(DES3HMAC2_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_CTR_CFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_CTR_CFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES128HMAC2.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES128HMAC2.hmacKey0;
+ cipher_keylen = XLR_SEC_AES128_KEY_LENGTH;
+ hmac_keylen = sizeof(HMAC2_t);
+ ctl_size = sizeof(AES128HMAC2_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_ECB_CBC_OFB:
+ XLR_SEC_CMD_DIAG(" XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_ECB_CBC_OFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES128HMAC2.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES128HMAC2.hmacKey0;
+ cipher_keylen = XLR_SEC_AES128_KEY_LENGTH;
+ hmac_keylen = sizeof(HMAC2_t);
+ ctl_size = sizeof(AES128HMAC2_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_F8:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_F8 \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES128F8HMAC2.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES128F8HMAC2.hmacKey0;
+ cipher_keylen = XLR_SEC_AES128F8_KEY_LENGTH;
+ hmac_keylen = sizeof(HMAC2_t);
+ ctl_size = sizeof(AES128F8HMAC2_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_CTR_CFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_CTR_CFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES192HMAC2.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES192HMAC2.hmacKey0;
+ cipher_keylen = XLR_SEC_AES192_KEY_LENGTH;
+ hmac_keylen = sizeof(HMAC2_t);
+ ctl_size = sizeof(AES192HMAC2_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_ECB_CBC_OFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_ECB_CBC_OFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES192HMAC2.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES192HMAC2.hmacKey0;
+ cipher_keylen = XLR_SEC_AES192_KEY_LENGTH;
+ hmac_keylen = sizeof(HMAC2_t);
+ ctl_size = sizeof(AES192HMAC2_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_F8:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_F8 \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES192F8HMAC2.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES192F8HMAC2.hmacKey0;
+ cipher_keylen = XLR_SEC_AES192F8_KEY_LENGTH;
+ hmac_keylen = sizeof(HMAC2_t);
+ ctl_size = sizeof(AES192F8HMAC2_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_CTR_CFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_CTR_CFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES256HMAC2.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES256HMAC2.hmacKey0;
+ cipher_keylen = XLR_SEC_AES256_KEY_LENGTH;
+ hmac_keylen = sizeof(HMAC2_t);
+ ctl_size = sizeof(AES256HMAC2_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_ECB_CBC_OFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_ECB_CBC_OFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES256HMAC2.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES256HMAC2.hmacKey0;
+ cipher_keylen = XLR_SEC_AES256_KEY_LENGTH;
+ hmac_keylen = sizeof(HMAC2_t);
+ ctl_size = sizeof(AES256HMAC2_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_F8:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_F8 \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES256F8HMAC2.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES256F8HMAC2.hmacKey0;
+ cipher_keylen = XLR_SEC_AES256F8_KEY_LENGTH;
+ hmac_keylen = sizeof(HMAC2_t);
+ ctl_size = sizeof(AES256F8HMAC2_t);
+ break;
+ case XLR_SEC_VECTOR_GCM:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_GCM \n");
+ hmac_key = &ctl_desc->cipherHashInfo.infoGCM.GCMH0;
+ hmac_keylen = sizeof(GCM_t);
+ ctl_size = sizeof(GCM_t);
+ break;
+ case XLR_SEC_VECTOR_CIPHER_ARC4__GCM:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_ARC4__GCM\n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoARC4GCM.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoARC4GCM.GCMH0;
+ cipher_keylen = op->rc4_key_len;
+ hmac_keylen = sizeof(GCM_t);
+ ctl_size = sizeof(ARC4GCM_t);
+ break;
+ case XLR_SEC_VECTOR_CIPHER_ARC4__GCM__STATE:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_ARC4__GCM__STATE\n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoARC4StateGCM.cipherKey0;
+ cipher_state =
+ &ctl_desc->cipherHashInfo.infoARC4StateGCM.Arc4SboxData0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoARC4StateGCM.GCMH0;
+ cipher_keylen = op->rc4_key_len;
+ hmac_keylen = sizeof(GCM_t);
+ ctl_size = sizeof(ARC4StateGCM_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_DES__GCM__MODE_ECB_CBC:
+ XLR_SEC_CMD_DIAG(" XLR_SEC_VECTOR__CIPHER_DES__GCM__MODE_ECB_CBC \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoDESGCM.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoDESGCM.GCMH0;
+ hmac_keylen = sizeof(GCM_t);
+ cipher_keylen = XLR_SEC_DES_KEY_LENGTH;
+ ctl_size = sizeof(DESGCM_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_3DES__GCM__MODE_ECB_CBC:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_3DES__GCM__MODE_ECB_CBC \n");
+ cipher_key = &ctl_desc->cipherHashInfo.info3DESGCM.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.info3DESGCM.GCMH0;
+ cipher_keylen = XLR_SEC_3DES_KEY_LENGTH;
+ hmac_keylen = sizeof(GCM_t);
+ ctl_size = sizeof(DES3GCM_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_CTR_CFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_CTR_CFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES128GCM.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES128GCM.GCMH0;
+ cipher_keylen = XLR_SEC_AES128_KEY_LENGTH;
+ hmac_keylen = sizeof(GCM_t);
+ ctl_size = sizeof(AES128GCM_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_ECB_CBC_OFB:
+ XLR_SEC_CMD_DIAG(" XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_ECB_CBC_OFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES128GCM.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES128GCM.GCMH0;
+ cipher_keylen = XLR_SEC_AES128_KEY_LENGTH;
+ hmac_keylen = sizeof(GCM_t);
+ ctl_size = sizeof(AES128GCM_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_F8:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_F8 \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES128F8GCM.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES128F8GCM.GCMH0;
+ cipher_keylen = XLR_SEC_AES128F8_KEY_LENGTH;
+ hmac_keylen = sizeof(GCM_t);
+ ctl_size = sizeof(AES128F8GCM_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_CTR_CFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_CTR_CFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES192GCM.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES192GCM.GCMH0;
+ cipher_keylen = XLR_SEC_AES192_KEY_LENGTH;
+ hmac_keylen = sizeof(GCM_t);
+ ctl_size = sizeof(AES192GCM_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_ECB_CBC_OFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_ECB_CBC_OFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES192GCM.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES192GCM.GCMH0;
+ cipher_keylen = XLR_SEC_AES192_KEY_LENGTH;
+ hmac_keylen = sizeof(GCM_t);
+ ctl_size = sizeof(AES192GCM_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_F8:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_F8 \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES192F8GCM.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES192F8GCM.GCMH0;
+ cipher_keylen = XLR_SEC_AES192F8_KEY_LENGTH;
+ hmac_keylen = sizeof(GCM_t);
+ ctl_size = sizeof(AES192F8GCM_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_CTR_CFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_CTR_CFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES256GCM.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES256GCM.GCMH0;
+ cipher_keylen = XLR_SEC_AES256_KEY_LENGTH;
+ hmac_keylen = sizeof(GCM_t);
+ ctl_size = sizeof(AES256GCM_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_ECB_CBC_OFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_ECB_CBC_OFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES256GCM.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES256GCM.GCMH0;
+ cipher_keylen = XLR_SEC_AES256_KEY_LENGTH;
+ hmac_keylen = sizeof(GCM_t);
+ ctl_size = sizeof(AES256GCM_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_F8:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_F8 \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES256F8GCM.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES256F8GCM.GCMH0;
+ cipher_keylen = XLR_SEC_AES256F8_KEY_LENGTH;
+ hmac_keylen = sizeof(GCM_t);
+ ctl_size = sizeof(AES256F8GCM_t);
+ break;
+ case XLR_SEC_VECTOR_F9:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_F9 \n");
+ hmac_key = &ctl_desc->cipherHashInfo.infoF9.authKey0;
+ hmac_keylen = sizeof(F9_t);
+ ctl_size = sizeof(F9_t);
+ break;
+ case XLR_SEC_VECTOR_CIPHER_ARC4__F9:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_ARC4__F9\n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoARC4F9.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoARC4F9.authKey0;
+ cipher_keylen = op->rc4_key_len;
+ hmac_keylen = sizeof(F9_t);
+ ctl_size = sizeof(ARC4F9_t);
+ break;
+ case XLR_SEC_VECTOR_CIPHER_ARC4__F9__STATE:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR_CIPHER_ARC4__F9__STATE\n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoARC4StateF9.cipherKey0;
+ cipher_state =
+ &ctl_desc->cipherHashInfo.infoARC4StateF9.Arc4SboxData0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoARC4StateF9.authKey0;
+ cipher_keylen = op->rc4_key_len;
+ hmac_keylen = sizeof(F9_t);
+ ctl_size = sizeof(ARC4StateF9_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_DES__F9__MODE_ECB_CBC:
+ XLR_SEC_CMD_DIAG(" XLR_SEC_VECTOR__CIPHER_DES__F9__MODE_ECB_CBC \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoDESF9.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoDESF9.authKey0;
+ hmac_keylen = sizeof(F9_t);
+ cipher_keylen = XLR_SEC_DES_KEY_LENGTH;
+ ctl_size = sizeof(DESF9_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_3DES__F9__MODE_ECB_CBC:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_3DES__F9__MODE_ECB_CBC \n");
+ cipher_key = &ctl_desc->cipherHashInfo.info3DESF9.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.info3DESF9.authKey0;
+ cipher_keylen = XLR_SEC_3DES_KEY_LENGTH;
+ hmac_keylen = sizeof(F9_t);
+ ctl_size = sizeof(DES3F9_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_CTR_CFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_CTR_CFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES128F9.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES128F9.authKey0;
+ cipher_keylen = XLR_SEC_AES128_KEY_LENGTH;
+ hmac_keylen = sizeof(F9_t);
+ ctl_size = sizeof(AES128F9_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_ECB_CBC_OFB:
+ XLR_SEC_CMD_DIAG(" XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_ECB_CBC_OFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES128F9.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES128F9.authKey0;
+ cipher_keylen = XLR_SEC_AES128_KEY_LENGTH;
+ hmac_keylen = sizeof(F9_t);
+ ctl_size = sizeof(AES128F9_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_F8:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_F8 \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES128F8F9.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES128F8F9.authKey0;
+ cipher_keylen = XLR_SEC_AES128F8_KEY_LENGTH;
+ hmac_keylen = sizeof(F9_t);
+ ctl_size = sizeof(AES128F8F9_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_CTR_CFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_CTR_CFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES192F9.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES192F9.authKey0;
+ cipher_keylen = XLR_SEC_AES192_KEY_LENGTH;
+ hmac_keylen = sizeof(F9_t);
+ ctl_size = sizeof(AES192F9_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_ECB_CBC_OFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_ECB_CBC_OFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES192F9.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES192F9.authKey0;
+ cipher_keylen = XLR_SEC_AES192_KEY_LENGTH;
+ hmac_keylen = sizeof(F9_t);
+ ctl_size = sizeof(AES192F9_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_F8:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_F8 \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES192F8F9.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES192F8F9.authKey0;
+ cipher_keylen = XLR_SEC_AES192F8_KEY_LENGTH;
+ hmac_keylen = sizeof(F9_t);
+ ctl_size = sizeof(AES192F8F9_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_CTR_CFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_CTR_CFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES256F9.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES256F9.authKey0;
+ cipher_keylen = XLR_SEC_AES256_KEY_LENGTH;
+ hmac_keylen = sizeof(F9_t);
+ ctl_size = sizeof(AES256F9_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_ECB_CBC_OFB:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_ECB_CBC_OFB \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES256F9.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES256F9.authKey0;
+ cipher_keylen = XLR_SEC_AES256_KEY_LENGTH;
+ hmac_keylen = sizeof(F9_t);
+ ctl_size = sizeof(AES256F9_t);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_F8:
+ XLR_SEC_CMD_DIAG("XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_F8 \n");
+ cipher_key = &ctl_desc->cipherHashInfo.infoAES256F8F9.cipherKey0;
+ hmac_key = &ctl_desc->cipherHashInfo.infoAES256F8F9.authKey0;
+ cipher_keylen = XLR_SEC_AES256F8_KEY_LENGTH;
+ hmac_keylen = sizeof(F9_t);
+ ctl_size = sizeof(AES256F8F9_t);
+ break;
+
+ default:
+ XLR_SEC_CMD_DIAG("default \n");
+ return XLR_SEC_ERR_CONTROL_VECTOR;
+ }
-xlr_sec_error_t
-xlr_sec_submit_op(symkey_desc_pt desc)
-{
- struct msgrng_msg send_msg;
+ if ((cipher_key != NULL) && !(flags & XLR_SEC_SETUP_OP_PRESERVE_CIPHER_KEY))
+ memcpy(cipher_key, &op->crypt_key[0], cipher_keylen);
- int rsp_dest_id, cpu, hard_cpu, hard_thread;
- int code, retries;
- unsigned long msgrng_flags = 0;
+ if ((hmac_key != NULL) && !(flags & XLR_SEC_SETUP_OP_PRESERVE_HMAC_KEY))
+ memcpy(hmac_key, &op->mac_key[0], hmac_keylen);
+ if (cipher_state) {
+ if (op->rc4_loadstate)
+ memcpy(cipher_state, (void *)(unsigned long)op->rc4_state,
+ XLR_SEC_MAX_RC4_STATE_SIZE);
+ if (op->rc4_savestate)
+ user->aligned_state = (char *)cipher_state;
+ }
+ if (flags & XLR_SEC_SETUP_OP_FLIP_3DES_KEY) {
+ uint64_t temp;
- /* threads (0-3) are orthogonal to buckets 0-3 */
- cpu = xlr_cpu_id();
+ temp = ctl_desc->cipherHashInfo.info3DES.cipherKey0;
+ ctl_desc->cipherHashInfo.info3DES.cipherKey0 =
+ ctl_desc->cipherHashInfo.info3DES.cipherKey2;
+ ctl_desc->cipherHashInfo.info3DES.cipherKey2 = temp;
+ }
+ /*
+ * Control length is the number of control cachelines to be read so
+ * user needs to round up the control length to closest integer
+ * multiple of 32 bytes.
+ */
+ ctl_size += sizeof(ctl_desc->instruction);
+ ctl_len = NUM_CHUNKS(ctl_size, 5);
+ XLR_SEC_CMD_DIAG("ctl_size in bytes: %u, in cachelines: %u\n", ctl_size, ctl_len);
+ CLEAR_SET_FIELD(*control, MSG_CMD_CTL_LEN, ctl_len);
- hard_cpu = cpu >> 2;
- hard_thread = cpu & 0x3; /* thread id */
- rsp_dest_id = (hard_cpu << 3) + hard_thread;
+ ctl_addr = (uint64_t) vtophys(ctl_desc);
+ CLEAR_SET_FIELD(*control, MSG_CMD_CTL_ADDR, ctl_addr);
- desc->op_ctl.cpu = hard_cpu;
- desc->op_ctl.flags = 0; /* called from kernel thread */
+ XLR_SEC_CMD_DIAG(" xlr_sec_control_setup(): ctl_desc=%p ctl_addr=%llx \n",
+ ctl_desc, (unsigned long long)ctl_addr);
- XLR_SEC_CMD_DIAG("[%s]:%d: cpu=0x%x hard_cpu=0x%x hard_thrd=0x%x id=0x%x \n",
- __FUNCTION__, __LINE__, cpu, hard_cpu, hard_thread, rsp_dest_id);
+ CLEAR_SET_FIELD(*control, MSG_CMD_CTL_CTL, SEC_SOP);
- /*
- * Set DestId in Message Control Word.
- * This tells the Security Engine which bucket to send the
- * reply to for this CPU
- */
- CLEAR_SET_FIELD(desc->control, MSG_CMD_CTL_ID, rsp_dest_id);
- CLEAR_SET_FIELD(desc->data, MSG_CMD_CTL_ID, rsp_dest_id);
+ return XLR_SEC_ERR_NONE;
+}
- CLEAR_SET_FIELD(desc->control, MSG_CTL_OP_TYPE, MSG0_CTL_OP_ENGINE_SYMKEY);
- CLEAR_SET_FIELD(desc->data, MSG_CTL_OP_TYPE, MSG1_CTL_OP_SYMKEY_PIPE0);
- send_msg.msg0 = desc->control | (1ULL<<53);
- send_msg.msg1 = desc->data | (1ULL<<53) | (1ULL<<52);
- send_msg.msg2 = send_msg.msg3 = 0;
+xlr_sec_error_t
+xlr_sec_submit_op(symkey_desc_pt desc)
+{
+ struct msgrng_msg send_msg;
- desc->op_ctl.flags = 1; // in_interrupt(); /* ipsec softirq ? */
+ int rsp_dest_id, cpu, hard_cpu, hard_thread;
+ int code, retries;
+ unsigned long msgrng_flags = 0;
- XLR_SEC_CMD_DIAG("[%s]: IN_IRQ=%d msg0=0x%llx msg1=0x%llx \n",
- __FUNCTION__, desc->op_ctl.flags, send_msg.msg0, send_msg.msg1);
+ /* threads (0-3) are orthogonal to buckets 0-3 */
+ cpu = xlr_cpu_id();
+ hard_cpu = cpu >> 2;
+ hard_thread = cpu & 0x3;/* thread id */
+ rsp_dest_id = (hard_cpu << 3) + hard_thread;
+ desc->op_ctl.cpu = hard_cpu;
+ desc->op_ctl.flags = 0; /* called from kernel thread */
- retries = 100;
+ XLR_SEC_CMD_DIAG("[%s]:%d: cpu=0x%x hard_cpu=0x%x hard_thrd=0x%x id=0x%x \n",
+ __FUNCTION__, __LINE__, cpu, hard_cpu, hard_thread, rsp_dest_id);
- while (retries--) {
- msgrng_flags_save(msgrng_flags);
+ /*
+ * Set DestId in Message Control Word. This tells the Security
+ * Engine which bucket to send the reply to for this CPU
+ */
+ CLEAR_SET_FIELD(desc->control, MSG_CMD_CTL_ID, rsp_dest_id);
+ CLEAR_SET_FIELD(desc->data, MSG_CMD_CTL_ID, rsp_dest_id);
- code = message_send_retry(SEC_MSGRING_WORDSIZE,
- MSGRNG_CODE_SEC,
- desc->op_ctl.stn_id,
- &send_msg);
+ CLEAR_SET_FIELD(desc->control, MSG_CTL_OP_TYPE, MSG0_CTL_OP_ENGINE_SYMKEY);
+ CLEAR_SET_FIELD(desc->data, MSG_CTL_OP_TYPE, MSG1_CTL_OP_SYMKEY_PIPE0);
+ send_msg.msg0 = desc->control | (1ULL << 53);
+ send_msg.msg1 = desc->data | (1ULL << 53) | (1ULL << 52);
+ send_msg.msg2 = send_msg.msg3 = 0;
- msgrng_flags_restore(msgrng_flags);
+ desc->op_ctl.flags = 1;
+ //in_interrupt(); /* ipsec softirq ? */
- if (code == 0)
- break;
- }
+ XLR_SEC_CMD_DIAG("[%s]: IN_IRQ=%d msg0=0x%llx msg1=0x%llx \n",
+ __FUNCTION__, desc->op_ctl.flags, send_msg.msg0, send_msg.msg1);
- return (XLR_SEC_ERR_NONE);
-}
+ retries = 100;
+ while (retries--) {
+ msgrng_flags_save(msgrng_flags);
-symkey_desc_pt xlr_sec_allocate_desc(void* session_ptr)
-{
- uint64_t addr;
- symkey_desc_pt aligned, new;
+ code = message_send_retry(SEC_MSGRING_WORDSIZE,
+ MSGRNG_CODE_SEC,
+ desc->op_ctl.stn_id,
+ &send_msg);
- new = (symkey_desc_pt) malloc(sizeof(symkey_desc_t),
- M_DEVBUF, M_NOWAIT | M_ZERO);
- if (new == NULL)
- return (NULL);
+ msgrng_flags_restore(msgrng_flags);
- new->ses = session_ptr ;
+ if (code == 0)
+ break;
+ }
- new->user.kern_src = new->user.aligned_src =
- (uint8_t *) contigmalloc(256*1024+1024,
- M_DEVBUF, M_NOWAIT | M_ZERO,
- 0, 0xffffffff, XLR_CACHELINE_SIZE, 0);
- if(new->user.kern_src == NULL){
- printf("ERROR - malloc failed for user.kern_src\n");
- return NULL;
- }
+ return (XLR_SEC_ERR_NONE);
+}
- new->user.aligned_dest = new->user.kern_dest =
- (uint8_t *) contigmalloc(257*1024,
- M_DEVBUF, M_NOWAIT | M_ZERO,
- 0, 0xffffffff, XLR_CACHELINE_SIZE, 0);
- if(new->user.aligned_dest == NULL){
- printf("ERROR - malloc failed for user.aligned_dest\n");
- return NULL;
- }
-
+symkey_desc_pt
+xlr_sec_allocate_desc(void *session_ptr)
+{
+ uint64_t addr;
+ symkey_desc_pt aligned, new;
- new->next_src_buf = (uint8_t *) contigmalloc(256*1024+1024,
- M_DEVBUF, M_NOWAIT | M_ZERO,
- 0, 0xffffffff, XLR_CACHELINE_SIZE, 0);
+ new = (symkey_desc_pt) malloc(sizeof(symkey_desc_t),
+ M_DEVBUF, M_NOWAIT | M_ZERO);
- if(new->next_src_buf == NULL){
- printf("ERROR - malloc failed for next_src_buf\n");
- return NULL;
- }
+ if (new == NULL)
+ return (NULL);
+ new->ses = session_ptr;
- new->next_dest_buf =
- (uint8_t *) contigmalloc(257*1024,
- M_DEVBUF, M_NOWAIT | M_ZERO,
- 0, 0xffffffff, XLR_CACHELINE_SIZE, 0);
+ new->user.kern_src = new->user.aligned_src =
+ (uint8_t *) contigmalloc(256 * 1024 + 1024,
+ M_DEVBUF, M_NOWAIT | M_ZERO,
+ 0, 0xffffffff, XLR_CACHELINE_SIZE, 0);
- if(new->next_dest_buf == NULL){
- printf("ERROR - malloc failed for next_dest_buf\n");
- return NULL;
- }
+ if (new->user.kern_src == NULL) {
+ printf("ERROR - malloc failed for user.kern_src\n");
+ return NULL;
+ }
+ new->user.aligned_dest = new->user.kern_dest =
+ (uint8_t *) contigmalloc(257 * 1024,
+ M_DEVBUF, M_NOWAIT | M_ZERO,
+ 0, 0xffffffff, XLR_CACHELINE_SIZE, 0);
+
+ if (new->user.aligned_dest == NULL) {
+ printf("ERROR - malloc failed for user.aligned_dest\n");
+ return NULL;
+ }
+ new->next_src_buf = (uint8_t *) contigmalloc(256 * 1024 + 1024,
+ M_DEVBUF, M_NOWAIT | M_ZERO,
+ 0, 0xffffffff, XLR_CACHELINE_SIZE, 0);
- new->user.kern_auth = new->user.user_auth = NULL;
- new->user.aligned_auth = new->user.user_auth = NULL;
+ if (new->next_src_buf == NULL) {
+ printf("ERROR - malloc failed for next_src_buf\n");
+ return NULL;
+ }
+ new->next_dest_buf =
+ (uint8_t *) contigmalloc(257 * 1024,
+ M_DEVBUF, M_NOWAIT | M_ZERO,
+ 0, 0xffffffff, XLR_CACHELINE_SIZE, 0);
+
+ if (new->next_dest_buf == NULL) {
+ printf("ERROR - malloc failed for next_dest_buf\n");
+ return NULL;
+ }
+ new->user.kern_auth = new->user.user_auth = NULL;
+ new->user.aligned_auth = new->user.user_auth = NULL;
- /* find cacheline alignment */
- aligned = new;
- addr = (uint64_t)vtophys(new);
+ /* find cacheline alignment */
+ aligned = new;
+ addr = (uint64_t) vtophys(new);
- /* save for free */
- aligned->alloc = new;
+ /* save for free */
+ aligned->alloc = new;
- /* setup common control info */
- aligned->op_ctl.phys_self = addr;
- aligned->op_ctl.stn_id = MSGRNG_STNID_SEC0;
+ /* setup common control info */
+ aligned->op_ctl.phys_self = addr;
+ aligned->op_ctl.stn_id = MSGRNG_STNID_SEC0;
- return (aligned);
+ return (aligned);
}
-static void xlr_sec_free_desc(symkey_desc_pt desc)
+static void
+xlr_sec_free_desc(symkey_desc_pt desc)
{
- if ((desc == NULL) || (desc->alloc == NULL)) {
- printf("%s: NULL descriptor \n", __FUNCTION__);
- return;
- }
-
- contigfree(desc,sizeof(symkey_desc_t),M_DEVBUF);
+ if ((desc == NULL) || (desc->alloc == NULL)) {
+ printf("%s: NULL descriptor \n", __FUNCTION__);
+ return;
+ }
+ contigfree(desc, sizeof(symkey_desc_t), M_DEVBUF);
- return;
+ return;
}
-void print_buf (char *desc, void *data, int len)
+void
+print_buf(char *desc, void *data, int len)
{
- uint8_t *dp;
- int i;
-
- DPRINT("%s: ", desc); /* newline done in for-loop */
- dp = data;
- for (i=0; i < len; i++, dp++) {
- if ((i % 16) == 0) DPRINT("\n");
- DPRINT(" %c%c",
- nib2hex[(((*dp)&0xf0)>>4)],
- nib2hex[((*dp)&0x0f)] );
- }
- DPRINT("\n");
+ uint8_t *dp;
+ int i;
+
+ DPRINT("%s: ", desc); /* newline done in for-loop */
+ dp = data;
+ for (i = 0; i < len; i++, dp++) {
+ if ((i % 16) == 0)
+ DPRINT("\n");
+ DPRINT(" %c%c",
+ nib2hex[(((*dp) & 0xf0) >> 4)],
+ nib2hex[((*dp) & 0x0f)]);
+ }
+ DPRINT("\n");
}
#ifdef XLR_SEC_CMD_DEBUG
static void
-decode_symkey_desc (symkey_desc_pt desc, uint32_t cfg_vector)
+decode_symkey_desc(symkey_desc_pt desc, uint32_t cfg_vector)
{
- unsigned long long word;
- /* uint8_t *info; */
- /* int i; */
-
- DPRINT ("MSG - CTL: \n");
- DPRINT ("\t CTRL = %lld \n",
- GET_FIELD(desc->control, MSG_CMD_CTL_CTL));
- DPRINT ("\t CTRL LEN = %lld \n",
- GET_FIELD(desc->control, MSG_CMD_CTL_LEN));
- DPRINT ("\t CTRL ADDR = %llx \n\n",
- GET_FIELD(desc->control, MSG_CMD_CTL_ADDR));
-
- DPRINT ("MSG - DATA: \n");
- DPRINT ("\t CTRL = %lld \n",
- GET_FIELD(desc->data, MSG_CMD_DATA_CTL));
- DPRINT ("\t DATA LEN = %lld \n",
- GET_FIELD(desc->data, MSG_CMD_DATA_LEN));
- DPRINT ("\t DATA ADDR = %llx \n\n",
- GET_FIELD(desc->data, MSG_CMD_DATA_ADDR));
-
- DPRINT ("CONTROL DESCRIPTOR: \n");
- word = desc->ctl_desc.instruction;
- DPRINT ("\tINSTRUCTION: %llx\n", word);
- DPRINT("\t\tOVERRIDE CIPH = %lld \n", GET_FIELD(word, CTL_DSC_OVERRIDECIPHER));
- DPRINT("\t\tARC4 WAIT = %lld \n", GET_FIELD(word, CTL_DSC_ARC4_WAIT4SAVE));
- DPRINT("\t\tARC4 SAVE = %lld \n", GET_FIELD(word, CTL_DSC_ARC4_SAVESTATE));
- DPRINT("\t\tARC4 LOAD = %lld \n", GET_FIELD(word, CTL_DSC_ARC4_LOADSTATE));
- DPRINT("\t\tARC4 KEYLEN = %lld \n", GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
- DPRINT("\t\tCIPHER = %lld \n", GET_FIELD(word, CTL_DSC_CPHR));
- DPRINT("\t\tCIPHER MODE = %lld \n", GET_FIELD(word, CTL_DSC_MODE));
- DPRINT("\t\tINIT CIPHER = %lld \n", GET_FIELD(word, CTL_DSC_ICPHR));
- DPRINT("\t\tHMAC = %lld \n", GET_FIELD(word, CTL_DSC_HMAC));
- DPRINT("\t\tHASH ALG = %lld \n", GET_FIELD(word, CTL_DSC_HASH) | (GET_FIELD(word, CTL_DSC_HASHHI)<<2));
- DPRINT("\t\tINIT HASH = %lld \n", GET_FIELD(word, CTL_DSC_IHASH));
- DPRINT("\t\tCHKSUM = %lld \n", GET_FIELD(word, CTL_DSC_CKSUM));
- DPRINT ("\tCIPHER HASH INFO: \n");
+ unsigned long long word;
+
+ /* uint8_t *info; */
+ /* int i; */
+
+ DPRINT("MSG - CTL: \n");
+ DPRINT("\t CTRL = %lld \n",
+ GET_FIELD(desc->control, MSG_CMD_CTL_CTL));
+ DPRINT("\t CTRL LEN = %lld \n",
+ GET_FIELD(desc->control, MSG_CMD_CTL_LEN));
+ DPRINT("\t CTRL ADDR = %llx \n\n",
+ GET_FIELD(desc->control, MSG_CMD_CTL_ADDR));
+
+ DPRINT("MSG - DATA: \n");
+ DPRINT("\t CTRL = %lld \n",
+ GET_FIELD(desc->data, MSG_CMD_DATA_CTL));
+ DPRINT("\t DATA LEN = %lld \n",
+ GET_FIELD(desc->data, MSG_CMD_DATA_LEN));
+ DPRINT("\t DATA ADDR = %llx \n\n",
+ GET_FIELD(desc->data, MSG_CMD_DATA_ADDR));
+
+ DPRINT("CONTROL DESCRIPTOR: \n");
+ word = desc->ctl_desc.instruction;
+ DPRINT("\tINSTRUCTION: %llx\n", word);
+ DPRINT("\t\tOVERRIDE CIPH = %lld \n", GET_FIELD(word, CTL_DSC_OVERRIDECIPHER));
+ DPRINT("\t\tARC4 WAIT = %lld \n", GET_FIELD(word, CTL_DSC_ARC4_WAIT4SAVE));
+ DPRINT("\t\tARC4 SAVE = %lld \n", GET_FIELD(word, CTL_DSC_ARC4_SAVESTATE));
+ DPRINT("\t\tARC4 LOAD = %lld \n", GET_FIELD(word, CTL_DSC_ARC4_LOADSTATE));
+ DPRINT("\t\tARC4 KEYLEN = %lld \n", GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
+ DPRINT("\t\tCIPHER = %lld \n", GET_FIELD(word, CTL_DSC_CPHR));
+ DPRINT("\t\tCIPHER MODE = %lld \n", GET_FIELD(word, CTL_DSC_MODE));
+ DPRINT("\t\tINIT CIPHER = %lld \n", GET_FIELD(word, CTL_DSC_ICPHR));
+ DPRINT("\t\tHMAC = %lld \n", GET_FIELD(word, CTL_DSC_HMAC));
+ DPRINT("\t\tHASH ALG = %lld \n", GET_FIELD(word, CTL_DSC_HASH) | (GET_FIELD(word, CTL_DSC_HASHHI) << 2));
+ DPRINT("\t\tINIT HASH = %lld \n", GET_FIELD(word, CTL_DSC_IHASH));
+ DPRINT("\t\tCHKSUM = %lld \n", GET_FIELD(word, CTL_DSC_CKSUM));
+ DPRINT("\tCIPHER HASH INFO: \n");
#if 0
- info = (uint8_t *)&desc->ctl_desc->cipherHashInfo;
- for (i=0; i < sizeof(CipherHashInfo_t); i++, info++) {
- DPRINT(" %02x", *info);
- if (i && (i % 16) == 0) DPRINT("\n");
- }
- DPRINT("\n\n");
+ info = (uint8_t *) & desc->ctl_desc->cipherHashInfo;
+ for (i = 0; i < sizeof(CipherHashInfo_t); i++, info++) {
+ DPRINT(" %02x", *info);
+ if (i && (i % 16) == 0)
+ DPRINT("\n");
+ }
+ DPRINT("\n\n");
#endif
- switch (cfg_vector) {
- case XLR_SEC_VECTOR_CIPHER_ARC4:
- DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_ARC4 \n");
- print_buf("ARC4 Key",
- &desc->ctl_desc.cipherHashInfo.infoARC4.cipherKey0,
- GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
- break;
- case XLR_SEC_VECTOR_CIPHER_ARC4__HMAC:
- DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_ARC4__HMAC \n");
- print_buf("ARC4 Key",
- &desc->ctl_desc.cipherHashInfo.infoARC4HMAC.cipherKey0,
- GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
- print_buf("HMAC Key",
- &desc->ctl_desc.cipherHashInfo.infoARC4HMAC.hmacKey0,
- sizeof(HMAC_t));
- break;
- case XLR_SEC_VECTOR_CIPHER_ARC4__STATE:
- DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_ARC4__STATE \n");
- print_buf("ARC4 Key",
- &desc->ctl_desc.cipherHashInfo.infoARC4State.cipherKey0,
- GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
- break;
- case XLR_SEC_VECTOR_CIPHER_ARC4__HMAC__STATE:
- DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_ARC4__HMAC__STATE \n");
- print_buf("ARC4 Key",
- &desc->ctl_desc.cipherHashInfo.infoARC4StateHMAC.cipherKey0,
- GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
- print_buf("HMAC Key",
- &desc->ctl_desc.cipherHashInfo.infoARC4StateHMAC.hmacKey0,
- sizeof(HMAC_t));
- break;
- case XLR_SEC_VECTOR_CIPHER_KASUMI_F8:
- DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_KASUMI_F8 \n");
- print_buf("KASUMI_F8 Key",
- &desc->ctl_desc.cipherHashInfo.infoKASUMIF8.cipherKey0,
- XLR_SEC_KASUMI_F8_KEY_LENGTH);
- break;
- case XLR_SEC_VECTOR_CIPHER_KASUMI_F8__HMAC:
- DPRINT("XLR_SEC_VECTOR_CIPHER_KASUMI_F8__HMAC\n");
- print_buf("KASUMI_F8 Key",
- &desc->ctl_desc.cipherHashInfo.infoKASUMIF8HMAC.cipherKey0,
- XLR_SEC_KASUMI_F8_KEY_LENGTH);
- print_buf("HMAC Key",
- &desc->ctl_desc.cipherHashInfo.infoKASUMIF8HMAC.hmacKey0,
- sizeof(HMAC_t));
- break;
- case XLR_SEC_VECTOR_CIPHER_KASUMI_F8__HMAC2:
- DPRINT("XLR_SEC_VECTOR_CIPHER_KASUMI_F8__HMAC2\n");
- print_buf("KASUMI_F8 Key",
- &desc->ctl_desc.cipherHashInfo.infoKASUMIF8HMAC2.cipherKey0,
- XLR_SEC_KASUMI_F8_KEY_LENGTH);
- print_buf("HMAC2 Key",
- &desc->ctl_desc.cipherHashInfo.infoKASUMIF8HMAC2.hmacKey0,
- sizeof(HMAC2_t));
- break;
- case XLR_SEC_VECTOR_CIPHER_KASUMI_F8__GCM:
- DPRINT("XLR_SEC_VECTOR_CIPHER_KASUMI_F8__GCM\n");
- print_buf("KASUMI_F8 Key",
- &desc->ctl_desc.cipherHashInfo.infoKASUMIF8GCM.cipherKey0,
- XLR_SEC_KASUMI_F8_KEY_LENGTH);
- print_buf("GCM Key",
- &desc->ctl_desc.cipherHashInfo.infoKASUMIF8GCM.GCMH0,
- sizeof(GCM_t));
- break;
- case XLR_SEC_VECTOR_CIPHER_KASUMI_F8__F9:
- DPRINT("XLR_SEC_VECTOR_CIPHER_KASUMI_F8__F9\n");
- print_buf("KASUMI_F8 Key",
- &desc->ctl_desc.cipherHashInfo.infoKASUMIF8F9.cipherKey0,
- XLR_SEC_KASUMI_F8_KEY_LENGTH);
- print_buf("F9 Key",
- &desc->ctl_desc.cipherHashInfo.infoKASUMIF8F9.authKey0,
- sizeof(F9_t));
- break;
- case XLR_SEC_VECTOR_MAC:
- DPRINT("VECTOR: XLR_SEC_VECTOR_MAC \n");
- DPRINT("MAC-ONLY - No Info\n");
- break;
- case XLR_SEC_VECTOR_HMAC:
- DPRINT ("VECTOR: XLR_SEC_VECTOR_HMAC \n");
- print_buf("HMAC Key",
- &desc->ctl_desc.cipherHashInfo.infoHMAC.hmacKey0,
- sizeof(HMAC_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_DES__HMAC__MODE_ECB_CBC:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_DES__HMAC__MODE_ECB_CBC \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoDESHMAC.cipherKey0,
- XLR_SEC_DES_KEY_LENGTH);
- print_buf("HMAC Key",
- &desc->ctl_desc.cipherHashInfo.infoDESHMAC.hmacKey0,
- sizeof(HMAC_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_DES__MODE_ECB_CBC:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_DES__MODE_ECB_CBC \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoDES.cipherKey0,
- XLR_SEC_DES_KEY_LENGTH);
- break;
- case XLR_SEC_VECTOR__CIPHER_3DES__HMAC__MODE_ECB_CBC:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_3DES__HMAC__MODE_ECB_CBC \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.info3DESHMAC.cipherKey0,
- XLR_SEC_3DES_KEY_LENGTH);
- print_buf("HMAC Key",
- &desc->ctl_desc.cipherHashInfo.info3DESHMAC.hmacKey0,
- sizeof(HMAC_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_3DES__MODE_ECB_CBC:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_3DES__MODE_ECB_CBC \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.info3DES.cipherKey0,
- XLR_SEC_3DES_KEY_LENGTH);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_CTR_CFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_CTR_CFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128HMAC.cipherKey0,
- XLR_SEC_AES128_KEY_LENGTH);
- print_buf("HMAC Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128HMAC.hmacKey0,
- sizeof(HMAC_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__MODE_CTR_CFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__MODE_CTR_CFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128.cipherKey0,
- XLR_SEC_AES128_KEY_LENGTH);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_ECB_CBC_OFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_ECB_CBC_OFB\n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128HMAC.cipherKey0,
- XLR_SEC_AES128_KEY_LENGTH);
- print_buf("HMAC Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128HMAC.hmacKey0,
- sizeof(HMAC_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__MODE_ECB_CBC_OFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__MODE_ECB_CBC_OFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128.cipherKey0,
- XLR_SEC_AES128_KEY_LENGTH);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_CTR_CFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_CTR_CFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192HMAC.cipherKey0,
- XLR_SEC_AES192_KEY_LENGTH);
- print_buf("HMAC Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192HMAC.hmacKey0,
- sizeof(HMAC_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__MODE_CTR_CFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__MODE_CTR_CFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192.cipherKey0,
- XLR_SEC_AES192_KEY_LENGTH);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_ECB_CBC_OFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_ECB_CBC_OFB\n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192HMAC.cipherKey0,
- XLR_SEC_AES192_KEY_LENGTH);
- print_buf("HMAC Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192HMAC.hmacKey0,
- sizeof(HMAC_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__MODE_ECB_CBC_OFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__MODE_ECB_CBC_OFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192.cipherKey0,
- XLR_SEC_AES192_KEY_LENGTH);
- break;
-
- case XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_CTR_CFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_CTR_CFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256HMAC.cipherKey0,
- XLR_SEC_AES256_KEY_LENGTH);
- print_buf("HMAC Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256HMAC.hmacKey0,
- sizeof(HMAC_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__MODE_CTR_CFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__MODE_CTR_CFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256.cipherKey0,
- XLR_SEC_AES256_KEY_LENGTH);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_ECB_CBC_OFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_ECB_CBC_OFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256HMAC.cipherKey0,
- XLR_SEC_AES256_KEY_LENGTH);
- print_buf("HMAC Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256HMAC.hmacKey0,
- sizeof(HMAC_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__MODE_ECB_CBC_OFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__MODE_ECB_CBC_OFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256.cipherKey0,
- XLR_SEC_AES256_KEY_LENGTH);
- break;
- case XLR_SEC_VECTOR_CIPHER_ARC4__HMAC2:
- DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_ARC4__HMAC2 \n");
- print_buf("ARC4 Key",
- &desc->ctl_desc.cipherHashInfo.infoARC4HMAC2.cipherKey0,
- GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
- print_buf("HMAC2 Key",
- &desc->ctl_desc.cipherHashInfo.infoARC4HMAC2.hmacKey0,
- sizeof(HMAC2_t));
- break;
- case XLR_SEC_VECTOR_CIPHER_ARC4__HMAC2__STATE:
- DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_ARC4__HMAC2__STATE \n");
- print_buf("ARC4 Key",
- &desc->ctl_desc.cipherHashInfo.infoARC4StateHMAC2.cipherKey0,
- GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
- print_buf("HMAC2 Key",
- &desc->ctl_desc.cipherHashInfo.infoARC4StateHMAC2.hmacKey0,
- sizeof(HMAC2_t));
- break;
- case XLR_SEC_VECTOR_HMAC2:
- DPRINT ("VECTOR: XLR_SEC_VECTOR_HMAC2 \n");
- print_buf("HMAC2 Key",
- &desc->ctl_desc.cipherHashInfo.infoHMAC2.hmacKey0,
- sizeof(HMAC2_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_DES__HMAC2__MODE_ECB_CBC:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_DES__HMAC2__MODE_ECB_CBC \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoDESHMAC2.cipherKey0,
- XLR_SEC_DES_KEY_LENGTH);
- print_buf("HMAC2 Key",
- &desc->ctl_desc.cipherHashInfo.infoDESHMAC2.hmacKey0,
- sizeof(HMAC2_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_3DES__HMAC2__MODE_ECB_CBC:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_3DES__HMAC2__MODE_ECB_CBC \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.info3DESHMAC2.cipherKey0,
- XLR_SEC_3DES_KEY_LENGTH);
- print_buf("HMAC2 Key",
- &desc->ctl_desc.cipherHashInfo.info3DESHMAC2.hmacKey0,
- sizeof(HMAC2_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_CTR_CFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_CTR_CFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128HMAC2.cipherKey0,
- XLR_SEC_AES128_KEY_LENGTH);
- print_buf("HMAC2 Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128HMAC2.hmacKey0,
- sizeof(HMAC2_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_ECB_CBC_OFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_ECB_CBC_OFB\n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128HMAC2.cipherKey0,
- XLR_SEC_AES128_KEY_LENGTH);
- print_buf("HMAC2 Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128HMAC2.hmacKey0,
- sizeof(HMAC2_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_CTR_CFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_CTR_CFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192HMAC2.cipherKey0,
- XLR_SEC_AES192_KEY_LENGTH);
- print_buf("HMAC2 Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192HMAC2.hmacKey0,
- sizeof(HMAC2_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_ECB_CBC_OFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_ECB_CBC_OFB\n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192HMAC2.cipherKey0,
- XLR_SEC_AES192_KEY_LENGTH);
- print_buf("HMAC2 Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192HMAC2.hmacKey0,
- sizeof(HMAC2_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_CTR_CFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_CTR_CFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256HMAC2.cipherKey0,
- XLR_SEC_AES256_KEY_LENGTH);
- print_buf("HMAC2 Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256HMAC2.hmacKey0,
- sizeof(HMAC2_t));
- break;
-
- case XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_ECB_CBC_OFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_ECB_CBC_OFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256HMAC2.cipherKey0,
- XLR_SEC_AES256_KEY_LENGTH);
- print_buf("HMAC2 Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256HMAC2.hmacKey0,
- sizeof(HMAC2_t));
- break;
- case XLR_SEC_VECTOR_CIPHER_ARC4__GCM:
- DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_ARC4__GCM \n");
- print_buf("ARC4 Key",
- &desc->ctl_desc.cipherHashInfo.infoARC4GCM.cipherKey0,
- GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
- print_buf("GCM Key",
- &desc->ctl_desc.cipherHashInfo.infoARC4GCM.GCMH0,
- sizeof(GCM_t));
- break;
- case XLR_SEC_VECTOR_CIPHER_ARC4__GCM__STATE:
- DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_ARC4__GCM__STATE \n");
- print_buf("ARC4 Key",
- &desc->ctl_desc.cipherHashInfo.infoARC4StateGCM.cipherKey0,
- GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
- print_buf("GCM Key",
- &desc->ctl_desc.cipherHashInfo.infoARC4StateGCM.GCMH0,
- sizeof(GCM_t));
- break;
- case XLR_SEC_VECTOR_GCM:
- DPRINT ("VECTOR: XLR_SEC_VECTOR_GCM \n");
- print_buf("GCM Key",
- &desc->ctl_desc.cipherHashInfo.infoGCM.GCMH0,
- sizeof(GCM_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_DES__GCM__MODE_ECB_CBC:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_DES__GCM__MODE_ECB_CBC \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoDESGCM.cipherKey0,
- XLR_SEC_DES_KEY_LENGTH);
- print_buf("GCM Key",
- &desc->ctl_desc.cipherHashInfo.infoDESGCM.GCMH0,
- sizeof(GCM_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_3DES__GCM__MODE_ECB_CBC:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_3DES__GCM__MODE_ECB_CBC \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.info3DESGCM.cipherKey0,
- XLR_SEC_3DES_KEY_LENGTH);
- print_buf("GCM Key",
- &desc->ctl_desc.cipherHashInfo.info3DESGCM.GCMH0,
- sizeof(GCM_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_CTR_CFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_CTR_CFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128GCM.cipherKey0,
- XLR_SEC_AES128_KEY_LENGTH);
- print_buf("GCM Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128GCM.GCMH0,
- XLR_SEC_AES128_KEY_LENGTH);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_ECB_CBC_OFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_ECB_CBC_OFB\n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128GCM.cipherKey0,
- XLR_SEC_AES128_KEY_LENGTH);
- print_buf("GCM Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128GCM.GCMH0,
- XLR_SEC_AES128_KEY_LENGTH);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_CTR_CFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_CTR_CFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192GCM.cipherKey0,
- XLR_SEC_AES192_KEY_LENGTH);
- print_buf("GCM Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192GCM.GCMH0,
- XLR_SEC_AES192_KEY_LENGTH);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_ECB_CBC_OFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_ECB_CBC_OFB\n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192GCM.cipherKey0,
- XLR_SEC_AES192_KEY_LENGTH);
- print_buf("GCM Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192GCM.GCMH0,
- XLR_SEC_AES192_KEY_LENGTH);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_CTR_CFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_CTR_CFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256GCM.cipherKey0,
- XLR_SEC_AES256_KEY_LENGTH);
- print_buf("GCM Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256GCM.GCMH0,
- XLR_SEC_AES256_KEY_LENGTH);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_ECB_CBC_OFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_ECB_CBC_OFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256GCM.cipherKey0,
- XLR_SEC_AES256_KEY_LENGTH);
- print_buf("GCM Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256GCM.GCMH0,
- XLR_SEC_AES256_KEY_LENGTH);
- break;
- case XLR_SEC_VECTOR_CIPHER_ARC4__F9:
- DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_ARC4__F9 \n");
- print_buf("ARC4 Key",
- &desc->ctl_desc.cipherHashInfo.infoARC4F9.cipherKey0,
- GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
- print_buf("F9 Key",
- &desc->ctl_desc.cipherHashInfo.infoARC4F9.authKey0,
- sizeof(F9_t));
- break;
- case XLR_SEC_VECTOR_CIPHER_ARC4__F9__STATE:
- DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_ARC4__F9__STATE \n");
- print_buf("ARC4 Key",
- &desc->ctl_desc.cipherHashInfo.infoARC4StateF9.cipherKey0,
- GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
- print_buf("F9 Key",
- &desc->ctl_desc.cipherHashInfo.infoARC4StateF9.authKey0,
- sizeof(F9_t));
- break;
- case XLR_SEC_VECTOR_F9:
- DPRINT ("VECTOR: XLR_SEC_VECTOR_F9 \n");
- print_buf("F9 Key",
- &desc->ctl_desc.cipherHashInfo.infoF9.authKey0,
- sizeof(F9_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_DES__F9__MODE_ECB_CBC:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_DES__F9__MODE_ECB_CBC \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoDESF9.cipherKey0,
- XLR_SEC_DES_KEY_LENGTH);
- print_buf("F9 Key",
- &desc->ctl_desc.cipherHashInfo.infoDESF9.authKey0,
- sizeof(F9_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_3DES__F9__MODE_ECB_CBC:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_3DES__F9__MODE_ECB_CBC \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.info3DESF9.cipherKey0,
- XLR_SEC_3DES_KEY_LENGTH);
- print_buf("F9 Key",
- &desc->ctl_desc.cipherHashInfo.info3DESF9.authKey0,
- sizeof(F9_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_CTR_CFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_CTR_CFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128F9.cipherKey0,
- XLR_SEC_AES128_KEY_LENGTH);
- print_buf("F9 Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128F9.authKey0,
- sizeof(F9_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_ECB_CBC_OFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_ECB_CBC_OFB\n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128F9.cipherKey0,
- XLR_SEC_AES128_KEY_LENGTH);
- print_buf("F9 Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128F9.authKey0,
- sizeof(F9_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_CTR_CFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_CTR_CFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192F9.cipherKey0,
- XLR_SEC_AES192_KEY_LENGTH);
- print_buf("F9 Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192F9.authKey0,
- sizeof(F9_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_ECB_CBC_OFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_ECB_CBC_OFB\n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192F9.cipherKey0,
- XLR_SEC_AES192_KEY_LENGTH);
- print_buf("F9 Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192F9.authKey0,
- sizeof(F9_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_CTR_CFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_CTR_CFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256F9.cipherKey0,
- XLR_SEC_AES256_KEY_LENGTH);
- print_buf("F9 Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256F9.authKey0,
- sizeof(F9_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_ECB_CBC_OFB:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_ECB_CBC_OFB \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256F9.cipherKey0,
- XLR_SEC_AES256_KEY_LENGTH);
- print_buf("F9 Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256F9.authKey0,
- sizeof(F9_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_F8:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_F8 \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128F8HMAC.cipherKey0,
- XLR_SEC_AES128F8_KEY_LENGTH);
- print_buf("HMAC Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128F8HMAC.hmacKey0,
- sizeof(HMAC_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__MODE_F8:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__MODE_F8 \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128F8.cipherKey0,
- XLR_SEC_AES128F8_KEY_LENGTH);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_F8:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_F8 \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192F8HMAC.cipherKey0,
- XLR_SEC_AES192F8_KEY_LENGTH);
- print_buf("HMAC Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192F8HMAC.hmacKey0,
- sizeof(HMAC_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__MODE_F8:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__MODE_F8 \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192F8.cipherKey0,
- XLR_SEC_AES192F8_KEY_LENGTH);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_F8:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_F8 \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256F8HMAC.cipherKey0,
- XLR_SEC_AES256F8_KEY_LENGTH);
- print_buf("HMAC Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256HMAC.hmacKey0,
- sizeof(HMAC_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__MODE_F8:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__MODE_F8 \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256F8.cipherKey0,
- XLR_SEC_AES256F8_KEY_LENGTH);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_F8:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_F8 \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128F8HMAC2.cipherKey0,
- XLR_SEC_AES128F8_KEY_LENGTH);
- print_buf("HMAC2 Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128F8HMAC2.hmacKey0,
- sizeof(HMAC2_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_F8:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_F8 \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192F8HMAC2.cipherKey0,
- XLR_SEC_AES192F8_KEY_LENGTH);
- print_buf("HMAC2 Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192F8HMAC2.hmacKey0,
- sizeof(HMAC2_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_F8:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_F8 \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256F8HMAC2.cipherKey0,
- XLR_SEC_AES256F8_KEY_LENGTH);
- print_buf("HMAC2 Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256F8HMAC2.hmacKey0,
- sizeof(HMAC2_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_F8:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_F8 \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128F8GCM.cipherKey0,
- XLR_SEC_AES128F8_KEY_LENGTH);
- print_buf("GCM Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128GCM.GCMH0,
- XLR_SEC_AES128_KEY_LENGTH);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_F8:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_F8 \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192F8GCM.cipherKey0,
- XLR_SEC_AES192_KEY_LENGTH);
- print_buf("GCM Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192F8GCM.GCMH0,
- XLR_SEC_AES192_KEY_LENGTH);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_F8:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_F8 \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256F8GCM.cipherKey0,
- XLR_SEC_AES256F8_KEY_LENGTH);
- print_buf("GCM Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256F8GCM.GCMH0,
- XLR_SEC_AES256_KEY_LENGTH);
- break;
- case XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_F8:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_F8 \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128F8F9.cipherKey0,
- XLR_SEC_AES128F8_KEY_LENGTH);
- print_buf("F9 Key",
- &desc->ctl_desc.cipherHashInfo.infoAES128F8F9.authKey0,
- sizeof(F9_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_F8:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_F8 \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192F8F9.cipherKey0,
- XLR_SEC_AES192F8_KEY_LENGTH);
- print_buf("F9 Key",
- &desc->ctl_desc.cipherHashInfo.infoAES192F8F9.authKey0,
- sizeof(F9_t));
- break;
- case XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_F8:
- DPRINT ("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_F8 \n");
- print_buf("CIPHER Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256F8F9.cipherKey0,
- XLR_SEC_AES256F8_KEY_LENGTH);
- print_buf("F9 Key",
- &desc->ctl_desc.cipherHashInfo.infoAES256F8F9.authKey0,
- sizeof(F9_t));
- break;
-
- default:
- DPRINT ("VECTOR: ???? \n");
- DPRINT(">>> WHAT THE HECK !!! <<< \n");
- break;
- }
- DPRINT ("PACKET DESCRIPTOR: \n");
- word = desc->pkt_desc.srcLengthIVOffUseIVNext;
- DPRINT ("\tSrcLengthIVOffsetIVNext: %llx\n", word);
- DPRINT ("\t\tLoad HMAC = %lld \n",
- GET_FIELD(word, PKT_DSC_LOADHMACKEY));
- DPRINT ("\t\tPad Hash = %lld \n",
- GET_FIELD(word, PKT_DSC_PADHASH));
- DPRINT ("\t\tHash Byte Count = %lld \n",
- GET_FIELD(word, PKT_DSC_HASHBYTES));
- DPRINT ("\t\tNext = %lld \n",
- GET_FIELD(word, PKT_DSC_NEXT));
- DPRINT ("\t\tUse IV = %lld \n",
- GET_FIELD(word, PKT_DSC_IV));
- DPRINT ("\t\tIV Offset = %lld \n",
- GET_FIELD(word, PKT_DSC_IVOFF));
- DPRINT ("\t\tPacket Length = %lld \n",
- GET_FIELD(word, PKT_DSC_PKTLEN));
- DPRINT ("\t\tNLHMAC = %lld \n", GET_FIELD(word, PKT_DSC_NLHMAC));
- DPRINT ("\t\tBreak = %lld \n", GET_FIELD(word, PKT_DSC_BREAK));
- DPRINT ("\t\tWait = %lld \n", GET_FIELD(word, PKT_DSC_WAIT));
- DPRINT ("\t\tSegment Src Addr = %llx \n",
- (GET_FIELD(word, PKT_DSC_SEGADDR) << 5)& 0xffffffffffULL);
- DPRINT("\t\tSRTCP = %lld \n", GET_FIELD(word, PKT_DSC_SRTCP));
- DPRINT ("\t\tGlobal Src Offset = %lld \n",
- GET_FIELD(word, PKT_DSC_SEGOFFSET));
-
- word = desc->pkt_desc.dstDataSettings;
- DPRINT("\tdstDataSettings: %llx \n", word);
- DPRINT("\t\tArc4 Byte Count = %lld \n", GET_FIELD(word,
- PKT_DSC_ARC4BYTECOUNT));
- DPRINT("\t\tSym Operation = %lld \n", GET_FIELD(word, PKT_DSC_SYM_OP));
- DPRINT("\t\tCipher Offset = %lld \n", GET_FIELD(word, PKT_DSC_CPHROFF));
- DPRINT("\t\tHash Offset = %lld \n", GET_FIELD(word, PKT_DSC_HASHOFF));
- DPRINT("\t\tHash Source = %lld \n", GET_FIELD(word, PKT_DSC_HASHSRC));
- DPRINT("\t\tChecksum Offset = %lld \n", GET_FIELD(word,
- PKT_DSC_CKSUMOFF));
- DPRINT("\t\tChecksum Source = %lld \n", GET_FIELD(word,
- PKT_DSC_CKSUMSRC));
- DPRINT("\t\tCipher Dest Addr = %llx \n", GET_FIELD(word,
- PKT_DSC_CPHR_DST_ADDR));
- DPRINT("\t\tCipher Dest Dword = %lld \n", GET_FIELD(word,
- PKT_DSC_CPHR_DST_DWOFFSET));
- DPRINT("\t\tCipher Dest Offset= %lld \n", GET_FIELD(word,
- PKT_DSC_CPHR_DST_OFFSET));
- word = desc->pkt_desc.authDstNonceLow;
- DPRINT("\tauthDstNonceLow: %llx \n", word);
- DPRINT("\t\tNonce Low 24 = %lld \n", GET_FIELD(word,
- PKT_DSC_NONCE_LOW));
- DPRINT("\t\tauthDst = %llx \n", GET_FIELD(word,
- PKT_DSC_AUTH_DST_ADDR));
- DPRINT("\t\tCipher Offset High= %lld \n", GET_FIELD(word,
- PKT_DSC_CIPH_OFF_HI));
- word = desc->pkt_desc.ckSumDstNonceHiCFBMaskLLWMask;
- DPRINT("\tckSumDstNonceHiCFBMaskLLWMask: %llx \n", word);
- DPRINT("\t\tHash Byte off = %lld \n", GET_FIELD(word, PKT_DSC_HASH_BYTE_OFF));
- DPRINT("\t\tPacket Len bytes = %lld \n", GET_FIELD(word, PKT_DSC_PKTLEN_BYTES));
- DPRINT("\t\tLast Long Word Mask = %lld \n", GET_FIELD(word,
- PKT_DSC_LASTWORD));
- DPRINT("\t\tCipher Dst Address = %llx \n", GET_FIELD(word,
- PKT_DSC_CPHR_DST_ADDR));
- DPRINT("\t\tGlobal Dst Offset = %lld \n", GET_FIELD(word,
- PKT_DSC_CPHR_DST_OFFSET));
-
- DPRINT ("CFG_VECTOR = %04x\n", cfg_vector);
- DPRINT ("\n\n");
+ switch (cfg_vector) {
+ case XLR_SEC_VECTOR_CIPHER_ARC4:
+ DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_ARC4 \n");
+ print_buf("ARC4 Key",
+ &desc->ctl_desc.cipherHashInfo.infoARC4.cipherKey0,
+ GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
+ break;
+ case XLR_SEC_VECTOR_CIPHER_ARC4__HMAC:
+ DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_ARC4__HMAC \n");
+ print_buf("ARC4 Key",
+ &desc->ctl_desc.cipherHashInfo.infoARC4HMAC.cipherKey0,
+ GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
+ print_buf("HMAC Key",
+ &desc->ctl_desc.cipherHashInfo.infoARC4HMAC.hmacKey0,
+ sizeof(HMAC_t));
+ break;
+ case XLR_SEC_VECTOR_CIPHER_ARC4__STATE:
+ DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_ARC4__STATE \n");
+ print_buf("ARC4 Key",
+ &desc->ctl_desc.cipherHashInfo.infoARC4State.cipherKey0,
+ GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
+ break;
+ case XLR_SEC_VECTOR_CIPHER_ARC4__HMAC__STATE:
+ DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_ARC4__HMAC__STATE \n");
+ print_buf("ARC4 Key",
+ &desc->ctl_desc.cipherHashInfo.infoARC4StateHMAC.cipherKey0,
+ GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
+ print_buf("HMAC Key",
+ &desc->ctl_desc.cipherHashInfo.infoARC4StateHMAC.hmacKey0,
+ sizeof(HMAC_t));
+ break;
+ case XLR_SEC_VECTOR_CIPHER_KASUMI_F8:
+ DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_KASUMI_F8 \n");
+ print_buf("KASUMI_F8 Key",
+ &desc->ctl_desc.cipherHashInfo.infoKASUMIF8.cipherKey0,
+ XLR_SEC_KASUMI_F8_KEY_LENGTH);
+ break;
+ case XLR_SEC_VECTOR_CIPHER_KASUMI_F8__HMAC:
+ DPRINT("XLR_SEC_VECTOR_CIPHER_KASUMI_F8__HMAC\n");
+ print_buf("KASUMI_F8 Key",
+ &desc->ctl_desc.cipherHashInfo.infoKASUMIF8HMAC.cipherKey0,
+ XLR_SEC_KASUMI_F8_KEY_LENGTH);
+ print_buf("HMAC Key",
+ &desc->ctl_desc.cipherHashInfo.infoKASUMIF8HMAC.hmacKey0,
+ sizeof(HMAC_t));
+ break;
+ case XLR_SEC_VECTOR_CIPHER_KASUMI_F8__HMAC2:
+ DPRINT("XLR_SEC_VECTOR_CIPHER_KASUMI_F8__HMAC2\n");
+ print_buf("KASUMI_F8 Key",
+ &desc->ctl_desc.cipherHashInfo.infoKASUMIF8HMAC2.cipherKey0,
+ XLR_SEC_KASUMI_F8_KEY_LENGTH);
+ print_buf("HMAC2 Key",
+ &desc->ctl_desc.cipherHashInfo.infoKASUMIF8HMAC2.hmacKey0,
+ sizeof(HMAC2_t));
+ break;
+ case XLR_SEC_VECTOR_CIPHER_KASUMI_F8__GCM:
+ DPRINT("XLR_SEC_VECTOR_CIPHER_KASUMI_F8__GCM\n");
+ print_buf("KASUMI_F8 Key",
+ &desc->ctl_desc.cipherHashInfo.infoKASUMIF8GCM.cipherKey0,
+ XLR_SEC_KASUMI_F8_KEY_LENGTH);
+ print_buf("GCM Key",
+ &desc->ctl_desc.cipherHashInfo.infoKASUMIF8GCM.GCMH0,
+ sizeof(GCM_t));
+ break;
+ case XLR_SEC_VECTOR_CIPHER_KASUMI_F8__F9:
+ DPRINT("XLR_SEC_VECTOR_CIPHER_KASUMI_F8__F9\n");
+ print_buf("KASUMI_F8 Key",
+ &desc->ctl_desc.cipherHashInfo.infoKASUMIF8F9.cipherKey0,
+ XLR_SEC_KASUMI_F8_KEY_LENGTH);
+ print_buf("F9 Key",
+ &desc->ctl_desc.cipherHashInfo.infoKASUMIF8F9.authKey0,
+ sizeof(F9_t));
+ break;
+ case XLR_SEC_VECTOR_MAC:
+ DPRINT("VECTOR: XLR_SEC_VECTOR_MAC \n");
+ DPRINT("MAC-ONLY - No Info\n");
+ break;
+ case XLR_SEC_VECTOR_HMAC:
+ DPRINT("VECTOR: XLR_SEC_VECTOR_HMAC \n");
+ print_buf("HMAC Key",
+ &desc->ctl_desc.cipherHashInfo.infoHMAC.hmacKey0,
+ sizeof(HMAC_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_DES__HMAC__MODE_ECB_CBC:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_DES__HMAC__MODE_ECB_CBC \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoDESHMAC.cipherKey0,
+ XLR_SEC_DES_KEY_LENGTH);
+ print_buf("HMAC Key",
+ &desc->ctl_desc.cipherHashInfo.infoDESHMAC.hmacKey0,
+ sizeof(HMAC_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_DES__MODE_ECB_CBC:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_DES__MODE_ECB_CBC \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoDES.cipherKey0,
+ XLR_SEC_DES_KEY_LENGTH);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_3DES__HMAC__MODE_ECB_CBC:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_3DES__HMAC__MODE_ECB_CBC \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.info3DESHMAC.cipherKey0,
+ XLR_SEC_3DES_KEY_LENGTH);
+ print_buf("HMAC Key",
+ &desc->ctl_desc.cipherHashInfo.info3DESHMAC.hmacKey0,
+ sizeof(HMAC_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_3DES__MODE_ECB_CBC:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_3DES__MODE_ECB_CBC \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.info3DES.cipherKey0,
+ XLR_SEC_3DES_KEY_LENGTH);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_CTR_CFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_CTR_CFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128HMAC.cipherKey0,
+ XLR_SEC_AES128_KEY_LENGTH);
+ print_buf("HMAC Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128HMAC.hmacKey0,
+ sizeof(HMAC_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__MODE_CTR_CFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__MODE_CTR_CFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128.cipherKey0,
+ XLR_SEC_AES128_KEY_LENGTH);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_ECB_CBC_OFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_ECB_CBC_OFB\n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128HMAC.cipherKey0,
+ XLR_SEC_AES128_KEY_LENGTH);
+ print_buf("HMAC Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128HMAC.hmacKey0,
+ sizeof(HMAC_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__MODE_ECB_CBC_OFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__MODE_ECB_CBC_OFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128.cipherKey0,
+ XLR_SEC_AES128_KEY_LENGTH);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_CTR_CFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_CTR_CFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192HMAC.cipherKey0,
+ XLR_SEC_AES192_KEY_LENGTH);
+ print_buf("HMAC Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192HMAC.hmacKey0,
+ sizeof(HMAC_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__MODE_CTR_CFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__MODE_CTR_CFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192.cipherKey0,
+ XLR_SEC_AES192_KEY_LENGTH);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_ECB_CBC_OFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_ECB_CBC_OFB\n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192HMAC.cipherKey0,
+ XLR_SEC_AES192_KEY_LENGTH);
+ print_buf("HMAC Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192HMAC.hmacKey0,
+ sizeof(HMAC_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__MODE_ECB_CBC_OFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__MODE_ECB_CBC_OFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192.cipherKey0,
+ XLR_SEC_AES192_KEY_LENGTH);
+ break;
+
+ case XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_CTR_CFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_CTR_CFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256HMAC.cipherKey0,
+ XLR_SEC_AES256_KEY_LENGTH);
+ print_buf("HMAC Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256HMAC.hmacKey0,
+ sizeof(HMAC_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__MODE_CTR_CFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__MODE_CTR_CFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256.cipherKey0,
+ XLR_SEC_AES256_KEY_LENGTH);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_ECB_CBC_OFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_ECB_CBC_OFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256HMAC.cipherKey0,
+ XLR_SEC_AES256_KEY_LENGTH);
+ print_buf("HMAC Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256HMAC.hmacKey0,
+ sizeof(HMAC_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__MODE_ECB_CBC_OFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__MODE_ECB_CBC_OFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256.cipherKey0,
+ XLR_SEC_AES256_KEY_LENGTH);
+ break;
+ case XLR_SEC_VECTOR_CIPHER_ARC4__HMAC2:
+ DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_ARC4__HMAC2 \n");
+ print_buf("ARC4 Key",
+ &desc->ctl_desc.cipherHashInfo.infoARC4HMAC2.cipherKey0,
+ GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
+ print_buf("HMAC2 Key",
+ &desc->ctl_desc.cipherHashInfo.infoARC4HMAC2.hmacKey0,
+ sizeof(HMAC2_t));
+ break;
+ case XLR_SEC_VECTOR_CIPHER_ARC4__HMAC2__STATE:
+ DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_ARC4__HMAC2__STATE \n");
+ print_buf("ARC4 Key",
+ &desc->ctl_desc.cipherHashInfo.infoARC4StateHMAC2.cipherKey0,
+ GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
+ print_buf("HMAC2 Key",
+ &desc->ctl_desc.cipherHashInfo.infoARC4StateHMAC2.hmacKey0,
+ sizeof(HMAC2_t));
+ break;
+ case XLR_SEC_VECTOR_HMAC2:
+ DPRINT("VECTOR: XLR_SEC_VECTOR_HMAC2 \n");
+ print_buf("HMAC2 Key",
+ &desc->ctl_desc.cipherHashInfo.infoHMAC2.hmacKey0,
+ sizeof(HMAC2_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_DES__HMAC2__MODE_ECB_CBC:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_DES__HMAC2__MODE_ECB_CBC \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoDESHMAC2.cipherKey0,
+ XLR_SEC_DES_KEY_LENGTH);
+ print_buf("HMAC2 Key",
+ &desc->ctl_desc.cipherHashInfo.infoDESHMAC2.hmacKey0,
+ sizeof(HMAC2_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_3DES__HMAC2__MODE_ECB_CBC:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_3DES__HMAC2__MODE_ECB_CBC \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.info3DESHMAC2.cipherKey0,
+ XLR_SEC_3DES_KEY_LENGTH);
+ print_buf("HMAC2 Key",
+ &desc->ctl_desc.cipherHashInfo.info3DESHMAC2.hmacKey0,
+ sizeof(HMAC2_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_CTR_CFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_CTR_CFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128HMAC2.cipherKey0,
+ XLR_SEC_AES128_KEY_LENGTH);
+ print_buf("HMAC2 Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128HMAC2.hmacKey0,
+ sizeof(HMAC2_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_ECB_CBC_OFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_ECB_CBC_OFB\n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128HMAC2.cipherKey0,
+ XLR_SEC_AES128_KEY_LENGTH);
+ print_buf("HMAC2 Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128HMAC2.hmacKey0,
+ sizeof(HMAC2_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_CTR_CFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_CTR_CFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192HMAC2.cipherKey0,
+ XLR_SEC_AES192_KEY_LENGTH);
+ print_buf("HMAC2 Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192HMAC2.hmacKey0,
+ sizeof(HMAC2_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_ECB_CBC_OFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_ECB_CBC_OFB\n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192HMAC2.cipherKey0,
+ XLR_SEC_AES192_KEY_LENGTH);
+ print_buf("HMAC2 Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192HMAC2.hmacKey0,
+ sizeof(HMAC2_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_CTR_CFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_CTR_CFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256HMAC2.cipherKey0,
+ XLR_SEC_AES256_KEY_LENGTH);
+ print_buf("HMAC2 Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256HMAC2.hmacKey0,
+ sizeof(HMAC2_t));
+ break;
+
+ case XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_ECB_CBC_OFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_ECB_CBC_OFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256HMAC2.cipherKey0,
+ XLR_SEC_AES256_KEY_LENGTH);
+ print_buf("HMAC2 Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256HMAC2.hmacKey0,
+ sizeof(HMAC2_t));
+ break;
+ case XLR_SEC_VECTOR_CIPHER_ARC4__GCM:
+ DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_ARC4__GCM \n");
+ print_buf("ARC4 Key",
+ &desc->ctl_desc.cipherHashInfo.infoARC4GCM.cipherKey0,
+ GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
+ print_buf("GCM Key",
+ &desc->ctl_desc.cipherHashInfo.infoARC4GCM.GCMH0,
+ sizeof(GCM_t));
+ break;
+ case XLR_SEC_VECTOR_CIPHER_ARC4__GCM__STATE:
+ DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_ARC4__GCM__STATE \n");
+ print_buf("ARC4 Key",
+ &desc->ctl_desc.cipherHashInfo.infoARC4StateGCM.cipherKey0,
+ GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
+ print_buf("GCM Key",
+ &desc->ctl_desc.cipherHashInfo.infoARC4StateGCM.GCMH0,
+ sizeof(GCM_t));
+ break;
+ case XLR_SEC_VECTOR_GCM:
+ DPRINT("VECTOR: XLR_SEC_VECTOR_GCM \n");
+ print_buf("GCM Key",
+ &desc->ctl_desc.cipherHashInfo.infoGCM.GCMH0,
+ sizeof(GCM_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_DES__GCM__MODE_ECB_CBC:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_DES__GCM__MODE_ECB_CBC \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoDESGCM.cipherKey0,
+ XLR_SEC_DES_KEY_LENGTH);
+ print_buf("GCM Key",
+ &desc->ctl_desc.cipherHashInfo.infoDESGCM.GCMH0,
+ sizeof(GCM_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_3DES__GCM__MODE_ECB_CBC:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_3DES__GCM__MODE_ECB_CBC \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.info3DESGCM.cipherKey0,
+ XLR_SEC_3DES_KEY_LENGTH);
+ print_buf("GCM Key",
+ &desc->ctl_desc.cipherHashInfo.info3DESGCM.GCMH0,
+ sizeof(GCM_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_CTR_CFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_CTR_CFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128GCM.cipherKey0,
+ XLR_SEC_AES128_KEY_LENGTH);
+ print_buf("GCM Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128GCM.GCMH0,
+ XLR_SEC_AES128_KEY_LENGTH);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_ECB_CBC_OFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_ECB_CBC_OFB\n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128GCM.cipherKey0,
+ XLR_SEC_AES128_KEY_LENGTH);
+ print_buf("GCM Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128GCM.GCMH0,
+ XLR_SEC_AES128_KEY_LENGTH);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_CTR_CFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_CTR_CFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192GCM.cipherKey0,
+ XLR_SEC_AES192_KEY_LENGTH);
+ print_buf("GCM Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192GCM.GCMH0,
+ XLR_SEC_AES192_KEY_LENGTH);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_ECB_CBC_OFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_ECB_CBC_OFB\n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192GCM.cipherKey0,
+ XLR_SEC_AES192_KEY_LENGTH);
+ print_buf("GCM Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192GCM.GCMH0,
+ XLR_SEC_AES192_KEY_LENGTH);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_CTR_CFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_CTR_CFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256GCM.cipherKey0,
+ XLR_SEC_AES256_KEY_LENGTH);
+ print_buf("GCM Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256GCM.GCMH0,
+ XLR_SEC_AES256_KEY_LENGTH);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_ECB_CBC_OFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_ECB_CBC_OFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256GCM.cipherKey0,
+ XLR_SEC_AES256_KEY_LENGTH);
+ print_buf("GCM Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256GCM.GCMH0,
+ XLR_SEC_AES256_KEY_LENGTH);
+ break;
+ case XLR_SEC_VECTOR_CIPHER_ARC4__F9:
+ DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_ARC4__F9 \n");
+ print_buf("ARC4 Key",
+ &desc->ctl_desc.cipherHashInfo.infoARC4F9.cipherKey0,
+ GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
+ print_buf("F9 Key",
+ &desc->ctl_desc.cipherHashInfo.infoARC4F9.authKey0,
+ sizeof(F9_t));
+ break;
+ case XLR_SEC_VECTOR_CIPHER_ARC4__F9__STATE:
+ DPRINT("VECTOR: XLR_SEC_VECTOR_CIPHER_ARC4__F9__STATE \n");
+ print_buf("ARC4 Key",
+ &desc->ctl_desc.cipherHashInfo.infoARC4StateF9.cipherKey0,
+ GET_FIELD(word, CTL_DSC_ARC4_KEYLEN));
+ print_buf("F9 Key",
+ &desc->ctl_desc.cipherHashInfo.infoARC4StateF9.authKey0,
+ sizeof(F9_t));
+ break;
+ case XLR_SEC_VECTOR_F9:
+ DPRINT("VECTOR: XLR_SEC_VECTOR_F9 \n");
+ print_buf("F9 Key",
+ &desc->ctl_desc.cipherHashInfo.infoF9.authKey0,
+ sizeof(F9_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_DES__F9__MODE_ECB_CBC:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_DES__F9__MODE_ECB_CBC \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoDESF9.cipherKey0,
+ XLR_SEC_DES_KEY_LENGTH);
+ print_buf("F9 Key",
+ &desc->ctl_desc.cipherHashInfo.infoDESF9.authKey0,
+ sizeof(F9_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_3DES__F9__MODE_ECB_CBC:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_3DES__F9__MODE_ECB_CBC \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.info3DESF9.cipherKey0,
+ XLR_SEC_3DES_KEY_LENGTH);
+ print_buf("F9 Key",
+ &desc->ctl_desc.cipherHashInfo.info3DESF9.authKey0,
+ sizeof(F9_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_CTR_CFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_CTR_CFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128F9.cipherKey0,
+ XLR_SEC_AES128_KEY_LENGTH);
+ print_buf("F9 Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128F9.authKey0,
+ sizeof(F9_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_ECB_CBC_OFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_ECB_CBC_OFB\n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128F9.cipherKey0,
+ XLR_SEC_AES128_KEY_LENGTH);
+ print_buf("F9 Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128F9.authKey0,
+ sizeof(F9_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_CTR_CFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_CTR_CFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192F9.cipherKey0,
+ XLR_SEC_AES192_KEY_LENGTH);
+ print_buf("F9 Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192F9.authKey0,
+ sizeof(F9_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_ECB_CBC_OFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_ECB_CBC_OFB\n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192F9.cipherKey0,
+ XLR_SEC_AES192_KEY_LENGTH);
+ print_buf("F9 Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192F9.authKey0,
+ sizeof(F9_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_CTR_CFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_CTR_CFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256F9.cipherKey0,
+ XLR_SEC_AES256_KEY_LENGTH);
+ print_buf("F9 Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256F9.authKey0,
+ sizeof(F9_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_ECB_CBC_OFB:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_ECB_CBC_OFB \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256F9.cipherKey0,
+ XLR_SEC_AES256_KEY_LENGTH);
+ print_buf("F9 Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256F9.authKey0,
+ sizeof(F9_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_F8:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__HMAC__MODE_F8 \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128F8HMAC.cipherKey0,
+ XLR_SEC_AES128F8_KEY_LENGTH);
+ print_buf("HMAC Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128F8HMAC.hmacKey0,
+ sizeof(HMAC_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__MODE_F8:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__MODE_F8 \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128F8.cipherKey0,
+ XLR_SEC_AES128F8_KEY_LENGTH);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_F8:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__HMAC__MODE_F8 \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192F8HMAC.cipherKey0,
+ XLR_SEC_AES192F8_KEY_LENGTH);
+ print_buf("HMAC Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192F8HMAC.hmacKey0,
+ sizeof(HMAC_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__MODE_F8:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__MODE_F8 \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192F8.cipherKey0,
+ XLR_SEC_AES192F8_KEY_LENGTH);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_F8:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__HMAC__MODE_F8 \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256F8HMAC.cipherKey0,
+ XLR_SEC_AES256F8_KEY_LENGTH);
+ print_buf("HMAC Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256HMAC.hmacKey0,
+ sizeof(HMAC_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__MODE_F8:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__MODE_F8 \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256F8.cipherKey0,
+ XLR_SEC_AES256F8_KEY_LENGTH);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_F8:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__HMAC2__MODE_F8 \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128F8HMAC2.cipherKey0,
+ XLR_SEC_AES128F8_KEY_LENGTH);
+ print_buf("HMAC2 Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128F8HMAC2.hmacKey0,
+ sizeof(HMAC2_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_F8:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__HMAC2__MODE_F8 \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192F8HMAC2.cipherKey0,
+ XLR_SEC_AES192F8_KEY_LENGTH);
+ print_buf("HMAC2 Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192F8HMAC2.hmacKey0,
+ sizeof(HMAC2_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_F8:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__HMAC2__MODE_F8 \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256F8HMAC2.cipherKey0,
+ XLR_SEC_AES256F8_KEY_LENGTH);
+ print_buf("HMAC2 Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256F8HMAC2.hmacKey0,
+ sizeof(HMAC2_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_F8:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__GCM__MODE_F8 \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128F8GCM.cipherKey0,
+ XLR_SEC_AES128F8_KEY_LENGTH);
+ print_buf("GCM Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128GCM.GCMH0,
+ XLR_SEC_AES128_KEY_LENGTH);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_F8:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__GCM__MODE_F8 \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192F8GCM.cipherKey0,
+ XLR_SEC_AES192_KEY_LENGTH);
+ print_buf("GCM Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192F8GCM.GCMH0,
+ XLR_SEC_AES192_KEY_LENGTH);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_F8:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__GCM__MODE_F8 \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256F8GCM.cipherKey0,
+ XLR_SEC_AES256F8_KEY_LENGTH);
+ print_buf("GCM Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256F8GCM.GCMH0,
+ XLR_SEC_AES256_KEY_LENGTH);
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_F8:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES128__F9__MODE_F8 \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128F8F9.cipherKey0,
+ XLR_SEC_AES128F8_KEY_LENGTH);
+ print_buf("F9 Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES128F8F9.authKey0,
+ sizeof(F9_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_F8:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES192__F9__MODE_F8 \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192F8F9.cipherKey0,
+ XLR_SEC_AES192F8_KEY_LENGTH);
+ print_buf("F9 Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES192F8F9.authKey0,
+ sizeof(F9_t));
+ break;
+ case XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_F8:
+ DPRINT("VECTOR: XLR_SEC_VECTOR__CIPHER_AES256__F9__MODE_F8 \n");
+ print_buf("CIPHER Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256F8F9.cipherKey0,
+ XLR_SEC_AES256F8_KEY_LENGTH);
+ print_buf("F9 Key",
+ &desc->ctl_desc.cipherHashInfo.infoAES256F8F9.authKey0,
+ sizeof(F9_t));
+ break;
+
+ default:
+ DPRINT("VECTOR: ???? \n");
+ DPRINT(">>> WHAT THE HECK !!! <<< \n");
+ break;
+ }
+ DPRINT("PACKET DESCRIPTOR: \n");
+ word = desc->pkt_desc.srcLengthIVOffUseIVNext;
+ DPRINT("\tSrcLengthIVOffsetIVNext: %llx\n", word);
+ DPRINT("\t\tLoad HMAC = %lld \n",
+ GET_FIELD(word, PKT_DSC_LOADHMACKEY));
+ DPRINT("\t\tPad Hash = %lld \n",
+ GET_FIELD(word, PKT_DSC_PADHASH));
+ DPRINT("\t\tHash Byte Count = %lld \n",
+ GET_FIELD(word, PKT_DSC_HASHBYTES));
+ DPRINT("\t\tNext = %lld \n",
+ GET_FIELD(word, PKT_DSC_NEXT));
+ DPRINT("\t\tUse IV = %lld \n",
+ GET_FIELD(word, PKT_DSC_IV));
+ DPRINT("\t\tIV Offset = %lld \n",
+ GET_FIELD(word, PKT_DSC_IVOFF));
+ DPRINT("\t\tPacket Length = %lld \n",
+ GET_FIELD(word, PKT_DSC_PKTLEN));
+ DPRINT("\t\tNLHMAC = %lld \n", GET_FIELD(word, PKT_DSC_NLHMAC));
+ DPRINT("\t\tBreak = %lld \n", GET_FIELD(word, PKT_DSC_BREAK));
+ DPRINT("\t\tWait = %lld \n", GET_FIELD(word, PKT_DSC_WAIT));
+ DPRINT("\t\tSegment Src Addr = %llx \n",
+ (GET_FIELD(word, PKT_DSC_SEGADDR) << 5) & 0xffffffffffULL);
+ DPRINT("\t\tSRTCP = %lld \n", GET_FIELD(word, PKT_DSC_SRTCP));
+ DPRINT("\t\tGlobal Src Offset = %lld \n",
+ GET_FIELD(word, PKT_DSC_SEGOFFSET));
+
+ word = desc->pkt_desc.dstDataSettings;
+ DPRINT("\tdstDataSettings: %llx \n", word);
+ DPRINT("\t\tArc4 Byte Count = %lld \n", GET_FIELD(word,
+ PKT_DSC_ARC4BYTECOUNT));
+ DPRINT("\t\tSym Operation = %lld \n", GET_FIELD(word, PKT_DSC_SYM_OP));
+ DPRINT("\t\tCipher Offset = %lld \n", GET_FIELD(word, PKT_DSC_CPHROFF));
+ DPRINT("\t\tHash Offset = %lld \n", GET_FIELD(word, PKT_DSC_HASHOFF));
+ DPRINT("\t\tHash Source = %lld \n", GET_FIELD(word, PKT_DSC_HASHSRC));
+ DPRINT("\t\tChecksum Offset = %lld \n", GET_FIELD(word,
+ PKT_DSC_CKSUMOFF));
+ DPRINT("\t\tChecksum Source = %lld \n", GET_FIELD(word,
+ PKT_DSC_CKSUMSRC));
+ DPRINT("\t\tCipher Dest Addr = %llx \n", GET_FIELD(word,
+ PKT_DSC_CPHR_DST_ADDR));
+ DPRINT("\t\tCipher Dest Dword = %lld \n", GET_FIELD(word,
+ PKT_DSC_CPHR_DST_DWOFFSET));
+ DPRINT("\t\tCipher Dest Offset= %lld \n", GET_FIELD(word,
+ PKT_DSC_CPHR_DST_OFFSET));
+ word = desc->pkt_desc.authDstNonceLow;
+ DPRINT("\tauthDstNonceLow: %llx \n", word);
+ DPRINT("\t\tNonce Low 24 = %lld \n", GET_FIELD(word,
+ PKT_DSC_NONCE_LOW));
+ DPRINT("\t\tauthDst = %llx \n", GET_FIELD(word,
+ PKT_DSC_AUTH_DST_ADDR));
+ DPRINT("\t\tCipher Offset High= %lld \n", GET_FIELD(word,
+ PKT_DSC_CIPH_OFF_HI));
+ word = desc->pkt_desc.ckSumDstNonceHiCFBMaskLLWMask;
+ DPRINT("\tckSumDstNonceHiCFBMaskLLWMask: %llx \n", word);
+ DPRINT("\t\tHash Byte off = %lld \n", GET_FIELD(word, PKT_DSC_HASH_BYTE_OFF));
+ DPRINT("\t\tPacket Len bytes = %lld \n", GET_FIELD(word, PKT_DSC_PKTLEN_BYTES));
+ DPRINT("\t\tLast Long Word Mask = %lld \n", GET_FIELD(word,
+ PKT_DSC_LASTWORD));
+ DPRINT("\t\tCipher Dst Address = %llx \n", GET_FIELD(word,
+ PKT_DSC_CPHR_DST_ADDR));
+ DPRINT("\t\tGlobal Dst Offset = %lld \n", GET_FIELD(word,
+ PKT_DSC_CPHR_DST_OFFSET));
+
+ DPRINT("CFG_VECTOR = %04x\n", cfg_vector);
+ DPRINT("\n\n");
}
+
#endif
/* This function is called from an interrupt handler */
-void xlr_sec_msgring_handler(int bucket, int size, int code, int stid,
- struct msgrng_msg *msg, void *data)
+void
+xlr_sec_msgring_handler(int bucket, int size, int code, int stid,
+ struct msgrng_msg *msg, void *data)
{
- uint64_t error;
- uint64_t addr, sec_eng, sec_pipe;
- xlr_sec_io_pt op = NULL;
- symkey_desc_pt desc=NULL;
- struct xlr_sec_session *ses =NULL;
- struct xlr_sec_command* cmd=NULL;
-
-
- if (code != MSGRNG_CODE_SEC) {
- panic("xlr_sec_msgring_handler: bad code = %d,"
- " expected code = %d\n",
- code, MSGRNG_CODE_SEC);
- }
-
-
- if ((stid < MSGRNG_STNID_SEC0) || (stid > MSGRNG_STNID_PK0)) {
- panic("xlr_sec_msgring_handler: bad stn id = %d, expect %d - %d\n",
- stid, MSGRNG_STNID_SEC0, MSGRNG_STNID_PK0);
- }
-
-
- /*
- * The Submit() operation encodes the engine and pipe in these two
- * separate fields. This allows use to verify the result type with
- * the submitted operation type.
- */
- sec_eng = GET_FIELD(msg->msg0, MSG_CTL_OP_TYPE);
- sec_pipe = GET_FIELD(msg->msg1, MSG_CTL_OP_TYPE);
-
-
- error = msg->msg0 >>40 & 0x1ff ;
- if(error) printf("ctrl error = 0x%llx\n", error);
- error = msg->msg1 >>40 & 0x1ff ;
- if(error) printf("data error = 0x%llx\n", error);
-
-
- XLR_SEC_CMD_DIAG("[%s]: eng=%lld pipe=%lld\n",
- __FUNCTION__, sec_eng, sec_pipe);
-
- /* Symmetric Key Operation ? */
- if (sec_eng == MSG0_CTL_OP_ENGINE_SYMKEY) {
-
- /*
- * The data descriptor address allows us to associate the response
- * with the submitted operation.
- * Address is 40-bit cacheline aligned address.
- * We need to zero bit 0-4 since they are used for the
- * engine and pipe Id.
- */
- addr = GET_FIELD(msg->msg1, MSG_RSLT_DATA_DSC_ADDR);
-
- addr = addr & ~((1 << 5) - 1);
- if (!addr) {
- panic("[%s:STNID_SEC]: NULL symkey addr!\n", __FUNCTION__);
-
- }
-
-
- /*
- * The adddress points to the data descriptor.
- * The operation descriptor is defined with the 32-byte cacheline
- * size in mind. It allows the code to use this address to reference
- * the symkey descriptor. (ref: xlr_sec_desc.h)
- */
- addr = addr - sizeof(OperationDescriptor_t);
- desc = (symkey_desc_pt) MIPS_PHYS_TO_KSEG0(addr);
-
- if (!desc) {
- printf("\nerror : not getting desc back correctly \n");
- panic("[%s:STNID_SEC]: NULL symkey data descriptor!\n", __FUNCTION__);
- }
-
- ses = (struct xlr_sec_session* ) desc->ses;
- if (!ses) {
- printf("\n error : not getting ses back correctly \n");
- panic("[%s:STNID_SEC]: NULL symkey data descriptor!\n", __FUNCTION__);
- }
-
- cmd = &ses->cmd;
- if (!cmd) {
- printf("\n error : not getting cmd back correctly \n");
- panic("[%s:STNID_SEC]: NULL symkey data descriptor!\n", __FUNCTION__);
- }
-
- op = &cmd->op;
- if (!op) {
- printf("\n error : not getting op back correctly \n");
- panic("[%s:STNID_SEC]: NULL symkey data descriptor!\n", __FUNCTION__);
- }
-
-
-
- XLR_SEC_CMD_DIAG("[%s:STNID_SEC]: addr=0x%llx desc=%p alloc=%p \n",
- __FUNCTION__, addr, desc, desc->alloc);
-
- XLR_SEC_CMD_DIAG("[%s:STNID_SEC]: op_ctl=%p phys_self=%llx stn_id=%d \n",
- __FUNCTION__, &desc->op_ctl, desc->op_ctl.phys_self,
- desc->op_ctl.stn_id);
-
- if (addr != desc->op_ctl.phys_self) {
- XLR_SEC_CMD_DIAG("[%s:STNID_SEC]: Control Descriptor fails Self-Verify !\n",
- __FUNCTION__);
- printf("[%s:STNID_SEC]: Control Descriptor fails Self-Verify !\n",
- __FUNCTION__);
- printf("[%s:STNID_SEC]: addr=0x%llx desc=%p alloc=%p \n",
- __FUNCTION__, (unsigned long long)addr, desc, desc->alloc);
- printf("[%s:STNID_SEC]: op_ctl=%p phys_self=%llx stn_id=%d \n",
- __FUNCTION__, &desc->op_ctl, (unsigned long long)desc->op_ctl.phys_self,
- desc->op_ctl.stn_id);
-
- }
-
- if (desc->op_ctl.stn_id != MSGRNG_STNID_SEC0 &&
- desc->op_ctl.stn_id != MSGRNG_STNID_SEC1) {
- XLR_SEC_CMD_DIAG("[%s:STNID_SEC]: Operation Type Mismatch !\n",
- __FUNCTION__);
- printf("[%s:STNID_SEC]: Operation Type Mismatch !\n",
- __FUNCTION__);
- printf("[%s:STNID_SEC]: addr=0x%llx desc=%p alloc=%p \n",
- __FUNCTION__, (unsigned long long)addr, desc, desc->alloc);
- printf("[%s:STNID_SEC]: op_ctl=%p phys_self=%llx stn_id=%d \n",
- __FUNCTION__, &desc->op_ctl, (unsigned long long)desc->op_ctl.phys_self,
- desc->op_ctl.stn_id);
- }
-
- desc->ctl_result = GET_FIELD(msg->msg0, MSG_RSLT_CTL_INST_ERR);
- desc->data_result = GET_FIELD(msg->msg1, MSG_RSLT_DATA_INST_ERR);
-
- XLR_SEC_CMD_DIAG("[%s:STNID_SEC]: cpu=%d ctl_result=0x%llx data_result=%llx\n",
- __FUNCTION__, desc->op_ctl.cpu,
- desc->ctl_result, desc->data_result);
-
- }
+ uint64_t error;
+ uint64_t addr, sec_eng, sec_pipe;
+ xlr_sec_io_pt op = NULL;
+ symkey_desc_pt desc = NULL;
+ struct xlr_sec_session *ses = NULL;
+ struct xlr_sec_command *cmd = NULL;
+
+
+ if (code != MSGRNG_CODE_SEC) {
+ panic("xlr_sec_msgring_handler: bad code = %d,"
+ " expected code = %d\n",
+ code, MSGRNG_CODE_SEC);
+ }
+ if ((stid < MSGRNG_STNID_SEC0) || (stid > MSGRNG_STNID_PK0)) {
+ panic("xlr_sec_msgring_handler: bad stn id = %d, expect %d - %d\n",
+ stid, MSGRNG_STNID_SEC0, MSGRNG_STNID_PK0);
+ }
+ /*
+ * The Submit() operation encodes the engine and pipe in these two
+ * separate fields. This allows use to verify the result type with
+ * the submitted operation type.
+ */
+ sec_eng = GET_FIELD(msg->msg0, MSG_CTL_OP_TYPE);
+ sec_pipe = GET_FIELD(msg->msg1, MSG_CTL_OP_TYPE);
+
+
+ error = msg->msg0 >> 40 & 0x1ff;
+ if (error)
+ printf("ctrl error = 0x%llx\n", error);
+ error = msg->msg1 >> 40 & 0x1ff;
+ if (error)
+ printf("data error = 0x%llx\n", error);
+
+
+ XLR_SEC_CMD_DIAG("[%s]: eng=%lld pipe=%lld\n",
+ __FUNCTION__, sec_eng, sec_pipe);
+
+ /* Symmetric Key Operation ? */
+ if (sec_eng == MSG0_CTL_OP_ENGINE_SYMKEY) {
+
+ /*
+ * The data descriptor address allows us to associate the
+ * response with the submitted operation. Address is 40-bit
+ * cacheline aligned address. We need to zero bit 0-4 since
+ * they are used for the engine and pipe Id.
+ */
+ addr = GET_FIELD(msg->msg1, MSG_RSLT_DATA_DSC_ADDR);
+
+ addr = addr & ~((1 << 5) - 1);
+ if (!addr) {
+ panic("[%s:STNID_SEC]: NULL symkey addr!\n", __FUNCTION__);
+
+ }
+ /*
+ * The adddress points to the data descriptor. The operation
+ * descriptor is defined with the 32-byte cacheline size in
+ * mind. It allows the code to use this address to
+ * reference the symkey descriptor. (ref: xlr_sec_desc.h)
+ */
+ addr = addr - sizeof(OperationDescriptor_t);
+ desc = (symkey_desc_pt) MIPS_PHYS_TO_KSEG0(addr);
+
+ if (!desc) {
+ printf("\nerror : not getting desc back correctly \n");
+ panic("[%s:STNID_SEC]: NULL symkey data descriptor!\n", __FUNCTION__);
+ }
+ ses = (struct xlr_sec_session *)desc->ses;
+ if (!ses) {
+ printf("\n error : not getting ses back correctly \n");
+ panic("[%s:STNID_SEC]: NULL symkey data descriptor!\n", __FUNCTION__);
+ }
+ cmd = &ses->cmd;
+ if (!cmd) {
+ printf("\n error : not getting cmd back correctly \n");
+ panic("[%s:STNID_SEC]: NULL symkey data descriptor!\n", __FUNCTION__);
+ }
+ op = &cmd->op;
+ if (!op) {
+ printf("\n error : not getting op back correctly \n");
+ panic("[%s:STNID_SEC]: NULL symkey data descriptor!\n", __FUNCTION__);
+ }
+ XLR_SEC_CMD_DIAG("[%s:STNID_SEC]: addr=0x%llx desc=%p alloc=%p \n",
+ __FUNCTION__, addr, desc, desc->alloc);
+
+ XLR_SEC_CMD_DIAG("[%s:STNID_SEC]: op_ctl=%p phys_self=%llx stn_id=%d \n",
+ __FUNCTION__, &desc->op_ctl, desc->op_ctl.phys_self,
+ desc->op_ctl.stn_id);
+
+ if (addr != desc->op_ctl.phys_self) {
+ XLR_SEC_CMD_DIAG("[%s:STNID_SEC]: Control Descriptor fails Self-Verify !\n",
+ __FUNCTION__);
+ printf("[%s:STNID_SEC]: Control Descriptor fails Self-Verify !\n",
+ __FUNCTION__);
+ printf("[%s:STNID_SEC]: addr=0x%llx desc=%p alloc=%p \n",
+ __FUNCTION__, (unsigned long long)addr, desc, desc->alloc);
+ printf("[%s:STNID_SEC]: op_ctl=%p phys_self=%llx stn_id=%d \n",
+ __FUNCTION__, &desc->op_ctl, (unsigned long long)desc->op_ctl.phys_self,
+ desc->op_ctl.stn_id);
+
+ }
+ if (desc->op_ctl.stn_id != MSGRNG_STNID_SEC0 &&
+ desc->op_ctl.stn_id != MSGRNG_STNID_SEC1) {
+ XLR_SEC_CMD_DIAG("[%s:STNID_SEC]: Operation Type Mismatch !\n",
+ __FUNCTION__);
+ printf("[%s:STNID_SEC]: Operation Type Mismatch !\n",
+ __FUNCTION__);
+ printf("[%s:STNID_SEC]: addr=0x%llx desc=%p alloc=%p \n",
+ __FUNCTION__, (unsigned long long)addr, desc, desc->alloc);
+ printf("[%s:STNID_SEC]: op_ctl=%p phys_self=%llx stn_id=%d \n",
+ __FUNCTION__, &desc->op_ctl, (unsigned long long)desc->op_ctl.phys_self,
+ desc->op_ctl.stn_id);
+ }
+ desc->ctl_result = GET_FIELD(msg->msg0, MSG_RSLT_CTL_INST_ERR);
+ desc->data_result = GET_FIELD(msg->msg1, MSG_RSLT_DATA_INST_ERR);
+
+ XLR_SEC_CMD_DIAG("[%s:STNID_SEC]: cpu=%d ctl_result=0x%llx data_result=%llx\n",
+ __FUNCTION__, desc->op_ctl.cpu,
+ desc->ctl_result, desc->data_result);
+
+ }
#if 0
- else if (sec_eng == MSG0_CTL_OP_ENGINE_PUBKEY) {
- pubkey_desc_pt desc;
-
- if (sec_pipe != MSG1_CTL_OP_PUBKEY_PIPE0) {
- /* response to uc load */
- /*
- XLR_SEC_CMD_DIAG("[%s:STNID_SEC]: ecc cpu=%d ctl_result=0x%llx data_result=%llx\n",
- __FUNCTION__, desc->op_ctl.cpu,
- desc->ctl_result, desc->data_result);
- */
- return;
- }
- /*
- * The data descriptor address allows us to associate the response
- * with the submitted operation.
- * Address is 40-bit cacheline aligned address.
- * We need to zero bit 0-4 since they are used for the
- * engine and pipe Id.
- */
- addr = GET_FIELD(msg->msg0, PUBKEY_RSLT_CTL_SRCADDR);
- addr = addr & ~((1 << 5) - 1);
- if (!addr) {
- panic("[%s:STNID_SEC]: NULL pubkey ctrl desc!\n", __FUNCTION__);
- }
-
- /*
- * The adddress points to the data descriptor.
- * The operation descriptor is defined with the 32-byte cacheline
- * size in mind. It allows the code to use this address to reference
- * the symkey descriptor. (ref: xlr_sec_desc.h)
- */
- addr = addr - sizeof(OperationDescriptor_t);
-
- /* Get pointer to pubkey Descriptor */
- desc = (pubkey_desc_pt)(unsigned long) addr ;
- if (!desc) {
- panic("[%s:STNID_SEC]: NULL pubkey data descriptor!\n", __FUNCTION__);
- }
-
- XLR_SEC_CMD_DIAG("[%s:STNID_PK0]: addr=0x%llx desc=%p alloc=%p \n",
- __FUNCTION__, addr, desc, desc->alloc);
-
- XLR_SEC_CMD_DIAG("[%s:STNID_PK0]: op_ctl=%p phys_self=%llx stn_id=%d \n",
- __FUNCTION__, &desc->op_ctl, desc->op_ctl.phys_self,
- desc->op_ctl.stn_id);
-
- if (addr != desc->op_ctl.phys_self) {
- XLR_SEC_CMD_DIAG("[%s:STNID_PK0]: Control Descriptor fails Self-Verify !\n",
- __FUNCTION__);
- }
-
-
- if (desc->op_ctl.stn_id != msgrng_stnid_pk0) {
- XLR_SEC_CMD_DIAG("[%s:STNID_PK0]: Operation Type Mismatch ! \n",
- __FUNCTION__);
- }
-
- desc->ctl_result = GET_FIELD(msg->msg0, PUBKEY_RSLT_CTL_ERROR);
- desc->data_result = GET_FIELD(msg->msg1, PUBKEY_RSLT_DATA_ERROR);
-
- XLR_SEC_CMD_DIAG("[%s:STNID_PK0]: ctl_result=0x%llx data_result=%llx\n",
- __FUNCTION__, desc->ctl_result, desc->data_result);
-
- }
+ else if (sec_eng == MSG0_CTL_OP_ENGINE_PUBKEY) {
+ pubkey_desc_pt desc;
+
+ if (sec_pipe != MSG1_CTL_OP_PUBKEY_PIPE0) {
+ /* response to uc load */
+ /*
+ * XLR_SEC_CMD_DIAG("[%s:STNID_SEC]: ecc cpu=%d
+ * ctl_result=0x%llx data_result=%llx\n",
+ * __FUNCTION__, desc->op_ctl.cpu, desc->ctl_result,
+ * desc->data_result);
+ */
+ return;
+ }
+ /*
+ * The data descriptor address allows us to associate the
+ * response with the submitted operation. Address is 40-bit
+ * cacheline aligned address. We need to zero bit 0-4 since
+ * they are used for the engine and pipe Id.
+ */
+ addr = GET_FIELD(msg->msg0, PUBKEY_RSLT_CTL_SRCADDR);
+ addr = addr & ~((1 << 5) - 1);
+ if (!addr) {
+ panic("[%s:STNID_SEC]: NULL pubkey ctrl desc!\n", __FUNCTION__);
+ }
+ /*
+ * The adddress points to the data descriptor. The operation
+ * descriptor is defined with the 32-byte cacheline size in
+ * mind. It allows the code to use this address to
+ * reference the symkey descriptor. (ref: xlr_sec_desc.h)
+ */
+ addr = addr - sizeof(OperationDescriptor_t);
+
+ /* Get pointer to pubkey Descriptor */
+ desc = (pubkey_desc_pt) (unsigned long)addr;
+ if (!desc) {
+ panic("[%s:STNID_SEC]: NULL pubkey data descriptor!\n", __FUNCTION__);
+ }
+ XLR_SEC_CMD_DIAG("[%s:STNID_PK0]: addr=0x%llx desc=%p alloc=%p \n",
+ __FUNCTION__, addr, desc, desc->alloc);
+
+ XLR_SEC_CMD_DIAG("[%s:STNID_PK0]: op_ctl=%p phys_self=%llx stn_id=%d \n",
+ __FUNCTION__, &desc->op_ctl, desc->op_ctl.phys_self,
+ desc->op_ctl.stn_id);
+
+ if (addr != desc->op_ctl.phys_self) {
+ XLR_SEC_CMD_DIAG("[%s:STNID_PK0]: Control Descriptor fails Self-Verify !\n",
+ __FUNCTION__);
+ }
+ if (desc->op_ctl.stn_id != msgrng_stnid_pk0) {
+ XLR_SEC_CMD_DIAG("[%s:STNID_PK0]: Operation Type Mismatch ! \n",
+ __FUNCTION__);
+ }
+ desc->ctl_result = GET_FIELD(msg->msg0, PUBKEY_RSLT_CTL_ERROR);
+ desc->data_result = GET_FIELD(msg->msg1, PUBKEY_RSLT_DATA_ERROR);
+
+ XLR_SEC_CMD_DIAG("[%s:STNID_PK0]: ctl_result=0x%llx data_result=%llx\n",
+ __FUNCTION__, desc->ctl_result, desc->data_result);
+
+ }
#endif
- else {
- printf("[%s]: HANDLER bad id = %d\n", __FUNCTION__, stid);
- }
+ else {
+ printf("[%s]: HANDLER bad id = %d\n", __FUNCTION__, stid);
+ }
#ifdef RMI_SEC_DEBUG
- if(ses->multi_frag_flag){
- int i;
- char *ptr;
- printf("\n RETURNED DATA: \n");
-
- ptr = (char*) (unsigned long)(desc->user.aligned_dest+cmd->op.cipher_offset) ;
- for(i = 0; i< SEC_MAX_FRAG_LEN ; i++){
- printf("%c ",(char) *ptr++);
- if((i%10) == 0) printf("\n");
- }
-
- printf("second desc\n");
- ptr = (char*) (unsigned long)(desc->next_dest_buf) ;
- for(i = 0; i< desc->next_src_len; i++){
- printf("%c ",(char) *ptr++);
- if((i%10) == 0) printf("\n");
- }
- }
+ if (ses->multi_frag_flag) {
+ int i;
+ char *ptr;
+
+ printf("\n RETURNED DATA: \n");
+
+ ptr = (char *)(unsigned long)(desc->user.aligned_dest + cmd->op.cipher_offset);
+ for (i = 0; i < SEC_MAX_FRAG_LEN; i++) {
+ printf("%c ", (char)*ptr++);
+ if ((i % 10) == 0)
+ printf("\n");
+ }
+
+ printf("second desc\n");
+ ptr = (char *)(unsigned long)(desc->next_dest_buf);
+ for (i = 0; i < desc->next_src_len; i++) {
+ printf("%c ", (char)*ptr++);
+ if ((i % 10) == 0)
+ printf("\n");
+ }
+ }
#endif
- /* Copy cipher-data to User-space */
- if (op->cipher_type != XLR_SEC_CIPHER_TYPE_NONE) {
-
- size = op->dest_buf_size;
-
- /* DEBUG -dpk */
- XLR_SEC_CMD_DIAG("cipher: to_addr=%p from_addr=%p size=%d \n",
- desc->user.user_dest, desc->user.aligned_dest, size);
-
- if(ses->multi_frag_flag){
- crypto_copyback(cmd->crp->crp_flags, cmd->crp->crp_buf, 0,
- SEC_MAX_FRAG_LEN, (caddr_t)(long)desc->user.aligned_dest+op->cipher_offset);
- crypto_copyback(cmd->crp->crp_flags, cmd->crp->crp_buf+SEC_MAX_FRAG_LEN, 0,
- desc->next_src_len, (caddr_t)(long)desc->next_dest_buf);
- crypto_done(cmd->crp);
- }
- else{
- crypto_copyback(cmd->crp->crp_flags, cmd->crp->crp_buf, 0,
- cmd->op.dest_buf_size, (caddr_t)(long)desc->user.aligned_dest+op->cipher_offset);
- crypto_done(cmd->crp);
-
- }
-
-
- }
-
-
- /* Copy digest to User-space */
- if (op->digest_type != XLR_SEC_DIGEST_TYPE_NONE) {
-
- int offset = 0;
- switch (op->digest_type) {
- case XLR_SEC_DIGEST_TYPE_MD5:
- size = XLR_SEC_MD5_LENGTH;
- break;
- case XLR_SEC_DIGEST_TYPE_SHA1:
- size = XLR_SEC_SHA1_LENGTH;
- break;
- case XLR_SEC_DIGEST_TYPE_SHA256:
- size = XLR_SEC_SHA256_LENGTH;
- break;
- case XLR_SEC_DIGEST_TYPE_SHA384:
- size = XLR_SEC_SHA384_LENGTH;
- break;
- case XLR_SEC_DIGEST_TYPE_SHA512:
- size = XLR_SEC_SHA512_LENGTH;
- break;
- case XLR_SEC_DIGEST_TYPE_GCM:
- size = XLR_SEC_GCM_LENGTH;
- break;
- case XLR_SEC_DIGEST_TYPE_KASUMI_F9:
- offset = 4;
- size = XLR_SEC_KASUMI_F9_RESULT_LENGTH;
- break;
- default:
- size = 0;
- }
-
- XLR_SEC_CMD_DIAG("digest: to_addr=%p from_addr=%p size=%d \n",
- desc->user.user_auth, desc->user.aligned_auth, size);
- memcpy(desc->user.user_auth, desc->user.aligned_auth + offset,size);
- op->auth_dest = (uint64_t)(unsigned long)desc->user.user_auth;
- }
-
-
- if (op->cipher_type == XLR_SEC_CIPHER_TYPE_ARC4 &&
- op->rc4_savestate) {
-
- size = XLR_SEC_MAX_RC4_STATE_SIZE;
-
- XLR_SEC_CMD_DIAG("state: to_addr=%p from_addr=%p size=%d \n",
- desc->user.user_state, desc->user.aligned_state, size);
- op->rc4_state = (uint64_t)(unsigned long)desc->user.user_state;
- }
-
- return;
-}
+ /* Copy cipher-data to User-space */
+ if (op->cipher_type != XLR_SEC_CIPHER_TYPE_NONE) {
+
+ size = op->dest_buf_size;
+
+ /* DEBUG -dpk */
+ XLR_SEC_CMD_DIAG("cipher: to_addr=%p from_addr=%p size=%d \n",
+ desc->user.user_dest, desc->user.aligned_dest, size);
+ if (ses->multi_frag_flag) {
+ crypto_copyback(cmd->crp->crp_flags, cmd->crp->crp_buf, 0,
+ SEC_MAX_FRAG_LEN, (caddr_t)(long)desc->user.aligned_dest + op->cipher_offset);
+ crypto_copyback(cmd->crp->crp_flags, cmd->crp->crp_buf + SEC_MAX_FRAG_LEN, 0,
+ desc->next_src_len, (caddr_t)(long)desc->next_dest_buf);
+ crypto_done(cmd->crp);
+ } else {
+ crypto_copyback(cmd->crp->crp_flags, cmd->crp->crp_buf, 0,
+ cmd->op.dest_buf_size, (caddr_t)(long)desc->user.aligned_dest + op->cipher_offset);
+ crypto_done(cmd->crp);
+
+ }
+
+
+ }
+ /* Copy digest to User-space */
+ if (op->digest_type != XLR_SEC_DIGEST_TYPE_NONE) {
+
+ int offset = 0;
+
+ switch (op->digest_type) {
+ case XLR_SEC_DIGEST_TYPE_MD5:
+ size = XLR_SEC_MD5_LENGTH;
+ break;
+ case XLR_SEC_DIGEST_TYPE_SHA1:
+ size = XLR_SEC_SHA1_LENGTH;
+ break;
+ case XLR_SEC_DIGEST_TYPE_SHA256:
+ size = XLR_SEC_SHA256_LENGTH;
+ break;
+ case XLR_SEC_DIGEST_TYPE_SHA384:
+ size = XLR_SEC_SHA384_LENGTH;
+ break;
+ case XLR_SEC_DIGEST_TYPE_SHA512:
+ size = XLR_SEC_SHA512_LENGTH;
+ break;
+ case XLR_SEC_DIGEST_TYPE_GCM:
+ size = XLR_SEC_GCM_LENGTH;
+ break;
+ case XLR_SEC_DIGEST_TYPE_KASUMI_F9:
+ offset = 4;
+ size = XLR_SEC_KASUMI_F9_RESULT_LENGTH;
+ break;
+ default:
+ size = 0;
+ }
+
+ XLR_SEC_CMD_DIAG("digest: to_addr=%p from_addr=%p size=%d \n",
+ desc->user.user_auth, desc->user.aligned_auth, size);
+ memcpy(desc->user.user_auth, desc->user.aligned_auth + offset, size);
+ op->auth_dest = (uint64_t) (unsigned long)desc->user.user_auth;
+ }
+ if (op->cipher_type == XLR_SEC_CIPHER_TYPE_ARC4 &&
+ op->rc4_savestate) {
+
+ size = XLR_SEC_MAX_RC4_STATE_SIZE;
+
+ XLR_SEC_CMD_DIAG("state: to_addr=%p from_addr=%p size=%d \n",
+ desc->user.user_state, desc->user.aligned_state, size);
+ op->rc4_state = (uint64_t) (unsigned long)desc->user.user_state;
+ }
+ return;
+}
diff --git a/sys/dev/rmi/sec/rmilib.h b/sys/dev/rmi/sec/rmilib.h
index 7eb7c5d..060b9db 100644
--- a/sys/dev/rmi/sec/rmilib.h
+++ b/sys/dev/rmi/sec/rmilib.h
@@ -64,48 +64,48 @@
/*
* Cryptographic parameter definitions
*/
-#define XLR_SEC_DES_KEY_LENGTH 8 /* Bytes */
-#define XLR_SEC_3DES_KEY_LENGTH 24 /* Bytes */
-#define XLR_SEC_AES128_KEY_LENGTH 16 /* Bytes */
-#define XLR_SEC_AES192_KEY_LENGTH 24 /* Bytes */
-#define XLR_SEC_AES256_KEY_LENGTH 32 /* Bytes */
-#define XLR_SEC_AES128F8_KEY_LENGTH 32 /* Bytes */
-#define XLR_SEC_AES192F8_KEY_LENGTH 48 /* Bytes */
-#define XLR_SEC_AES256F8_KEY_LENGTH 64 /* Bytes */
-#define XLR_SEC_KASUMI_F8_KEY_LENGTH 16 /* Bytes */
+#define XLR_SEC_DES_KEY_LENGTH 8 /* Bytes */
+#define XLR_SEC_3DES_KEY_LENGTH 24 /* Bytes */
+#define XLR_SEC_AES128_KEY_LENGTH 16 /* Bytes */
+#define XLR_SEC_AES192_KEY_LENGTH 24 /* Bytes */
+#define XLR_SEC_AES256_KEY_LENGTH 32 /* Bytes */
+#define XLR_SEC_AES128F8_KEY_LENGTH 32 /* Bytes */
+#define XLR_SEC_AES192F8_KEY_LENGTH 48 /* Bytes */
+#define XLR_SEC_AES256F8_KEY_LENGTH 64 /* Bytes */
+#define XLR_SEC_KASUMI_F8_KEY_LENGTH 16 /* Bytes */
#define XLR_SEC_MAX_CRYPT_KEY_LENGTH XLR_SEC_AES256F8_KEY_LENGTH
-#define XLR_SEC_DES_IV_LENGTH 8 /* Bytes */
-#define XLR_SEC_AES_IV_LENGTH 16 /* Bytes */
-#define XLR_SEC_ARC4_IV_LENGTH 0 /* Bytes */
-#define XLR_SEC_KASUMI_F8_IV_LENGTH 16 /* Bytes */
-#define XLR_SEC_MAX_IV_LENGTH 16 /* Bytes */
-#define XLR_SEC_IV_LENGTH_BYTES 8 /* Bytes */
-
-#define XLR_SEC_AES_BLOCK_SIZE 16 /* Bytes */
-#define XLR_SEC_DES_BLOCK_SIZE 8 /* Bytes */
-#define XLR_SEC_3DES_BLOCK_SIZE 8 /* Bytes */
-
-#define XLR_SEC_MD5_BLOCK_SIZE 64 /* Bytes */
-#define XLR_SEC_SHA1_BLOCK_SIZE 64 /* Bytes */
-#define XLR_SEC_SHA256_BLOCK_SIZE 64 /* Bytes */
-#define XLR_SEC_SHA384_BLOCK_SIZE 128/* Bytes */
-#define XLR_SEC_SHA512_BLOCK_SIZE 128/* Bytes */
-#define XLR_SEC_GCM_BLOCK_SIZE 16 /* XXX: Bytes */
-#define XLR_SEC_KASUMI_F9_BLOCK_SIZE 16 /* XXX: Bytes */
-#define XLR_SEC_MAX_BLOCK_SIZE 64 /* Max of MD5/SHA */
-#define XLR_SEC_MD5_LENGTH 16 /* Bytes */
-#define XLR_SEC_SHA1_LENGTH 20 /* Bytes */
-#define XLR_SEC_SHA256_LENGTH 32 /* Bytes */
-#define XLR_SEC_SHA384_LENGTH 64 /* Bytes */
-#define XLR_SEC_SHA512_LENGTH 64 /* Bytes */
-#define XLR_SEC_GCM_LENGTH 16 /* Bytes */
-#define XLR_SEC_KASUMI_F9_LENGTH 16 /* Bytes */
-#define XLR_SEC_KASUMI_F9_RESULT_LENGTH 4 /* Bytes */
-#define XLR_SEC_HMAC_LENGTH 64 /* Max of MD5/SHA/SHA256 */
+#define XLR_SEC_DES_IV_LENGTH 8 /* Bytes */
+#define XLR_SEC_AES_IV_LENGTH 16 /* Bytes */
+#define XLR_SEC_ARC4_IV_LENGTH 0 /* Bytes */
+#define XLR_SEC_KASUMI_F8_IV_LENGTH 16 /* Bytes */
+#define XLR_SEC_MAX_IV_LENGTH 16 /* Bytes */
+#define XLR_SEC_IV_LENGTH_BYTES 8 /* Bytes */
+
+#define XLR_SEC_AES_BLOCK_SIZE 16 /* Bytes */
+#define XLR_SEC_DES_BLOCK_SIZE 8 /* Bytes */
+#define XLR_SEC_3DES_BLOCK_SIZE 8 /* Bytes */
+
+#define XLR_SEC_MD5_BLOCK_SIZE 64 /* Bytes */
+#define XLR_SEC_SHA1_BLOCK_SIZE 64 /* Bytes */
+#define XLR_SEC_SHA256_BLOCK_SIZE 64 /* Bytes */
+#define XLR_SEC_SHA384_BLOCK_SIZE 128 /* Bytes */
+#define XLR_SEC_SHA512_BLOCK_SIZE 128 /* Bytes */
+#define XLR_SEC_GCM_BLOCK_SIZE 16 /* XXX: Bytes */
+#define XLR_SEC_KASUMI_F9_BLOCK_SIZE 16 /* XXX: Bytes */
+#define XLR_SEC_MAX_BLOCK_SIZE 64 /* Max of MD5/SHA */
+#define XLR_SEC_MD5_LENGTH 16 /* Bytes */
+#define XLR_SEC_SHA1_LENGTH 20 /* Bytes */
+#define XLR_SEC_SHA256_LENGTH 32 /* Bytes */
+#define XLR_SEC_SHA384_LENGTH 64 /* Bytes */
+#define XLR_SEC_SHA512_LENGTH 64 /* Bytes */
+#define XLR_SEC_GCM_LENGTH 16 /* Bytes */
+#define XLR_SEC_KASUMI_F9_LENGTH 16 /* Bytes */
+#define XLR_SEC_KASUMI_F9_RESULT_LENGTH 4 /* Bytes */
+#define XLR_SEC_HMAC_LENGTH 64 /* Max of MD5/SHA/SHA256 */
#define XLR_SEC_MAX_AUTH_KEY_LENGTH XLR_SEC_SHA512_BLOCK_SIZE
-#define XLR_SEC_MAX_RC4_STATE_SIZE 264 /* char s[256], int i, int j */
+#define XLR_SEC_MAX_RC4_STATE_SIZE 264 /* char s[256], int i, int j */
/* Status code is used by the SRL to indicate status */
typedef unsigned int xlr_sec_status_t;
@@ -394,200 +394,204 @@ typedef int xlr_sec_error_t;
* Cipher Modes
*/
typedef enum {
- XLR_SEC_CIPHER_MODE_NONE = 0,
- XLR_SEC_CIPHER_MODE_PASS = 1,
- XLR_SEC_CIPHER_MODE_ECB,
- XLR_SEC_CIPHER_MODE_CBC,
- XLR_SEC_CIPHER_MODE_OFB,
- XLR_SEC_CIPHER_MODE_CTR,
- XLR_SEC_CIPHER_MODE_CFB,
- XLR_SEC_CIPHER_MODE_F8
-} XLR_SEC_CIPHER_MODE;
+ XLR_SEC_CIPHER_MODE_NONE = 0,
+ XLR_SEC_CIPHER_MODE_PASS = 1,
+ XLR_SEC_CIPHER_MODE_ECB,
+ XLR_SEC_CIPHER_MODE_CBC,
+ XLR_SEC_CIPHER_MODE_OFB,
+ XLR_SEC_CIPHER_MODE_CTR,
+ XLR_SEC_CIPHER_MODE_CFB,
+ XLR_SEC_CIPHER_MODE_F8
+} XLR_SEC_CIPHER_MODE;
typedef enum {
- XLR_SEC_CIPHER_OP_NONE = 0,
- XLR_SEC_CIPHER_OP_ENCRYPT = 1,
- XLR_SEC_CIPHER_OP_DECRYPT
-} XLR_SEC_CIPHER_OP;
+ XLR_SEC_CIPHER_OP_NONE = 0,
+ XLR_SEC_CIPHER_OP_ENCRYPT = 1,
+ XLR_SEC_CIPHER_OP_DECRYPT
+} XLR_SEC_CIPHER_OP;
typedef enum {
- XLR_SEC_CIPHER_TYPE_UNSUPPORTED = -1,
- XLR_SEC_CIPHER_TYPE_NONE = 0,
- XLR_SEC_CIPHER_TYPE_DES,
- XLR_SEC_CIPHER_TYPE_3DES,
- XLR_SEC_CIPHER_TYPE_AES128,
- XLR_SEC_CIPHER_TYPE_AES192,
- XLR_SEC_CIPHER_TYPE_AES256,
- XLR_SEC_CIPHER_TYPE_ARC4,
- XLR_SEC_CIPHER_TYPE_KASUMI_F8
-} XLR_SEC_CIPHER_TYPE;
+ XLR_SEC_CIPHER_TYPE_UNSUPPORTED = -1,
+ XLR_SEC_CIPHER_TYPE_NONE = 0,
+ XLR_SEC_CIPHER_TYPE_DES,
+ XLR_SEC_CIPHER_TYPE_3DES,
+ XLR_SEC_CIPHER_TYPE_AES128,
+ XLR_SEC_CIPHER_TYPE_AES192,
+ XLR_SEC_CIPHER_TYPE_AES256,
+ XLR_SEC_CIPHER_TYPE_ARC4,
+ XLR_SEC_CIPHER_TYPE_KASUMI_F8
+} XLR_SEC_CIPHER_TYPE;
typedef enum {
- XLR_SEC_CIPHER_INIT_OK = 1, /* Preserve old Keys */
- XLR_SEC_CIPHER_INIT_NK /*Load new Keys */
-} XLR_SEC_CIPHER_INIT;
+ XLR_SEC_CIPHER_INIT_OK = 1, /* Preserve old Keys */
+ XLR_SEC_CIPHER_INIT_NK /* Load new Keys */
+} XLR_SEC_CIPHER_INIT;
/*
* Hash Modes
*/
typedef enum {
- XLR_SEC_DIGEST_TYPE_UNSUPPORTED = -1,
- XLR_SEC_DIGEST_TYPE_NONE = 0,
- XLR_SEC_DIGEST_TYPE_MD5,
- XLR_SEC_DIGEST_TYPE_SHA1,
- XLR_SEC_DIGEST_TYPE_SHA256,
- XLR_SEC_DIGEST_TYPE_SHA384,
- XLR_SEC_DIGEST_TYPE_SHA512,
- XLR_SEC_DIGEST_TYPE_GCM,
- XLR_SEC_DIGEST_TYPE_KASUMI_F9,
- XLR_SEC_DIGEST_TYPE_HMAC_MD5,
- XLR_SEC_DIGEST_TYPE_HMAC_SHA1,
- XLR_SEC_DIGEST_TYPE_HMAC_SHA256,
- XLR_SEC_DIGEST_TYPE_HMAC_SHA384,
- XLR_SEC_DIGEST_TYPE_HMAC_SHA512,
- XLR_SEC_DIGEST_TYPE_HMAC_AES_CBC,
- XLR_SEC_DIGEST_TYPE_HMAC_AES_XCBC
-} XLR_SEC_DIGEST_TYPE;
+ XLR_SEC_DIGEST_TYPE_UNSUPPORTED = -1,
+ XLR_SEC_DIGEST_TYPE_NONE = 0,
+ XLR_SEC_DIGEST_TYPE_MD5,
+ XLR_SEC_DIGEST_TYPE_SHA1,
+ XLR_SEC_DIGEST_TYPE_SHA256,
+ XLR_SEC_DIGEST_TYPE_SHA384,
+ XLR_SEC_DIGEST_TYPE_SHA512,
+ XLR_SEC_DIGEST_TYPE_GCM,
+ XLR_SEC_DIGEST_TYPE_KASUMI_F9,
+ XLR_SEC_DIGEST_TYPE_HMAC_MD5,
+ XLR_SEC_DIGEST_TYPE_HMAC_SHA1,
+ XLR_SEC_DIGEST_TYPE_HMAC_SHA256,
+ XLR_SEC_DIGEST_TYPE_HMAC_SHA384,
+ XLR_SEC_DIGEST_TYPE_HMAC_SHA512,
+ XLR_SEC_DIGEST_TYPE_HMAC_AES_CBC,
+ XLR_SEC_DIGEST_TYPE_HMAC_AES_XCBC
+} XLR_SEC_DIGEST_TYPE;
typedef enum {
- XLR_SEC_DIGEST_INIT_OLDKEY = 1, /* Preserve old key HMAC key stored in ID registers (moot if HASH.HMAC == 0) */
- XLR_SEC_DIGEST_INIT_NEWKEY /*Load new HMAC key from memory ctrl section to ID registers */
-} XLR_SEC_DIGEST_INIT;
+ XLR_SEC_DIGEST_INIT_OLDKEY = 1, /* Preserve old key HMAC key stored in
+ * ID registers (moot if HASH.HMAC ==
+ * 0) */
+ XLR_SEC_DIGEST_INIT_NEWKEY /* Load new HMAC key from memory ctrl
+ * section to ID registers */
+} XLR_SEC_DIGEST_INIT;
typedef enum {
- XLR_SEC_DIGEST_SRC_DMA = 1, /* DMA channel */
- XLR_SEC_DIGEST_SRC_CPHR /*Cipher if word count exceeded Cipher_Offset; else DMA */
-} XLR_SEC_DIGEST_SRC;
+ XLR_SEC_DIGEST_SRC_DMA = 1, /* DMA channel */
+ XLR_SEC_DIGEST_SRC_CPHR /* Cipher if word count exceeded
+ * Cipher_Offset; else DMA */
+} XLR_SEC_DIGEST_SRC;
/*
* Checksum Modes
*/
typedef enum {
- XLR_SEC_CKSUM_TYPE_NOP = 1,
- XLR_SEC_CKSUM_TYPE_IP
-} XLR_SEC_CKSUM_TYPE;
+ XLR_SEC_CKSUM_TYPE_NOP = 1,
+ XLR_SEC_CKSUM_TYPE_IP
+} XLR_SEC_CKSUM_TYPE;
typedef enum {
- XLR_SEC_CKSUM_SRC_DMA = 1,
- XLR_SEC_CKSUM_SRC_CIPHER
-} XLR_SEC_CKSUM_SRC;
+ XLR_SEC_CKSUM_SRC_DMA = 1,
+ XLR_SEC_CKSUM_SRC_CIPHER
+} XLR_SEC_CKSUM_SRC;
/*
* Packet Modes
*/
typedef enum {
- XLR_SEC_LOADHMACKEY_MODE_OLD = 1,
- XLR_SEC_LOADHMACKEY_MODE_LOAD
-} XLR_SEC_LOADHMACKEY_MODE;
+ XLR_SEC_LOADHMACKEY_MODE_OLD = 1,
+ XLR_SEC_LOADHMACKEY_MODE_LOAD
+} XLR_SEC_LOADHMACKEY_MODE;
typedef enum {
- XLR_SEC_PADHASH_PADDED = 1,
- XLR_SEC_PADHASH_PAD
-} XLR_SEC_PADHASH_MODE;
+ XLR_SEC_PADHASH_PADDED = 1,
+ XLR_SEC_PADHASH_PAD
+} XLR_SEC_PADHASH_MODE;
typedef enum {
- XLR_SEC_HASHBYTES_ALL8 = 1,
- XLR_SEC_HASHBYTES_MSB,
- XLR_SEC_HASHBYTES_MSW
-} XLR_SEC_HASHBYTES_MODE;
+ XLR_SEC_HASHBYTES_ALL8 = 1,
+ XLR_SEC_HASHBYTES_MSB,
+ XLR_SEC_HASHBYTES_MSW
+} XLR_SEC_HASHBYTES_MODE;
typedef enum {
- XLR_SEC_NEXT_FINISH = 1,
- XLR_SEC_NEXT_DO
-} XLR_SEC_NEXT_MODE;
+ XLR_SEC_NEXT_FINISH = 1,
+ XLR_SEC_NEXT_DO
+} XLR_SEC_NEXT_MODE;
typedef enum {
- XLR_SEC_PKT_IV_OLD = 1,
- XLR_SEC_PKT_IV_NEW
-} XLR_SEC_PKT_IV_MODE;
+ XLR_SEC_PKT_IV_OLD = 1,
+ XLR_SEC_PKT_IV_NEW
+} XLR_SEC_PKT_IV_MODE;
typedef enum {
- XLR_SEC_LASTWORD_128 = 1,
- XLR_SEC_LASTWORD_96MASK,
- XLR_SEC_LASTWORD_64MASK,
- XLR_SEC_LASTWORD_32MASK
-} XLR_SEC_LASTWORD_MODE;
+ XLR_SEC_LASTWORD_128 = 1,
+ XLR_SEC_LASTWORD_96MASK,
+ XLR_SEC_LASTWORD_64MASK,
+ XLR_SEC_LASTWORD_32MASK
+} XLR_SEC_LASTWORD_MODE;
typedef enum {
- XLR_SEC_CFB_MASK_REGULAR_CTR = 0,
- XLR_SEC_CFB_MASK_CCMP,
- XLR_SEC_CFB_MASK_GCM_WITH_SCI,
- XLR_SEC_CFB_MASK_GCM_WITHOUT_SCI
-} XLR_SEC_CFB_MASK_MODE;
+ XLR_SEC_CFB_MASK_REGULAR_CTR = 0,
+ XLR_SEC_CFB_MASK_CCMP,
+ XLR_SEC_CFB_MASK_GCM_WITH_SCI,
+ XLR_SEC_CFB_MASK_GCM_WITHOUT_SCI
+} XLR_SEC_CFB_MASK_MODE;
/*
* Public Key
*/
typedef enum {
- RMIPK_BLKWIDTH_512 = 1,
- RMIPK_BLKWIDTH_1024
-} RMIPK_BLKWIDTH_MODE;
+ RMIPK_BLKWIDTH_512 = 1,
+ RMIPK_BLKWIDTH_1024
+} RMIPK_BLKWIDTH_MODE;
typedef enum {
- RMIPK_LDCONST_OLD = 1,
- RMIPK_LDCONST_NEW
-} RMIPK_LDCONST_MODE;
+ RMIPK_LDCONST_OLD = 1,
+ RMIPK_LDCONST_NEW
+} RMIPK_LDCONST_MODE;
typedef struct xlr_sec_io_s {
- unsigned int command;
- unsigned int result_status;
- unsigned int flags;
- unsigned int session_num;
- unsigned int use_callback;
- unsigned int time_us;
- unsigned int user_context[2];/*usable for anything by caller*/
- unsigned int command_context; /* Context (ID) of this command). */
- unsigned char initial_vector[XLR_SEC_MAX_IV_LENGTH];
- unsigned char crypt_key[XLR_SEC_MAX_CRYPT_KEY_LENGTH];
- unsigned char mac_key[XLR_SEC_MAX_AUTH_KEY_LENGTH];
-
- XLR_SEC_CIPHER_OP cipher_op;
- XLR_SEC_CIPHER_MODE cipher_mode;
- XLR_SEC_CIPHER_TYPE cipher_type;
- XLR_SEC_CIPHER_INIT cipher_init;
- unsigned int cipher_offset;
-
- XLR_SEC_DIGEST_TYPE digest_type;
- XLR_SEC_DIGEST_INIT digest_init;
- XLR_SEC_DIGEST_SRC digest_src;
- unsigned int digest_offset;
-
- XLR_SEC_CKSUM_TYPE cksum_type;
- XLR_SEC_CKSUM_SRC cksum_src;
- unsigned int cksum_offset;
-
- XLR_SEC_LOADHMACKEY_MODE pkt_hmac;
- XLR_SEC_PADHASH_MODE pkt_hash;
- XLR_SEC_HASHBYTES_MODE pkt_hashbytes;
- XLR_SEC_NEXT_MODE pkt_next;
- XLR_SEC_PKT_IV_MODE pkt_iv;
- XLR_SEC_LASTWORD_MODE pkt_lastword;
-
- unsigned int nonce;
- unsigned int cfb_mask;
-
- unsigned int iv_offset;
- unsigned short pad_type;
- unsigned short rc4_key_len;
-
- unsigned int num_packets;
- unsigned int num_fragments;
-
- uint64_t source_buf;
- unsigned int source_buf_size;
- uint64_t dest_buf;
- unsigned int dest_buf_size;
-
- uint64_t auth_dest;
- uint64_t cksum_dest;
-
- unsigned short rc4_loadstate;
- unsigned short rc4_savestate;
- uint64_t rc4_state;
-
-} xlr_sec_io_t, *xlr_sec_io_pt;
+ unsigned int command;
+ unsigned int result_status;
+ unsigned int flags;
+ unsigned int session_num;
+ unsigned int use_callback;
+ unsigned int time_us;
+ unsigned int user_context[2]; /* usable for anything by caller */
+ unsigned int command_context; /* Context (ID) of this command). */
+ unsigned char initial_vector[XLR_SEC_MAX_IV_LENGTH];
+ unsigned char crypt_key[XLR_SEC_MAX_CRYPT_KEY_LENGTH];
+ unsigned char mac_key[XLR_SEC_MAX_AUTH_KEY_LENGTH];
+
+ XLR_SEC_CIPHER_OP cipher_op;
+ XLR_SEC_CIPHER_MODE cipher_mode;
+ XLR_SEC_CIPHER_TYPE cipher_type;
+ XLR_SEC_CIPHER_INIT cipher_init;
+ unsigned int cipher_offset;
+
+ XLR_SEC_DIGEST_TYPE digest_type;
+ XLR_SEC_DIGEST_INIT digest_init;
+ XLR_SEC_DIGEST_SRC digest_src;
+ unsigned int digest_offset;
+
+ XLR_SEC_CKSUM_TYPE cksum_type;
+ XLR_SEC_CKSUM_SRC cksum_src;
+ unsigned int cksum_offset;
+
+ XLR_SEC_LOADHMACKEY_MODE pkt_hmac;
+ XLR_SEC_PADHASH_MODE pkt_hash;
+ XLR_SEC_HASHBYTES_MODE pkt_hashbytes;
+ XLR_SEC_NEXT_MODE pkt_next;
+ XLR_SEC_PKT_IV_MODE pkt_iv;
+ XLR_SEC_LASTWORD_MODE pkt_lastword;
+
+ unsigned int nonce;
+ unsigned int cfb_mask;
+
+ unsigned int iv_offset;
+ unsigned short pad_type;
+ unsigned short rc4_key_len;
+
+ unsigned int num_packets;
+ unsigned int num_fragments;
+
+ uint64_t source_buf;
+ unsigned int source_buf_size;
+ uint64_t dest_buf;
+ unsigned int dest_buf_size;
+
+ uint64_t auth_dest;
+ uint64_t cksum_dest;
+
+ unsigned short rc4_loadstate;
+ unsigned short rc4_savestate;
+ uint64_t rc4_state;
+
+} xlr_sec_io_t, *xlr_sec_io_pt;
#define XLR_SEC_SESSION(sid) ((sid) & 0x000007ff)
@@ -608,32 +612,32 @@ typedef struct xlr_sec_io_s {
#define SEC_MAX_FRAG_LEN 16000
struct xlr_sec_command {
- uint16_t session_num;
- struct cryptop *crp;
- struct cryptodesc *enccrd, *maccrd;
+ uint16_t session_num;
+ struct cryptop *crp;
+ struct cryptodesc *enccrd, *maccrd;
- xlr_sec_io_t op;
+ xlr_sec_io_t op;
};
-struct xlr_sec_session{
- uint32_t sessionid;
- int hs_used;
- int hs_mlen;
- struct xlr_sec_command cmd;
- void* desc_ptr;
- uint8_t multi_frag_flag;
+struct xlr_sec_session {
+ uint32_t sessionid;
+ int hs_used;
+ int hs_mlen;
+ struct xlr_sec_command cmd;
+ void *desc_ptr;
+ uint8_t multi_frag_flag;
};
/*
* Holds data specific to rmi security accelerators
*/
struct xlr_sec_softc {
- device_t sc_dev; /* device backpointer */
- struct mtx sc_mtx; /* per-instance lock */
+ device_t sc_dev; /* device backpointer */
+ struct mtx sc_mtx; /* per-instance lock */
- int32_t sc_cid;
- struct xlr_sec_session *sc_sessions;
- int sc_nsessions;
- xlr_reg_t* mmio;
+ int32_t sc_cid;
+ struct xlr_sec_session *sc_sessions;
+ int sc_nsessions;
+ xlr_reg_t *mmio;
};
@@ -772,103 +776,103 @@ union xlr_sec_operand_t {
enum sec_pipe_config {
- SEC_PIPE_CIPHER_KEY0_L0 = 0x00,
- SEC_PIPE_CIPHER_KEY0_HI,
- SEC_PIPE_CIPHER_KEY1_LO,
- SEC_PIPE_CIPHER_KEY1_HI,
- SEC_PIPE_CIPHER_KEY2_LO,
- SEC_PIPE_CIPHER_KEY2_HI,
- SEC_PIPE_CIPHER_KEY3_LO,
- SEC_PIPE_CIPHER_KEY3_HI,
- SEC_PIPE_HMAC_KEY0_LO,
- SEC_PIPE_HMAC_KEY0_HI,
- SEC_PIPE_HMAC_KEY1_LO,
- SEC_PIPE_HMAC_KEY1_HI,
- SEC_PIPE_HMAC_KEY2_LO,
- SEC_PIPE_HMAC_KEY2_HI,
- SEC_PIPE_HMAC_KEY3_LO,
- SEC_PIPE_HMAC_KEY3_HI,
- SEC_PIPE_HMAC_KEY4_LO,
- SEC_PIPE_HMAC_KEY4_HI,
- SEC_PIPE_HMAC_KEY5_LO,
- SEC_PIPE_HMAC_KEY5_HI,
- SEC_PIPE_HMAC_KEY6_LO,
- SEC_PIPE_HMAC_KEY6_HI,
- SEC_PIPE_HMAC_KEY7_LO,
- SEC_PIPE_HMAC_KEY7_HI,
- SEC_PIPE_NCFBM_LO,
- SEC_PIPE_NCFBM_HI,
- SEC_PIPE_INSTR_LO,
- SEC_PIPE_INSTR_HI,
- SEC_PIPE_RSVD0,
- SEC_PIPE_RSVD1,
- SEC_PIPE_RSVD2,
- SEC_PIPE_RSVD3,
-
- SEC_PIPE_DF_PTRS0,
- SEC_PIPE_DF_PTRS1,
- SEC_PIPE_DF_PTRS2,
- SEC_PIPE_DF_PTRS3,
- SEC_PIPE_DF_PTRS4,
- SEC_PIPE_DF_PTRS5,
- SEC_PIPE_DF_PTRS6,
- SEC_PIPE_DF_PTRS7,
-
- SEC_PIPE_DU_DATA_IN_LO,
- SEC_PIPE_DU_DATA_IN_HI,
- SEC_PIPE_DU_DATA_IN_CTRL,
- SEC_PIPE_DU_DATA_OUT_LO,
- SEC_PIPE_DU_DATA_OUT_HI,
- SEC_PIPE_DU_DATA_OUT_CTRL,
-
- SEC_PIPE_STATE0,
- SEC_PIPE_STATE1,
- SEC_PIPE_STATE2,
- SEC_PIPE_STATE3,
- SEC_PIPE_STATE4,
- SEC_PIPE_INCLUDE_MASK0,
- SEC_PIPE_INCLUDE_MASK1,
- SEC_PIPE_INCLUDE_MASK2,
- SEC_PIPE_INCLUDE_MASK3,
- SEC_PIPE_INCLUDE_MASK4,
- SEC_PIPE_EXCLUDE_MASK0,
- SEC_PIPE_EXCLUDE_MASK1,
- SEC_PIPE_EXCLUDE_MASK2,
- SEC_PIPE_EXCLUDE_MASK3,
- SEC_PIPE_EXCLUDE_MASK4,
+ SEC_PIPE_CIPHER_KEY0_L0 = 0x00,
+ SEC_PIPE_CIPHER_KEY0_HI,
+ SEC_PIPE_CIPHER_KEY1_LO,
+ SEC_PIPE_CIPHER_KEY1_HI,
+ SEC_PIPE_CIPHER_KEY2_LO,
+ SEC_PIPE_CIPHER_KEY2_HI,
+ SEC_PIPE_CIPHER_KEY3_LO,
+ SEC_PIPE_CIPHER_KEY3_HI,
+ SEC_PIPE_HMAC_KEY0_LO,
+ SEC_PIPE_HMAC_KEY0_HI,
+ SEC_PIPE_HMAC_KEY1_LO,
+ SEC_PIPE_HMAC_KEY1_HI,
+ SEC_PIPE_HMAC_KEY2_LO,
+ SEC_PIPE_HMAC_KEY2_HI,
+ SEC_PIPE_HMAC_KEY3_LO,
+ SEC_PIPE_HMAC_KEY3_HI,
+ SEC_PIPE_HMAC_KEY4_LO,
+ SEC_PIPE_HMAC_KEY4_HI,
+ SEC_PIPE_HMAC_KEY5_LO,
+ SEC_PIPE_HMAC_KEY5_HI,
+ SEC_PIPE_HMAC_KEY6_LO,
+ SEC_PIPE_HMAC_KEY6_HI,
+ SEC_PIPE_HMAC_KEY7_LO,
+ SEC_PIPE_HMAC_KEY7_HI,
+ SEC_PIPE_NCFBM_LO,
+ SEC_PIPE_NCFBM_HI,
+ SEC_PIPE_INSTR_LO,
+ SEC_PIPE_INSTR_HI,
+ SEC_PIPE_RSVD0,
+ SEC_PIPE_RSVD1,
+ SEC_PIPE_RSVD2,
+ SEC_PIPE_RSVD3,
+
+ SEC_PIPE_DF_PTRS0,
+ SEC_PIPE_DF_PTRS1,
+ SEC_PIPE_DF_PTRS2,
+ SEC_PIPE_DF_PTRS3,
+ SEC_PIPE_DF_PTRS4,
+ SEC_PIPE_DF_PTRS5,
+ SEC_PIPE_DF_PTRS6,
+ SEC_PIPE_DF_PTRS7,
+
+ SEC_PIPE_DU_DATA_IN_LO,
+ SEC_PIPE_DU_DATA_IN_HI,
+ SEC_PIPE_DU_DATA_IN_CTRL,
+ SEC_PIPE_DU_DATA_OUT_LO,
+ SEC_PIPE_DU_DATA_OUT_HI,
+ SEC_PIPE_DU_DATA_OUT_CTRL,
+
+ SEC_PIPE_STATE0,
+ SEC_PIPE_STATE1,
+ SEC_PIPE_STATE2,
+ SEC_PIPE_STATE3,
+ SEC_PIPE_STATE4,
+ SEC_PIPE_INCLUDE_MASK0,
+ SEC_PIPE_INCLUDE_MASK1,
+ SEC_PIPE_INCLUDE_MASK2,
+ SEC_PIPE_INCLUDE_MASK3,
+ SEC_PIPE_INCLUDE_MASK4,
+ SEC_PIPE_EXCLUDE_MASK0,
+ SEC_PIPE_EXCLUDE_MASK1,
+ SEC_PIPE_EXCLUDE_MASK2,
+ SEC_PIPE_EXCLUDE_MASK3,
+ SEC_PIPE_EXCLUDE_MASK4,
};
enum sec_pipe_base_config {
- SEC_PIPE0_BASE = 0x00,
- SEC_PIPE1_BASE = 0x40,
- SEC_PIPE2_BASE = 0x80,
- SEC_PIPE3_BASE = 0xc0
+ SEC_PIPE0_BASE = 0x00,
+ SEC_PIPE1_BASE = 0x40,
+ SEC_PIPE2_BASE = 0x80,
+ SEC_PIPE3_BASE = 0xc0
};
enum sec_rsa_config {
- SEC_RSA_PIPE0_DU_DATA_IN_LO = 0x100,
- SEC_RSA_PIPE0_DU_DATA_IN_HI,
- SEC_RSA_PIPE0_DU_DATA_IN_CTRL,
- SEC_RSA_PIPE0_DU_DATA_OUT_LO,
- SEC_RSA_PIPE0_DU_DATA_OUT_HI,
- SEC_RSA_PIPE0_DU_DATA_OUT_CTRL,
- SEC_RSA_RSVD0,
- SEC_RSA_RSVD1,
-
- SEC_RSA_PIPE0_STATE0,
- SEC_RSA_PIPE0_STATE1,
- SEC_RSA_PIPE0_STATE2,
- SEC_RSA_PIPE0_INCLUDE_MASK0,
- SEC_RSA_PIPE0_INCLUDE_MASK1,
- SEC_RSA_PIPE0_INCLUDE_MASK2,
- SEC_RSA_PIPE0_EXCLUDE_MASK0,
- SEC_RSA_PIPE0_EXCLUDE_MASK1,
- SEC_RSA_PIPE0_EXCLUDE_MASK2,
- SEC_RSA_PIPE0_EVENT_CTR
+ SEC_RSA_PIPE0_DU_DATA_IN_LO = 0x100,
+ SEC_RSA_PIPE0_DU_DATA_IN_HI,
+ SEC_RSA_PIPE0_DU_DATA_IN_CTRL,
+ SEC_RSA_PIPE0_DU_DATA_OUT_LO,
+ SEC_RSA_PIPE0_DU_DATA_OUT_HI,
+ SEC_RSA_PIPE0_DU_DATA_OUT_CTRL,
+ SEC_RSA_RSVD0,
+ SEC_RSA_RSVD1,
+
+ SEC_RSA_PIPE0_STATE0,
+ SEC_RSA_PIPE0_STATE1,
+ SEC_RSA_PIPE0_STATE2,
+ SEC_RSA_PIPE0_INCLUDE_MASK0,
+ SEC_RSA_PIPE0_INCLUDE_MASK1,
+ SEC_RSA_PIPE0_INCLUDE_MASK2,
+ SEC_RSA_PIPE0_EXCLUDE_MASK0,
+ SEC_RSA_PIPE0_EXCLUDE_MASK1,
+ SEC_RSA_PIPE0_EXCLUDE_MASK2,
+ SEC_RSA_PIPE0_EVENT_CTR
};
@@ -877,10 +881,10 @@ enum sec_rsa_config {
enum sec_config {
- SEC_DMA_CREDIT = 0x140,
- SEC_CONFIG1,
- SEC_CONFIG2,
- SEC_CONFIG3,
+ SEC_DMA_CREDIT = 0x140,
+ SEC_CONFIG1,
+ SEC_CONFIG2,
+ SEC_CONFIG3,
};
@@ -888,104 +892,106 @@ enum sec_config {
enum sec_debug_config {
- SEC_DW0_DESCRIPTOR0_LO = 0x180,
- SEC_DW0_DESCRIPTOR0_HI,
- SEC_DW0_DESCRIPTOR1_LO,
- SEC_DW0_DESCRIPTOR1_HI,
- SEC_DW1_DESCRIPTOR0_LO,
- SEC_DW1_DESCRIPTOR0_HI,
- SEC_DW1_DESCRIPTOR1_LO,
- SEC_DW1_DESCRIPTOR1_HI,
- SEC_DW2_DESCRIPTOR0_LO,
- SEC_DW2_DESCRIPTOR0_HI,
- SEC_DW2_DESCRIPTOR1_LO,
- SEC_DW2_DESCRIPTOR1_HI,
- SEC_DW3_DESCRIPTOR0_LO,
- SEC_DW3_DESCRIPTOR0_HI,
- SEC_DW3_DESCRIPTOR1_LO,
- SEC_DW3_DESCRIPTOR1_HI,
-
- SEC_STATE0,
- SEC_STATE1,
- SEC_STATE2,
- SEC_INCLUDE_MASK0,
- SEC_INCLUDE_MASK1,
- SEC_INCLUDE_MASK2,
- SEC_EXCLUDE_MASK0,
- SEC_EXCLUDE_MASK1,
- SEC_EXCLUDE_MASK2,
- SEC_EVENT_CTR
+ SEC_DW0_DESCRIPTOR0_LO = 0x180,
+ SEC_DW0_DESCRIPTOR0_HI,
+ SEC_DW0_DESCRIPTOR1_LO,
+ SEC_DW0_DESCRIPTOR1_HI,
+ SEC_DW1_DESCRIPTOR0_LO,
+ SEC_DW1_DESCRIPTOR0_HI,
+ SEC_DW1_DESCRIPTOR1_LO,
+ SEC_DW1_DESCRIPTOR1_HI,
+ SEC_DW2_DESCRIPTOR0_LO,
+ SEC_DW2_DESCRIPTOR0_HI,
+ SEC_DW2_DESCRIPTOR1_LO,
+ SEC_DW2_DESCRIPTOR1_HI,
+ SEC_DW3_DESCRIPTOR0_LO,
+ SEC_DW3_DESCRIPTOR0_HI,
+ SEC_DW3_DESCRIPTOR1_LO,
+ SEC_DW3_DESCRIPTOR1_HI,
+
+ SEC_STATE0,
+ SEC_STATE1,
+ SEC_STATE2,
+ SEC_INCLUDE_MASK0,
+ SEC_INCLUDE_MASK1,
+ SEC_INCLUDE_MASK2,
+ SEC_EXCLUDE_MASK0,
+ SEC_EXCLUDE_MASK1,
+ SEC_EXCLUDE_MASK2,
+ SEC_EVENT_CTR
};
enum sec_msgring_bucket_config {
- SEC_BIU_CREDITS = 0x308,
+ SEC_BIU_CREDITS = 0x308,
- SEC_MSG_BUCKET0_SIZE = 0x320,
- SEC_MSG_BUCKET1_SIZE,
- SEC_MSG_BUCKET2_SIZE,
- SEC_MSG_BUCKET3_SIZE,
- SEC_MSG_BUCKET4_SIZE,
- SEC_MSG_BUCKET5_SIZE,
- SEC_MSG_BUCKET6_SIZE,
- SEC_MSG_BUCKET7_SIZE,
+ SEC_MSG_BUCKET0_SIZE = 0x320,
+ SEC_MSG_BUCKET1_SIZE,
+ SEC_MSG_BUCKET2_SIZE,
+ SEC_MSG_BUCKET3_SIZE,
+ SEC_MSG_BUCKET4_SIZE,
+ SEC_MSG_BUCKET5_SIZE,
+ SEC_MSG_BUCKET6_SIZE,
+ SEC_MSG_BUCKET7_SIZE,
};
enum sec_msgring_credit_config {
- SEC_CC_CPU0_0 = 0x380,
- SEC_CC_CPU1_0 = 0x388,
- SEC_CC_CPU2_0 = 0x390,
- SEC_CC_CPU3_0 = 0x398,
- SEC_CC_CPU4_0 = 0x3a0,
- SEC_CC_CPU5_0 = 0x3a8,
- SEC_CC_CPU6_0 = 0x3b0,
- SEC_CC_CPU7_0 = 0x3b8
+ SEC_CC_CPU0_0 = 0x380,
+ SEC_CC_CPU1_0 = 0x388,
+ SEC_CC_CPU2_0 = 0x390,
+ SEC_CC_CPU3_0 = 0x398,
+ SEC_CC_CPU4_0 = 0x3a0,
+ SEC_CC_CPU5_0 = 0x3a8,
+ SEC_CC_CPU6_0 = 0x3b0,
+ SEC_CC_CPU7_0 = 0x3b8
};
enum sec_engine_id {
- SEC_PIPE0,
- SEC_PIPE1,
- SEC_PIPE2,
- SEC_PIPE3,
- SEC_RSA
+ SEC_PIPE0,
+ SEC_PIPE1,
+ SEC_PIPE2,
+ SEC_PIPE3,
+ SEC_RSA
};
enum sec_cipher {
- SEC_AES256_MODE_HMAC,
- SEC_AES256_MODE,
- SEC_AES256_HMAC,
- SEC_AES256,
- SEC_AES192_MODE_HMAC,
- SEC_AES192_MODE,
- SEC_AES192_HMAC,
- SEC_AES192,
- SEC_AES128_MODE_HMAC,
- SEC_AES128_MODE,
- SEC_AES128_HMAC,
- SEC_AES128,
- SEC_DES_HMAC,
- SEC_DES,
- SEC_3DES,
- SEC_3DES_HMAC,
- SEC_HMAC
+ SEC_AES256_MODE_HMAC,
+ SEC_AES256_MODE,
+ SEC_AES256_HMAC,
+ SEC_AES256,
+ SEC_AES192_MODE_HMAC,
+ SEC_AES192_MODE,
+ SEC_AES192_HMAC,
+ SEC_AES192,
+ SEC_AES128_MODE_HMAC,
+ SEC_AES128_MODE,
+ SEC_AES128_HMAC,
+ SEC_AES128,
+ SEC_DES_HMAC,
+ SEC_DES,
+ SEC_3DES,
+ SEC_3DES_HMAC,
+ SEC_HMAC
};
enum sec_msgrng_msg_ctrl_config {
- SEC_EOP=5,
- SEC_SOP=6,
+ SEC_EOP = 5,
+ SEC_SOP = 6,
};
-void xlr_sec_init( struct xlr_sec_softc *sc) ;
+void
+xlr_sec_init(struct xlr_sec_softc *sc);
-int xlr_sec_setup(struct xlr_sec_session* ses,
- struct xlr_sec_command *cmd, symkey_desc_pt desc);
+int
+xlr_sec_setup(struct xlr_sec_session *ses,
+ struct xlr_sec_command *cmd, symkey_desc_pt desc);
-symkey_desc_pt xlr_sec_allocate_desc(void*);
+symkey_desc_pt xlr_sec_allocate_desc(void *);
#endif
diff --git a/sys/dev/rmi/sec/rmisec.c b/sys/dev/rmi/sec/rmisec.c
index 60eb860..ad20e09 100644
--- a/sys/dev/rmi/sec/rmisec.c
+++ b/sys/dev/rmi/sec/rmisec.c
@@ -59,33 +59,33 @@
void xlr_sec_print_data(struct cryptop *crp);
-static int xlr_sec_newsession(void *arg, uint32_t *sidp, struct cryptoini *cri);
+static int xlr_sec_newsession(void *arg, uint32_t * sidp, struct cryptoini *cri);
static int xlr_sec_freesession(void *arg, uint64_t tid);
static int xlr_sec_process(void *arg, struct cryptop *crp, int hint);
-static int xlr_sec_probe(device_t);
-static int xlr_sec_attach(device_t);
-static int xlr_sec_detach(device_t);
+static int xlr_sec_probe(device_t);
+static int xlr_sec_attach(device_t);
+static int xlr_sec_detach(device_t);
static device_method_t xlr_sec_methods[] = {
- /* device interface */
- DEVMETHOD(device_probe, xlr_sec_probe),
- DEVMETHOD(device_attach, xlr_sec_attach),
- DEVMETHOD(device_detach, xlr_sec_detach),
+ /* device interface */
+ DEVMETHOD(device_probe, xlr_sec_probe),
+ DEVMETHOD(device_attach, xlr_sec_attach),
+ DEVMETHOD(device_detach, xlr_sec_detach),
- /* bus interface */
- DEVMETHOD(bus_print_child, bus_generic_print_child),
- DEVMETHOD(bus_driver_added, bus_generic_driver_added),
+ /* bus interface */
+ DEVMETHOD(bus_print_child, bus_generic_print_child),
+ DEVMETHOD(bus_driver_added, bus_generic_driver_added),
- { 0, 0 }
+ {0, 0}
};
static driver_t xlr_sec_driver = {
- "rmisec",
- xlr_sec_methods,
- sizeof (struct xlr_sec_softc)
+ "rmisec",
+ xlr_sec_methods,
+ sizeof(struct xlr_sec_softc)
};
static devclass_t xlr_sec_devclass;
@@ -97,7 +97,7 @@ MODULE_DEPEND(rmisec, crypto, 1, 1, 1);
static int
xlr_sec_probe(device_t dev)
{
- return (BUS_PROBE_DEFAULT);
+ return (BUS_PROBE_DEFAULT);
}
@@ -109,62 +109,60 @@ static int
xlr_sec_attach(device_t dev)
{
- struct xlr_sec_softc *sc = device_get_softc(dev);
+ struct xlr_sec_softc *sc = device_get_softc(dev);
- bzero(sc, sizeof (*sc));
- sc->sc_dev = dev;
+ bzero(sc, sizeof(*sc));
+ sc->sc_dev = dev;
- mtx_init(&sc->sc_mtx, device_get_nameunit(dev), "rmi crypto driver", MTX_DEF);
+ mtx_init(&sc->sc_mtx, device_get_nameunit(dev), "rmi crypto driver", MTX_DEF);
- sc->sc_cid = crypto_get_driverid(0);
- if (sc->sc_cid < 0) {
- printf("xlr_sec - error : could not get the driver id\n");
- goto error_exit;
- }
+ sc->sc_cid = crypto_get_driverid(0);
+ if (sc->sc_cid < 0) {
+ printf("xlr_sec - error : could not get the driver id\n");
+ goto error_exit;
+ }
+ if (crypto_register(sc->sc_cid, CRYPTO_DES_CBC, 0, 0,
+ xlr_sec_newsession, xlr_sec_freesession, xlr_sec_process, sc) != 0)
+ printf("register failed for CRYPTO_DES_CBC\n");
+ if (crypto_register(sc->sc_cid, CRYPTO_3DES_CBC, 0, 0,
+ xlr_sec_newsession, xlr_sec_freesession, xlr_sec_process, sc) != 0)
+ printf("register failed for CRYPTO_3DES_CBC\n");
- if(crypto_register(sc->sc_cid, CRYPTO_DES_CBC, 0, 0,
- xlr_sec_newsession, xlr_sec_freesession, xlr_sec_process, sc)!=0)
- printf("register failed for CRYPTO_DES_CBC\n");
+ if (crypto_register(sc->sc_cid, CRYPTO_AES_CBC, 0, 0,
+ xlr_sec_newsession, xlr_sec_freesession,
+ xlr_sec_process, sc) != 0)
+ printf("register failed for CRYPTO_AES_CBC\n");
- if(crypto_register(sc->sc_cid, CRYPTO_3DES_CBC, 0, 0,
- xlr_sec_newsession, xlr_sec_freesession, xlr_sec_process, sc)!=0)
- printf("register failed for CRYPTO_3DES_CBC\n");
+ if (crypto_register(sc->sc_cid, CRYPTO_ARC4, 0, 0,
+ xlr_sec_newsession, xlr_sec_freesession, xlr_sec_process, sc) != 0)
+ printf("register failed for CRYPTO_ARC4\n");
- if(crypto_register(sc->sc_cid, CRYPTO_AES_CBC, 0, 0,
- xlr_sec_newsession, xlr_sec_freesession,
- xlr_sec_process, sc)!=0)
- printf("register failed for CRYPTO_AES_CBC\n");
- if(crypto_register(sc->sc_cid, CRYPTO_ARC4, 0, 0,
- xlr_sec_newsession, xlr_sec_freesession, xlr_sec_process, sc)!=0)
- printf("register failed for CRYPTO_ARC4\n");
+ if (crypto_register(sc->sc_cid, CRYPTO_MD5, 0, 0,
+ xlr_sec_newsession, xlr_sec_freesession, xlr_sec_process, sc) != 0)
+ printf("register failed for CRYPTO_MD5\n");
+ if (crypto_register(sc->sc_cid, CRYPTO_SHA1, 0, 0,
+ xlr_sec_newsession, xlr_sec_freesession, xlr_sec_process, sc) != 0)
+ printf("register failed for CRYPTO_SHA1\n");
- if(crypto_register(sc->sc_cid, CRYPTO_MD5, 0, 0,
- xlr_sec_newsession, xlr_sec_freesession, xlr_sec_process, sc)!=0)
- printf("register failed for CRYPTO_MD5\n");
+ if (crypto_register(sc->sc_cid, CRYPTO_MD5_HMAC, 0, 0,
+ xlr_sec_newsession, xlr_sec_freesession, xlr_sec_process, sc) != 0)
+ printf("register failed for CRYPTO_MD5_HMAC\n");
- if(crypto_register(sc->sc_cid, CRYPTO_SHA1, 0, 0,
- xlr_sec_newsession, xlr_sec_freesession, xlr_sec_process, sc)!=0)
- printf("register failed for CRYPTO_SHA1\n");
+ if (crypto_register(sc->sc_cid, CRYPTO_SHA1_HMAC, 0, 0,
+ xlr_sec_newsession, xlr_sec_freesession, xlr_sec_process, sc) != 0)
+ printf("register failed for CRYPTO_SHA1_HMAC\n");
- if(crypto_register(sc->sc_cid, CRYPTO_MD5_HMAC, 0, 0,
- xlr_sec_newsession, xlr_sec_freesession, xlr_sec_process, sc)!=0)
- printf("register failed for CRYPTO_MD5_HMAC\n");
- if(crypto_register(sc->sc_cid, CRYPTO_SHA1_HMAC, 0, 0,
- xlr_sec_newsession, xlr_sec_freesession, xlr_sec_process, sc)!=0)
- printf("register failed for CRYPTO_SHA1_HMAC\n");
-
-
- xlr_sec_init(sc);
- return (0);
+ xlr_sec_init(sc);
+ return (0);
error_exit:
- return (ENXIO);
+ return (ENXIO);
}
@@ -175,22 +173,22 @@ error_exit:
static int
xlr_sec_detach(device_t dev)
{
- int sesn;
- struct xlr_sec_softc *sc = device_get_softc(dev);
- struct xlr_sec_session *ses = NULL;
- symkey_desc_pt desc ;
-
- for (sesn = 0; sesn < sc->sc_nsessions; sesn++) {
- ses = &sc->sc_sessions[sesn];
- desc = (symkey_desc_pt)ses->desc_ptr;
- free(desc->user.kern_src, M_DEVBUF);
- free(desc->user.kern_dest, M_DEVBUF);
- free(desc->next_src_buf, M_DEVBUF);
- free(desc->next_dest_buf, M_DEVBUF);
- free(ses->desc_ptr, M_DEVBUF) ;
- }
-
- return (0);
+ int sesn;
+ struct xlr_sec_softc *sc = device_get_softc(dev);
+ struct xlr_sec_session *ses = NULL;
+ symkey_desc_pt desc;
+
+ for (sesn = 0; sesn < sc->sc_nsessions; sesn++) {
+ ses = &sc->sc_sessions[sesn];
+ desc = (symkey_desc_pt) ses->desc_ptr;
+ free(desc->user.kern_src, M_DEVBUF);
+ free(desc->user.kern_dest, M_DEVBUF);
+ free(desc->next_src_buf, M_DEVBUF);
+ free(desc->next_dest_buf, M_DEVBUF);
+ free(ses->desc_ptr, M_DEVBUF);
+ }
+
+ return (0);
}
@@ -202,107 +200,108 @@ xlr_sec_detach(device_t dev)
* id on successful allocation.
*/
static int
-xlr_sec_newsession(void *arg, u_int32_t *sidp, struct cryptoini *cri)
+xlr_sec_newsession(void *arg, u_int32_t * sidp, struct cryptoini *cri)
{
- struct cryptoini *c;
- struct xlr_sec_softc *sc = arg;
- int mac = 0, cry = 0, sesn;
- struct xlr_sec_session *ses = NULL;
-
-
- if (sidp == NULL || cri == NULL || sc == NULL)
- return (EINVAL);
-
-
- if (sc->sc_sessions == NULL) {
- ses = sc->sc_sessions = (struct xlr_sec_session *)malloc(
- sizeof(struct xlr_sec_session), M_DEVBUF, M_NOWAIT);
- if (ses == NULL)
- return (ENOMEM);
-
- ses->desc_ptr = (void*) xlr_sec_allocate_desc((void*)ses);
- if(ses->desc_ptr == NULL)
- return (ENOMEM);
-
- sesn = 0;
- ses->sessionid = sesn;
- sc->sc_nsessions = 1;
- } else {
- for (sesn = 0; sesn < sc->sc_nsessions; sesn++) {
- if (!sc->sc_sessions[sesn].hs_used) {
- ses = &sc->sc_sessions[sesn];
- break;
- }
- }
-
- if (ses == NULL) {
- sesn = sc->sc_nsessions;
- ses = (struct xlr_sec_session *)malloc((sesn + 1) *
- sizeof(struct xlr_sec_session), M_DEVBUF, M_NOWAIT);
- if (ses == NULL)
- return (ENOMEM);
- bcopy(sc->sc_sessions, ses, sesn * sizeof(struct xlr_sec_session));
- bzero(sc->sc_sessions, sesn * sizeof(struct xlr_sec_session));
- free(sc->sc_sessions, M_DEVBUF);
- sc->sc_sessions = ses;
- ses = &sc->sc_sessions[sesn];
- ses->sessionid = sesn;
- ses->desc_ptr = (void*) xlr_sec_allocate_desc((void*)ses);
- if(ses->desc_ptr == NULL)
- return (ENOMEM);
- sc->sc_nsessions++;
- }
- }
- ses->hs_used = 1;
-
-
- for (c = cri; c != NULL; c = c->cri_next) {
-
- switch (c->cri_alg) {
- case CRYPTO_MD5:
- case CRYPTO_SHA1:
- case CRYPTO_MD5_HMAC:
- case CRYPTO_SHA1_HMAC:
- if (mac)
- return (EINVAL);
- mac = 1;
- ses->hs_mlen = c->cri_mlen;
- if (ses->hs_mlen == 0) {
- switch (c->cri_alg) {
- case CRYPTO_MD5:
- case CRYPTO_MD5_HMAC:
- ses->hs_mlen = 16;
- break;
- case CRYPTO_SHA1:
- case CRYPTO_SHA1_HMAC:
- ses->hs_mlen = 20;
- break;
- }
- }
- break;
- case CRYPTO_DES_CBC:
- case CRYPTO_3DES_CBC:
- case CRYPTO_AES_CBC:
- /* XXX this may read fewer, does it matter? */
- /* read_random(ses->hs_iv,
- c->cri_alg == CRYPTO_AES_CBC ?
-XLR_SEC_AES_IV_LENGTH : XLR_SEC_IV_LENGTH);
- */
- /*FALLTHROUGH*/
- case CRYPTO_ARC4:
- if (cry)
- return (EINVAL);
- cry = 1;
- break;
- default:
- return (EINVAL);
- }
- }
- if (mac == 0 && cry == 0)
- return (EINVAL);
-
- *sidp = XLR_SEC_SID(device_get_unit(sc->sc_dev), sesn);
- return (0);
+ struct cryptoini *c;
+ struct xlr_sec_softc *sc = arg;
+ int mac = 0, cry = 0, sesn;
+ struct xlr_sec_session *ses = NULL;
+
+
+ if (sidp == NULL || cri == NULL || sc == NULL)
+ return (EINVAL);
+
+
+ if (sc->sc_sessions == NULL) {
+ ses = sc->sc_sessions = (struct xlr_sec_session *)malloc(
+ sizeof(struct xlr_sec_session), M_DEVBUF, M_NOWAIT);
+ if (ses == NULL)
+ return (ENOMEM);
+
+ ses->desc_ptr = (void *)xlr_sec_allocate_desc((void *)ses);
+ if (ses->desc_ptr == NULL)
+ return (ENOMEM);
+
+ sesn = 0;
+ ses->sessionid = sesn;
+ sc->sc_nsessions = 1;
+ } else {
+ for (sesn = 0; sesn < sc->sc_nsessions; sesn++) {
+ if (!sc->sc_sessions[sesn].hs_used) {
+ ses = &sc->sc_sessions[sesn];
+ break;
+ }
+ }
+
+ if (ses == NULL) {
+ sesn = sc->sc_nsessions;
+ ses = (struct xlr_sec_session *)malloc((sesn + 1) *
+ sizeof(struct xlr_sec_session), M_DEVBUF, M_NOWAIT);
+ if (ses == NULL)
+ return (ENOMEM);
+ bcopy(sc->sc_sessions, ses, sesn * sizeof(struct xlr_sec_session));
+ bzero(sc->sc_sessions, sesn * sizeof(struct xlr_sec_session));
+ free(sc->sc_sessions, M_DEVBUF);
+ sc->sc_sessions = ses;
+ ses = &sc->sc_sessions[sesn];
+ ses->sessionid = sesn;
+ ses->desc_ptr = (void *)xlr_sec_allocate_desc((void *)ses);
+ if (ses->desc_ptr == NULL)
+ return (ENOMEM);
+ sc->sc_nsessions++;
+ }
+ }
+ ses->hs_used = 1;
+
+
+ for (c = cri; c != NULL; c = c->cri_next) {
+
+ switch (c->cri_alg) {
+ case CRYPTO_MD5:
+ case CRYPTO_SHA1:
+ case CRYPTO_MD5_HMAC:
+ case CRYPTO_SHA1_HMAC:
+ if (mac)
+ return (EINVAL);
+ mac = 1;
+ ses->hs_mlen = c->cri_mlen;
+ if (ses->hs_mlen == 0) {
+ switch (c->cri_alg) {
+ case CRYPTO_MD5:
+ case CRYPTO_MD5_HMAC:
+ ses->hs_mlen = 16;
+ break;
+ case CRYPTO_SHA1:
+ case CRYPTO_SHA1_HMAC:
+ ses->hs_mlen = 20;
+ break;
+ }
+ }
+ break;
+ case CRYPTO_DES_CBC:
+ case CRYPTO_3DES_CBC:
+ case CRYPTO_AES_CBC:
+ /* XXX this may read fewer, does it matter? */
+ /*
+ * read_random(ses->hs_iv, c->cri_alg ==
+ * CRYPTO_AES_CBC ? XLR_SEC_AES_IV_LENGTH :
+ * XLR_SEC_IV_LENGTH);
+ */
+ /* FALLTHROUGH */
+ case CRYPTO_ARC4:
+ if (cry)
+ return (EINVAL);
+ cry = 1;
+ break;
+ default:
+ return (EINVAL);
+ }
+ }
+ if (mac == 0 && cry == 0)
+ return (EINVAL);
+
+ *sidp = XLR_SEC_SID(device_get_unit(sc->sc_dev), sesn);
+ return (0);
}
/*
@@ -313,61 +312,62 @@ XLR_SEC_AES_IV_LENGTH : XLR_SEC_IV_LENGTH);
static int
xlr_sec_freesession(void *arg, u_int64_t tid)
{
- struct xlr_sec_softc *sc = arg;
- int session;
- u_int32_t sid = CRYPTO_SESID2LID(tid);
+ struct xlr_sec_softc *sc = arg;
+ int session;
+ u_int32_t sid = CRYPTO_SESID2LID(tid);
- if (sc == NULL)
- return (EINVAL);
+ if (sc == NULL)
+ return (EINVAL);
- session = XLR_SEC_SESSION(sid);
- if (session >= sc->sc_nsessions)
- return (EINVAL);
+ session = XLR_SEC_SESSION(sid);
+ if (session >= sc->sc_nsessions)
+ return (EINVAL);
- sc->sc_sessions[session].hs_used = 0;
+ sc->sc_sessions[session].hs_used = 0;
- return (0);
+ return (0);
}
#ifdef RMI_SEC_DEBUG
-void xlr_sec_print_data(struct cryptop *crp)
+void
+xlr_sec_print_data(struct cryptop *crp)
{
- int i, key_len;
- struct cryptodesc *crp_desc;
+ int i, key_len;
+ struct cryptodesc *crp_desc;
- printf("session id = 0x%llx, crp_ilen = %d, crp_olen=%d \n",
- crp->crp_sid, crp->crp_ilen, crp->crp_olen);
+ printf("session id = 0x%llx, crp_ilen = %d, crp_olen=%d \n",
+ crp->crp_sid, crp->crp_ilen, crp->crp_olen);
- printf("crp_flags = 0x%x\n", crp->crp_flags);
+ printf("crp_flags = 0x%x\n", crp->crp_flags);
- printf("crp buf:\n");
- for(i=0; i<crp->crp_ilen; i++)
- {
- printf("%c ",crp->crp_buf[i] );
- if(i%10 == 0) printf("\n");
- }
+ printf("crp buf:\n");
+ for (i = 0; i < crp->crp_ilen; i++) {
+ printf("%c ", crp->crp_buf[i]);
+ if (i % 10 == 0)
+ printf("\n");
+ }
- printf("\n");
- printf("****************** desc ****************\n");
- crp_desc = crp->crp_desc;
- printf("crd_skip=%d, crd_len=%d, crd_flags=0x%x, crd_alg=%d\n",
- crp_desc->crd_skip, crp_desc->crd_len, crp_desc->crd_flags, crp_desc->crd_alg);
+ printf("\n");
+ printf("****************** desc ****************\n");
+ crp_desc = crp->crp_desc;
+ printf("crd_skip=%d, crd_len=%d, crd_flags=0x%x, crd_alg=%d\n",
+ crp_desc->crd_skip, crp_desc->crd_len, crp_desc->crd_flags, crp_desc->crd_alg);
- key_len = crp_desc->crd_klen / 8;
- printf("key(%d) :\n",key_len);
- for(i=0; i< key_len; i++)
- printf("%d", crp_desc->crd_key[i]);
- printf("\n");
+ key_len = crp_desc->crd_klen / 8;
+ printf("key(%d) :\n", key_len);
+ for (i = 0; i < key_len; i++)
+ printf("%d", crp_desc->crd_key[i]);
+ printf("\n");
- printf(" IV : \n");
- for(i=0; i< EALG_MAX_BLOCK_LEN; i++)
- printf("%d", crp_desc->crd_iv[i]);
- printf("\n");
+ printf(" IV : \n");
+ for (i = 0; i < EALG_MAX_BLOCK_LEN; i++)
+ printf("%d", crp_desc->crd_iv[i]);
+ printf("\n");
- printf("crd_next=%p\n", crp_desc->crd_next);
- return;
+ printf("crd_next=%p\n", crp_desc->crd_next);
+ return;
}
#endif
@@ -376,242 +376,228 @@ void xlr_sec_print_data(struct cryptop *crp)
static int
xlr_sec_process(void *arg, struct cryptop *crp, int hint)
{
- struct xlr_sec_softc *sc = arg;
- struct xlr_sec_command *cmd = NULL;
- int session, err;
- struct cryptodesc *crd1, *crd2, *maccrd, *enccrd;
- struct xlr_sec_session* ses;
-
- if (crp == NULL || crp->crp_callback == NULL) {
- return (EINVAL);
- }
-
- session = XLR_SEC_SESSION(crp->crp_sid);
- if (sc == NULL || session >= sc->sc_nsessions) {
- err = EINVAL;
- goto errout;
- }
-
- ses = &sc->sc_sessions[session];
-
- cmd = &ses->cmd ;
- if (cmd == NULL) {
- err = ENOMEM;
- goto errout;
- }
-
-
- crd1 = crp->crp_desc;
- if (crd1 == NULL) {
- err = EINVAL;
- goto errout;
- }
-
- crd2 = crd1->crd_next;
-
- if (crd2 == NULL) {
- if (crd1->crd_alg == CRYPTO_MD5_HMAC ||
- crd1->crd_alg == CRYPTO_SHA1_HMAC ||
- crd1->crd_alg == CRYPTO_SHA1 ||
- crd1->crd_alg == CRYPTO_MD5) {
- maccrd = crd1;
- enccrd = NULL;
- } else if (crd1->crd_alg == CRYPTO_DES_CBC ||
- crd1->crd_alg == CRYPTO_3DES_CBC ||
- crd1->crd_alg == CRYPTO_AES_CBC ||
- crd1->crd_alg == CRYPTO_ARC4) {
- maccrd = NULL;
- enccrd = crd1;
- } else {
- err = EINVAL;
- goto errout;
- }
- } else {
- if ((crd1->crd_alg == CRYPTO_MD5_HMAC ||
- crd1->crd_alg == CRYPTO_SHA1_HMAC ||
- crd1->crd_alg == CRYPTO_MD5 ||
- crd1->crd_alg == CRYPTO_SHA1) &&
- (crd2->crd_alg == CRYPTO_DES_CBC ||
- crd2->crd_alg == CRYPTO_3DES_CBC ||
- crd2->crd_alg == CRYPTO_AES_CBC ||
- crd2->crd_alg == CRYPTO_ARC4)){
- maccrd = crd1;
- enccrd = crd2;
- } else if ((crd1->crd_alg == CRYPTO_DES_CBC ||
- crd1->crd_alg == CRYPTO_ARC4 ||
- crd1->crd_alg == CRYPTO_3DES_CBC ||
- crd1->crd_alg == CRYPTO_AES_CBC) &&
- (crd2->crd_alg == CRYPTO_MD5_HMAC ||
- crd2->crd_alg == CRYPTO_SHA1_HMAC ||
- crd2->crd_alg == CRYPTO_MD5 ||
- crd2->crd_alg == CRYPTO_SHA1) &&
- (crd1->crd_flags & CRD_F_ENCRYPT)) {
- enccrd = crd1;
- maccrd = crd2;
- } else {
- err = EINVAL;
- goto errout;
- }
- }
-
- bzero(&cmd->op, sizeof(xlr_sec_io_t));
-
- cmd->op.source_buf = (uint64_t)(unsigned long) crp->crp_buf;
- cmd->op.source_buf_size = crp->crp_ilen;
- if(crp->crp_flags & CRYPTO_F_REL){
- cmd->op.dest_buf = (uint64_t)(unsigned long)crp->crp_buf;
- cmd->op.dest_buf_size = crp->crp_ilen ;
- }
- else{
- cmd->op.dest_buf = (uint64_t)(unsigned long)crp->crp_buf;
- cmd->op.dest_buf_size = crp->crp_ilen ;
- }
- cmd->op.num_packets = 1;
- cmd->op.num_fragments = 1;
-
-
- if(cmd->op.source_buf_size > SEC_MAX_FRAG_LEN){
- ses->multi_frag_flag = 1;
- }
- else{
- ses->multi_frag_flag = 0;
- }
-
- if(maccrd){
- cmd->maccrd = maccrd;
- cmd->op.cipher_op = XLR_SEC_CIPHER_MODE_PASS ;
- cmd->op.cipher_mode = XLR_SEC_CIPHER_MODE_NONE ;
- cmd->op.cipher_type = XLR_SEC_CIPHER_TYPE_NONE ;
- cmd->op.cipher_init = 0 ;
- cmd->op.cipher_offset = 0;
-
- switch(maccrd->crd_alg){
- case CRYPTO_MD5:
- cmd->op.digest_type = XLR_SEC_DIGEST_TYPE_MD5 ;
- cmd->op.digest_init = XLR_SEC_DIGEST_INIT_NEWKEY ;
- cmd->op.digest_src = XLR_SEC_DIGEST_SRC_DMA ;
- cmd->op.digest_offset = 0;
-
- cmd->op.cksum_type = XLR_SEC_CKSUM_TYPE_NOP ;
- cmd->op.cksum_src = XLR_SEC_CKSUM_SRC_CIPHER ;
- cmd->op.cksum_offset = 0;
-
- cmd->op.pkt_hmac = XLR_SEC_LOADHMACKEY_MODE_OLD ;
- cmd->op.pkt_hash = XLR_SEC_PADHASH_PAD ;
- cmd->op.pkt_hashbytes = XLR_SEC_HASHBYTES_ALL8 ;
- cmd->op.pkt_next = XLR_SEC_NEXT_FINISH ;
- cmd->op.pkt_iv = XLR_SEC_PKT_IV_OLD ;
- cmd->op.pkt_lastword = XLR_SEC_LASTWORD_128;
-
-
- default:
- printf("currently not handled\n");
- }
- }
-
- if(enccrd){
- cmd->enccrd = enccrd;
+ struct xlr_sec_softc *sc = arg;
+ struct xlr_sec_command *cmd = NULL;
+ int session, err;
+ struct cryptodesc *crd1, *crd2, *maccrd, *enccrd;
+ struct xlr_sec_session *ses;
+
+ if (crp == NULL || crp->crp_callback == NULL) {
+ return (EINVAL);
+ }
+ session = XLR_SEC_SESSION(crp->crp_sid);
+ if (sc == NULL || session >= sc->sc_nsessions) {
+ err = EINVAL;
+ goto errout;
+ }
+ ses = &sc->sc_sessions[session];
+
+ cmd = &ses->cmd;
+ if (cmd == NULL) {
+ err = ENOMEM;
+ goto errout;
+ }
+ crd1 = crp->crp_desc;
+ if (crd1 == NULL) {
+ err = EINVAL;
+ goto errout;
+ }
+ crd2 = crd1->crd_next;
+
+ if (crd2 == NULL) {
+ if (crd1->crd_alg == CRYPTO_MD5_HMAC ||
+ crd1->crd_alg == CRYPTO_SHA1_HMAC ||
+ crd1->crd_alg == CRYPTO_SHA1 ||
+ crd1->crd_alg == CRYPTO_MD5) {
+ maccrd = crd1;
+ enccrd = NULL;
+ } else if (crd1->crd_alg == CRYPTO_DES_CBC ||
+ crd1->crd_alg == CRYPTO_3DES_CBC ||
+ crd1->crd_alg == CRYPTO_AES_CBC ||
+ crd1->crd_alg == CRYPTO_ARC4) {
+ maccrd = NULL;
+ enccrd = crd1;
+ } else {
+ err = EINVAL;
+ goto errout;
+ }
+ } else {
+ if ((crd1->crd_alg == CRYPTO_MD5_HMAC ||
+ crd1->crd_alg == CRYPTO_SHA1_HMAC ||
+ crd1->crd_alg == CRYPTO_MD5 ||
+ crd1->crd_alg == CRYPTO_SHA1) &&
+ (crd2->crd_alg == CRYPTO_DES_CBC ||
+ crd2->crd_alg == CRYPTO_3DES_CBC ||
+ crd2->crd_alg == CRYPTO_AES_CBC ||
+ crd2->crd_alg == CRYPTO_ARC4)) {
+ maccrd = crd1;
+ enccrd = crd2;
+ } else if ((crd1->crd_alg == CRYPTO_DES_CBC ||
+ crd1->crd_alg == CRYPTO_ARC4 ||
+ crd1->crd_alg == CRYPTO_3DES_CBC ||
+ crd1->crd_alg == CRYPTO_AES_CBC) &&
+ (crd2->crd_alg == CRYPTO_MD5_HMAC ||
+ crd2->crd_alg == CRYPTO_SHA1_HMAC ||
+ crd2->crd_alg == CRYPTO_MD5 ||
+ crd2->crd_alg == CRYPTO_SHA1) &&
+ (crd1->crd_flags & CRD_F_ENCRYPT)) {
+ enccrd = crd1;
+ maccrd = crd2;
+ } else {
+ err = EINVAL;
+ goto errout;
+ }
+ }
+
+ bzero(&cmd->op, sizeof(xlr_sec_io_t));
+
+ cmd->op.source_buf = (uint64_t) (unsigned long)crp->crp_buf;
+ cmd->op.source_buf_size = crp->crp_ilen;
+ if (crp->crp_flags & CRYPTO_F_REL) {
+ cmd->op.dest_buf = (uint64_t) (unsigned long)crp->crp_buf;
+ cmd->op.dest_buf_size = crp->crp_ilen;
+ } else {
+ cmd->op.dest_buf = (uint64_t) (unsigned long)crp->crp_buf;
+ cmd->op.dest_buf_size = crp->crp_ilen;
+ }
+ cmd->op.num_packets = 1;
+ cmd->op.num_fragments = 1;
+
+
+ if (cmd->op.source_buf_size > SEC_MAX_FRAG_LEN) {
+ ses->multi_frag_flag = 1;
+ } else {
+ ses->multi_frag_flag = 0;
+ }
+
+ if (maccrd) {
+ cmd->maccrd = maccrd;
+ cmd->op.cipher_op = XLR_SEC_CIPHER_MODE_PASS;
+ cmd->op.cipher_mode = XLR_SEC_CIPHER_MODE_NONE;
+ cmd->op.cipher_type = XLR_SEC_CIPHER_TYPE_NONE;
+ cmd->op.cipher_init = 0;
+ cmd->op.cipher_offset = 0;
+
+ switch (maccrd->crd_alg) {
+ case CRYPTO_MD5:
+ cmd->op.digest_type = XLR_SEC_DIGEST_TYPE_MD5;
+ cmd->op.digest_init = XLR_SEC_DIGEST_INIT_NEWKEY;
+ cmd->op.digest_src = XLR_SEC_DIGEST_SRC_DMA;
+ cmd->op.digest_offset = 0;
+
+ cmd->op.cksum_type = XLR_SEC_CKSUM_TYPE_NOP;
+ cmd->op.cksum_src = XLR_SEC_CKSUM_SRC_CIPHER;
+ cmd->op.cksum_offset = 0;
+
+ cmd->op.pkt_hmac = XLR_SEC_LOADHMACKEY_MODE_OLD;
+ cmd->op.pkt_hash = XLR_SEC_PADHASH_PAD;
+ cmd->op.pkt_hashbytes = XLR_SEC_HASHBYTES_ALL8;
+ cmd->op.pkt_next = XLR_SEC_NEXT_FINISH;
+ cmd->op.pkt_iv = XLR_SEC_PKT_IV_OLD;
+ cmd->op.pkt_lastword = XLR_SEC_LASTWORD_128;
+
+
+ default:
+ printf("currently not handled\n");
+ }
+ }
+ if (enccrd) {
+ cmd->enccrd = enccrd;
#ifdef RMI_SEC_DEBUG
- xlr_sec_print_data(crp);
+ xlr_sec_print_data(crp);
#endif
- if(enccrd->crd_flags & CRD_F_ENCRYPT){
- cmd->op.cipher_op = XLR_SEC_CIPHER_OP_ENCRYPT;
- }
- else
- cmd->op.cipher_op = XLR_SEC_CIPHER_OP_DECRYPT;
-
- switch(enccrd->crd_alg){
- case CRYPTO_DES_CBC :
- case CRYPTO_3DES_CBC:
- if(enccrd->crd_alg == CRYPTO_DES_CBC){
- cmd->op.cipher_type = XLR_SEC_CIPHER_TYPE_DES;
- memcpy(&cmd->op.crypt_key[0],enccrd->crd_key, XLR_SEC_DES_KEY_LENGTH);
- }
- else{
- cmd->op.cipher_type = XLR_SEC_CIPHER_TYPE_3DES;
-// if(enccrd->crd_flags & CRD_F_KEY_EXPLICIT)
- {
- memcpy(&cmd->op.crypt_key[0],enccrd->crd_key, XLR_SEC_3DES_KEY_LENGTH);
- }
- }
-
- cmd->op.cipher_mode = XLR_SEC_CIPHER_MODE_CBC;
- cmd->op.cipher_init = XLR_SEC_CIPHER_INIT_NK;
- cmd->op.cipher_offset = XLR_SEC_DES_IV_LENGTH;
-
- cmd->op.digest_type = XLR_SEC_DIGEST_TYPE_NONE;
- cmd->op.digest_init = XLR_SEC_DIGEST_INIT_OLDKEY;
- cmd->op.digest_src = XLR_SEC_DIGEST_SRC_DMA;
- cmd->op.digest_offset = 0;
-
- cmd->op.cksum_type = XLR_SEC_CKSUM_TYPE_NOP;
- cmd->op.cksum_src = XLR_SEC_CKSUM_SRC_CIPHER;
- cmd->op.cksum_offset = 0;
-
- cmd->op.pkt_hmac = XLR_SEC_LOADHMACKEY_MODE_OLD;
- cmd->op.pkt_hash = XLR_SEC_PADHASH_PAD;
- cmd->op.pkt_hashbytes = XLR_SEC_HASHBYTES_ALL8;
- cmd->op.pkt_next = XLR_SEC_NEXT_FINISH;
- cmd->op.pkt_iv = XLR_SEC_PKT_IV_NEW;
- cmd->op.pkt_lastword = XLR_SEC_LASTWORD_128;
-
-// if((!(enccrd->crd_flags & CRD_F_IV_PRESENT)) &&
- if( (enccrd->crd_flags & CRD_F_IV_EXPLICIT)){
- memcpy(&cmd->op.initial_vector[0],enccrd->crd_iv, XLR_SEC_DES_IV_LENGTH);
- }
- break;
-
- case CRYPTO_AES_CBC:
- if(enccrd->crd_alg == CRYPTO_AES_CBC){
- cmd->op.cipher_type = XLR_SEC_CIPHER_TYPE_AES128;
-// if(enccrd->crd_flags & CRD_F_KEY_EXPLICIT)
- {
- memcpy(&cmd->op.crypt_key[0],enccrd->crd_key, XLR_SEC_AES128_KEY_LENGTH);
- }
- }
-
- cmd->op.cipher_mode = XLR_SEC_CIPHER_MODE_CBC;
- cmd->op.cipher_init = XLR_SEC_CIPHER_INIT_NK;
- cmd->op.cipher_offset = XLR_SEC_AES_BLOCK_SIZE;
-
- cmd->op.digest_type = XLR_SEC_DIGEST_TYPE_NONE;
- cmd->op.digest_init = XLR_SEC_DIGEST_INIT_OLDKEY;
- cmd->op.digest_src = XLR_SEC_DIGEST_SRC_DMA;
- cmd->op.digest_offset = 0;
-
- cmd->op.cksum_type = XLR_SEC_CKSUM_TYPE_NOP;
- cmd->op.cksum_src = XLR_SEC_CKSUM_SRC_CIPHER;
- cmd->op.cksum_offset = 0;
-
- cmd->op.pkt_hmac = XLR_SEC_LOADHMACKEY_MODE_OLD;
- cmd->op.pkt_hash = XLR_SEC_PADHASH_PAD;
- cmd->op.pkt_hashbytes = XLR_SEC_HASHBYTES_ALL8;
- cmd->op.pkt_next = XLR_SEC_NEXT_FINISH;
- cmd->op.pkt_iv = XLR_SEC_PKT_IV_NEW;
- cmd->op.pkt_lastword = XLR_SEC_LASTWORD_128;
-
-// if(!(enccrd->crd_flags & CRD_F_IV_PRESENT)){
- if( (enccrd->crd_flags & CRD_F_IV_EXPLICIT)){
- memcpy(&cmd->op.initial_vector[0],enccrd->crd_iv, XLR_SEC_AES_BLOCK_SIZE);
- }
-// }
- break;
- }
- }
-
-
- cmd->crp = crp;
- cmd->session_num = session;
- xlr_sec_setup(ses, cmd, (symkey_desc_pt)ses->desc_ptr);
-
- return(0);
+ if (enccrd->crd_flags & CRD_F_ENCRYPT) {
+ cmd->op.cipher_op = XLR_SEC_CIPHER_OP_ENCRYPT;
+ } else
+ cmd->op.cipher_op = XLR_SEC_CIPHER_OP_DECRYPT;
+
+ switch (enccrd->crd_alg) {
+ case CRYPTO_DES_CBC:
+ case CRYPTO_3DES_CBC:
+ if (enccrd->crd_alg == CRYPTO_DES_CBC) {
+ cmd->op.cipher_type = XLR_SEC_CIPHER_TYPE_DES;
+ memcpy(&cmd->op.crypt_key[0], enccrd->crd_key, XLR_SEC_DES_KEY_LENGTH);
+ } else {
+ cmd->op.cipher_type = XLR_SEC_CIPHER_TYPE_3DES;
+ //if (enccrd->crd_flags & CRD_F_KEY_EXPLICIT) {
+ memcpy(&cmd->op.crypt_key[0], enccrd->crd_key, XLR_SEC_3DES_KEY_LENGTH);
+ }
+ }
+
+ cmd->op.cipher_mode = XLR_SEC_CIPHER_MODE_CBC;
+ cmd->op.cipher_init = XLR_SEC_CIPHER_INIT_NK;
+ cmd->op.cipher_offset = XLR_SEC_DES_IV_LENGTH;
+
+ cmd->op.digest_type = XLR_SEC_DIGEST_TYPE_NONE;
+ cmd->op.digest_init = XLR_SEC_DIGEST_INIT_OLDKEY;
+ cmd->op.digest_src = XLR_SEC_DIGEST_SRC_DMA;
+ cmd->op.digest_offset = 0;
+
+ cmd->op.cksum_type = XLR_SEC_CKSUM_TYPE_NOP;
+ cmd->op.cksum_src = XLR_SEC_CKSUM_SRC_CIPHER;
+ cmd->op.cksum_offset = 0;
+
+ cmd->op.pkt_hmac = XLR_SEC_LOADHMACKEY_MODE_OLD;
+ cmd->op.pkt_hash = XLR_SEC_PADHASH_PAD;
+ cmd->op.pkt_hashbytes = XLR_SEC_HASHBYTES_ALL8;
+ cmd->op.pkt_next = XLR_SEC_NEXT_FINISH;
+ cmd->op.pkt_iv = XLR_SEC_PKT_IV_NEW;
+ cmd->op.pkt_lastword = XLR_SEC_LASTWORD_128;
+
+ //if ((!(enccrd->crd_flags & CRD_F_IV_PRESENT)) &&
+ if ((enccrd->crd_flags & CRD_F_IV_EXPLICIT)) {
+ memcpy(&cmd->op.initial_vector[0], enccrd->crd_iv, XLR_SEC_DES_IV_LENGTH);
+ }
+ break;
+
+ case CRYPTO_AES_CBC:
+ if (enccrd->crd_alg == CRYPTO_AES_CBC) {
+ cmd->op.cipher_type = XLR_SEC_CIPHER_TYPE_AES128;
+ //if (enccrd->crd_flags & CRD_F_KEY_EXPLICIT) {
+ memcpy(&cmd->op.crypt_key[0], enccrd->crd_key, XLR_SEC_AES128_KEY_LENGTH);
+ }
+ }
+ cmd->op.cipher_mode = XLR_SEC_CIPHER_MODE_CBC;
+ cmd->op.cipher_init = XLR_SEC_CIPHER_INIT_NK;
+ cmd->op.cipher_offset = XLR_SEC_AES_BLOCK_SIZE;
+
+ cmd->op.digest_type = XLR_SEC_DIGEST_TYPE_NONE;
+ cmd->op.digest_init = XLR_SEC_DIGEST_INIT_OLDKEY;
+ cmd->op.digest_src = XLR_SEC_DIGEST_SRC_DMA;
+ cmd->op.digest_offset = 0;
+
+ cmd->op.cksum_type = XLR_SEC_CKSUM_TYPE_NOP;
+ cmd->op.cksum_src = XLR_SEC_CKSUM_SRC_CIPHER;
+ cmd->op.cksum_offset = 0;
+
+ cmd->op.pkt_hmac = XLR_SEC_LOADHMACKEY_MODE_OLD;
+ cmd->op.pkt_hash = XLR_SEC_PADHASH_PAD;
+ cmd->op.pkt_hashbytes = XLR_SEC_HASHBYTES_ALL8;
+ cmd->op.pkt_next = XLR_SEC_NEXT_FINISH;
+ cmd->op.pkt_iv = XLR_SEC_PKT_IV_NEW;
+ cmd->op.pkt_lastword = XLR_SEC_LASTWORD_128;
+
+ //if (!(enccrd->crd_flags & CRD_F_IV_PRESENT)) {
+ if ((enccrd->crd_flags & CRD_F_IV_EXPLICIT)) {
+ memcpy(&cmd->op.initial_vector[0], enccrd->crd_iv, XLR_SEC_AES_BLOCK_SIZE);
+ }
+ //
+ }
+ break;
+ }
+ }
+ cmd->crp = crp;
+ cmd->session_num = session;
+ xlr_sec_setup(ses, cmd, (symkey_desc_pt) ses->desc_ptr);
+
+ return (0);
errout:
- if (cmd != NULL)
- free(cmd, M_DEVBUF);
- crp->crp_etype = err;
- crypto_done(crp);
- return (err);
+ if (cmd != NULL)
+ free(cmd, M_DEVBUF);
+ crp->crp_etype = err;
+ crypto_done(crp);
+ return (err);
}
OpenPOWER on IntegriCloud