Received: by 10.223.176.46 with SMTP id f43csp927532wra; Fri, 26 Jan 2018 09:03:24 -0800 (PST) X-Google-Smtp-Source: AH8x2272SAADFJ1h2IC7vRDUiryMkSveUDZ8CPMiCGQwI2hfdnxw3CL4mxTmYuIFljBvuQc3M/eg X-Received: by 10.99.147.21 with SMTP id b21mr15731334pge.318.1516986204753; Fri, 26 Jan 2018 09:03:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516986204; cv=none; d=google.com; s=arc-20160816; b=tWUW4mfzvT4y/T4IKbMVIMVWkcJNUtFxXf0fgHPKTU14QbKsGgWg38ZnRbjcCl6W0P KMkn6VR3OxymT8QGJ2Ap4BH90IOEZdcEl2ZeCAPphi2adbUPGYfbAjw3bm/sPvH85m0o hx7b00tRxiPab11e2SJ4/bkPQfs0O4Ii7gT+rYURY6Ne8SNNHrpPb40cHbjwmuqI63eG hzfepgSdkvCCp48b7jIVvwFziJMWmwFmtMNX9hiFHiePhGmF4+atqzMlqb42fMvkFyE7 F7Ns0h7niVTo3dk1si6hx2Dq4Mn8ZeLIwvkQkkYxAycNiB5zeK0DWbBV5h1ZTIHK6O7j 2KUw== 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 :dkim-signature:arc-authentication-results; bh=/8OKyKXFl8eaAcY5CwxPGK8XXyEVRhBmohFRn1e6/9w=; b=rVg4F7syKNsoM3tvjRF3WsmLYc9OmDgj6kbuhRYwmLvyHgWUy/X1zbMpg5P9KMa1q1 dthu/WHl8c6kFotwo/vRusrbrCpqF58pP1sRd7pA/HS3+UhPBrQ+/v7A5cE0+dYTVatQ OcVmK2tRMMHbbh993pN7UmCiWWWYtcmRwv6/Fvhq5JCfZ+O3TM41rDnx8GHGDP2uhifk 9eLSlcNFIcEhIcVjmuzJLanu2fPW0FL0z4onf2sSpK/lggylVsflQSWuPynJOty3wfXC LXy9CAcUXZWZ0vrJ8MXk753LjP61v2jOWmDrQtnvxPR4sKjEK1WpyTC1PLw1UFQBd2BU HGqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nexus-software-ie.20150623.gappssmtp.com header.s=20150623 header.b=KfjQUpQX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 a185si3210881pgc.69.2018.01.26.09.03.10; Fri, 26 Jan 2018 09:03:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nexus-software-ie.20150623.gappssmtp.com header.s=20150623 header.b=KfjQUpQX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752577AbeAZRBU (ORCPT + 99 others); Fri, 26 Jan 2018 12:01:20 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:56221 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751924AbeAZRAJ (ORCPT ); Fri, 26 Jan 2018 12:00:09 -0500 Received: by mail-wm0-f67.google.com with SMTP id 143so2567216wma.5 for ; Fri, 26 Jan 2018 09:00:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexus-software-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/8OKyKXFl8eaAcY5CwxPGK8XXyEVRhBmohFRn1e6/9w=; b=KfjQUpQXw/8835y8Lj5L5Fy8sL9fLrm+Do1ggRypL8jnKlhGF3UmhpKO+IxIz30mpo RtIwafDL16tSNhJVMdIljqcqiOBOgsm72jGioOEV5DTHoLqR1qCjZixV+xgQi75YNjl1 x2SI5KeSXgEHyzhkc6aRfYy6FpQW2z5lIVxJL1lqEhIGGZ6hYbVS4AQEUr2YmWbaDVAa 8RFWkFHzKmpOi9a4vROzALWjODdsZbBygE45/+7wVgMLJ+0q0zSYKV+43mpFa4cWTeH7 /9X+gcRBpE5lmQleOd285xDMDnRBqyqxsUMFhSqIe9VrRAoVKBq0NU1lqPJZJhHMx7ao pGqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/8OKyKXFl8eaAcY5CwxPGK8XXyEVRhBmohFRn1e6/9w=; b=ec2ztjeYWsh4XlNVGQUY94v9JxrOcu8TAiud5nkWvEdyvi2eQhZdcNopT3o/RDFg9Z WfywAtqKohagmuE5cM3hm8X2DsBSUZLfvfi3RuK/5GLRr++U8zgk4vsdl7Loe1ezOxA1 4v140CdgialdvviGay0n0TvT6zH/fWW7HG/90jPgTgQq1kvGDDrL9GKlFW70pbRlYNlM 3zbb42dIrhC03iV1CeFrEElqDkZx5BeIThcGbDUdPMgipjMHN9eoafvUWo9O/cLTQQpu dlCviY0mpySc5DXN57XEaq6BfP98AaQzIMrpoCwp1WVld8Xv8myErTB4+WCvHyJ4bm9I wO8Q== X-Gm-Message-State: AKwxytewGizV3CdFcH0uckJfeVYlp3ScUKHZKQ+x3zF1pJICQ/yL8Lsl zbGrJEJcvpDdr3utl/t2sLk4EA== X-Received: by 10.80.166.218 with SMTP id f26mr34462157edc.266.1516986008591; Fri, 26 Jan 2018 09:00:08 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id d21sm2733949edb.13.2018.01.26.09.00.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Jan 2018 09:00:08 -0800 (PST) From: Bryan O'Donoghue To: horia.geanta@nxp.com, aymen.sghaier@nxp.com, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Cc: fabio.estevam@nxp.com, peng.fan@nxp.com, herbert@gondor.apana.org.au, davem@davemloft.net, lukas.auer@aisec.fraunhofer.de, rui.silva@linaro.org, ryan.harkin@linaro.org, Bryan O'Donoghue , "# 4 . 12+" Subject: [PATCH v2 2/5] crypto: caam: Fix endless loop when RNG is already initialized Date: Fri, 26 Jan 2018 17:00:01 +0000 Message-Id: <1516986004-25452-3-git-send-email-pure.logic@nexus-software.ie> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516986004-25452-1-git-send-email-pure.logic@nexus-software.ie> References: <1516986004-25452-1-git-send-email-pure.logic@nexus-software.ie> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit 1005bccd7a4a ("crypto: caam - enable instantiation of all RNG4 state handles") introduces a control when incrementing ent_delay which contains the following comment above it: /* * If either SH were instantiated by somebody else * (e.g. u-boot) then it is assumed that the entropy * parameters are properly set and thus the function * setting these (kick_trng(...)) is skipped. * Also, if a handle was instantiated, do not change * the TRNG parameters. */ This is a problem observed when sec_init() has been run in u-boot and and TrustZone is enabled. We can fix this by instantiating all rng state handles in u-boot but, on the Kernel side we should ensure that this non-terminating path is dealt with. Fixes: 1005bccd7a4a ("crypto: caam - enable instantiation of all RNG4 state handles") Reported-by: Ryan Harkin Cc: "Horia Geantă" Cc: Aymen Sghaier Cc: Fabio Estevam Cc: Peng Fan Cc: Herbert Xu Cc: "David S. Miller" Cc: Lukas Auer Cc: # 4.12+ Signed-off-by: Bryan O'Donoghue --- drivers/crypto/caam/ctrl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index 98986d3..0a1e96b 100644 --- a/drivers/crypto/caam/ctrl.c +++ b/drivers/crypto/caam/ctrl.c @@ -704,7 +704,10 @@ static int caam_probe(struct platform_device *pdev) ent_delay); kick_trng(pdev, ent_delay); ent_delay += 400; + } else if (ctrlpriv->rng4_sh_init && inst_handles) { + ent_delay += 400; } + /* * if instantiate_rng(...) fails, the loop will rerun * and the kick_trng(...) function will modfiy the -- 2.7.4