@@ -35,6 +35,8 @@ DES CBC = Y
KASUMI F8 = Y
SNOW3G UEA2 = Y
ZUC EEA3 = Y
+AES DOCSIS BPI = Y
+DES DOCSIS BPI = Y
;
; Supported authentication algorithms of 'cn9k' crypto driver.
@@ -58,6 +58,7 @@ New Features
* **Updated Marvell cnxk crypto driver.**
* Added AES-CCM support in lookaside protocol (IPsec) for CN9K & CN10K.
+ * Added AES & DES DOCSIS algorithm support in lookaside crypto for CN9K.
Removed Items
@@ -63,6 +63,7 @@ cpt_ciph_type_set(roc_se_cipher_type type, struct roc_se_ctx *ctx,
break;
case ROC_SE_DES3_CBC:
case ROC_SE_DES3_ECB:
+ case ROC_SE_DES_DOCSISBPI:
fc_type = ROC_SE_FC_GEN;
break;
case ROC_SE_AES_CBC:
@@ -70,6 +71,7 @@ cpt_ciph_type_set(roc_se_cipher_type type, struct roc_se_ctx *ctx,
case ROC_SE_AES_CFB:
case ROC_SE_AES_CTR:
case ROC_SE_AES_GCM:
+ case ROC_SE_AES_DOCSISBPI:
if (unlikely(cpt_ciph_aes_key_validate(key_len) != 0))
return -1;
fc_type = ROC_SE_FC_GEN;
@@ -451,7 +453,7 @@ roc_se_ciph_key_set(struct roc_se_ctx *se_ctx, roc_se_cipher_type type,
uint8_t *zuc_const;
uint32_t keyx[4];
uint8_t *ci_key;
- int ret;
+ int i, ret;
zs_ch_ctx = &se_ctx->se_ctx.zs_ch_ctx;
@@ -531,6 +533,27 @@ roc_se_ciph_key_set(struct roc_se_ctx *se_ctx, roc_se_cipher_type type,
memset(fctx->hmac.ipad, 0, sizeof(fctx->hmac.ipad));
memcpy(fctx->hmac.ipad, &key[key_len], key_len);
break;
+ case ROC_SE_AES_DOCSISBPI:
+ /*
+ * DOCSIS uses the combination of AES-CBC and residual termination blocks that are
+ * less than 128. Pass it as regular AES-CBC cipher to CPT, but keep type in
+ * se_ctx as AES_DOCSISBPI to skip block size checks in instruction preparation.
+ */
+ cpt_ciph_aes_key_type_set(fctx, key_len);
+ fctx->enc.enc_cipher = ROC_SE_AES_CBC;
+ memcpy(fctx->enc.encr_key, key, key_len);
+ goto success;
+ case ROC_SE_DES_DOCSISBPI:
+ /* See case ROC_SE_DES3_CBC: for explanation */
+ for (i = 0; i < 3; i++)
+ memcpy(fctx->enc.encr_key + key_len * i, key, key_len);
+ /*
+ * DOCSIS uses DES-CBC mode with special handling of residual termination blocks
+ * that are less than 64 bits. Pass it as regular DES-CBC, but keep type in
+ * se_ctx as DES_DOCSISBPI to skip block size checks in instruction preparation.
+ */
+ fctx->enc.enc_cipher = ROC_SE_DES3_CBC;
+ goto success;
case ROC_SE_SNOW3G_UEA2:
if (chained_op == true) {
struct roc_se_onk_zuc_chain_ctx *ctx =
@@ -10,6 +10,7 @@
#define ROC_SE_FC_MINOR_OP_ENCRYPT 0x0
#define ROC_SE_FC_MINOR_OP_DECRYPT 0x1
#define ROC_SE_FC_MINOR_OP_HMAC_FIRST 0x10
+#define ROC_SE_FC_MINOR_OP_DOCSIS 0x40
#define ROC_SE_MAJOR_OP_HASH 0x34
#define ROC_SE_MAJOR_OP_HMAC 0x35
@@ -17,10 +18,10 @@
#define ROC_SE_MAJOR_OP_KASUMI 0x38
#define ROC_SE_MAJOR_OP_PDCP_CHAIN 0x3C
-#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_MAJOR_OP_MISC 0x01ULL
+#define ROC_SE_MISC_MINOR_OP_PASSTHROUGH 0x03ULL
+#define ROC_SE_MISC_MINOR_OP_DUMMY 0x04ULL
+#define ROC_SE_MISC_MINOR_OP_HW_SUPPORT 0x08ULL
#define ROC_SE_MAX_AAD_SIZE 64
#define ROC_SE_MAX_MAC_LEN 64
@@ -125,6 +126,8 @@ typedef enum {
ROC_SE_AES_CTR_EEA2 = 0x92,
ROC_SE_KASUMI_F8_CBC = 0x93,
ROC_SE_KASUMI_F8_ECB = 0x94,
+ ROC_SE_AES_DOCSISBPI = 0x95,
+ ROC_SE_DES_DOCSISBPI = 0x96,
} roc_se_cipher_type;
typedef enum {
@@ -10,7 +10,7 @@
#include "roc_cpt.h"
-#define CNXK_CPT_MAX_CAPS 35
+#define CNXK_CPT_MAX_CAPS 37
#define CNXK_SEC_CRYPTO_MAX_CAPS 14
#define CNXK_SEC_MAX_CAPS 9
#define CNXK_AE_EC_ID_MAX 8
@@ -697,6 +697,49 @@ static const struct rte_cryptodev_capabilities caps_des[] = {
},
};
+static const struct rte_cryptodev_capabilities caps_docsis[] = {
+ { /* AES DOCSIS BPI */
+ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+ {.sym = {
+ .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+ {.cipher = {
+ .algo = RTE_CRYPTO_CIPHER_AES_DOCSISBPI,
+ .block_size = 16,
+ .key_size = {
+ .min = 16,
+ .max = 32,
+ .increment = 16
+ },
+ .iv_size = {
+ .min = 16,
+ .max = 16,
+ .increment = 0
+ }
+ }, }
+ }, }
+ },
+ { /* DES DOCSIS BPI */
+ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+ {.sym = {
+ .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+ {.cipher = {
+ .algo = RTE_CRYPTO_CIPHER_DES_DOCSISBPI,
+ .block_size = 8,
+ .key_size = {
+ .min = 8,
+ .max = 8,
+ .increment = 0
+ },
+ .iv_size = {
+ .min = 8,
+ .max = 8,
+ .increment = 0
+ }
+ }, }
+ }, }
+ },
+};
+
static const struct rte_cryptodev_capabilities caps_null[] = {
{ /* NULL (AUTH) */
.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
@@ -1158,6 +1201,12 @@ cn10k_crypto_caps_update(struct rte_cryptodev_capabilities cnxk_caps[])
}
}
+static void
+cn9k_crypto_caps_add(struct rte_cryptodev_capabilities cnxk_caps[], int *cur_pos)
+{
+ cpt_caps_add(cnxk_caps, cur_pos, caps_docsis, RTE_DIM(caps_docsis));
+}
+
static void
crypto_caps_populate(struct rte_cryptodev_capabilities cnxk_caps[],
union cpt_eng_caps *hw_caps)
@@ -1172,6 +1221,9 @@ crypto_caps_populate(struct rte_cryptodev_capabilities cnxk_caps[],
CPT_CAPS_ADD(cnxk_caps, &cur_pos, hw_caps, kasumi);
CPT_CAPS_ADD(cnxk_caps, &cur_pos, hw_caps, des);
+ if (!roc_model_is_cn10k())
+ cn9k_crypto_caps_add(cnxk_caps, &cur_pos);
+
cpt_caps_add(cnxk_caps, &cur_pos, caps_null, RTE_DIM(caps_null));
cpt_caps_add(cnxk_caps, &cur_pos, caps_end, RTE_DIM(caps_end));
@@ -2032,6 +2032,18 @@ fill_sess_cipher(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess)
enc_type = ROC_SE_AES_ECB;
cipher_key_len = 16;
break;
+ case RTE_CRYPTO_CIPHER_AES_DOCSISBPI:
+ /* Set DOCSIS flag */
+ sess->roc_se_ctx.template_w4.s.opcode_minor |= ROC_SE_FC_MINOR_OP_DOCSIS;
+ enc_type = ROC_SE_AES_DOCSISBPI;
+ cipher_key_len = 16;
+ break;
+ case RTE_CRYPTO_CIPHER_DES_DOCSISBPI:
+ /* Set DOCSIS flag */
+ sess->roc_se_ctx.template_w4.s.opcode_minor |= ROC_SE_FC_MINOR_OP_DOCSIS;
+ enc_type = ROC_SE_DES_DOCSISBPI;
+ cipher_key_len = 8;
+ break;
case RTE_CRYPTO_CIPHER_3DES_CTR:
case RTE_CRYPTO_CIPHER_AES_F8:
case RTE_CRYPTO_CIPHER_ARC4: