From patchwork Tue Jul 5 05:48:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 587432 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp1446706map; Mon, 4 Jul 2022 22:49:30 -0700 (PDT) X-Google-Smtp-Source: AGRyM1suWsQfwaWkfLp5g6xds9OaYsS5GXCqabAuDpJ0PvkeoJHSdlCy0PKVOWNspn3rTwtmL9F0 X-Received: by 2002:a05:6512:3b98:b0:47f:9660:9a9a with SMTP id g24-20020a0565123b9800b0047f96609a9amr20807384lfv.528.1657000169936; Mon, 04 Jul 2022 22:49:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657000169; cv=none; d=google.com; s=arc-20160816; b=xA45+bec+U5y4adOD5lpo4K0oJzQ7xbP3/skmWw7N7nI7wLk4wefcHcyRgQhm0f4Pe 18A9Tlnq65BPernH0vlqHAHJJSIlma03G3aB6hQkvkOAHPzdavLhKhmvyXSkEwh8paEd 35JmLBnlCPcK/Ks3VUglBuUKQ0viLIcCU4iB5CV29O3VY6bBZJIwRPCr0HzMNdYPcErC PDrXDiCOO2BnmXwk4rBOWDfpyTiS97A2ykUzEhSnzmqVwVqejciZeUci91awypYAqeE4 5yYUtu8lgc2ABJfA0tY/rSEq+KtMJxl7T9sR8KnG6cz8EP8wzEDEtfgplcbwtR1PeBER 5F9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+KSH3zrucvGH8AyzxveQg5uge2mEfgO1NqvLyBLW37c=; b=EsV5Tb+b+FsDZDRtBwNH6kBaVBkpCq2atbCE+ZaxxI1GqCho0emlyF/KX79tAgMl23 cQYYtlfFl4xjWxlYIUnIwnK/ZvYewjnBJZ9xtkSOuuItYt+g9dHrP9hxMmCMplptdHvL ag5+YMcNk2ET/hcK2/qVh2gayIl9wJaInOTT/OMjThegLnBj2+jJ6zMcX4dr79TLn89n 1Bht/YCXMeSlYLmwjmwEHApQuiP8GDFM3H68Z1iUtr5Dm5s+V4qaHFBddOweIlukyGBY TEHVgHhcQfqe/chSz3Ok0fjWcDrSzM58Mxl+okjNcTD0sEHz2jrBm/bwK+eYq1wHQB/8 A9qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f17xTMVo; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id r17-20020a2eb891000000b002558b4cffedsi37101337ljp.327.2022.07.04.22.49.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 22:49:29 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f17xTMVo; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2EE4D84512; Tue, 5 Jul 2022 07:49:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (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=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="f17xTMVo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9E2E98451A; Tue, 5 Jul 2022 07:49:08 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) (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 EF83584512 for ; Tue, 5 Jul 2022 07:49:05 +0200 (CEST) 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-pf1-x42c.google.com with SMTP id y141so10564771pfb.7 for ; Mon, 04 Jul 2022 22:49:05 -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=+KSH3zrucvGH8AyzxveQg5uge2mEfgO1NqvLyBLW37c=; b=f17xTMVobHY8UQ/Knmt5qTxgwHHVrHGTqjgvwOob8hS+1rK2CdM4iwtDvvsqOn42Uz xboAqdA8QQsSUx3vRmeVV5N1tDw6dZIYgGgbT/3gWsR2YkCMhu4RdwqIIAPqe7ofLFA8 oXGbWQyhI7NgrAq+guj+l/aAECypaCpLYGyJNCfv5ne4oJuCgsnp8bb4Jk6hTKmX9IWg gCsuHDdMdsKnJ7b2NSftP3comDZUft/7Gb7FfezyjtuHGYUQSl6MtZNqQqQL+Spi/Ura 9a2jxtQdCuukEzAn6gDNLQhxLAm9A32+XA4inEifAdTfLZgl2IC14lKNroiInyWdUSgd UE6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+KSH3zrucvGH8AyzxveQg5uge2mEfgO1NqvLyBLW37c=; b=pT5MXO7lJmJzm14UQtln+nZ5fJHgKd854zfZxKLSRXuGKErJ4tVsIQ+LqaFoZMfa6o u75UkoNQWvN4DkPh1/gbSZCFAMW6mNJdG+/DGDdVmyq/HFJYRnf4zxlLmFAAaVRQVhYj E4TF4qwCsv4Gfk7GOhLck4JF+5s1s6uodBkBhcKEhSTIesVIyf+7fTt8kNvTTayAuqI/ 1kKnDooH0QBXrRBphsycC2CQKcsMxTLnxNd4sLW7JnbS/FHPWpg/OurZQP4mpUy5R13u RNEpcKvthDqRc13JbnnS0xYCbaI6hgEMi0nRWfPVDWBbMcFlKOkXZByS0W0RVcTa+g4g Gd4w== X-Gm-Message-State: AJIora/1en0WAusGZxXdNHg1oxuzjSjdl6hSsOUwutjp2RB/zQMXdDY1 TTL98BACTWDqEGDpL3YJSyhiHw== X-Received: by 2002:a05:6a00:c92:b0:525:8782:71f2 with SMTP id a18-20020a056a000c9200b00525878271f2mr39579459pfv.50.1657000144274; Mon, 04 Jul 2022 22:49:04 -0700 (PDT) Received: from localhost.localdomain ([2400:4050:c3e1:100:8c42:b67b:3e2f:7653]) by smtp.gmail.com with ESMTPSA id a5-20020a1709027e4500b0016784c93f23sm22149390pln.197.2022.07.04.22.49.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Jul 2022 22:49:03 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de Cc: ilias.apalodimas@linaro.org, baocheng.su@siemens.com, jan.kiszka@siemens.com, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH 2/5] efi_loader: signature: export efi_hash_regions() Date: Tue, 5 Jul 2022 14:48:12 +0900 Message-Id: <20220705054815.30318-3-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220705054815.30318-1-takahiro.akashi@linaro.org> References: <20220705054815.30318-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean This function is used to calculate a message digest as part of authentication process in a later patch. Signed-off-by: AKASHI Takahiro --- include/efi_loader.h | 2 ++ lib/efi_loader/efi_signature.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index c1e00ebac398..11930fbea838 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -931,6 +931,8 @@ struct efi_signature_store { struct x509_certificate; struct pkcs7_message; +bool efi_hash_regions(struct image_region *regs, int count, + void **hash, const char *hash_algo, int *len); bool efi_signature_lookup_digest(struct efi_image_regions *regs, struct efi_signature_store *db, bool dbx); diff --git a/lib/efi_loader/efi_signature.c b/lib/efi_loader/efi_signature.c index ddac751d128e..742d8919402c 100644 --- a/lib/efi_loader/efi_signature.c +++ b/lib/efi_loader/efi_signature.c @@ -125,8 +125,8 @@ struct pkcs7_message *efi_parse_pkcs7_header(const void *buf, * * Return: true on success, false on error */ -static bool efi_hash_regions(struct image_region *regs, int count, - void **hash, const char *hash_algo, int *len) +bool efi_hash_regions(struct image_region *regs, int count, + void **hash, const char *hash_algo, int *len) { int ret, hash_len;