From patchwork Tue Apr 23 10:19:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 1089290 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="G49wYNi1"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44pKHB1Dp1z9sNN for ; Tue, 23 Apr 2019 20:21:25 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B6C53C21E96; Tue, 23 Apr 2019 10:20:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 4BF79C21E36; Tue, 23 Apr 2019 10:20:22 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E829FC21E1A; Tue, 23 Apr 2019 10:20:08 +0000 (UTC) Received: from mail-ed1-f65.google.com (mail-ed1-f65.google.com [209.85.208.65]) by lists.denx.de (Postfix) with ESMTPS id 7BBD2C21E60 for ; Tue, 23 Apr 2019 10:20:04 +0000 (UTC) Received: by mail-ed1-f65.google.com with SMTP id a6so12145323edv.1 for ; Tue, 23 Apr 2019 03:20:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Cx3rD9q5Initik2Wp5cgwiBObwTYr7mAjcApkT0Y/ZQ=; b=G49wYNi1trEYvv10m+ZYKOCTaq+JhvOQW7tClIEGePbKmlwKlNu5tbMXTk8/t09KWn s34lugy84h1tShTGZi0wW4GoVRikYTcvOSLchFDAcc9gz2VlUEDRuo4lpzBoN0aNl33a K3srVwmuectRqdK0fDSQ8wYC9uvVIkfuEytusF8RF1Vol7/hduOinTmGEhLvZ2k67B3D rW5AuS04vFCQNTm0topgqbH9aKa+z2uUFDeSLuezh8ellsM3t8N9xhx8qd/Vz5tpvpgV 3N+eTAcz/+xPDLILUD2hg8Riil19pAFuk65fD7auMuGODQXzIzX2CLWpybDOjhkYMDvS ZWyw== 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=Cx3rD9q5Initik2Wp5cgwiBObwTYr7mAjcApkT0Y/ZQ=; b=ucXTdnhSedPJ4JkVpjp2TOjhZyr98hUOCeVb4hLtER15K9Sa9JJ3onoEjFwsKILdh/ TMKrm/sBVpV5LX2yYhy5yBTKDtYHRlSw7k/1mM8bjtqNUrR+ks3cbkPKPeGEtB1HBpUh xO3Qdj0G4bDJNQ5PcqFUDis8yw7+MEHOu3TTG1pdlFlJqG4g3+cvuFI1zAKasjl5OITo rvIJu+POjI002p2C9ylDEA76IyGdBIBm2gqERMlxm5m2sYk8XQG/eLj4cT5uIYrjIgZg 72Sz0b0Xg3sJXrsEK52haKVcf/RwXlIwrRLdWHbPQD+yGyYF7fNFwmryvb34oA2E7VXp 78GQ== X-Gm-Message-State: APjAAAUhfecCKuLozmX/5VgtmsSrpsodDS+gSHmY77iiChT1V8cbdBSC yw/5n6j672xCdVoTEtIfjHCjdA== X-Google-Smtp-Source: APXvYqxxw29sY+0b1A5qzTJXc69RHwKXxde006SUTugjmLA7E4YAlnSCTgkBqf5IoGDfKxbZvmbqRg== X-Received: by 2002:aa7:de09:: with SMTP id h9mr15082273edv.271.1556014804188; Tue, 23 Apr 2019 03:20:04 -0700 (PDT) Received: from event-horizon.net ([80.111.179.123]) by smtp.gmail.com with ESMTPSA id z4sm121172ejm.8.2019.04.23.03.20.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Apr 2019 03:20:03 -0700 (PDT) From: Bryan O'Donoghue To: breno.lima@nxp.com, fabio.estevam@nxp.com, trini@konsulko.com, sbabic@denx.de Date: Tue, 23 Apr 2019 11:19:48 +0100 Message-Id: <20190423101948.24898-5-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190423101948.24898-1-bryan.odonoghue@linaro.org> References: <20190423101948.24898-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Cc: aneesh.bansal@nxp.com, u-boot@lists.denx.de, ruchika.gupta@nxp.com, silvano.dininno@nxp.com Subject: [U-Boot] [PATCH 4/4] crypto/fsl: Wrapper run_descriptor_jr_idx() to set jr permissions X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This patch sets the relevant set of job-rings to secure-world prior to calling into run_descriptor_jr_idx(). As observed by Breno Matheus Lima the DEK blob verification layer in NXP BootROMs performs a check on job-ring ownership and requires the permission to be set to secure world. Once run_descriptor_jr_idx() is complete we switch back to normal-world ownership. Normal world job-ring ownership allows Linux to run in either secure or normal world when using the CAAM, irrespective which is ultimately what we want to support. Signed-off-by: Bryan O'Donoghue --- drivers/crypto/fsl/jr.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/fsl/jr.c b/drivers/crypto/fsl/jr.c index 65982b8369..8ab92ad2f1 100644 --- a/drivers/crypto/fsl/jr.c +++ b/drivers/crypto/fsl/jr.c @@ -389,7 +389,13 @@ out: int run_descriptor_jr(uint32_t *desc) { - return run_descriptor_jr_idx(desc, 0); + int ret; + + sec_set_jr_context_secure(); + ret = run_descriptor_jr_idx(desc, 0); + sec_set_jr_context_normal(); + + return ret; } static inline int jr_reset_sec(uint8_t sec_idx)