Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp486143imn; Wed, 27 Jul 2022 11:32:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sAyTw2ajEFZC5IVekSu0eIZfBv/rxXXBMUALZL9gvpcc0mSjMCEPTH4yIIvhKyYRUq93bS X-Received: by 2002:a05:6402:43cf:b0:43b:d65e:2002 with SMTP id p15-20020a05640243cf00b0043bd65e2002mr24201462edc.91.1658946737784; Wed, 27 Jul 2022 11:32:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946737; cv=none; d=google.com; s=arc-20160816; b=zfqAgXsgn5QVlog2A2DcJQAc2T0NfZyeAWDmrRJ6pneT/Xjh4iZcGFqP+tdzMoQwJu kdPNMVJqK+IMiE8AU8gxZ9LjEi+Fjt/6ASU5um657ySTsGiCE0pVjBE4gc65m3xy4Lo5 do7E7wxhW67EAf0l7UnHuybalI5ltJKxzV7K1GbSiFdVQXTl9rnGcPMluai5XRqgZ+WY FmJrquwG7B9yT+e19Rhbw8ZqIjyMbFlGuDulpmcP5DOsXDX/iPnTa25LdtMVvo71tGSs moSpwxcAN7vejOeMZsGO+OBPHJcCWSN7+MKGMX+XVpPT8madl3Bxs6F889AnKx+qM2fd uAXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=u6zcFibiUELUzNAI+SvKwKdPfKxwDb1CJb64TpRG3rU=; b=KPtEFlQsArpD1+DoK+vkrdFRt7IYclM3HoM5OHQimop5rAj46k50uxuxmlcqO6tgEN TQ12iyieISEQF2XpoyIB9Qt6DufN3a4CmX1r1hgL3GuPzHENHSXzJ3tWDQVWMBfi8XsW 4V7AuGwcqhIGwtN+MhcaO1f4QABZcrI1ICOVT7ZwNCDjGbzCvEXdbh7FceeS/PT3DDRn icaXnkNVVREcIFhVJBGfwiGvCrPaIXZYTZM8DeQhGAzJ5Tj9Hl7v95JywfUsDWH/IQWt 0DSwHFKlQqZbQbCuVv4VmOzVo4B5rAO62kaNi6hpdmf9ppoc9mw1XZW7NIMjiyyUWJTC uw8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="orB/p/fm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y16-20020a056402441000b0043bbb93fd28si24130743eda.102.2022.07.27.11.31.52; Wed, 27 Jul 2022 11:32:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="orB/p/fm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231152AbiG0RWe (ORCPT + 99 others); Wed, 27 Jul 2022 13:22:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241913AbiG0RTT (ORCPT ); Wed, 27 Jul 2022 13:19:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF22E5D0D5; Wed, 27 Jul 2022 09:44:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 39B7F60DDB; Wed, 27 Jul 2022 16:44:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F3A3C433C1; Wed, 27 Jul 2022 16:44:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658940251; bh=8TAjTG3BVgjt6+mej6insq8utXxrMq0kT2BsFUAqqQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=orB/p/fmPQKpEBjcW4pJNSJdhZiBxIGfzcwgSbu/xdi8nvcPIaAcgfggg+nYlDQES 9xWPWUallzFOSaoBkagHs6ahwKvCncZcZMVQ+P1RqrPJRDEuBWBfkbCrdbQ83ivywk NEsmsPHxfL5Y8FNVdOrrzl77Rpc3Epj15iVnvx2I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Giovanni Cabiddu , Adam Guerin , Wojciech Ziemba , Herbert Xu , Sasha Levin Subject: [PATCH 5.15 158/201] crypto: qat - set to zero DH parameters before free Date: Wed, 27 Jul 2022 18:11:02 +0200 Message-Id: <20220727161034.370335483@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161026.977588183@linuxfoundation.org> References: <20220727161026.977588183@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Giovanni Cabiddu [ Upstream commit 1731160ff7c7bbb11bb1aacb14dd25e18d522779 ] Set to zero the context buffers containing the DH key before they are freed. This is a defense in depth measure that avoids keys to be recovered from memory in case the system is compromised between the free of the buffer and when that area of memory (containing keys) gets overwritten. Cc: stable@vger.kernel.org Fixes: c9839143ebbf ("crypto: qat - Add DH support") Signed-off-by: Giovanni Cabiddu Reviewed-by: Adam Guerin Reviewed-by: Wojciech Ziemba Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/qat/qat_common/qat_asym_algs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/crypto/qat/qat_common/qat_asym_algs.c b/drivers/crypto/qat/qat_common/qat_asym_algs.c index b0b78445418b..5633f9df3b6f 100644 --- a/drivers/crypto/qat/qat_common/qat_asym_algs.c +++ b/drivers/crypto/qat/qat_common/qat_asym_algs.c @@ -420,14 +420,17 @@ static int qat_dh_set_params(struct qat_dh_ctx *ctx, struct dh *params) static void qat_dh_clear_ctx(struct device *dev, struct qat_dh_ctx *ctx) { if (ctx->g) { + memset(ctx->g, 0, ctx->p_size); dma_free_coherent(dev, ctx->p_size, ctx->g, ctx->dma_g); ctx->g = NULL; } if (ctx->xa) { + memset(ctx->xa, 0, ctx->p_size); dma_free_coherent(dev, ctx->p_size, ctx->xa, ctx->dma_xa); ctx->xa = NULL; } if (ctx->p) { + memset(ctx->p, 0, ctx->p_size); dma_free_coherent(dev, ctx->p_size, ctx->p, ctx->dma_p); ctx->p = NULL; } -- 2.35.1