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 09D0CA0C41 for ; Tue, 30 Nov 2021 17:42:16 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 01C9E41190; Tue, 30 Nov 2021 17:42:16 +0100 (CET) Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by mails.dpdk.org (Postfix) with ESMTP id 6FB37410F7 for ; Tue, 30 Nov 2021 17:42:15 +0100 (CET) Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id ECCD73F044 for ; Tue, 30 Nov 2021 16:42:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1638290534; bh=X90TgdFr/PNfmg7bjivvr78CuZUHsK8hw+eJbt1cHSw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NbSbds7k6MmZOfUY1Y9Oy9IjEmNcUrz1jYieIPEY5ZZJBpEyVx8bcPPRNrQ3iD2fv Ca+oR5vC29ZcF2boHhU+/h91FbAopAJVrJEBdLZURcy0B3h7P/XSgm+taVdeUMGkyH qz4SAbdfhXtfvksglR6E+RM+aO17tBOwXfBgg3iBku/k5e8+568nLmLBFXcEsr9aFz rKeVkf0gD8zqsCs7IHECO0Sw3qRikHmIixUo68janMw8NRcpoqZmN2TYXhlmfzOI4V WoJL684oB00BEdCDvCaMjVwO8YmQ6UGQBzLfN4uSzMMwSgVtI1eBCK2tNcS5wWSc49 Yc1P4cRUX7tEg== Received: by mail-ed1-f70.google.com with SMTP id y9-20020aa7c249000000b003e7bf7a1579so17441803edo.5 for ; Tue, 30 Nov 2021 08:42:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=X90TgdFr/PNfmg7bjivvr78CuZUHsK8hw+eJbt1cHSw=; b=zlCjkeTSYN22IjM020JuU+ZMpSTaTELK1tDFTfsjV8rP4HR97iSZ94T3tEeMYdBww9 AWNo6+4ejfPDsFfWvK9l0jhHbHZ5mpRk6cnKcd+HBnqIWYdnYVUsiMX6IivP16B0LUIT 5bYXs/iybuT0pBgro8eLpsR7UNaDmBX9vSGH3c3QFvig6aW9ATOXvtmB/DQRxeLdGcvr WXDzer4pSb2fLWVUWVGPxAXlHro+F03l6wjOkul2IbKQHh8LM/mTHjxhDyae7WiyEpsK Tny79DVX/XWmlCIt3s++lYAWiRZBYIxAuNBgEBihH0/okmKW18NF0FKLi3OuviW22FdP Zpkg== X-Gm-Message-State: AOAM532G5HpSgG5HSMmgLCCAaiGbj/Wnvi+ntZ4UeptHJu5wyr3VqE+y HyiQf/OWwxQV7ZXT+1vUsifwMcl3/OLI8tGKlkefZauuvG0BjbLHbhXKzHM3R1ncSRfLyOHqMaK BxdUKykqx9buDsCqA1qCKlBsw X-Received: by 2002:a05:6402:90c:: with SMTP id g12mr169585edz.36.1638290534312; Tue, 30 Nov 2021 08:42:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwqkX0deogTV4k9ngoenThRAgrqbLl5bcW44CC6t10TOMbCIS1NqjdP2gVFpaP58h5r7n3T3g== X-Received: by 2002:a05:6402:90c:: with SMTP id g12mr169559edz.36.1638290534111; Tue, 30 Nov 2021 08:42:14 -0800 (PST) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c4ad]) by smtp.gmail.com with ESMTPSA id q17sm11839723edd.10.2021.11.30.08.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Nov 2021 08:42:13 -0800 (PST) From: christian.ehrhardt@canonical.com To: Arek Kusztal Cc: Fan Zhang , dpdk stable Subject: patch 'crypto/qat: fix uncleared cookies after operation' has been queued to stable release 19.11.11 Date: Tue, 30 Nov 2021 17:35:23 +0100 Message-Id: <20211130163605.2460997-119-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211130163605.2460997-1-christian.ehrhardt@canonical.com> References: <20211130163605.2460997-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Hi, FYI, your patch has been queued to stable release 19.11.11 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before December 10th 2021. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/1bac9e7b29cb1979e876b810451a2272d34308d1 Thanks. Christian Ehrhardt --- >From 1bac9e7b29cb1979e876b810451a2272d34308d1 Mon Sep 17 00:00:00 2001 From: Arek Kusztal Date: Thu, 21 Oct 2021 11:06:01 +0100 Subject: [PATCH] crypto/qat: fix uncleared cookies after operation [ upstream commit 867ba300f915291629c33b2eadf6a98564c622a0 ] This commit fixes uncleared cookies issue when using RSA algorithm. Fixes: e2c5f4ea994c ("crypto/qat: support RSA in asym") Signed-off-by: Arek Kusztal Acked-by: Fan Zhang --- drivers/crypto/qat/qat_asym.c | 41 +++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/drivers/crypto/qat/qat_asym.c b/drivers/crypto/qat/qat_asym.c index 983c639d68..f893508030 100644 --- a/drivers/crypto/qat/qat_asym.c +++ b/drivers/crypto/qat/qat_asym.c @@ -65,27 +65,45 @@ static size_t max_of(int n, ...) } static void qat_clear_arrays(struct qat_asym_op_cookie *cookie, - int in_count, int out_count, int in_size, int out_size) + int in_count, int out_count, int alg_size) { int i; for (i = 0; i < in_count; i++) - memset(cookie->input_array[i], 0x0, in_size); + memset(cookie->input_array[i], 0x0, alg_size); for (i = 0; i < out_count; i++) - memset(cookie->output_array[i], 0x0, out_size); + memset(cookie->output_array[i], 0x0, alg_size); +} + +static void qat_clear_arrays_crt(struct qat_asym_op_cookie *cookie, + int alg_size) +{ + int i; + + memset(cookie->input_array[0], 0x0, alg_size); + for (i = 1; i < QAT_ASYM_RSA_QT_NUM_IN_PARAMS; i++) + memset(cookie->input_array[i], 0x0, alg_size / 2); + for (i = 0; i < QAT_ASYM_RSA_NUM_OUT_PARAMS; i++) + memset(cookie->output_array[i], 0x0, alg_size); } static void qat_clear_arrays_by_alg(struct qat_asym_op_cookie *cookie, - enum rte_crypto_asym_xform_type alg, int in_size, int out_size) + struct rte_crypto_asym_xform *xform, int alg_size) { - if (alg == RTE_CRYPTO_ASYM_XFORM_MODEX) + if (xform->xform_type == RTE_CRYPTO_ASYM_XFORM_MODEX) qat_clear_arrays(cookie, QAT_ASYM_MODEXP_NUM_IN_PARAMS, - QAT_ASYM_MODEXP_NUM_OUT_PARAMS, in_size, - out_size); - else if (alg == RTE_CRYPTO_ASYM_XFORM_MODINV) + QAT_ASYM_MODEXP_NUM_OUT_PARAMS, alg_size); + else if (xform->xform_type == RTE_CRYPTO_ASYM_XFORM_MODINV) qat_clear_arrays(cookie, QAT_ASYM_MODINV_NUM_IN_PARAMS, - QAT_ASYM_MODINV_NUM_OUT_PARAMS, in_size, - out_size); + QAT_ASYM_MODINV_NUM_OUT_PARAMS, alg_size); + else if (xform->xform_type == RTE_CRYPTO_ASYM_XFORM_RSA) { + if (xform->rsa.key_type == RTE_RSA_KET_TYPE_QT) + qat_clear_arrays_crt(cookie, alg_size); + else { + qat_clear_arrays(cookie, QAT_ASYM_RSA_NUM_IN_PARAMS, + QAT_ASYM_RSA_NUM_OUT_PARAMS, alg_size); + } + } } static int qat_asym_check_nonzero(rte_crypto_param n) @@ -657,8 +675,7 @@ static void qat_asym_collect_response(struct rte_crypto_op *rx_op, } } } - qat_clear_arrays_by_alg(cookie, xform->xform_type, alg_size_in_bytes, - alg_size_in_bytes); + qat_clear_arrays_by_alg(cookie, xform, alg_size_in_bytes); } void -- 2.34.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-30 16:50:12.941504518 +0100 +++ 0119-crypto-qat-fix-uncleared-cookies-after-operation.patch 2021-11-30 16:50:05.942874646 +0100 @@ -1 +1 @@ -From 867ba300f915291629c33b2eadf6a98564c622a0 Mon Sep 17 00:00:00 2001 +From 1bac9e7b29cb1979e876b810451a2272d34308d1 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 867ba300f915291629c33b2eadf6a98564c622a0 ] + @@ -10 +11,0 @@ -Cc: stable@dpdk.org