X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=drivers%2Fcommon%2Fcnxk%2Froc_se.h;h=c565ec1b741405873820ce92ec4dcb7977831ef0;hb=5242d8dbbed7fa78c01e86777a4cbc96f5605372;hp=ffae06505d90e16be7b05584607e4be9a874caee;hpb=a45859312ff2d852ddc754acbf50a636aaf7b531;p=dpdk.git diff --git a/drivers/common/cnxk/roc_se.h b/drivers/common/cnxk/roc_se.h index ffae06505d..c565ec1b74 100644 --- a/drivers/common/cnxk/roc_se.h +++ b/drivers/common/cnxk/roc_se.h @@ -11,11 +11,15 @@ #define ROC_SE_FC_MINOR_OP_DECRYPT 0x1 #define ROC_SE_FC_MINOR_OP_HMAC_FIRST 0x10 -#define ROC_SE_MAJOR_OP_HASH 0x34 -#define ROC_SE_MAJOR_OP_HMAC 0x35 -#define ROC_SE_MAJOR_OP_ZUC_SNOW3G 0x37 -#define ROC_SE_MAJOR_OP_KASUMI 0x38 -#define ROC_SE_MAJOR_OP_MISC 0x01 +#define ROC_SE_MAJOR_OP_HASH 0x34 +#define ROC_SE_MAJOR_OP_HMAC 0x35 +#define ROC_SE_MAJOR_OP_PDCP 0x37 +#define ROC_SE_MAJOR_OP_KASUMI 0x38 + +#define ROC_SE_MAJOR_OP_MISC 0x01 +#define ROC_SE_MISC_MINOR_OP_PASSTHROUGH 0x03 +#define ROC_SE_MISC_MINOR_OP_DUMMY 0x04 +#define ROC_SE_MISC_MINOR_OP_HW_SUPPORT 0x08 #define ROC_SE_MAX_AAD_SIZE 64 #define ROC_SE_MAX_MAC_LEN 64 @@ -158,6 +162,12 @@ typedef enum { ROC_SE_AES_256_BIT = 0x3 } roc_se_aes_type; +typedef enum { + ROC_SE_PDCP_MAC_LEN_32_BIT = 0x1, + ROC_SE_PDCP_MAC_LEN_64_BIT = 0x2, + ROC_SE_PDCP_MAC_LEN_128_BIT = 0x3 +} roc_se_pdcp_mac_len_type; + struct roc_se_sglist_comp { union { uint64_t len; @@ -192,12 +202,35 @@ struct roc_se_context { struct roc_se_hmac_context hmac; }; -struct roc_se_zuc_snow3g_ctx { +struct roc_se_otk_zuc_ctx { + union { + uint64_t u64; + struct { + uint64_t rsvd_56 : 57; + uint64_t mac_len : 2; + uint64_t key_len : 2; + uint64_t lfsr_state : 1; + uint64_t alg_type : 2; + } s; + } w0; + uint8_t ci_key[32]; + uint8_t encr_auth_iv[24]; + uint8_t zuc_const[32]; +}; + +struct roc_se_onk_zuc_ctx { uint8_t encr_auth_iv[16]; uint8_t ci_key[16]; uint8_t zuc_const[32]; }; +struct roc_se_zuc_snow3g_ctx { + union { + struct roc_se_onk_zuc_ctx onk_ctx; + struct roc_se_otk_zuc_ctx otk_ctx; + } zuc; +}; + struct roc_se_kasumi_ctx { uint8_t reg_A[8]; uint8_t ci_key[16]; @@ -213,7 +246,7 @@ struct roc_se_buf_ptr { /* IOV Pointer */ struct roc_se_iov_ptr { int buf_cnt; - struct roc_se_buf_ptr bufs[0]; + struct roc_se_buf_ptr bufs[]; }; struct roc_se_fc_params { @@ -229,7 +262,11 @@ struct roc_se_fc_params { void *auth_iv_buf; struct roc_se_buf_ptr meta_buf; struct roc_se_buf_ptr ctx_buf; - uint64_t rsvd2; + uint32_t rsvd2; + uint8_t rsvd3; + uint8_t iv_ovr; + uint8_t cipher_iv_len; + uint8_t auth_iv_len; /* 1st cache line */ struct roc_se_buf_ptr aad_buf __plt_cache_aligned; @@ -261,7 +298,38 @@ struct roc_se_ctx { struct roc_se_zuc_snow3g_ctx zs_ctx; struct roc_se_kasumi_ctx k_ctx; } se_ctx; - uint8_t auth_key[1024]; + uint8_t *auth_key; }; +static inline void +roc_se_zuc_bytes_swap(uint8_t *arr, int len) +{ + int start, end; + uint8_t tmp; + + if (len <= 0) + return; + + start = 0; + end = len - 1; + + while (start < end) { + tmp = arr[start]; + arr[start] = arr[end]; + arr[end] = tmp; + start++; + end--; + } +} + +int __roc_api roc_se_auth_key_set(struct roc_se_ctx *se_ctx, + roc_se_auth_type type, const uint8_t *key, + uint16_t key_len, uint16_t mac_len); + +int __roc_api roc_se_ciph_key_set(struct roc_se_ctx *se_ctx, + roc_se_cipher_type type, const uint8_t *key, + uint16_t key_len, uint8_t *salt); + +void __roc_api roc_se_ctx_swap(struct roc_se_ctx *se_ctx); + #endif /* __ROC_SE_H__ */