Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3248461ybi; Tue, 2 Jul 2019 04:40:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzDV68eRcjwqBzEAixFUfzvcqexH89wVg6rqCDDcEaUlvSU7I1aqjd2eW5iML9ydFaVutlb X-Received: by 2002:a63:394:: with SMTP id 142mr22477780pgd.43.1562067603118; Tue, 02 Jul 2019 04:40:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562067603; cv=none; d=google.com; s=arc-20160816; b=QVlY9Ifnl4mUDtd1RyWA12IYFUwbTvV+rE50OIaL7GiJKXfHT7SwU1o0WHwkyQv/kj bRZOeV2g+XoNtnD2blQv0ZwsliTyWzdO/IAA0xX59QlGt4PJxvONv8GBqtH5DJ7jCyF1 k6fPy+lszhkJpeT35bc6d6J4lQFWJ4dIIQzdVJi4zD0QJ8JCQkkV0vLOMqNKsmkZWQf4 JCse1Udt6jGwX67ifDTe5KXROeRbV/4m8Gv0ZeMvxtgybtaa1ie8TeYsYR/Tzjcbvg8l vee+Lc7+FoThwIp3B03oRl5ksFsGyf+bEvpymKvN+eEdtjGRqz6+NkfwTUkXcqRw2OwC KQcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=9TtOX1eRW9TkRP7iNnO8AU2B9wmKKMcGMJpkrIQudYo=; b=Plkp02xNroIcJnItsVaoT1IjU7Tz5Ln4eiyccxScZ/j7qdswYXJJA40PMRcUeVCk45 fDwgRgkMqSxXsIKoK8lOEB0+pe3QaMnoLx3rvMlF2ChXc9VEw4ruu82Db+0f5XOGfYXT 0IA129dZlOF8QV+iVd/NEIfa92ikm0atGX9KqqOw7Slg1XqwMRbzAveogtzz/a3z+R3k nHcJNeIb+0xAm50LMmwK/Pu/EgZ91DlGEdSZT2DOHzCeVXc2C26edt9TcxUtSGfgEKHG eNHDNjcx/oXR6iN4eXgH+INTiX7dUSJGrnIB7D1nSNdFMSgTP/ybYKKN/pjIB3b1j2za 1Dxg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y187si12636824pgb.480.2019.07.02.04.39.49; Tue, 02 Jul 2019 04:40:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726821AbfGBLjh (ORCPT + 99 others); Tue, 2 Jul 2019 07:39:37 -0400 Received: from foss.arm.com ([217.140.110.172]:48110 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725868AbfGBLjh (ORCPT ); Tue, 2 Jul 2019 07:39:37 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 85B84344; Tue, 2 Jul 2019 04:39:36 -0700 (PDT) Received: from e110176-lin.kfn.arm.com (unknown [10.50.4.178]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 27EF93F246; Tue, 2 Jul 2019 04:39:34 -0700 (PDT) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" Cc: Ofir Drang , stable@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] crypto: ccree: account for TEE not ready to report Date: Tue, 2 Jul 2019 14:39:19 +0300 Message-Id: <20190702113922.24911-3-gilad@benyossef.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190702113922.24911-1-gilad@benyossef.com> References: <20190702113922.24911-1-gilad@benyossef.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org When ccree driver runs it checks the state of the Trusted Execution Environment CryptoCell driver before proceeding. We did not account for cases where the TEE side is not ready or not available at all. Fix it by only considering TEE error state after sync with the TEE side driver. Signed-off-by: Gilad Ben-Yossef Fixes: ab8ec9658f5a ("crypto: ccree - add FIPS support") CC: stable@vger.kernel.org # v4.17+ --- drivers/crypto/ccree/cc_fips.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/ccree/cc_fips.c b/drivers/crypto/ccree/cc_fips.c index 5ad3ffb7acaa..040e09c0e1af 100644 --- a/drivers/crypto/ccree/cc_fips.c +++ b/drivers/crypto/ccree/cc_fips.c @@ -21,7 +21,13 @@ static bool cc_get_tee_fips_status(struct cc_drvdata *drvdata) u32 reg; reg = cc_ioread(drvdata, CC_REG(GPR_HOST)); - return (reg == (CC_FIPS_SYNC_TEE_STATUS | CC_FIPS_SYNC_MODULE_OK)); + /* Did the TEE report status? */ + if (reg & CC_FIPS_SYNC_TEE_STATUS) + /* Yes. Is it OK? */ + return (reg & CC_FIPS_SYNC_MODULE_OK); + + /* No. It's either not in use or will be reported later */ + return true; } /* -- 2.21.0