Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp610423pxx; Wed, 28 Oct 2020 12:20:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyc+0m/rYhGNkYkHTxL7ea39bC7y/I/bej4UjxQhFtXigHJa7CMpzdL7Ac1tOxzvaVtPXXM X-Received: by 2002:a17:907:960b:: with SMTP id gb11mr595623ejc.396.1603912842063; Wed, 28 Oct 2020 12:20:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603912842; cv=none; d=google.com; s=arc-20160816; b=rXzLgwUl4a6UUaGNnJWTL10hFK8Cy10GmFoQSxeWTpELdJliaktXPMx9pkYLaHFAy+ knrVJrR5uoLLrd+Zjf4OYszI6KxLPa65+tViJmJDcZTxwyGgTun/zA3DAIvEVLqV7mFm 0Yb6Ym63h+HU5+wUyy15IE5eHJleLguTM7a9+bZloE/hNZrswLbo+X7cRlJZ3+xIIj6q pxzQvlaIb8XHL46wgvQrFwWGpeGSK3SfYIqvyGNQI9jRp3ZUpvMdH6fSD8DDviYsjzsl vYI7W6GWd17BefDoKtW5p/3i/q+jkN43KwTBOIKnZZbu8PKqrpSpP+hw+kjGuuF6iqcf m5xA== 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=ccyWhh2z/n31Vp6ALguaS3eQWTFL7U2WqByiotEaIoA=; b=DyQbpxMDpV5hQwz3JOlRPZBletYVlEVhoafPm+kx06E5X5cKYAPMdDw1G1K6FtD2xR UGqXOooTxCtd43wRQ+jXAGwj5ykvsk01PuSzxCGq8OfYLn+1yMT/5U58U7s1bnd+mhxs AYbe8GpYgozpvIdFI15KO8WbHa2kHHfqm9ptk6hJu7ZxsUCqaCmSpXs0z/7PoFmOCFCa lw8HCzKrXm9usIqvE8S63zztm7B2lLGSKPOYT8oYMSa4RGtJrqM5Abf1XPVnTr9mh75q /b1YcazfHuTaxDPeSMYXf5PG7nAgjywp40iKir0Ty6ihCPJjzPFzq6gpe0akF00All8l YnsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ihr4Iots; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h13si2268edr.541.2020.10.28.12.20.19; Wed, 28 Oct 2020 12:20:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ihr4Iots; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1827257AbgJ0SWf (ORCPT + 99 others); Tue, 27 Oct 2020 14:22:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:50370 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753825AbgJ0OCa (ORCPT ); Tue, 27 Oct 2020 10:02:30 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ED9FA22263; Tue, 27 Oct 2020 14:02:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807350; bh=Tt8anaHWBpkqAAG8PNcOXNLxoDkf7g9eYAlqnYGKg5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ihr4Iots3OSmI7RoTegu1VBgaLp7crCbdXweA+ZSv53SttgIEFPhWWuYmX3DIHVLL xoDjQK/6o8ZNnIFfuGi9iCZ71Kki/0Cfggx0aeCBkK64uqo5wKOjtxcMRdokn0LE4L HSsPfRtnZSCQqJ4RiCOWp86lmrSyOE7Xc1G1tWvI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tero Kristo , Herbert Xu , Sasha Levin Subject: [PATCH 4.9 020/139] crypto: omap-sham - fix digcnt register handling with export/import Date: Tue, 27 Oct 2020 14:48:34 +0100 Message-Id: <20201027134903.090841266@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134902.130312227@linuxfoundation.org> References: <20201027134902.130312227@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tero Kristo [ Upstream commit 3faf757bad75f3fc1b2736f0431e295a073a7423 ] Running export/import for hashes in peculiar order (mostly done by openssl) can mess up the internal book keeping of the OMAP SHA core. Fix by forcibly writing the correct DIGCNT back to hardware. This issue was noticed while transitioning to openssl 1.1 support. Fixes: 0d373d603202 ("crypto: omap-sham - Add OMAP4/AM33XX SHAM Support") Signed-off-by: Tero Kristo Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/omap-sham.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c index e7ca922a45e13..4adcf89add252 100644 --- a/drivers/crypto/omap-sham.c +++ b/drivers/crypto/omap-sham.c @@ -454,6 +454,9 @@ static void omap_sham_write_ctrl_omap4(struct omap_sham_dev *dd, size_t length, struct omap_sham_reqctx *ctx = ahash_request_ctx(dd->req); u32 val, mask; + if (likely(ctx->digcnt)) + omap_sham_write(dd, SHA_REG_DIGCNT(dd), ctx->digcnt); + /* * Setting ALGO_CONST only for the first iteration and * CLOSE_HASH only for the last one. Note that flags mode bits -- 2.25.1