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 X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AB94C04FF3 for ; Mon, 24 May 2021 20:19:51 +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 83D4A613CC for ; Mon, 24 May 2021 20:19:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 83D4A613CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 32C0682EBD; Mon, 24 May 2021 22:19:48 +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="L4YuSINl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C47DC82EBC; Mon, 24 May 2021 22:19:45 +0200 (CEST) Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) (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 D8AC882AB1 for ; Mon, 24 May 2021 22:19:42 +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-oi1-x235.google.com with SMTP id z3so28177649oib.5 for ; Mon, 24 May 2021 13:19:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mhllI/v1LWRHITaFUGsdGau3zZ6WwjFtioN4+tz13v4=; b=L4YuSINl3WabZWRWHqQu72JeCZYCj2AiR27AkR1nnJtwO544XlrD+NmhuhYGZuNuHI NvZbZnZ6c/okd9txquoOJbMjplyfI5dEgHQV1npHKwyWW/FoHs8J25GVEF4sbDNPieyv 5qF2jVoUoD5qCTk5QTTVSTe8tgJBUEVEZT/Zv+2vUWs9T+O+lrganXsUhMiarqaKvSc0 /8ZZ2JLCpwpXalIxx8dPymImz/opEwVsq3+ECkuw4ceJvVfz5JA1hMKVii6MmUYQDMoV meFxG/M8a/DpXwjWrCUxvrHd+sVdf/OpfM+EmJNExOydz4iDqcCVoJBdLEjpey+cwYAT RuwQ== 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:mime-version :content-transfer-encoding; bh=mhllI/v1LWRHITaFUGsdGau3zZ6WwjFtioN4+tz13v4=; b=OQMHxRtOSKm9eXQ//pokLogqMR8br8B7YahKv02ubvExtSCD5ilW2DilNRgnTh7qRy yLjAFNga6vSkBdLbp/13r5mF3YMHIeZt4iZIP2aoXoTG6CStpBuWfguuiBs86h5mUkkA wXKe2M1froeIEgsASYqyhyy68ioWbUHjYF4zUKMHz7mC+AsD7m6CXIRBNCKeF6mprKRp VCpZFA8jSm6Mgus8b/iD4EonkOXXqzfFeNgtTKlvqdfDEuL8FafoKgKNSGlD2ZKcm2Fj nukbEdX2AUPwBbRUxWJQCyCZrGLxunG61XukEMMyBixkvVI87g6aEiXvkX2dQz+0hKRP kkSw== X-Gm-Message-State: AOAM533cxsEFYmkilRzns5eZUCisdOxDxjZsftQCePMKbuuGdmkDCl/I MbWY10VKT9I4fVu0LBnB/HA0WJSI7nocmw== X-Google-Smtp-Source: ABdhPJyh4m615o8C4mpwVR4OMN8mt3dr9jvdLLTmAykdhTb/VjJaVONW1EWpnmh4tkI5TCTBnQD0AQ== X-Received: by 2002:aca:280a:: with SMTP id 10mr570561oix.13.1621887581208; Mon, 24 May 2021 13:19:41 -0700 (PDT) Received: from nuclearis3.lan (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id w13sm2816338otp.10.2021.05.24.13.19.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 13:19:40 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de, sjg@chromium.org Cc: Alexandru Gagniuc , trini@konsulko.com, michal.simek@xilinx.com, rasmus.villemoes@prevas.dk Subject: [PATCH v2 00/18] image: Reduce #ifdef abuse in image code Date: Mon, 24 May 2021 15:19:21 -0500 Message-Id: <20210524201939.1491676-1-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.102.4 at phobos.denx.de X-Virus-Status: Clean This is a combination of select patches from Simon's series: "image: Reduce #ifdefs and ad-hoc defines in image code" and alternative solutions I proposed in: "image: Reduce the abuse of #ifdefs in image-sig.c" After syncing with Simon, we agree that this is a reasonable base for further work in #ifdef reduction. Rather than describing changes from Simon's series or mine, we present this series de novo. Most patches are already peer-reviewed. Changes since v1: - Place fit_common.o under CONFIG_FIT, not CONFIG_FIT_SIGNATURE Alexandru Gagniuc (10): common: Move host-only logic in image-sig.c to separate file common: image-sig.c: Remove host-specific logic and #ifdefs image: Add support for placing crypto_algo in linker lists image: rsa: Move verification algorithm to a linker list image: image-sig.c: Remove crypto_algos array lib: ecdsa: Remove #ifdefs from ecdsa.h lib: rsa: Remove #ifdefs from rsa.h image: Eliminate IMAGE_ENABLE_VERIFY macro image: Eliminate IMAGE_ENABLE_VERIFY_ECDSA macro image: Add support for relocating crypto_algos in linker lists Simon Glass (8): image: Shorten FIT_ENABLE_SHAxxx_SUPPORT image: Rename SPL_SHAxxx_SUPPORT to SPL_FIT_SHAxxx image: Rename CONFIG_FIT_ENABLE_RSASSA_PSS_SUPPORT Kconfig: Rename SPL_CRC32_SUPPORT to SPL_CRC32 Kconfig: Rename SPL_MD5_SUPPORT to SPL_MD5 image: Drop IMAGE_ENABLE_SHA1 image: Drop IMAGE_ENABLE_SHAxxx image: Drop IMAGE_ENABLE_BEST_MATCH common/Kconfig.boot | 8 +- common/image-fit.c | 10 +- common/image-sig.c | 75 +++--------- common/spl/Kconfig | 14 +-- configs/axm_defconfig | 2 +- configs/bcm963158_ram_defconfig | 2 +- configs/chromebit_mickey_defconfig | 2 +- configs/chromebook_jerry_defconfig | 2 +- configs/chromebook_minnie_defconfig | 2 +- configs/chromebook_speedy_defconfig | 2 +- configs/evb-px30_defconfig | 2 +- configs/firefly-px30_defconfig | 2 +- configs/imxrt1020-evk_defconfig | 2 +- configs/imxrt1050-evk_defconfig | 2 +- configs/mt8516_pumpkin_defconfig | 2 +- configs/odroid-go2_defconfig | 2 +- configs/px30-core-ctouch2-px30_defconfig | 2 +- configs/px30-core-edimm2.2-px30_defconfig | 2 +- configs/sandbox_defconfig | 2 +- configs/socfpga_agilex_atf_defconfig | 2 +- configs/socfpga_agilex_vab_defconfig | 2 +- configs/socfpga_stratix10_atf_defconfig | 2 +- configs/taurus_defconfig | 2 +- include/image.h | 59 ++-------- include/u-boot/ecdsa.h | 25 ---- include/u-boot/rsa.h | 51 +-------- lib/rsa/rsa-sign.c | 4 +- lib/rsa/rsa-verify.c | 18 ++- tools/Makefile | 2 +- tools/image-sig-host.c | 133 ++++++++++++++++++++++ 30 files changed, 218 insertions(+), 219 deletions(-) create mode 100644 tools/image-sig-host.c -- 2.31.1