From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBAACC433F5 for ; Mon, 8 Nov 2021 04:55:39 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 38CC86134F for ; Mon, 8 Nov 2021 04:55:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 38CC86134F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A627083824; Mon, 8 Nov 2021 05:55:36 +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=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="Afv6Bw3c"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F3E008379D; Mon, 8 Nov 2021 05:55:34 +0100 (CET) Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (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 CF7728379D for ; Mon, 8 Nov 2021 05:55:30 +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-x102d.google.com with SMTP id h24so6150438pjq.2 for ; Sun, 07 Nov 2021 20:55:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=aAY64Jk9f1wP5I62xxOmOz5dc20sF9Y5eLWPqk9yKIQ=; b=Afv6Bw3cHMsvok3VbNKHn3ImCLvaxSuoM/DPnJGBIiF1qfE46gtFpNYOq6l28fd5+1 NFrlMdK33a58bWL6EIFI9JTahzV4ClFaO3eJBzXbETzAVzQgFzOlzk5pNj1Ys7p7NZcj eWb2aRsiXoR00fQNRORRlJ7dy1KBF4uF0Y39tNtt7A2ho6BzY5UTN7Z6S8rd08Ak44O6 NSD1HrYm3Jm/I1ri0DcD3bLO57micmYqwX8AaEHoeUoSMRXGP2592VJ+Q8ARlV+ElqK3 mY9hmkyv1cZxtjzIwS3uR1uY1ua5rZbhYCjx61beDay1xEskMS7vBOMBb97Yq3ZB7pNG 0bTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to; bh=aAY64Jk9f1wP5I62xxOmOz5dc20sF9Y5eLWPqk9yKIQ=; b=LloE7blAgU5+sQoPZgzM8L4PYVM07IGgmu0XGBLDwSZLzV6m5/mnMIP1VjW3io7I/u JESPcgiaEBnfw9yI6LQjTxPtDTawtBNv4uw3z7dB68WB1Tt+qXu8TpDFhDBrPgzr3/1E Z5FsiSrfcaw2D1n3xtd0RpDdrrZvNzUN23LfuTJC7T9HhhZWr9pWl0PSdErhUhFCZOqo fjzpwy4OGg3VPYwTPShyelQ60mCyUUcebnosye2VJRzDYKSuIn/NUb8iL8VYNsOrUCUp 7xBeRygcDZAZuRdE+669LekV+fVI5+0PKp+foblGd3Yn5EnXOiAs5h0qQGQtJyuq2c9w 3g8A== X-Gm-Message-State: AOAM533UbwFsbqJXyvgtFk7IRG+vHhLVrdNp4QCUEnT9eeIyaehh5f+L N2skquzdzE6Z3a68Ex4cUQ1HRQ== X-Google-Smtp-Source: ABdhPJx/HshJucmiHrh40SMWKv1P4dgEirDBLZ6CBzzqEE82wYcnugEYu40jkiUS5wT9dpyXOWOswQ== X-Received: by 2002:a17:902:b28b:b0:142:4abc:ac20 with SMTP id u11-20020a170902b28b00b001424abcac20mr20378876plr.88.1636347329084; Sun, 07 Nov 2021 20:55:29 -0800 (PST) Received: from laputa ([2400:4050:c3e1:100:98bf:5be1:75ff:1c8a]) by smtp.gmail.com with ESMTPSA id c2sm585995pfv.112.2021.11.07.20.55.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Nov 2021 20:55:28 -0800 (PST) Date: Mon, 8 Nov 2021 13:55:24 +0900 From: AKASHI Takahiro To: Simon Glass , Mark Kettenis , xypron.glpk@gmx.de, agraf@csgraf.de, ilias.apalodimas@linaro.org, sughosh.ganu@linaro.org, masami.hiramatsu@linaro.org, u-boot@lists.denx.de Subject: Re: [PATCH v5 02/11] tools: mkeficapsule: add firmwware image signing Message-ID: <20211108045524.GE16401@laputa> Mail-Followup-To: AKASHI Takahiro , Simon Glass , Mark Kettenis , xypron.glpk@gmx.de, agraf@csgraf.de, ilias.apalodimas@linaro.org, sughosh.ganu@linaro.org, masami.hiramatsu@linaro.org, u-boot@lists.denx.de References: <20211029045628.GA33977@laputa> <20211105010433.GA27316@laputa> <20211105023500.GC27316@laputa> <20211105093508.GH27316@laputa> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211105093508.GH27316@laputa> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean Heinrich, On Fri, Nov 05, 2021 at 06:35:08PM +0900, AKASHI Takahiro wrote: > On Fri, Nov 05, 2021 at 11:35:00AM +0900, AKASHI Takahiro wrote: > > On Thu, Nov 04, 2021 at 08:02:40PM -0600, Simon Glass wrote: > > > Hi Takahiro, > > > > > > On Thu, 4 Nov 2021 at 19:04, AKASHI Takahiro wrote: > > > > > > > > Hi, Simon, > > > > > > > > On Thu, Nov 04, 2021 at 09:11:59AM -0600, Simon Glass wrote: > > > > > Hi Mark, > > > > > > > > > > On Thu, 4 Nov 2021 at 08:31, Mark Kettenis wrote: > > > > > > > > > > > > > From: Simon Glass > > > > > > > Date: Wed, 3 Nov 2021 20:51:25 -0600 > > > > > > > > > > > > > > Hi Mark, > > > > > > > > > > > > > > On Tue, 2 Nov 2021 at 09:13, Mark Kettenis wrote: > > > > > > > > > > > > > > > > > From: Simon Glass > > > > > > > > > Date: Tue, 2 Nov 2021 08:56:50 -0600 > > > > > > > > > > > > > > > > > > Hi Takahiro, > > > > > > > > > > > > > > > > > > > > - can we just build the tool always? > > > > > > > > > > > > > > > > > > > > This is one of my questions. > > > > > > > > > > Why do you want to do so while there are bunch of tools that are > > > > > > > > > > not always built. > > > > > > > > > > > > > > > > > > Because I think all tools should be built always. It is fine if that > > > > > > > > > happens due to CONFIG options but we should try to avoid making it > > > > > > > > > complicated. > > > > > > > > > > > > > > > > Well, unless this patchset fixes things, we can't, because > > > > > > > > mkeficapsule doesn't build on OpenBSD. I tried looking into it, but I > > > > > > > > can't figure out how this is even supposed to compile as a host tool: > > > > > > > > > > > > > > > > > > > > > > > > In file included from tools/mkeficapsule.c:8: > > > > > > > > In file included from include/malloc.h:369: > > > > > > > > include/linux/string.h:15:24: error: conflicting types for 'strspn' > > > > > > > > extern __kernel_size_t strspn(const char *,const char *); > > > > > > > > ^ > > > > > > > > /usr/include/string.h:88:9: note: previous declaration is here > > > > > > > > size_t strspn(const char *, const char *); > > > > > > > > > > > > > > My guess is that linux/string.h should not be included, or perhaps > > > > > > > __kernel_size_t should be defined to size_t. > > > > > > > > > > > > > > I doubt it would take an age to figure out, with a bit of fiddling. > > > > > > > > > > > > Well, I think the problem is quite fundamental. Indeed I agree that > > > > > > linux/string.h shouldn't be included. It gets pulled in because the > > > > > > tools include . Modern software really shouldn't include > > > > > > that header anymore, and we removed it in OpenBSD some time ago. But > > > > > > even with that fixed, things break since the same header gets pulled > > > > > > in from . > > > > > > > > > > > > Redefining __kernel_size_t doesn't provide a way out: > > > > > > > > > > > > tools/mkeficapsule.c:23:16: error: typedef redefinition with different types ('size_t' (aka 'unsigned long') vs 'unsigned int') > > > > > > typedef size_t __kernel_size_t; > > > > > > ^ > > > > > > ./arch/arm/include/asm/posix_types.h:37:23: note: previous definition is here > > > > > > typedef unsigned int __kernel_size_t; > > > > > > ^ > > > > > > > > > > > > This is on an amd64 host, so "unsigned int" clearly is the wrong type > > > > > > for size_t. > > > > > > > > > > > > The fundamental problem seems to be that isn't safe to include > > > > > > in a "host" tool because it includes "target" headers that > > > > > > accidentally resolve to "system" headers on Linux systems. > > > > > > > > > > > > Maybe Takahiro or Heinrich have an idea how to fix that? But in the > > > > > > meantime it would be good if building this tool would remain optional. > > > > > > > > > > Yes let's ask them to fix that as I agree this sounds wrong. We have > > > > > several efi headers so perhaps just need to have the right stuff in > > > > > each. > > > > > > > > As far as I know, you initially introduced efi.h and efi_api.h. > > > > What is your intent to have the two? > > > > > > > > I think that efi_api.h contains definitions and interfaces defined > > > > in UEFI specification for building EFI application/modules, hence > > > > I believe that it should be target-independent. Right? > > > > > > > > But it *includes* efi.h which also contains some definitions > > > > defined in UEFI specification, while efi.h is only for U-Boot as > > > > UEFI application. > > > > > > > > I suspect that is the root cause. > > > > > > Yes I think you are right. > > > > > > > Or should we thoroughly use linux headers like "efi/efi.h" > > > > in this tool? > > > > > > Well either way, we need host builds to not include U-Boot headers. > > > > Yeah, but there are still lots of host tools which include U-Boot headers. > > In addition, I'm not quite sure whether *generic* efi headers, like > > efi/efi.h, are available across different host OSs. > > I looked through linux's efi headers under /usr/include/efi, > but they don't provide enough set of definitions to make mkeficapsule > buildable. Particularly, capsule-related structure definitions are missing. > > So modifying U-Boot headers and removing target-dependent coding > would be more practical. > (I don't know yet whether it is feasible or not.) What's your thought here? > Or even adding host-tools-local headers would be more optimal. I prefer this approach, though. -Takahiro Akashi > -Takahiro Akashi > > > -Takahiro Akashi > > > > > > > > - Simon > > > > > > > > > > > -Takahiro Akashi > > > > > > > > > > > > > It is OK to have it optional with a CONFIG, but it should be enabled > > > > > by default, otherwise no one will know it is there. > > > > > > > > > > Can we get the OpenBSD environment into CI or is that just too hard? > > > > > > > > > > Regards, > > > > > Simon