net/i40e/base: fix potentially uninitialized variables
[dpdk.git] / drivers / crypto / dpaa_sec / dpaa_sec.h
index 3686996..7890687 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- *   Copyright 2016-2020 NXP
+ *   Copyright 2016-2021 NXP
  *
  */
 
@@ -19,6 +19,8 @@
 #define AES_CTR_IV_LEN         16
 #define AES_GCM_IV_LEN         12
 
+extern uint8_t dpaa_cryptodev_driver_id;
+
 #define DPAA_IPv6_DEFAULT_VTC_FLOW     0x60000000
 
 /* Minimum job descriptor consists of a oneword job descriptor HEADER and
@@ -117,6 +119,25 @@ struct sec_pdcp_ctxt {
        uint32_t hfn_threshold; /*!< HFN Threashold for key renegotiation */
 };
 #endif
+
+typedef int (*dpaa_sec_build_fd_t)(
+       void *qp, uint8_t *drv_ctx, struct rte_crypto_vec *data_vec,
+       uint16_t n_data_vecs, union rte_crypto_sym_ofs ofs,
+       struct rte_crypto_va_iova_ptr *iv,
+       struct rte_crypto_va_iova_ptr *digest,
+       struct rte_crypto_va_iova_ptr *aad_or_auth_iv,
+       void *user_data);
+
+typedef struct dpaa_sec_job* (*dpaa_sec_build_raw_dp_fd_t)(uint8_t *drv_ctx,
+                       struct rte_crypto_sgl *sgl,
+                       struct rte_crypto_sgl *dest_sgl,
+                       struct rte_crypto_va_iova_ptr *iv,
+                       struct rte_crypto_va_iova_ptr *digest,
+                       struct rte_crypto_va_iova_ptr *auth_iv,
+                       union rte_crypto_sym_ofs ofs,
+                       void *userdata,
+                       struct qm_fd *fd);
+
 typedef struct dpaa_sec_session_entry {
        struct sec_cdb cdb;     /**< cmd block associated with qp */
        struct dpaa_sec_qp *qp[MAX_DPAA_CORES];
@@ -129,6 +150,8 @@ typedef struct dpaa_sec_session_entry {
 #ifdef RTE_LIB_SECURITY
        enum rte_security_session_protocol proto_alg; /*!< Security Algorithm*/
 #endif
+       dpaa_sec_build_fd_t build_fd;
+       dpaa_sec_build_raw_dp_fd_t build_raw_dp_fd;
        union {
                struct {
                        uint8_t *data;  /**< pointer to key data */
@@ -211,7 +234,10 @@ struct dpaa_sec_job {
 #define DPAA_MAX_NB_MAX_DIGEST 32
 struct dpaa_sec_op_ctx {
        struct dpaa_sec_job job;
-       struct rte_crypto_op *op;
+       union {
+               struct rte_crypto_op *op;
+               void *userdata;
+       };
        struct rte_mempool *ctx_pool; /* mempool pointer for dpaa_sec_op_ctx */
        uint32_t fd_status;
        int64_t vtop_offset;
@@ -240,6 +266,27 @@ static const struct rte_cryptodev_capabilities dpaa_sec_capabilities[] = {
                        }, },
                }, },
        },
+       {       /* MD5 */
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+               {.sym = {
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+                       {.auth = {
+                               .algo = RTE_CRYPTO_AUTH_MD5,
+                               .block_size = 64,
+                               .key_size = {
+                                       .min = 0,
+                                       .max = 0,
+                                       .increment = 0
+                               },
+                               .digest_size = {
+                                       .min = 16,
+                                       .max = 16,
+                                       .increment = 0
+                               },
+                               .iv_size = { 0 }
+                       }, }
+               }, }
+       },
        {       /* MD5 HMAC */
                .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
                {.sym = {
@@ -261,6 +308,27 @@ static const struct rte_cryptodev_capabilities dpaa_sec_capabilities[] = {
                        }, }
                }, }
        },
+       {       /* SHA1 */
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+               {.sym = {
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+                       {.auth = {
+                               .algo = RTE_CRYPTO_AUTH_SHA1,
+                               .block_size = 64,
+                               .key_size = {
+                                       .min = 0,
+                                       .max = 0,
+                                       .increment = 0
+                               },
+                               .digest_size = {
+                                       .min = 20,
+                                       .max = 20,
+                                       .increment = 0
+                               },
+                               .iv_size = { 0 }
+                       }, }
+               }, }
+       },
        {       /* SHA1 HMAC */
                .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
                {.sym = {
@@ -282,6 +350,27 @@ static const struct rte_cryptodev_capabilities dpaa_sec_capabilities[] = {
                        }, }
                }, }
        },
+       {       /* SHA224 */
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+               {.sym = {
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+                       {.auth = {
+                               .algo = RTE_CRYPTO_AUTH_SHA224,
+                               .block_size = 64,
+                                       .key_size = {
+                                       .min = 0,
+                                       .max = 0,
+                                       .increment = 0
+                               },
+                               .digest_size = {
+                                       .min = 28,
+                                       .max = 28,
+                                       .increment = 0
+                               },
+                               .iv_size = { 0 }
+                       }, }
+               }, }
+       },
        {       /* SHA224 HMAC */
                .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
                {.sym = {
@@ -303,6 +392,27 @@ static const struct rte_cryptodev_capabilities dpaa_sec_capabilities[] = {
                        }, }
                }, }
        },
+       {       /* SHA256 */
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+               {.sym = {
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+                       {.auth = {
+                               .algo = RTE_CRYPTO_AUTH_SHA256,
+                               .block_size = 64,
+                               .key_size = {
+                                       .min = 0,
+                                       .max = 0,
+                                       .increment = 0
+                               },
+                               .digest_size = {
+                                       .min = 32,
+                                       .max = 32,
+                                       .increment = 0
+                               },
+                               .iv_size = { 0 }
+                       }, }
+               }, }
+       },
        {       /* SHA256 HMAC */
                .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
                {.sym = {
@@ -324,6 +434,27 @@ static const struct rte_cryptodev_capabilities dpaa_sec_capabilities[] = {
                        }, }
                }, }
        },
+       {       /* SHA384 */
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+               {.sym = {
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+                       {.auth = {
+                               .algo = RTE_CRYPTO_AUTH_SHA384,
+                               .block_size = 64,
+                               .key_size = {
+                                       .min = 0,
+                                       .max = 0,
+                                       .increment = 0
+                               },
+                               .digest_size = {
+                                       .min = 48,
+                                       .max = 48,
+                                       .increment = 0
+                                       },
+                               .iv_size = { 0 }
+                       }, }
+               }, }
+       },
        {       /* SHA384 HMAC */
                .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
                {.sym = {
@@ -345,6 +476,27 @@ static const struct rte_cryptodev_capabilities dpaa_sec_capabilities[] = {
                        }, }
                }, }
        },
+       {       /* SHA512 */
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+               {.sym = {
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+                       {.auth = {
+                               .algo = RTE_CRYPTO_AUTH_SHA512,
+                               .block_size = 128,
+                               .key_size = {
+                                       .min = 0,
+                                       .max = 0,
+                                       .increment = 0
+                               },
+                               .digest_size = {
+                                       .min = 64,
+                                       .max = 64,
+                                       .increment = 0
+                               },
+                               .iv_size = { 0 }
+                       }, }
+               }, }
+       },
        {       /* SHA512 HMAC */
                .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
                {.sym = {
@@ -456,6 +608,26 @@ static const struct rte_cryptodev_capabilities dpaa_sec_capabilities[] = {
                        }, }
                }, }
        },
+       {       /* DES CBC */
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+               {.sym = {
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+                       {.cipher = {
+                               .algo = RTE_CRYPTO_CIPHER_DES_CBC,
+                               .block_size = 8,
+                               .key_size = {
+                                       .min = 8,
+                                       .max = 8,
+                                       .increment = 0
+                               },
+                               .iv_size = {
+                                       .min = 8,
+                                       .max = 8,
+                                       .increment = 0
+                               }
+                       }, }
+               }, }
+       },
        {       /* 3DES CBC */
                .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
                {.sym = {
@@ -566,6 +738,49 @@ static const struct rte_cryptodev_capabilities dpaa_sec_capabilities[] = {
                        }, }
                }, }
        },
+       {       /* AES CMAC */
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+               {.sym = {
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+                       {.auth = {
+                               .algo = RTE_CRYPTO_AUTH_AES_CMAC,
+                               .block_size = 16,
+                               .key_size = {
+                                       .min = 1,
+                                       .max = 16,
+                                       .increment = 1
+                               },
+                               .digest_size = {
+                                       .min = 12,
+                                       .max = 16,
+                                       .increment = 4
+                               },
+                               .iv_size = { 0 }
+                       }, }
+               }, }
+       },
+       {       /* AES XCBC HMAC */
+               .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+               {.sym = {
+                       .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
+                       {.auth = {
+                               .algo = RTE_CRYPTO_AUTH_AES_XCBC_MAC,
+                               .block_size = 16,
+                               .key_size = {
+                                       .min = 1,
+                                       .max = 16,
+                                       .increment = 1
+                               },
+                               .digest_size = {
+                                       .min = 12,
+                                       .max = 16,
+                                       .increment = 4
+                               },
+                               .aad_size = { 0 },
+                               .iv_size = { 0 }
+                       }, }
+               }, }
+       },
        RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
 
@@ -769,6 +984,15 @@ static const struct rte_security_capability dpaa_sec_security_cap[] = {
                },
                .crypto_capabilities = dpaa_pdcp_capabilities
        },
+       { /* PDCP Lookaside Protocol offload Short MAC */
+               .action = RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL,
+               .protocol = RTE_SECURITY_PROTOCOL_PDCP,
+               .pdcp = {
+                       .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC,
+                       .capa_flags = 0
+               },
+               .crypto_capabilities = dpaa_pdcp_capabilities
+       },
        {
                .action = RTE_SECURITY_ACTION_TYPE_NONE
        }
@@ -803,4 +1027,16 @@ calc_chksum(void *buffer, int len)
        return  result;
 }
 
+int
+dpaa_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
+       struct rte_crypto_raw_dp_ctx *raw_dp_ctx,
+       enum rte_crypto_op_sess_type sess_type,
+       union rte_cryptodev_session_ctx session_ctx, uint8_t is_update);
+
+int
+dpaa_sec_get_dp_ctx_size(struct rte_cryptodev *dev);
+
+int
+dpaa_sec_attach_sess_q(struct dpaa_sec_qp *qp, dpaa_sec_session *sess);
+
 #endif /* _DPAA_SEC_H_ */