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 21C7745CF9; Wed, 13 Nov 2024 19:57:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B5B4F40E3A; Wed, 13 Nov 2024 19:57:34 +0100 (CET) Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by mails.dpdk.org (Postfix) with ESMTP id E7C1D406B8 for ; Wed, 13 Nov 2024 19:57:31 +0100 (CET) Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-723f37dd76cso7482613b3a.0 for ; Wed, 13 Nov 2024 10:57:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731524251; x=1732129051; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CWmOTIvK9ZDcp4lN2B5D+UrdOO/GFdM4zqUVUE9+t1w=; b=ces1I34b8fTZemEF39yYrjfoHMp3F2J1gxvD5sA3cqMh1PhC+/Tr3LikZGZCWUCXXu LHTs1kZNTcIFY2qnhE2v3K3AudHHi3oSSXGBqFB4361PQXZWCkXpMSrQn158wYiJqJ7Q 0ZsmPaGD24Wpptzn2UEBX+QRpFbY0SGa8QXPxFwHfj6AZxAjUdHhdTVVJil7gnWwpyJr xPy0mmajtl5GhCfgY7sdFb9ghGeXu+Sv3BdtytO+Y/DCCjyVdx9zDsJ1Ksd3RynMFsZI D2ZNVNhNGp4lMggW8yExPXmbqdsnljxX/FOlRHwxQPT2BEJHu3VVxpPnzqsWYQtsByWI eJdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731524251; x=1732129051; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CWmOTIvK9ZDcp4lN2B5D+UrdOO/GFdM4zqUVUE9+t1w=; b=MCRZTymN0MtbBVwPpYsOthONABqLdtWr7vXnl1kBw0t6ZgmgnYSRIHDLIfw38CcjfI LR/nXQnAF9lii19Dmi3/qM8oWX03f4C0BNTD9qMc+C7B9MUYcyDShVKTBXYmv7J4KgD9 kQstmm2TSGPsNVY6iroTZqHsJQeMY6a5l3gPXj98dvf0Nsx35pG3cGdu4ZGuI8CwMKaw CRKg+ErwJn9erRHngiC2XP0f6mBnKitSKt7CLx2Vff4Q1XoD3JDH8QZkMdwfO45yY+Ah icc+ouyaZ3ocCNxEceRJSytt2byxPgm97kUPjV+bba4+8BFJmbknqThaHBrdIz8ARq8k I67Q== X-Gm-Message-State: AOJu0YwRlv7sYV1vnCwkAf4vBDCUow680jfBVzK+uWCGh/nV6n82BryA LawahNEbfaMCg8/d6u4whpeBmGHvZZOkd8jRS6HImtX6uBAORPhgQfpACYpF9NN6G/i3QP6d9mo 4 X-Google-Smtp-Source: AGHT+IEWlP8WS0MguXvnpvqvbWcXlVWKIWyZ8FkATzi8EcmxHJ/wi/jP5Z2fiCeJuWHXXZWGPrq3PA== X-Received: by 2002:a17:90b:2e48:b0:2e2:cd2f:b919 with SMTP id 98e67ed59e1d1-2e9f2d455b4mr4071213a91.28.1731524251101; Wed, 13 Nov 2024 10:57:31 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e9f3e977d7sm1817935a91.8.2024.11.13.10.57.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 10:57:30 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Kai Ji , Ciara Power , Fan Zhang Subject: [RFC 1/5] crypto/qat: fix memset of SHA3 state Date: Wed, 13 Nov 2024 10:56:00 -0800 Message-ID: <20241113185720.28706-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241113185720.28706-1-stephen@networkplumber.org> References: <20241113185720.28706-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 memset was always doing 0 bytes since size computed later. PVS studio bug 24-27 Fixes: 3a80d7fb2ecd ("crypto/qat: support SHA3 plain hash") Signed-off-by: Stephen Hemminger --- drivers/crypto/qat/qat_sym_session.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c index 50d687fd37..8ccd1babc0 100644 --- a/drivers/crypto/qat/qat_sym_session.c +++ b/drivers/crypto/qat/qat_sym_session.c @@ -2346,7 +2346,7 @@ int qat_sym_cd_cipher_set(struct qat_sym_session *cdesc, return 0; } -int qat_sym_cd_auth_set(struct qat_sym_session *cdesc, +static int qat_sym_cd_auth_set(struct qat_sym_session *cdesc, const uint8_t *authkey, uint32_t authkeylen, uint32_t aad_length, @@ -2619,27 +2619,27 @@ int qat_sym_cd_auth_set(struct qat_sym_session *cdesc, break; case ICP_QAT_HW_AUTH_ALGO_SHA3_224: /* Plain SHA3-224 */ - memset(cdesc->cd_cur_ptr, 0, state1_size); state1_size = qat_hash_get_state1_size( cdesc->qat_hash_alg); + memset(cdesc->cd_cur_ptr, 0, state1_size); break; case ICP_QAT_HW_AUTH_ALGO_SHA3_256: /* Plain SHA3-256 */ - memset(cdesc->cd_cur_ptr, 0, state1_size); state1_size = qat_hash_get_state1_size( cdesc->qat_hash_alg); + memset(cdesc->cd_cur_ptr, 0, state1_size); break; case ICP_QAT_HW_AUTH_ALGO_SHA3_384: /* Plain SHA3-384 */ - memset(cdesc->cd_cur_ptr, 0, state1_size); state1_size = qat_hash_get_state1_size( cdesc->qat_hash_alg); + memset(cdesc->cd_cur_ptr, 0, state1_size); break; case ICP_QAT_HW_AUTH_ALGO_SHA3_512: /* Plain SHA3-512 */ - memset(cdesc->cd_cur_ptr, 0, state1_size); state1_size = qat_hash_get_state1_size( cdesc->qat_hash_alg); + memset(cdesc->cd_cur_ptr, 0, state1_size); break; case ICP_QAT_HW_AUTH_ALGO_AES_XCBC_MAC: state1_size = ICP_QAT_HW_AES_XCBC_MAC_STATE1_SZ; -- 2.45.2