From patchwork Wed Sep 18 01:26:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 1163645 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=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="s+l94L+J"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46Y2RL3d47z9s4Y for ; Wed, 18 Sep 2019 11:27:58 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 250CDC21EE4; Wed, 18 Sep 2019 01:24:11 +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_H3, RCVD_IN_MSPIKE_WL, 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 51312C21E8A; Wed, 18 Sep 2019 01:24:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D1CC2C21E76; Wed, 18 Sep 2019 01:23:46 +0000 (UTC) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by lists.denx.de (Postfix) with ESMTPS id 3B9AAC21E35 for ; Wed, 18 Sep 2019 01:23:45 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id u72so2977849pgb.10 for ; Tue, 17 Sep 2019 18:23:45 -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=AJLRjIYANGSmDo/T5VxQbVaojrTzYkPWK12kGNG0Ugg=; b=s+l94L+JkYlPmlUqvpad1yvFMtoIu4OPaqryhRQoQ0JTnTRPgsT1A9K7qXqMqny56/ XVF07No+iB/8I5cKCLAv5/CT+J+buyUMdinMdEX3PPFfzBkkSydSGxkFLGn3IZmH6D2x 9trDPQWmwfaSX0uLxJb3icnEdJJIxDfXnS1xSUQq0XUoW0dBilt6N8BucRwvNIRXQ0re h6pKsI+3m/I5lPXdWx2HfOqIVArTUDoJH/6lM3ayc7/cWk1p3wF96tI1AXfnXa+IKIsZ PugsLslVrLpzzVUozlZet5TLsOwgEr/u1YuRYX265ko56c5kP+uzZIBaptWqyfpotNAI IXCA== 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=AJLRjIYANGSmDo/T5VxQbVaojrTzYkPWK12kGNG0Ugg=; b=Kc7C/IArYqEkAHPBRgvoyy+9KbDoQDZMIWMiVGziug/KOMAsfjkInI7dKJ2eYazZF8 mtzIqChVOtpyUaLe9YxeOr38BmbBdPyJExO+qFZPgzbXjioH0QP32OPRINjctOpc4H8n OeIWEgglENtMfWe72vy+6Ceqj2d6yYvZ3z/DItQlyQbmh6hLFB+c0S75JhuYeiocqNGC yWZcRIvs7eDi/3eHrOFIICvaI0p+Kqu7wEsDUQHy6w64h/jec22c3vmBtTUHKO7dFHAM wlxBOMAFL6Q3UuKAm8fVyhKO80HvEXaEDulU0+kTuPXrnJL9aDu+ra8xWjI1hUFQnqvF KsyQ== X-Gm-Message-State: APjAAAXkflOkEFCACUBh0N/nQpw7QWR0SpH8H7/e4nIfmzUicPXTNOw0 UIcln63P/o7Fa/0AkX4j8Vg1EA== X-Google-Smtp-Source: APXvYqwV5blRtik4VjvU5CmCiHMjIGml53HaH32lvAL1wVYefBzUPaZ8CoM4MKxWI0OVygGvKNSv0w== X-Received: by 2002:a63:5807:: with SMTP id m7mr1578046pgb.371.1568769823803; Tue, 17 Sep 2019 18:23:43 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id k3sm3320646pgl.9.2019.09.17.18.23.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Sep 2019 18:23:43 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, trini@konsulko.com Date: Wed, 18 Sep 2019 10:26:33 +0900 Message-Id: <20190918012643.25192-6-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190918012643.25192-1-takahiro.akashi@linaro.org> References: <20190918012643.25192-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 Cc: u-boot@lists.denx.de Subject: [U-Boot] [RFC 05/15] include: image.h: export hash algorithm helper functions 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 commit allows us to use common/image-sig.c even if CONFIG_FIT is disabled but CONFIG_EFI_LOADER is enabled. Signed-off-by: AKASHI Takahiro Reviewed-by: Simon Glass --- include/image.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/include/image.h b/include/image.h index 685f5181c829..c9fe1d8eaed8 100644 --- a/include/image.h +++ b/include/image.h @@ -53,7 +53,7 @@ struct fdt_region; #endif /* USE_HOSTCC */ -#if IMAGE_ENABLE_FIT +#if IMAGE_ENABLE_FIT || defined(CONFIG_EFI_SECURE_BOOT) #include #include #include @@ -86,13 +86,14 @@ struct fdt_region; #endif #if defined(CONFIG_FIT_ENABLE_SHA256_SUPPORT) || \ - defined(CONFIG_SPL_SHA256_SUPPORT) + defined(CONFIG_SPL_SHA256_SUPPORT) || \ + defined(CONFIG_EFI_SECURE_BOOT) #define IMAGE_ENABLE_SHA256 1 #else #define IMAGE_ENABLE_SHA256 0 #endif -#endif /* IMAGE_ENABLE_FIT */ +#endif /* IMAGE_ENABLE_FIT || defined(CONFIG_EFI_SECURE_BOOT) */ #ifdef CONFIG_SYS_BOOT_GET_CMDLINE # define IMAGE_BOOT_GET_CMDLINE 1 @@ -1085,6 +1086,7 @@ int fit_conf_get_prop_node(const void *fit, int noffset, int fit_check_ramdisk(const void *fit, int os_noffset, uint8_t arch, int verify); +#endif /* IMAGE_ENABLE_FIT */ int calculate_hash(const void *data, int data_len, const char *algo, uint8_t *value, int *value_len); @@ -1143,7 +1145,6 @@ struct image_sign_info { const char *require_keys; /* Value for 'required' property */ const char *engine_id; /* Engine to use for signing */ }; -#endif /* Allow struct image_region to always be defined for rsa.h */ /* A part of an image, used for hashing */ struct image_region { @@ -1151,7 +1152,7 @@ struct image_region { int size; }; -#if IMAGE_ENABLE_FIT +#if IMAGE_ENABLE_FIT || defined(CONFIG_EFI_SECURE_BOOT) #if IMAGE_ENABLE_VERIFY # include @@ -1252,7 +1253,9 @@ struct crypto_algo *image_get_crypto_algo(const char *full_name); * @return pointer to algorithm information, or NULL if not found */ struct padding_algo *image_get_padding_algo(const char *name); +#endif /* IMAGE_ENABLE_FIT || defined(CONFIG_EFI_SECURE_BOOT) */ +#if IMAGE_ENABLE_FIT /** * fit_image_verify_required_sigs() - Verify signatures marked as 'required' * @@ -1328,7 +1331,7 @@ static inline int fit_image_check_target_arch(const void *fdt, int node) #define fit_unsupported(msg) #define fit_unsupported_reset(msg) #endif /* CONFIG_FIT_VERBOSE */ -#endif /* CONFIG_FIT */ +#endif /* IMAGE_ENABLE_FIT */ #if defined(CONFIG_ANDROID_BOOT_IMAGE) struct andr_img_hdr;