From patchwork Mon Jan 27 10:27:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 1229664 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.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.a=rsa-sha256 header.s=google header.b=sElXBO6w; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 485mDV1kDFz9sPW for ; Mon, 27 Jan 2020 21:28:25 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 235E18191D; Mon, 27 Jan 2020 11:28:23 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="sElXBO6w"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0C9A58192A; Mon, 27 Jan 2020 11:28:21 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A90CB8191A for ; Mon, 27 Jan 2020 11:28:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pg1-x543.google.com with SMTP id l24so4938898pgk.2 for ; Mon, 27 Jan 2020 02:28:17 -0800 (PST) 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=Ju2be65r/4AvVJvZuxtZvOwP6K9FiaeWhpZCVjrcqgA=; b=sElXBO6wQO3AWGc8ru9NHV/9Hie8U2iuehgXvQ49aeD0TgIHAjuSAD+UUGRmQ59VO9 1t0ZzJMK8lpducfONDXEJMy4TNzgDIlT7KsMgyc8pldRwq/KY8ZkiU7PXW63uyOeqcqc BWok3X0q4dD49uGzETCoZmhannMBVeugxF9uaknua/7eJRT17r7+Eq8H7Uf6qYSAhpf+ NWIFpWAfniQUokXDbd3bhgLVoYau9uK/7B5Lzk2FVZ7lBykbBpALR0yYKRFcN2deSFUY aL8DwrxusC7QNZ+gyD7/uCLZ3qM3Oz7QdyCtkRd0xvvL2Gr9dAQ6LAp0EQfiDfN6ICmL 8AVQ== 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=Ju2be65r/4AvVJvZuxtZvOwP6K9FiaeWhpZCVjrcqgA=; b=K5HqrPfvI/CuDSOhpRJqTV7ZXyejr6xJNwSltuqJWbbOYWqsn49EDyeNRGMd5DrW+7 UwVynQZRjFNiog8Xe/S+BQ66t5clTykYZcT9wSu6eWefYNqOS55snu/f+tl5XZvuzLvm 1pSDubrMq9qnD5X62Y2Z7muAwdmxWElFQFPo2sH55HUUJDk4M8NniWZ74XgJptFuqo79 FP3wLa9sdnu0qiA47HEEhkkULihSq+7qC87quwDceu2FFn/hX2QKoA+Edt7JwFRZVccn NZYSdfDFfiE9vpNwTjHyVBcsAGTqsNqZ3WZykh/iTDKjvRWEB+1XlQajobiLszLBJyZu V5VA== X-Gm-Message-State: APjAAAVsazDe2p9ALVh6uDQKW3PmOkL9cllgIEf3FAPDO2e0Law1SdkE UGPk2Somefbjg/IkNY3TxAMOBg== X-Google-Smtp-Source: APXvYqwTznkDIxEEoYSEEZY049j5iBnC6TbGzx1xOO4MKjmVaRnreMii/4B8WTK8bYt+Ev2xqwNQvg== X-Received: by 2002:a63:2b52:: with SMTP id r79mr18378934pgr.230.1580120895926; Mon, 27 Jan 2020 02:28:15 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id b3sm11670341pft.73.2020.01.27.02.28.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jan 2020 02:28:15 -0800 (PST) From: AKASHI Takahiro To: trini@konsulko.com, sjg@chromium.org, xypron.glpk@gmx.de, agraf@csgraf.de Subject: [PATCH v6 2/7] rsa: add CONFIG_RSA_VERIFY_WITH_PKEY config Date: Mon, 27 Jan 2020 19:27:35 +0900 Message-Id: <20200127102740.26831-3-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200127102740.26831-1-takahiro.akashi@linaro.org> References: <20200127102740.26831-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: u-boot@lists.denx.de, mail@patrick-wildt.de Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean In the next couple of commits, under new CONFIG_RSA_VERIFY_WITH_PKEY, rsa_verify() will be extended to be able to perform RSA decryption without additional RSA key properties from FIT image, i.e. rr and n0inv. Signed-off-by: AKASHI Takahiro Reviewed-by: Simon Glass --- lib/rsa/Kconfig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/rsa/Kconfig b/lib/rsa/Kconfig index 18a075c17478..89697219db2d 100644 --- a/lib/rsa/Kconfig +++ b/lib/rsa/Kconfig @@ -28,6 +28,20 @@ config RSA_VERIFY help Add RSA signature verification support. +config RSA_VERIFY_WITH_PKEY + bool "Execute RSA verification without key parameters from FDT" + select RSA_VERIFY + help + The standard RSA-signature verification code (FIT_SIGNATURE) uses + pre-calculated key properties, that are stored in fdt blob, in + decrypting a signature. + This does not suit the use case where there is no way defined to + provide such additional key properties in standardized form, + particularly UEFI secure boot. + This options enables RSA signature verification with a public key + directly specified in image_sign_info, where all the necessary + key properties will be calculated on the fly in verification code. + config RSA_SOFTWARE_EXP bool "Enable driver for RSA Modular Exponentiation in software" depends on DM