summaryrefslogtreecommitdiffstats
path: root/drivers/crypto
diff options
context:
space:
mode:
authorGilad Ben-Yossef <gilad@benyossef.com>2019-07-02 14:39:19 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-11 18:20:54 +0200
commitf5c087a0d9a0e31b4a97ebba3b5eb263f1a6c24f (patch)
treebcec56761a745cb88ed69742e27cef44c5098de1 /drivers/crypto
parent561bf9309209e174035eaee0edfc3247ecfdff76 (diff)
downloadlinux-stable-f5c087a0d9a0e31b4a97ebba3b5eb263f1a6c24f.tar.gz
linux-stable-f5c087a0d9a0e31b4a97ebba3b5eb263f1a6c24f.tar.bz2
linux-stable-f5c087a0d9a0e31b4a97ebba3b5eb263f1a6c24f.zip
crypto: ccree - account for TEE not ready to report
commit 76a95bd8f9e10cade9c4c8df93b5c20ff45dc0f5 upstream. 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 <gilad@benyossef.com> Fixes: ab8ec9658f5a ("crypto: ccree - add FIPS support") CC: stable@vger.kernel.org # v4.17+ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/ccree/cc_fips.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/crypto/ccree/cc_fips.c b/drivers/crypto/ccree/cc_fips.c
index 09f708f6418e..bac278d274b0 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;
}
/*