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 7E85145C28 for ; Thu, 31 Oct 2024 20:19:58 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 77157400D6; Thu, 31 Oct 2024 20:19:58 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) by mails.dpdk.org (Postfix) with ESMTP id 995C143283; Thu, 31 Oct 2024 20:19:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730402398; x=1761938398; h=from:to:cc:subject:date:message-id; bh=6XNJdZIKgx9BMIpGtgJydKsTGwsdS25UidWwjFSEhto=; b=W4omOGbzZb06HeqPhyJsF9lHyv53lByUjR7o/5SxcEzG2TX+WS8Fbz+9 IUh7f48xWZZN/JtWGyc+kpYlcfzABIVYKtdbhwM91vz8GieDbUmfxf1EV h9SQD5WzndTMbHL3CM/TVl1wRMoqeL9dly/QWuT4xykW9v/Ubzp3zFpt9 s0rd62EXugBVFF5wKLJ4oyx6UPEkgp8I/z3VViGwa+1XvP+jv42gTl53k 3HriEqqVcjjfKMte0istmtxjm8PUaBWGb6sWU6+2ZKDYVXRDk+s8U7rY/ GZH8M90wiP64kE1NdrcpEkWxeKA3VDlzQAAi6O/iRmtVC851OhUqXyhaJ g==; X-CSE-ConnectionGUID: 3/eqeaVNQsOqK+PGCwb/hg== X-CSE-MsgGUID: YAHfZjf8Tr+O8IiNQ+gjIg== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="29934670" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="29934670" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Oct 2024 12:19:56 -0700 X-CSE-ConnectionGUID: 0HHymfggQQqvfmhCprB45Q== X-CSE-MsgGUID: p/4dTWITTCWGpfIRtbWcvg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,247,1725346800"; d="scan'208";a="82831804" Received: from silpixa00400308.ir.intel.com ([10.237.214.154]) by fmviesa009.fm.intel.com with ESMTP; 31 Oct 2024 12:19:54 -0700 From: Arkadiusz Kusztal To: dev@dpdk.org Cc: gakhil@marvell.com, brian.dooley@intel.com, Arkadiusz Kusztal , stable@dpdk.org Subject: [PATCH] crypto/qat: fix ecdsa session handling Date: Thu, 31 Oct 2024 19:19:52 +0000 Message-Id: <20241031191952.20863-1-arkadiuszx.kusztal@intel.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Fixed a problem with setting the key in the session in the ECDSA alghoritm. Fixes: badc0c6f6d6a ("cryptodev: set private and public keys in EC session") Cc: stable@dpdk.org Signed-off-by: Arkadiusz Kusztal --- drivers/crypto/qat/qat_asym.c | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/drivers/crypto/qat/qat_asym.c b/drivers/crypto/qat/qat_asym.c index 9e97582e22..d404fe48c0 100644 --- a/drivers/crypto/qat/qat_asym.c +++ b/drivers/crypto/qat/qat_asym.c @@ -1346,6 +1346,46 @@ session_set_rsa(struct qat_asym_session *qat_session, return ret; } +static int +session_set_ecdsa(struct qat_asym_session *qat_session, + struct rte_crypto_asym_xform *xform) +{ + uint8_t *pkey = xform->ec.pkey.data; + uint8_t *q_x = xform->ec.q.x.data; + uint8_t *q_y = xform->ec.q.y.data; + + qat_session->xform.ec.pkey.data = + rte_malloc(NULL, xform->ec.pkey.length, 0); + if (qat_session->xform.ec.pkey.data == NULL) + return -ENOMEM; + qat_session->xform.ec.q.x.data = rte_malloc(NULL, + xform->ec.q.x.length, 0); + if (qat_session->xform.ec.q.x.data == NULL) { + rte_free(qat_session->xform.ec.pkey.data); + return -ENOMEM; + } + qat_session->xform.ec.q.y.data = rte_malloc(NULL, + xform->ec.q.y.length, 0); + if (qat_session->xform.ec.q.y.data == NULL) { + rte_free(qat_session->xform.ec.pkey.data); + rte_free(qat_session->xform.ec.q.x.data); + return -ENOMEM; + } + + rte_memcpy(qat_session->xform.ec.pkey.data, pkey, + xform->ec.pkey.length); + qat_session->xform.ec.pkey.length = xform->ec.pkey.length; + rte_memcpy(qat_session->xform.ec.q.x.data, q_x, + xform->ec.q.x.length); + qat_session->xform.ec.q.x.length = xform->ec.q.x.length; + rte_memcpy(qat_session->xform.ec.q.y.data, q_y, + xform->ec.q.y.length); + qat_session->xform.ec.q.y.length = xform->ec.q.y.length; + qat_session->xform.ec.curve_id = xform->ec.curve_id; + + return 0; +} + static void session_set_ec(struct qat_asym_session *qat_session, struct rte_crypto_asym_xform *xform) @@ -1384,6 +1424,8 @@ qat_asym_session_configure(struct rte_cryptodev *dev __rte_unused, } break; case RTE_CRYPTO_ASYM_XFORM_ECDSA: + ret = session_set_ecdsa(qat_session, xform); + break; case RTE_CRYPTO_ASYM_XFORM_ECPM: case RTE_CRYPTO_ASYM_XFORM_ECDH: session_set_ec(qat_session, xform); -- 2.34.1