Skip to content

Commit

Permalink
crypto/octeontx: add supported sessions
Browse files Browse the repository at this point in the history
Adding AEAD, cipher & auth sessions support.

Signed-off-by: Ankur Dwivedi <ankur.dwivedi@caviumnetworks.com>
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
Signed-off-by: Murthy NSSR <nidadavolu.murthy@caviumnetworks.com>
Signed-off-by: Nithin Dabilpuram <nithin.dabilpuram@caviumnetworks.com>
Signed-off-by: Ragothaman Jayaraman <rjayaraman@caviumnetworks.com>
Signed-off-by: Srisivasubramanian S <ssrinivasan@caviumnetworks.com>
Signed-off-by: Tejasree Kondoj <kondoj.tejasree@caviumnetworks.com>
  • Loading branch information
Nithin Dabilpuram authored and akhilnxp committed Oct 17, 2018
1 parent 43d0176 commit 6cc5409
Show file tree
Hide file tree
Showing 3 changed files with 776 additions and 0 deletions.
90 changes: 90 additions & 0 deletions drivers/common/cpt/cpt_mcode_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,88 @@
#define SG_LIST_HDR_SIZE (8u)
#define SG_ENTRY_SIZE sizeof(sg_comp_t)

#define CPT_DMA_MODE (1 << 7)

#define CPT_FROM_CTX 0
#define CPT_FROM_DPTR 1

#define FC_GEN 0x1
#define ZUC_SNOW3G 0x2
#define KASUMI 0x3
#define HASH_HMAC 0x4

#define ZS_EA 0x1
#define ZS_IA 0x2
#define K_F8 0x4
#define K_F9 0x8

#define CPT_OP_CIPHER_ENCRYPT 0x1
#define CPT_OP_CIPHER_DECRYPT 0x2
#define CPT_OP_CIPHER_MASK 0x3

#define CPT_OP_AUTH_VERIFY 0x4
#define CPT_OP_AUTH_GENERATE 0x8
#define CPT_OP_AUTH_MASK 0xC

#define CPT_OP_ENCODE (CPT_OP_CIPHER_ENCRYPT | CPT_OP_AUTH_GENERATE)
#define CPT_OP_DECODE (CPT_OP_CIPHER_DECRYPT | CPT_OP_AUTH_VERIFY)

/* #define CPT_ALWAYS_USE_SG_MODE */
#define CPT_ALWAYS_USE_SEPARATE_BUF

typedef enum {
MD5_TYPE = 1,
SHA1_TYPE = 2,
SHA2_SHA224 = 3,
SHA2_SHA256 = 4,
SHA2_SHA384 = 5,
SHA2_SHA512 = 6,
GMAC_TYPE = 7,
XCBC_TYPE = 8,
SHA3_SHA224 = 10,
SHA3_SHA256 = 11,
SHA3_SHA384 = 12,
SHA3_SHA512 = 13,
SHA3_SHAKE256 = 14,
SHA3_SHAKE512 = 15,

/* These are only for software use */
ZUC_EIA3 = 0x90,
SNOW3G_UIA2 = 0x91,
KASUMI_F9_CBC = 0x92,
KASUMI_F9_ECB = 0x93,
} mc_hash_type_t;

typedef enum {
/* To support passthrough */
PASSTHROUGH = 0x0,
/*
* These are defined by MC for Flexi crypto
* for field of 4 bits
*/
DES3_CBC = 0x1,
DES3_ECB = 0x2,
AES_CBC = 0x3,
AES_ECB = 0x4,
AES_CFB = 0x5,
AES_CTR = 0x6,
AES_GCM = 0x7,
AES_XTS = 0x8,

/* These are only for software use */
ZUC_EEA3 = 0x90,
SNOW3G_UEA2 = 0x91,
KASUMI_F8_CBC = 0x92,
KASUMI_F8_ECB = 0x93,
} mc_cipher_type_t;

typedef enum {
AES_128_BIT = 0x1,
AES_192_BIT = 0x2,
AES_256_BIT = 0x3
} mc_aes_type_t;


typedef struct sglist_comp {
union {
uint64_t len;
Expand Down Expand Up @@ -152,6 +231,17 @@ struct cpt_ctx {
uint8_t auth_key[64];
};

typedef struct fc_params digest_params_t;

/* Cipher Algorithms */
typedef mc_cipher_type_t cipher_type_t;

/* Auth Algorithms */
typedef mc_hash_type_t auth_type_t;

#define CPT_P_ENC_CTRL(fctx) fctx->enc.enc_ctrl.e

#define SESS_PRIV(__sess) \
(void *)((uint8_t *)__sess + sizeof(struct cpt_sess_misc))

#endif /* _CPT_MCODE_DEFINES_H_ */
Loading

0 comments on commit 6cc5409

Please sign in to comment.