From patchwork Tue Dec 17 08:54:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 1211219 X-Patchwork-Delegate: xypron.glpk@gmx.de 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=2a01:238:438b:c500:173d:9f52:ddab:ee01; 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.b="SK07yhUt"; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 47cX4600wCz9sRh for ; Tue, 17 Dec 2019 19:53:41 +1100 (AEDT) Received: from phobos.denx.de (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BA74F814E1; Tue, 17 Dec 2019 09:53:19 +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="SK07yhUt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 884EB8149F; Tue, 17 Dec 2019 09:53:17 +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-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) (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 ED79A814C1 for ; Tue, 17 Dec 2019 09:53:12 +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-pj1-x1043.google.com with SMTP id j11so4284855pjs.1 for ; Tue, 17 Dec 2019 00:53:12 -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=FEHUi4pcz47s13NliFD+kqIQmk0hT2PkzRLi7MmjGno=; b=SK07yhUtPaysrkzxNBTWVQmxIfop1MGX5sa98fRHCNaCLEeVJb/f/oeHCVJMf81zYi l2iR9g4bmWPCnJZKQc11wGmt4/R7/bB4icqY6au86afdC05P6cwel3TcRD4TImtsYQeZ iQDyoTuHbldsgA+uTLPVlqTzhWU9gJIL4siM/G1U1EAalX4k4tszFv3Bcy78q+C6z+fo 3vX91zdz72ELNQXlmmory/YjE0lBFZR1wEsu5KbaM59gvYrkE9aLddCSyoOHVIN4wHU1 VrUEYY9jNy04HPE/3ceTNd9+lyQ4DLW2YlKK/l6fBbZWCGIlKha13VoUMQAPWK0i4x5e kIVw== 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=FEHUi4pcz47s13NliFD+kqIQmk0hT2PkzRLi7MmjGno=; b=UaV8DQh7tfDVyUBXmWVzs+WMzi9fx4bOaj1eJpxkJY77f5Qo5sbOlSkQb+Fr39vCwr 366KQrzbXeZvYTzgV5IkfEkVNfnDU7hKPv65DK8amDANZcA6YNXjapnCHYx4FkWigGkc AcVd4aN1GaY6Gtry/zw4b0VhZRHf7mooYMAIJtZhRjeIl2MUZlcqA6JZDlLAp98X+Ylk bTJDKPIsnPNFq61U6WvM0cCqjNvO5TK94TxBfnJvf4mQO87CefR/8sI0yG39/wugPG4a 24idguptLLctn60ALbjsQuK5k8N/XW+DqYDbsm0cggeMliP9IN9IUpqyzagkIYr4/2f4 9DFQ== X-Gm-Message-State: APjAAAU3AqelZT4QZf04TB5uWs9U//xtNwuay1UZu/+GoKxlejFGI44W 9Z150Qbx0s0U6BENo5jbHxHuaA== X-Google-Smtp-Source: APXvYqytTuMvqEwlBaePAbub3zxsx+rno+DMnEOZHNNSXGVchFn3qEGph5zjR8xi1IkoAO6OoVurKw== X-Received: by 2002:a17:902:6b85:: with SMTP id p5mr21466863plk.32.1576572791456; Tue, 17 Dec 2019 00:53:11 -0800 (PST) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id u18sm26631787pgn.9.2019.12.17.00.53.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Dec 2019 00:53:10 -0800 (PST) From: AKASHI Takahiro To: trini@konsulko.com, sjg@chromium.org, xypron.glpk@gmx.de, agraf@csgraf.de Subject: [PATCH v5 3/6] include: image.h: add key info to image_sign_info Date: Tue, 17 Dec 2019 17:54:19 +0900 Message-Id: <20191217085422.9089-4-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191217085422.9089-1-takahiro.akashi@linaro.org> References: <20191217085422.9089-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 For FIT verification, all the properties of a public key come from "control fdt" pointed to by fdt_blob. In UEFI secure boot, on the other hand, a public key is located and retrieved from dedicated signature database stored as UEFI variables. Added two fields may hold values of a public key if fdt_blob is NULL, and will be used in rsa_verify_with_pkey() to verify a signature in UEFI sub-system. Signed-off-by: AKASHI Takahiro Reviewed-by: Simon Glass --- include/image.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/image.h b/include/image.h index 7eb0b4b53184..20e1f95cf2a7 100644 --- a/include/image.h +++ b/include/image.h @@ -1142,6 +1142,13 @@ struct image_sign_info { int required_keynode; /* Node offset of key to use: -1=any */ const char *require_keys; /* Value for 'required' property */ const char *engine_id; /* Engine to use for signing */ + /* + * Note: the following two fields are always valid even w/o + * RSA_VERIFY_WITH_PKEY in order to make sure this structure is + * the same on target and host. Otherwise, vboot test may fail. + */ + const void *key; /* Pointer to public key in DER */ + int keylen; /* Length of public key */ }; /* A part of an image, used for hashing */