From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 148AC42CFF; Tue, 20 Jun 2023 03:24:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1B8C742D37; Tue, 20 Jun 2023 03:24:34 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2080.outbound.protection.outlook.com [40.107.223.80]) by mails.dpdk.org (Postfix) with ESMTP id 4950D42D38 for ; Tue, 20 Jun 2023 03:24:32 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y6KOI3aGgSHFl+rm5Y8Yhj0PCa20mKbjFioBFxzNJNOIBEjAWygbf02sT/CsRuxtsT3UCUgJERxQwN3MnmQXgBwhdNPEhX2aZgRpEhPYESvXxFPVxVMVy5F9o03ooeofrU6fl06aTLwhZG3G0/QsLJvJzZF4BnvsQOBQF/XA0BgiM4/sNUPf/oW6qQGHeWWM/a706mGQ/Rmhb3ATgdbMCTJEjSrjANe4CtasfZG7dQ6wc7GF8wE1MBDlDfPmO6HvoprOmDlGsrv10MOKHok/6DEJweWQHjNTmL5hh54S2pzrUuEyBpL76Y4GGIIzo1iHc85ahdRMypYxYWalA+WSyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=L3vGkxqSz7/Z1l6ffj67BF7ss7QWVNAaYIyX9p33YoU=; b=gOweYw8ac3urtghgS0EB9V8PvYUqriTjszXyRFZZtx0OLRsn/WYYJJIJ4xSy6wvEBeLJheknWXtCv3Vvb96LTRq3MgxVPXZPd/QW/DIU4RVdDjtlTfPVEdh6iWnd084OlQwelWEemfY4V9Ps03T1WrXT2jRopDd7PxmpiMldQl9v6+ori4od4MeBUgtp1t93DETTj86du2fYYImJu9EbEpPZJfeMGiEV6EoW8ehUlPIfguEz0pSVRzhF92zMLP7gFue04iYAGyh8wCsPiwDHIe8qaVDBkr8opibU0QkcxKqWx4BaXGRM1Wp/vnR1YUXmKnS1FJAVfB/7uy46tAS3iA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L3vGkxqSz7/Z1l6ffj67BF7ss7QWVNAaYIyX9p33YoU=; b=EwfmVrZ0a5h76Bb7B9g+SnInxrC+H7CffUqjl06KClEG7TePSOdVXxpVWEbz2GpruiwS619zdtGg2HsvYUGp5y+2Cv5UsXHEa0FBoAUWGKUQ6zZgz+DD1daYKmx5qfkO4nw8JP7p+QdB96fON4ZRYALvKM3QF1Z/Ei13+Ka8YUwfamph0+3Rdnjs4zgf6hlCmu2i8ZEZMZqca3BCGJcRZR5k7g/kSVbIq9nBJGb11+AsTnR9r5AvtYQj5f7krXsBMFO7KjWAY0HdF3gjlvFCUdvt4bI43PtBIW8OIqRER58TVfNND0tUXECOprQi4OuB8yPeLRHsxZEiSYW0cHmjFg== Received: from PH8PR20CA0005.namprd20.prod.outlook.com (2603:10b6:510:23c::13) by LV3PR12MB9216.namprd12.prod.outlook.com (2603:10b6:408:1a5::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37; Tue, 20 Jun 2023 01:24:29 +0000 Received: from SN1PEPF000252A1.namprd05.prod.outlook.com (2603:10b6:510:23c:cafe::d2) by PH8PR20CA0005.outlook.office365.com (2603:10b6:510:23c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37 via Frontend Transport; Tue, 20 Jun 2023 01:24:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by SN1PEPF000252A1.mail.protection.outlook.com (10.167.242.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.27 via Frontend Transport; Tue, 20 Jun 2023 01:24:28 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 19 Jun 2023 18:24:17 -0700 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 19 Jun 2023 18:24:14 -0700 From: Suanming Mou To: Matan Azrad CC: , , Subject: [PATCH v3 4/9] crypto/mlx5: add AES-GCM encryption key Date: Tue, 20 Jun 2023 04:23:17 +0300 Message-ID: <20230620012322.788099-5-suanmingm@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230620012322.788099-1-suanmingm@nvidia.com> References: <20230418092325.2578712-1-suanmingm@nvidia.com> <20230620012322.788099-1-suanmingm@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A1:EE_|LV3PR12MB9216:EE_ X-MS-Office365-Filtering-Correlation-Id: 97bd1213-f803-4726-0fdc-08db712d178c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +zrQtWhrEYLQfvIDf9xgyXOpGdVyhIlfQw+gwgR8/93HYLYoieBRZId9ujLhpckeT+oYHWH+7S4gjnRK/utZvY03Z1r9OgJUR62Ur6sEHHpOs6WY3Inctv/OmZH4Hg62oRX7KKC8au9+rfsZPeO05gdY01YMG2sBWwBi2pRgqK/LbWDyyyQ+DVSw9LdanG/YZjiJtQESHJ6+nXjdx/yUMoIgrszfz9dKismx/dl8VKYNWa7DiqpkxAOUUbcQ2gDspo2eURPnJR0tJlMfw1a8vQNUbTF2J3tx5w3M2KFzJE+JaYbl0QspFZN3htOmWbj1N4BJyMZVkC8c/efrRtr0NrONMdr/PQFokrlvH3vmVxFEiKy/t9cV51UuphUPOaXn+feqQSDvDKgqlzsR0kc7aShK8Ka7phl/0XO7qqTckiZ9rmbyJkYygYXXR3sDjjeuIlwus6NDgqrHnBvupsL6boOZlyLbwy6BpTNATmJQ/Uc77LdEd/1QLfatuWQoAhRx2EcnhphRl9CYCq8KFTRm2rev2jcdN6tehFt5c2i4CeOoCUhQH3lCWKRf4rij4VeY/3Bta5gC1tPdUfnu1GPOkGg5uaWGSm0xyJ0JQdK4eA57+hWRJrXCp86C+iU4QN+Nn14MqUOYiNtGVVZE6RDqQNrpOCfthFr0mzq4cSzxtmRGbCoWj5+o8kuum/uwoMVn5SuiiFk2WwzSDM0IgSinWFNB3S8kgseA/lRYMYTt/cpzx5e+9WTgoaoQGgkObzIb X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(396003)(39860400002)(136003)(376002)(346002)(451199021)(46966006)(40470700004)(36840700001)(82310400005)(6862004)(47076005)(356005)(86362001)(41300700001)(8936002)(8676002)(5660300002)(70206006)(70586007)(316002)(7636003)(2616005)(336012)(83380400001)(426003)(36860700001)(82740400003)(36756003)(186003)(16526019)(26005)(40460700003)(1076003)(478600001)(4326008)(6636002)(37006003)(54906003)(2906002)(55016003)(7696005)(6286002)(40480700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2023 01:24:28.4172 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 97bd1213-f803-4726-0fdc-08db712d178c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF000252A1.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9216 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The crypto device requires the DEK(data encryption key) object for data encryption/decryption operation. This commit adds the AES-GCM DEK object management support. Signed-off-by: Suanming Mou --- drivers/crypto/mlx5/mlx5_crypto.h | 17 ++++- drivers/crypto/mlx5/mlx5_crypto_dek.c | 102 +++++++++++++------------- drivers/crypto/mlx5/mlx5_crypto_gcm.c | 33 +++++++++ drivers/crypto/mlx5/mlx5_crypto_xts.c | 53 ++++++++++++- 4 files changed, 150 insertions(+), 55 deletions(-) diff --git a/drivers/crypto/mlx5/mlx5_crypto.h b/drivers/crypto/mlx5/mlx5_crypto.h index 76f368ee91..bb5a557a38 100644 --- a/drivers/crypto/mlx5/mlx5_crypto.h +++ b/drivers/crypto/mlx5/mlx5_crypto.h @@ -86,6 +86,11 @@ struct mlx5_crypto_session { uint32_t dek_id; /**< DEK ID */ } __rte_packed; +struct mlx5_crypto_dek_ctx { + struct rte_crypto_sym_xform *xform; + struct mlx5_crypto_priv *priv; +}; + typedef void *(*mlx5_crypto_mkey_update_t)(struct mlx5_crypto_priv *priv, struct mlx5_crypto_qp *qp, uint32_t idx); @@ -106,7 +111,7 @@ mlx5_crypto_dek_destroy(struct mlx5_crypto_priv *priv, struct mlx5_crypto_dek * mlx5_crypto_dek_prepare(struct mlx5_crypto_priv *priv, - struct rte_crypto_cipher_xform *cipher); + struct rte_crypto_sym_xform *xform); int mlx5_crypto_dek_setup(struct mlx5_crypto_priv *priv); @@ -120,4 +125,14 @@ mlx5_crypto_xts_init(struct mlx5_crypto_priv *priv); int mlx5_crypto_gcm_init(struct mlx5_crypto_priv *priv); +int +mlx5_crypto_dek_fill_xts_attr(struct mlx5_crypto_dek *dek, + struct mlx5_devx_dek_attr *dek_attr, + void *cb_ctx); + +int +mlx5_crypto_dek_fill_gcm_attr(struct mlx5_crypto_dek *dek, + struct mlx5_devx_dek_attr *dek_attr, + void *cb_ctx); + #endif /* MLX5_CRYPTO_H_ */ diff --git a/drivers/crypto/mlx5/mlx5_crypto_dek.c b/drivers/crypto/mlx5/mlx5_crypto_dek.c index 7339ef2bd9..716bcc0545 100644 --- a/drivers/crypto/mlx5/mlx5_crypto_dek.c +++ b/drivers/crypto/mlx5/mlx5_crypto_dek.c @@ -13,10 +13,24 @@ #include "mlx5_crypto_utils.h" #include "mlx5_crypto.h" -struct mlx5_crypto_dek_ctx { - struct rte_crypto_cipher_xform *cipher; - struct mlx5_crypto_priv *priv; -}; +static int +mlx5_crypto_dek_get_key(struct rte_crypto_sym_xform *xform, + const uint8_t **key, + uint16_t *key_len) +{ + if (xform->type == RTE_CRYPTO_SYM_XFORM_CIPHER) { + *key = xform->cipher.key.data; + *key_len = xform->cipher.key.length; + } else if (xform->type == RTE_CRYPTO_SYM_XFORM_AEAD) { + *key = xform->aead.key.data; + *key_len = xform->aead.key.length; + } else { + DRV_LOG(ERR, "Xform dek type not supported."); + rte_errno = -EINVAL; + return -1; + } + return 0; +} int mlx5_crypto_dek_destroy(struct mlx5_crypto_priv *priv, @@ -27,19 +41,22 @@ mlx5_crypto_dek_destroy(struct mlx5_crypto_priv *priv, struct mlx5_crypto_dek * mlx5_crypto_dek_prepare(struct mlx5_crypto_priv *priv, - struct rte_crypto_cipher_xform *cipher) + struct rte_crypto_sym_xform *xform) { + const uint8_t *key; + uint16_t key_len; struct mlx5_hlist *dek_hlist = priv->dek_hlist; struct mlx5_crypto_dek_ctx dek_ctx = { - .cipher = cipher, + .xform = xform, .priv = priv, }; - struct rte_crypto_cipher_xform *cipher_ctx = cipher; - uint64_t key64 = __rte_raw_cksum(cipher_ctx->key.data, - cipher_ctx->key.length, 0); - struct mlx5_list_entry *entry = mlx5_hlist_register(dek_hlist, - key64, &dek_ctx); + uint64_t key64; + struct mlx5_list_entry *entry; + if (mlx5_crypto_dek_get_key(xform, &key, &key_len)) + return NULL; + key64 = __rte_raw_cksum(key, key_len, 0); + entry = mlx5_hlist_register(dek_hlist, key64, &dek_ctx); return entry == NULL ? NULL : container_of(entry, struct mlx5_crypto_dek, entry); } @@ -76,76 +93,55 @@ mlx5_crypto_dek_match_cb(void *tool_ctx __rte_unused, struct mlx5_list_entry *entry, void *cb_ctx) { struct mlx5_crypto_dek_ctx *ctx = cb_ctx; - struct rte_crypto_cipher_xform *cipher_ctx = ctx->cipher; + struct rte_crypto_sym_xform *xform = ctx->xform; struct mlx5_crypto_dek *dek = container_of(entry, typeof(*dek), entry); uint32_t key_len = dek->size; + uint16_t xkey_len; + const uint8_t *key; - if (key_len != cipher_ctx->key.length) + if (mlx5_crypto_dek_get_key(xform, &key, &xkey_len)) + return -1; + if (key_len != xkey_len) return -1; - return memcmp(cipher_ctx->key.data, dek->data, cipher_ctx->key.length); + return memcmp(key, dek->data, xkey_len); } static struct mlx5_list_entry * mlx5_crypto_dek_create_cb(void *tool_ctx __rte_unused, void *cb_ctx) { struct mlx5_crypto_dek_ctx *ctx = cb_ctx; - struct rte_crypto_cipher_xform *cipher_ctx = ctx->cipher; + struct rte_crypto_sym_xform *xform = ctx->xform; struct mlx5_crypto_dek *dek = rte_zmalloc(__func__, sizeof(*dek), RTE_CACHE_LINE_SIZE); struct mlx5_devx_dek_attr dek_attr = { .pd = ctx->priv->cdev->pdn, - .key_purpose = MLX5_CRYPTO_KEY_PURPOSE_AES_XTS, - .has_keytag = 1, }; - bool is_wrapped = ctx->priv->is_wrapped_mode; + int ret = -1; if (dek == NULL) { DRV_LOG(ERR, "Failed to allocate dek memory."); return NULL; } - if (is_wrapped) { - switch (cipher_ctx->key.length) { - case 48: - dek->size = 48; - dek_attr.key_size = MLX5_CRYPTO_KEY_SIZE_128b; - break; - case 80: - dek->size = 80; - dek_attr.key_size = MLX5_CRYPTO_KEY_SIZE_256b; - break; - default: - DRV_LOG(ERR, "Wrapped key size not supported."); - return NULL; - } - } else { - switch (cipher_ctx->key.length) { - case 32: - dek->size = 40; - dek_attr.key_size = MLX5_CRYPTO_KEY_SIZE_128b; - break; - case 64: - dek->size = 72; - dek_attr.key_size = MLX5_CRYPTO_KEY_SIZE_256b; - break; - default: - DRV_LOG(ERR, "Key size not supported."); - return NULL; - } - memcpy(&dek_attr.key[cipher_ctx->key.length], - &ctx->priv->keytag, 8); - } - memcpy(&dek_attr.key, cipher_ctx->key.data, cipher_ctx->key.length); + if (xform->type == RTE_CRYPTO_SYM_XFORM_CIPHER) + ret = mlx5_crypto_dek_fill_xts_attr(dek, &dek_attr, cb_ctx); + else if (xform->type == RTE_CRYPTO_SYM_XFORM_AEAD) + ret = mlx5_crypto_dek_fill_gcm_attr(dek, &dek_attr, cb_ctx); + if (ret) + goto fail; dek->obj = mlx5_devx_cmd_create_dek_obj(ctx->priv->cdev->ctx, &dek_attr); if (dek->obj == NULL) { - rte_free(dek); - return NULL; + DRV_LOG(ERR, "Failed to create dek obj."); + goto fail; } - memcpy(&dek->data, cipher_ctx->key.data, cipher_ctx->key.length); return &dek->entry; +fail: + rte_free(dek); + return NULL; } + static void mlx5_crypto_dek_remove_cb(void *tool_ctx __rte_unused, struct mlx5_list_entry *entry) diff --git a/drivers/crypto/mlx5/mlx5_crypto_gcm.c b/drivers/crypto/mlx5/mlx5_crypto_gcm.c index bd78c6d66b..5b315ef42c 100644 --- a/drivers/crypto/mlx5/mlx5_crypto_gcm.c +++ b/drivers/crypto/mlx5/mlx5_crypto_gcm.c @@ -27,6 +27,39 @@ static struct rte_cryptodev_capabilities mlx5_crypto_gcm_caps[] = { } }; +int +mlx5_crypto_dek_fill_gcm_attr(struct mlx5_crypto_dek *dek, + struct mlx5_devx_dek_attr *dek_attr, + void *cb_ctx) +{ + uint32_t offset = 0; + struct mlx5_crypto_dek_ctx *ctx = cb_ctx; + struct rte_crypto_aead_xform *aead_ctx = &ctx->xform->aead; + + if (aead_ctx->algo != RTE_CRYPTO_AEAD_AES_GCM) { + DRV_LOG(ERR, "Only AES-GCM algo supported."); + return -EINVAL; + } + dek_attr->key_purpose = MLX5_CRYPTO_KEY_PURPOSE_GCM; + switch (aead_ctx->key.length) { + case 16: + offset = 16; + dek->size = 16; + dek_attr->key_size = MLX5_CRYPTO_KEY_SIZE_128b; + break; + case 32: + dek->size = 32; + dek_attr->key_size = MLX5_CRYPTO_KEY_SIZE_256b; + break; + default: + DRV_LOG(ERR, "Wrapped key size not supported."); + return -EINVAL; + } + memcpy(&dek_attr->key[offset], aead_ctx->key.data, aead_ctx->key.length); + memcpy(&dek->data, aead_ctx->key.data, aead_ctx->key.length); + return 0; +} + int mlx5_crypto_gcm_init(struct mlx5_crypto_priv *priv) { diff --git a/drivers/crypto/mlx5/mlx5_crypto_xts.c b/drivers/crypto/mlx5/mlx5_crypto_xts.c index 964d02e6ed..661da5f589 100644 --- a/drivers/crypto/mlx5/mlx5_crypto_xts.c +++ b/drivers/crypto/mlx5/mlx5_crypto_xts.c @@ -45,6 +45,57 @@ const struct rte_cryptodev_capabilities mlx5_crypto_caps[] = { }, }; +int +mlx5_crypto_dek_fill_xts_attr(struct mlx5_crypto_dek *dek, + struct mlx5_devx_dek_attr *dek_attr, + void *cb_ctx) +{ + struct mlx5_crypto_dek_ctx *ctx = cb_ctx; + struct rte_crypto_cipher_xform *cipher_ctx = &ctx->xform->cipher; + bool is_wrapped = ctx->priv->is_wrapped_mode; + + if (cipher_ctx->algo != RTE_CRYPTO_CIPHER_AES_XTS) { + DRV_LOG(ERR, "Only AES-XTS algo supported."); + return -EINVAL; + } + dek_attr->key_purpose = MLX5_CRYPTO_KEY_PURPOSE_AES_XTS; + dek_attr->has_keytag = 1; + if (is_wrapped) { + switch (cipher_ctx->key.length) { + case 48: + dek->size = 48; + dek_attr->key_size = MLX5_CRYPTO_KEY_SIZE_128b; + break; + case 80: + dek->size = 80; + dek_attr->key_size = MLX5_CRYPTO_KEY_SIZE_256b; + break; + default: + DRV_LOG(ERR, "Wrapped key size not supported."); + return -EINVAL; + } + } else { + switch (cipher_ctx->key.length) { + case 32: + dek->size = 40; + dek_attr->key_size = MLX5_CRYPTO_KEY_SIZE_128b; + break; + case 64: + dek->size = 72; + dek_attr->key_size = MLX5_CRYPTO_KEY_SIZE_256b; + break; + default: + DRV_LOG(ERR, "Key size not supported."); + return -EINVAL; + } + memcpy(&dek_attr->key[cipher_ctx->key.length], + &ctx->priv->keytag, 8); + } + memcpy(&dek_attr->key, cipher_ctx->key.data, cipher_ctx->key.length); + memcpy(&dek->data, cipher_ctx->key.data, cipher_ctx->key.length); + return 0; +} + static int mlx5_crypto_xts_sym_session_configure(struct rte_cryptodev *dev, struct rte_crypto_sym_xform *xform, @@ -66,7 +117,7 @@ mlx5_crypto_xts_sym_session_configure(struct rte_cryptodev *dev, return -ENOTSUP; } cipher = &xform->cipher; - sess_private_data->dek = mlx5_crypto_dek_prepare(priv, cipher); + sess_private_data->dek = mlx5_crypto_dek_prepare(priv, xform); if (sess_private_data->dek == NULL) { DRV_LOG(ERR, "Failed to prepare dek."); return -ENOMEM; -- 2.25.1