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 C0BF5C433EF for ; Thu, 7 Oct 2021 21:15:17 +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 3A2BD61058 for ; Thu, 7 Oct 2021 21:15:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3A2BD61058 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 81E2F83538; Thu, 7 Oct 2021 23:15:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="buRC2mG8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 517908353E; Thu, 7 Oct 2021 23:15:12 +0200 (CEST) Received: from mail-oo1-xc2c.google.com (mail-oo1-xc2c.google.com [IPv6:2607:f8b0:4864:20::c2c]) (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 A143F831B0 for ; Thu, 7 Oct 2021 23:15:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mr.nuke.me@gmail.com Received: by mail-oo1-xc2c.google.com with SMTP id h11-20020a4aa74b000000b002a933d156cbso2316491oom.4 for ; Thu, 07 Oct 2021 14:15:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=eYnzKZUkeuzdw1lXvGJnHvdLN03NpG9v4j2Kez17BjM=; b=buRC2mG8zirasBVgU/28/FGQR/XcoGLDk4Fqmjvv63cdWu/+6SNOAM7gVKIDlDnw+u JSuBwYeCkDoSoa/kOY15wP+hzodpFGPs3zMVwzHxpXx8v+Htl1MKi11UJyQSA29SGGog nMiHHQylOli6rGKzIpcdP5WMZauhxUwKiqxsG59j9GLsgJl1sR4ugJ0g/J+MMJlishqQ PeWUqTqC7H+SaZHZBvkOEermI964GSRUwSsJyl0gtSw5ulSIV5PJOOGWQnT5JRBD1OOz 1sfc33IpeSzwFv512+xPi+gYBgzNUyesVb/uIoxfuIEIis/XLpExawVibB8T+SvWVdjE mzjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=eYnzKZUkeuzdw1lXvGJnHvdLN03NpG9v4j2Kez17BjM=; b=5JN5mTc0Aj5CofSbax5FbNtqkk7Q1PsJMs82jgiNLC2Z2NEjOvlKMGb6YmtXj3zZLF jMw+3owSfJEGN9GdVrL+cY3lnbsSz3NCEYX/mvZ43guGRT+WgZWQ6HsHUUsmsR6JzX9Q IhiE2XdTpT0jIsJeeDeXjs71k/n0Kb3PJJXSCIYnWPej9VRIjZ7iVLesL1m5hwjmV2PT ljBs2Sahd6S1W/KEJ6MezcTefXyw1twOm2mu0YrCh9XhCC4bYY/YxVm+6FVmMB+TZQr6 OOGnfK52rK2gTCfYyTOwRGSumRx1kb6XTfGB8FTtPZkgSo1SE7KNMOeokENm9ZapWMJC HtZw== X-Gm-Message-State: AOAM533mx1etcI4oW7uWyelVQqKuBRuRMcx4HPLJxZQem6iueE1/DTHp c3CEqOG3piHt3JKG2tWSSeI= X-Google-Smtp-Source: ABdhPJzTEy/Dw4ip1aoZwPEFfJ6NP7EDMdAStIIv3TkHXscviDms3G9Ld0oyDSWwtA+fVFIVNvlfPQ== X-Received: by 2002:a4a:ca98:: with SMTP id x24mr5013959ooq.91.1633641306200; Thu, 07 Oct 2021 14:15:06 -0700 (PDT) Received: from nuclearis3.gtech (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id c3sm112865otr.42.2021.10.07.14.15.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Oct 2021 14:15:05 -0700 (PDT) Subject: Re: [PATCH v5 02/29] kconfig: Add tools support to CONFIG_IS_ENABLED() To: Tom Rini Cc: Simon Glass , U-Boot Mailing List , Andre Przywara , Rasmus Villemoes , Robert Marko , Masahiro Yamada , Masahiro Yamada References: <20211007025226.GQ31748@bill-the-cat> <20211007134209.GS31748@bill-the-cat> <20211007183045.GV31748@bill-the-cat> <5cb30240-b726-72be-fa68-05ce174218a3@gmail.com> <20211007193943.GW31748@bill-the-cat> <35223dc3-4af4-f70d-00d0-14495426be3f@gmail.com> <20211007210446.GY31748@bill-the-cat> From: "Alex G." Message-ID: Date: Thu, 7 Oct 2021 16:15:04 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20211007210446.GY31748@bill-the-cat> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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 On 10/7/21 4:04 PM, Tom Rini wrote: > On Thu, Oct 07, 2021 at 03:33:32PM -0500, Alex G. wrote: >> >> >> On 10/7/21 2:39 PM, Tom Rini wrote: >>> On Thu, Oct 07, 2021 at 02:32:42PM -0500, Alex G. wrote: >>>> >>>> >>>> On 10/7/21 1:50 PM, Simon Glass wrote: >>>>> Hi Tom, >>>>> >>>>> On Thu, 7 Oct 2021 at 12:30, Tom Rini wrote: >>>>>> >>>>>> On Thu, Oct 07, 2021 at 12:02:24PM -0600, Simon Glass wrote: >>>>>>> Hi Tom, >>>>>>> >>>>>>> On Thu, 7 Oct 2021 at 07:42, Tom Rini wrote: >>>>>>>> >>>>>>>> On Thu, Oct 07, 2021 at 07:32:04AM -0600, Simon Glass wrote: >>>>>>>>> Hi Tom, >>>>>>>>> >>>>>>>>> On Wed, 6 Oct 2021 at 20:52, Tom Rini wrote: >>>>>>>>>> >>>>>>>>>> On Wed, Oct 06, 2021 at 08:49:13PM -0600, Simon Glass wrote: >>>>>>>>>>> Hi Tom, >>>>>>>>>>> >>>>>>>>>>> On Wed, 6 Oct 2021 at 18:26, Tom Rini wrote: >>>>>>>>>>>> >>>>>>>>>>>> On Sat, Sep 25, 2021 at 07:43:15PM -0600, Simon Glass wrote: >>>>>>>>>>>> >>>>>>>>>>>>> At present we must separately test for the host build for many options, >>>>>>>>>>>>> since we force them to be enabled. For example, CONFIG_FIT is always >>>>>>>>>>>>> enabled in the host tools, even if CONFIG_FIT is not enabled by the >>>>>>>>>>>>> board itself. >>>>>>>>>>>>> >>>>>>>>>>>>> It would be more convenient if we could use, for example, >>>>>>>>>>>>> CONFIG_IS_ENABLED(FIT) and get CONFIG_HOST_FIT, when building for the >>>>>>>>>>>>> host. Add support for this. >>>>>>>>>>>>> >>>>>>>>>>>>> With this and the tools_build() function, we should be able to remove all >>>>>>>>>>>>> the #ifdefs currently needed in code that is build by tools and targets. >>>>>>>>>>>>> >>>>>>>>>>>>> This will be even nicer when we move to using CONFIG(xxx) everywhere, >>>>>>>>>>>>> since all the #ifdef and IS_ENABLED/CONFIG_IS_ENABLED stuff will go away. >>>>>>>>>>>>> >>>>>>>>>>>>> Signed-off-by: Simon Glass >>>>>>>>>>>>> Suggested-by: Rasmus Villemoes # b4f73886 >>>>>>>>>>>>> Reviewed-by: Alexandru Gagniuc >>>>>>>>>>>> >>>>>>>>>>>> The problem here is we don't include automatically >>>>>>>>>>>> when building host stuff, I believe. This is why doing this breaks >>>>>>>>>>>> test_mkimage_hashes for me on am335x_evm with: >>>>>>>>>>>> /tmp/.bm-work/am335x_evm/tools/mkimage -D -I dts -O dtb -i /tmp/.bm-work/am335x_evm -f /home/trini/work/u-boot/u-boot/test/py/tests/vboot//hash-images.its /tmp/.bm-work/am335x_evm/test.fit >>>>>>>>>>>> *** stack smashing detected ***: terminated >>>>>>>>>>> >>>>>>>>>>> Oh dear, and no CI coverage. >>>>>>>>>>> >>>>>>>>>>> I was reluctant to include kconfig.h everywhere but perhaps that is >>>>>>>>>>> the best approach. Will take a look ASAP. >>>>>>>>>> >>>>>>>>>> Maybe we need to think a bit harder too about how we structure >>>>>>>>>> intentionally shared code. >>>>>>>>>> >>>>>>>>>> Why not, for example, for these common algorithms, rely on typical >>>>>>>>>> system headers/libraries in the tooling, which means we validated U-Boot >>>>>>>>>> vs common reference, rather than just our implementations? >>>>>>>>> >>>>>>>>> Do you mean we use openssl for sha1, for example? >>>>>>>> >>>>>>>> I guess, yes. Just flat out saying we require openssl for tools, and >>>>>>>> doing our best to not make compatibility with libressl difficult, seems >>>>>>>> likely to cause less headaches for people than what we already require >>>>>>>> in terms of Python. >>>>>>> >>>>>>> I'm OK with that, although I do think the problem identified here >>>>>>> (CONFIG_SHA256 not enabled) is somewhat sideways from that. We already >>>>>> >>>>>> OK, I've taken what you posted on IRC and folded that in, continuing >>>>>> tests now. >>>>>> >>>>>>> use separate code paths to run hashing. Perhaps we could make it >>>>>>> optional? >>>>>>> >>>>>>> What about those people that complain about crypto libraries on their systems? >>>>>> >>>>>> I'm not sure how big a problem that really is, currently. I guess one >>>>>> thing would be to make a separate thread on it, and put it in the next >>>>>> -rc email as well, for people to explain why it would be a hardship. >>>>>> That in turn, I think, is coming down to modern vs very old openssl >>>>>> support, rather than having any at all. >>>>> >>>>> OK I'll take a look at some point. >>>>> >>>>> Or perhaps Alex might like to? >>>> >>>> We just got a complain about OpenSSL yesterday [1] >>>> >>>> Alex >>>> >>>> [1] https://lists.denx.de/pipermail/u-boot/2021-October/462728.html >>> >>> Oh goodness, LibreELC is a custom build system... I'll have to chime in >>> there, thanks. >> >> I am in favor of keeping libcrapto separate. We still need our own code for >> CRC32 and other weak or non-crypto hashes, a tidbit which makes me doubt the >> wisdom of relying entirely on an external lib. >> >> I had to make a similar decision when writing the hashes test. Originally, I >> was going to use pyCrypto, crcelk, to re-hash everything and compare to >> mkimage. It turned out to be neither necessarry nor efficient. > > Is there perhaps a happy medium? Or do we just need to think harder on > how to make the code U-Boot needs shared between target and host tools > clean and clear and obvious enough? I think hard that's an honorable goal irrespective of the status of libcrypto. libcrypto isolation is a happy side-effect. Alex