Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1028439pxk; Thu, 10 Sep 2020 05:22:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEUnTFVQVciYTgIGhuto7Svs+so1Lm6d6peBeBeXEVbHdFM+ikV+sBbKuhaO/H9eD6i0Zj X-Received: by 2002:a17:906:375a:: with SMTP id e26mr8254635ejc.552.1599740572771; Thu, 10 Sep 2020 05:22:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599740572; cv=none; d=google.com; s=arc-20160816; b=xOlaJ0lZjpeeXFoMmyLxbOfjDfAXDu6vsJVJ+PWs7+kXCyN6K1ElmzCfpE6N4ASsJg oTXQKzhTk2Q95LhtP0iBRREXYy9awmL5UWEkOozYZ0x+WKJJICnaGxosOEsYOg3tML5U kIkhLmBeSGges9lEohpWjY2r032r4R9vFkhNVtQbcTDc5s5tFq+XK3q/ZAYBjMONJnMV RS2FuZAKFzTn5PR7Cj0aD8L71Uy73nsgGkxLe8/+HBUcs4wE5evFOyROqDnJBNjjU3H5 bUuhoOppF3Q5FKi+zuWVXdQwv8FpljHrgcSFi7Wogdxkcob5dxlg7AUlgQsJmBlzmTv4 RZaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=3DqUZaLhFlFkx6jxt2qpDLAkZS9wRCzpbw3+KN0uRzE=; b=wkC6+EvA/boVffDSchsw+PPV/FRQ1j09+iiEqDMj62LXcrJWB4BI5PeQU0Y/2m+l1h MWVEAQvzTRKN5CbdRKvtkJpunNEOJPra0jwKy+W16UlX1K44KJKXLrP8KmpBytsrMfV5 Kl8YpJbVW+3dVT3UJtgCTgDzKpqzA/me+5aw0hKELEQpDnNVamhObOh6rcILX/gQXdIN V3y5b9CSssOutS2Fj+eK4a4JgtaPqtZ9uJU0HXUcYtd9uDRs6qYvDTYJA2rUFJusAVg+ V77kpcYVLml2A8duxb+oyjQ1XNNOswTIDPxCspNFrRENtLq5kW4I/7u/I05bwRXpVuQQ aokA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n8si3368251edb.421.2020.09.10.05.22.28; Thu, 10 Sep 2020 05:22:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728350AbgIJMUw (ORCPT + 99 others); Thu, 10 Sep 2020 08:20:52 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:11786 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730395AbgIJMRx (ORCPT ); Thu, 10 Sep 2020 08:17:53 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id C54A62D3EF1EC851C7A6; Thu, 10 Sep 2020 19:26:48 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.487.0; Thu, 10 Sep 2020 19:26:40 +0800 From: Meng Yu To: , CC: , , , Subject: [PATCH 3/3] crypto: hisilicon/hpre - fix a bug in dh algorithm Date: Thu, 10 Sep 2020 19:25:22 +0800 Message-ID: <1599737122-20734-4-git-send-email-yumeng18@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1599737122-20734-1-git-send-email-yumeng18@huawei.com> References: <1599737122-20734-1-git-send-email-yumeng18@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Using 'g' equals 5 in dh algorithm may cause an error like this: arm-smmu-v3 arm-smmu-v3.1.auto: event 0x10 received: dh: Party A: generate public key test failed. err -22 11375.065672] dh alg: dh: test failed on vector 1, err=-22 arm-smmu-v3 arm-smmu-v3.1.auto: 0x0000790000000010 arm-smmu-v3 arm-smmu-v3.1.auto: 0x0000120800000080 hpre-dh self test failed arm-smmu-v3 arm-smmu-v3.1.auto: 0x0000000000000000 arm-smmu-v3 arm-smmu-v3.1.auto: 0x0000000000000000 arm-smmu-v3 arm-smmu-v3.1.auto: event 0x10 received: arm-smmu-v3 arm-smmu-v3.1.auto: 0x0000790000000010 arm-smmu-v3 arm-smmu-v3.1.auto: 0x0000120800000083 arm-smmu-v3 arm-smmu-v3.1.auto: 0x00000000000000c0 arm-smmu-v3 arm-smmu-v3.1.auto: 0x0000000000000000 arm-smmu-v3 arm-smmu-v3.1.auto: event 0x10 received: arm-smmu-v3 arm-smmu-v3.1.auto: 0x0000790000000010 arm-smmu-v3 arm-smmu-v3.1.auto: 0x0000120800000081 arm-smmu-v3 arm-smmu-v3.1.auto: 0x0000000000000040 arm-smmu-v3 arm-smmu-v3.1.auto: 0x0000000000000000 arm-smmu-v3 arm-smmu-v3.1.auto: event 0x10 received: arm-smmu-v3 arm-smmu-v3.1.auto: 0x0000790000000010 arm-smmu-v3 arm-smmu-v3.1.auto: 0x0000120800000082 arm-smmu-v3 arm-smmu-v3.1.auto: 0x0000000000000080 arm-smmu-v3 arm-smmu-v3.1.auto: 0x0000000000000000 hisi_hpre 0000:79:00.0: dat_rd_poison_int_set [error status=0x8] found hisi_hpre 0000:79:00.0: ooo_rdrsp_err_int_set [error status=0xfc00] found hisi_hpre 0000:79:00.0: Controller resetting... hisi_hpre 0000:79:00.0: Controller reset complete {2}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 0 {2}[Hardware Error]: event severity: recoverable {2}[Hardware Error]: Error 0, type: recoverable {2}[Hardware Error]: section type: unknown, c8b328a8-9917-4af6-9a13-2e08ab2e7586 {2}[Hardware Error]: section length: 0x4c as we didn't allocate memory for msg->in. Fixes: c8b4b477079d("crypto: hisilicon - add HiSilicon HPRE accelerator") Signed-off-by: Meng Yu --- drivers/crypto/hisilicon/hpre/hpre_crypto.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/crypto/hisilicon/hpre/hpre_crypto.c b/drivers/crypto/hisilicon/hpre/hpre_crypto.c index 0cbe99a1..2d91593 100644 --- a/drivers/crypto/hisilicon/hpre/hpre_crypto.c +++ b/drivers/crypto/hisilicon/hpre/hpre_crypto.c @@ -528,6 +528,8 @@ static int hpre_dh_compute_value(struct kpp_request *req) ret = hpre_hw_data_init(hpre_req, req->src, req->src_len, 1, 1); if (unlikely(ret)) goto clear_all; + } else { + msg->in = cpu_to_le64((u64)ctx->dh.dma_g); } ret = hpre_hw_data_init(hpre_req, req->dst, req->dst_len, 0, 1); -- 2.8.1