From patchwork Fri May 14 19:45:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1478665 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=UV4whLtw; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FhfDK2QLNz9sWQ for ; Sat, 15 May 2021 05:46:41 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CDCF182ACC; Fri, 14 May 2021 21:46:33 +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="UV4whLtw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A570582AF1; Fri, 14 May 2021 21:46:12 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) (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 AF18382061 for ; Fri, 14 May 2021 21:46:06 +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-ot1-x32a.google.com with SMTP id 36-20020a9d0ba70000b02902e0a0a8fe36so231229oth.8 for ; Fri, 14 May 2021 12:46:06 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=4cOBM2XLJH/KMjHZ6/Cgb0gJx9Rze22BM2NA05djRCw=; b=UV4whLtw3KtRl2aaoQARmM199juNukPZskq1VxQ1Er+aLyM3Yft2AXI4LnOo+pcZGE CiBQEsDwupzlfCSQKHJxD4m+A8wcCmUWiYTC1efsBhLkrDKQmOY/fEIkbZ1dlgkKBAuD 8VTFqGdvPA3boFLlKAQVMufhncudvVIauJgbJBgBkXVArMmxyQ2ZxSOkcuy4lzSE6bc5 F98grQlR08AwBeLx6IEj97ofP2srEhqjaMybaLZoB/qnf9HovtAcBhC4Yzm9nd7p8OFe 5SgUenRfSjNC7vT9x0U0fPsdGQ0VJKRmDdZvTHgMyq+ylwz/6S0lG1vDadHt0Q1RxH+m te2g== 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=4cOBM2XLJH/KMjHZ6/Cgb0gJx9Rze22BM2NA05djRCw=; b=MvAfkD9DwpUihTcem5OLiunO54yeBMOsv6xDJzvp8N4uoxuPXOl+uuK5CQC8A9BnV2 IUiMa+gcY3TWYHj6RGNylyXrRuSX64ErGOuIlm2pypMxwnIUNORWxIm3NydKWvivSceD z0Hivb0T13Sin7vM15rscjFvzR5braTgR79pqwURViU7x+upa8d49gPAYh0hUKb5GtGG gbHPbXbyQlXb41OTx+Kp2KNIvCUj9rhQYDQdpA+SzVrvTdYzHDX2AftSDj941vD1AiH3 hQpRhK/a92LhulTyBXj8lekxMwBcKvQYzWmv0qqk/VLWt5Fov4Q22/KHJ5gP5/i1+1F8 ZKIA== X-Gm-Message-State: AOAM5320/NJuyvHodDCpmRm4AvOZPD/rUWqcsgaJHdB6FoQ+IWZWtiku gI3PFC1gDvKmu8M/OB87O1IUuzMo69T54g== X-Google-Smtp-Source: ABdhPJw9yDoPgk6UQqTa/FmEnfzSrcO+jFzUnevO59SgQ7tcwVN8Zt6Jk6iPsD0eeXCWv7YQljthLw== X-Received: by 2002:a9d:131:: with SMTP id 46mr3480908otu.241.1621021565065; Fri, 14 May 2021 12:46:05 -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 c131sm1015353oif.29.2021.05.14.12.46.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 12:46:04 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de, sjg@chromium.org Cc: Alexandru Gagniuc , trini@konsulko.com Subject: [PATCH RFC 01/10] common: Move host-only logic in image-sig.c to separate file Date: Fri, 14 May 2021 14:45:53 -0500 Message-Id: <20210514194602.598322-2-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210514194602.598322-1-mr.nuke.me@gmail.com> References: <20210514194602.598322-1-mr.nuke.me@gmail.com> MIME-Version: 1.0 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 image-sig.c is used to map a hash or crypto algorithm name to a handler of that algorithm. There is some similarity between the host and target variants, with the differences worked out by #ifdefs. The purpose of this change is to remove those ifdefs. First, copy the file to a host-only version, and remove target specific code. Although it looks like we are duplicating code, subsequent patches will change the way target algorithms are searched. Besides we are only duplicating three string to struct mapping functions. This isn't something to fuss about. --- common/image-sig-host.c | 134 ++++++++++++++++++++++++++++++++++++++++ tools/Makefile | 2 +- 2 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 common/image-sig-host.c diff --git a/common/image-sig-host.c b/common/image-sig-host.c new file mode 100644 index 0000000000..22e9c53c3e --- /dev/null +++ b/common/image-sig-host.c @@ -0,0 +1,134 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2013, Google Inc. + */ + +#include "mkimage.h" +#include +#include +#include +#include +#include +#include +#include + + +struct checksum_algo checksum_algos[] = { + { + .name = "sha1", + .checksum_len = SHA1_SUM_LEN, + .der_len = SHA1_DER_LEN, + .der_prefix = sha1_der_prefix, + .calculate_sign = EVP_sha1, + .calculate = hash_calculate, + }, + { + .name = "sha256", + .checksum_len = SHA256_SUM_LEN, + .der_len = SHA256_DER_LEN, + .der_prefix = sha256_der_prefix, + .calculate_sign = EVP_sha256, + .calculate = hash_calculate, + }, + { + .name = "sha384", + .checksum_len = SHA384_SUM_LEN, + .der_len = SHA384_DER_LEN, + .der_prefix = sha384_der_prefix, + .calculate_sign = EVP_sha384, + .calculate = hash_calculate, + }, + { + .name = "sha512", + .checksum_len = SHA512_SUM_LEN, + .der_len = SHA512_DER_LEN, + .der_prefix = sha512_der_prefix, + .calculate_sign = EVP_sha512, + .calculate = hash_calculate, + }, +}; + +struct crypto_algo crypto_algos[] = { + { + .name = "rsa2048", + .key_len = RSA2048_BYTES, + .sign = rsa_sign, + .add_verify_data = rsa_add_verify_data, + .verify = rsa_verify, + }, + { + .name = "rsa4096", + .key_len = RSA4096_BYTES, + .sign = rsa_sign, + .add_verify_data = rsa_add_verify_data, + .verify = rsa_verify, + }, + { + .name = "ecdsa256", + .key_len = ECDSA256_BYTES, + .sign = ecdsa_sign, + .add_verify_data = ecdsa_add_verify_data, + .verify = ecdsa_verify, + }, +}; + +struct padding_algo padding_algos[] = { + { + .name = "pkcs-1.5", + .verify = padding_pkcs_15_verify, + }, + { + .name = "pss", + .verify = padding_pss_verify, + } +}; + +struct checksum_algo *image_get_checksum_algo(const char *full_name) +{ + int i; + const char *name; + + for (i = 0; i < ARRAY_SIZE(checksum_algos); i++) { + name = checksum_algos[i].name; + /* Make sure names match and next char is a comma */ + if (!strncmp(name, full_name, strlen(name)) && + full_name[strlen(name)] == ',') + return &checksum_algos[i]; + } + + return NULL; +} + +struct crypto_algo *image_get_crypto_algo(const char *full_name) +{ + int i; + const char *name; + + /* Move name to after the comma */ + name = strchr(full_name, ','); + if (!name) + return NULL; + name += 1; + + for (i = 0; i < ARRAY_SIZE(crypto_algos); i++) { + if (!strcmp(crypto_algos[i].name, name)) + return &crypto_algos[i]; + } + + return NULL; +} + +struct padding_algo *image_get_padding_algo(const char *name) +{ + int i; + + if (!name) + return NULL; + + for (i = 0; i < ARRAY_SIZE(padding_algos); i++) { + if (!strcmp(padding_algos[i].name, name)) + return &padding_algos[i]; + } + + return NULL; +} diff --git a/tools/Makefile b/tools/Makefile index d020c55d66..6751d9874b 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -58,7 +58,7 @@ hostprogs-$(CONFIG_FIT_SIGNATURE) += fit_info fit_check_sign hostprogs-$(CONFIG_CMD_BOOTEFI_SELFTEST) += file2include FIT_OBJS-$(CONFIG_FIT) := fit_common.o fit_image.o image-host.o common/image-fit.o -FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := common/image-sig.o common/image-fit-sig.o +FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := common/image-sig-host.o common/image-fit-sig.o FIT_CIPHER_OBJS-$(CONFIG_FIT_CIPHER) := common/image-cipher.o # The following files are synced with upstream DTC. From patchwork Fri May 14 19:45:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1478669 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=GcWZLBUh; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FhfDz5VB1z9sT6 for ; Sat, 15 May 2021 05:47:15 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 27EA482D25; Fri, 14 May 2021 21:46:58 +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="GcWZLBUh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1979782B6D; Fri, 14 May 2021 21:46:17 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc2d.google.com (mail-oo1-xc2d.google.com [IPv6:2607:f8b0:4864:20::c2d]) (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 63C8E82604 for ; Fri, 14 May 2021 21:46: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-xc2d.google.com with SMTP id l25-20020a4a35190000b029020a54735152so121396ooa.4 for ; Fri, 14 May 2021 12:46:07 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=pmyvPpiHuzubTBzgfXqZp0HCCXo0T0ZnCvARvnNinMA=; b=GcWZLBUh20qtrHAHJXCt5RsEir/WJbbAuAZhc17aJ+4LoURWpzeetjZgJReRShps1H ABY3Bap14f4bxhLf61xVzW1koSl5wDwihPeondmihHC98aljWBKC2XvXHsYx4nBy0CBP XmKuAHebn780lApp8Lv4cUCoatb7bxCCXpr4h9afNS/JofbyU9zBK66ej02OcjfuYK1y msMMshkRVa+lbMU26nSYd9PdzMGQTk7APJ84jllidIFy1MykOJpJqgN0+l/bAS8Ny4z7 qnHIzN7qJp/SuWGLXaXYq9VvKQFXyszdawM98kR7UvPeLBFrPt0Vvqv+rAQHjc60icSw RqWw== 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=pmyvPpiHuzubTBzgfXqZp0HCCXo0T0ZnCvARvnNinMA=; b=QPpoaR1D/caKdw5lnLbkrT4ejj/e4hrcTjL+rKlFhD+92m1rqgffsmedjP9oeJFYyU f68Y88jCczNLMvXRg5XLVSx/qyTBbNHpuUo8XjFnTWyOKjVHXLrvBx6r6E8DdnXREC2b bu3RgDixF2yakc59g9uTn9BXsrIrdJoZuxkmfDDp/H4nRVJ+MZbipe9Gk/9tVuznzb8r r9eOtG6zuFO+R7INyqy+VBU5hVxify4h92BaGcpNxN7RE7u4OL7hHSOSfNgdUv3JYkTW kGMV+PNJ6ZysIB4OnMgsvbT/7JsvsZnLP6B6R7PZfbvHbPzkB0wHVcqNN1d8gHUBqOhm KhyQ== X-Gm-Message-State: AOAM533T6QK24UY/aASfvSjTVx8JYvNuu+xwhyjWiXd87RYPv7J6ATJm 2eZBi0/j4IqACWUwDWbbZmzDaGYT9COPng== X-Google-Smtp-Source: ABdhPJy+pjB+AqzvLA/RH4l87zUIcAnaw86W8nl5ueeEzeHZ2grK/yZwAnqc8lzS1Cvd/bIUyjlUWg== X-Received: by 2002:a4a:e5d5:: with SMTP id r21mr38210298oov.1.1621021565735; Fri, 14 May 2021 12:46:05 -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 c131sm1015353oif.29.2021.05.14.12.46.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 12:46:05 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de, sjg@chromium.org Cc: Alexandru Gagniuc , trini@konsulko.com Subject: [PATCH RFC 02/10] common: image-sig.c: Remove host-specific logic and #ifdefs Date: Fri, 14 May 2021 14:45:54 -0500 Message-Id: <20210514194602.598322-3-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210514194602.598322-1-mr.nuke.me@gmail.com> References: <20210514194602.598322-1-mr.nuke.me@gmail.com> MIME-Version: 1.0 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 Remove any ifdefs in image-sig.c that were previously used to differentiate from the host code. Note that all code dedicated to relocating ->sign() and ->add_verify_data)_ can be safely removed, as signing is not supported target-side. NOTE that although it appears we are removing ecdsa256 support, this is intentional. ecdsa_verify() is a no-op on the target, and is currently only used by host code. Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- common/image-sig.c | 39 ++------------------------------------- 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/common/image-sig.c b/common/image-sig.c index 0f8e592aba..698b044d50 100644 --- a/common/image-sig.c +++ b/common/image-sig.c @@ -3,18 +3,11 @@ * Copyright (c) 2013, Google Inc. */ -#ifdef USE_HOSTCC -#include "mkimage.h" -#include -#include -#include -#else #include #include #include #include DECLARE_GLOBAL_DATA_PTR; -#endif /* !USE_HOSTCC*/ #include #include #include @@ -28,9 +21,6 @@ struct checksum_algo checksum_algos[] = { .checksum_len = SHA1_SUM_LEN, .der_len = SHA1_DER_LEN, .der_prefix = sha1_der_prefix, -#if IMAGE_ENABLE_SIGN - .calculate_sign = EVP_sha1, -#endif .calculate = hash_calculate, }, { @@ -38,9 +28,6 @@ struct checksum_algo checksum_algos[] = { .checksum_len = SHA256_SUM_LEN, .der_len = SHA256_DER_LEN, .der_prefix = sha256_der_prefix, -#if IMAGE_ENABLE_SIGN - .calculate_sign = EVP_sha256, -#endif .calculate = hash_calculate, }, #ifdef CONFIG_SHA384 @@ -49,9 +36,6 @@ struct checksum_algo checksum_algos[] = { .checksum_len = SHA384_SUM_LEN, .der_len = SHA384_DER_LEN, .der_prefix = sha384_der_prefix, -#if IMAGE_ENABLE_SIGN - .calculate_sign = EVP_sha384, -#endif .calculate = hash_calculate, }, #endif @@ -61,9 +45,6 @@ struct checksum_algo checksum_algos[] = { .checksum_len = SHA512_SUM_LEN, .der_len = SHA512_DER_LEN, .der_prefix = sha512_der_prefix, -#if IMAGE_ENABLE_SIGN - .calculate_sign = EVP_sha512, -#endif .calculate = hash_calculate, }, #endif @@ -74,24 +55,13 @@ struct crypto_algo crypto_algos[] = { { .name = "rsa2048", .key_len = RSA2048_BYTES, - .sign = rsa_sign, - .add_verify_data = rsa_add_verify_data, .verify = rsa_verify, }, { .name = "rsa4096", .key_len = RSA4096_BYTES, - .sign = rsa_sign, - .add_verify_data = rsa_add_verify_data, .verify = rsa_verify, }, - { - .name = "ecdsa256", - .key_len = ECDSA256_BYTES, - .sign = ecdsa_sign, - .add_verify_data = ecdsa_add_verify_data, - .verify = ecdsa_verify, - }, }; struct padding_algo padding_algos[] = { @@ -112,16 +82,13 @@ struct checksum_algo *image_get_checksum_algo(const char *full_name) int i; const char *name; -#if !defined(USE_HOSTCC) && defined(CONFIG_NEEDS_MANUAL_RELOC) +#if defined(CONFIG_NEEDS_MANUAL_RELOC) static bool done; if (!done) { done = true; for (i = 0; i < ARRAY_SIZE(checksum_algos); i++) { checksum_algos[i].name += gd->reloc_off; -#if IMAGE_ENABLE_SIGN - checksum_algos[i].calculate_sign += gd->reloc_off; -#endif checksum_algos[i].calculate += gd->reloc_off; } } @@ -143,15 +110,13 @@ struct crypto_algo *image_get_crypto_algo(const char *full_name) int i; const char *name; -#if !defined(USE_HOSTCC) && defined(CONFIG_NEEDS_MANUAL_RELOC) +#if defined(CONFIG_NEEDS_MANUAL_RELOC) static bool done; if (!done) { done = true; for (i = 0; i < ARRAY_SIZE(crypto_algos); i++) { crypto_algos[i].name += gd->reloc_off; - crypto_algos[i].sign += gd->reloc_off; - crypto_algos[i].add_verify_data += gd->reloc_off; crypto_algos[i].verify += gd->reloc_off; } } From patchwork Fri May 14 19:45:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1478670 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=t2p5ztLZ; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FhfFC3N7Hz9sT6 for ; Sat, 15 May 2021 05:47:27 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A119182D56; Fri, 14 May 2021 21:47:09 +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="t2p5ztLZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 379F482B55; Fri, 14 May 2021 21:46:19 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) (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 33FCE82AA4 for ; Fri, 14 May 2021 21:46:08 +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-ot1-x333.google.com with SMTP id u25-20020a0568302319b02902ac3d54c25eso262787ote.1 for ; Fri, 14 May 2021 12:46:08 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=0l7aXc1ZgkSn8+P6nu6+yY5HsZ8KV6jnL6fzEJIvalo=; b=t2p5ztLZuuaZNYq2q6iEBryt+oGD3/6nUZhFfEbd0r4g/y9J+y3SoRYqotJ5zJ2i1s zGoF5VDD+apg/O5Op6tsW1jiMJ84Pg1eEzjSaeQ/mceLz6j2cNMckg+zlHmTHhqs04D/ v5bCoAUKVt7ItLgbjcnmS5NFxS7MTlwWm+LdHsk2IURWzvd0tinlhfQB9e90EkGCZkcv jwaCE5iYxBZfZTJI7kYWQftk/A1XUfdzPMBU1mOJZ1yqXzD+P+9JkYZvP3QFlqA2VPVJ wnEWXITq3N5f3385EGM9VKi/MI8+GVAaN6aNM4sHUGutucexsXReu8lb4nKUGTQrRbRs l56Q== 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=0l7aXc1ZgkSn8+P6nu6+yY5HsZ8KV6jnL6fzEJIvalo=; b=gIu8YGceA/xzzaIgk58ecEGMpzorsjQLUealRwgApMK99UAX21wnEsJChaxJsIPA23 8td4EPWB+wTGwpgqexPWxqAsrgN47zi1mrffT/b4ewuooONk0RY6wkaQSBcYbfT/g2/y ZLYfDKHZzwI4ZBEnRgvML3ty4Pm73Iu4IOqzHAVS5Jc2ZYwGZgK/cqO+CHNr0ZVUq1xh JIwiRlfjPTwp7hL5rGT2vN81l8a440krgtWxMCKxj+fqGR4CKT99fcAPPot2kazjsgNF ySz61ExN+YmcakITtxLHJhiTqc5M04O7gLHlHdxg17eyCaWx92dARXqznskm3SgVwr91 zV4Q== X-Gm-Message-State: AOAM531XEQ6716TXOZoSB/t5D5SKirhb/6GMgQOa6droFTaddnGv70yD io0YIcru+Ejg4fQX0Th+6WvR7yXS0bc3Aw== X-Google-Smtp-Source: ABdhPJxLzlHZxGmNOzrNyFmrTmU82gzRfCUq9stgv6nPn+DPs9nPvnbKZJOJMFhjcPJQMeRTAjDqCg== X-Received: by 2002:a9d:6198:: with SMTP id g24mr33755339otk.365.1621021566455; Fri, 14 May 2021 12:46:06 -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 c131sm1015353oif.29.2021.05.14.12.46.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 12:46:06 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de, sjg@chromium.org Cc: Alexandru Gagniuc , trini@konsulko.com Subject: [PATCH RFC 03/10] image: Add support for placing crypto_algo in linker lists Date: Fri, 14 May 2021 14:45:55 -0500 Message-Id: <20210514194602.598322-4-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210514194602.598322-1-mr.nuke.me@gmail.com> References: <20210514194602.598322-1-mr.nuke.me@gmail.com> MIME-Version: 1.0 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 The purpose of this change is to enable crypto algorithms to be placed in linker lists, rather than be declared as a static array. The goal is to remove the crypto_algos array in a subsequent patch. Create a new linker list named "cryptos", and search it when image_get_crypto_algo() is invoked. NOTE that adding support for manual relocation of crypto_algos within linker lists is beyond the scope of this patch. Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- common/image-sig.c | 9 +++++++++ include/image.h | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/common/image-sig.c b/common/image-sig.c index 698b044d50..2b7e23f99a 100644 --- a/common/image-sig.c +++ b/common/image-sig.c @@ -107,6 +107,7 @@ struct checksum_algo *image_get_checksum_algo(const char *full_name) struct crypto_algo *image_get_crypto_algo(const char *full_name) { + struct crypto_algo *crypto, *end; int i; const char *name; @@ -133,6 +134,14 @@ struct crypto_algo *image_get_crypto_algo(const char *full_name) return &crypto_algos[i]; } + crypto = ll_entry_start(struct crypto_algo, cryptos); + end = ll_entry_end(struct crypto_algo, cryptos); + for (; crypto < end; crypto++) { + if (!strcmp(crypto->name, name)) + return crypto; + } + + /* Not found */ return NULL; } diff --git a/include/image.h b/include/image.h index 459685d4d4..1bda4ef725 100644 --- a/include/image.h +++ b/include/image.h @@ -47,6 +47,7 @@ struct fdt_region; #include #include #include +#include /* Take notice of the 'ignore' property for hashes */ #define IMAGE_ENABLE_IGNORE 1 @@ -1362,6 +1363,10 @@ struct crypto_algo { uint8_t *sig, uint sig_len); }; +/* Declare a new U-Boot crypto algorithm handler */ +#define U_BOOT_CRYPTO_ALGO(__name) \ +ll_entry_declare(struct crypto_algo, __name, cryptos) + struct padding_algo { const char *name; int (*verify)(struct image_sign_info *info, From patchwork Fri May 14 19:45:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1478668 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=qVqlqSRH; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FhfDk6MVDz9sWQ for ; Sat, 15 May 2021 05:47:02 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3455D82CE7; Fri, 14 May 2021 21:46:50 +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="qVqlqSRH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A010982B31; Fri, 14 May 2021 21:46:18 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) (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 9EC3882AC2 for ; Fri, 14 May 2021 21:46:08 +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-ot1-x330.google.com with SMTP id 69-20020a9d0a4b0000b02902ed42f141e1so258811otg.2 for ; Fri, 14 May 2021 12:46:08 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=CKQ9sHHY9R0DyHHZRw2qGyaLZqKVqDbuuC10z6DY3eg=; b=qVqlqSRHX4kCZkBupunJ2cLSOjc+H/T74j2nYvM9QdmQCTo19LvCupHojsxW8USnQP HmLGyJUBnDZqFINMu5fJ6VBv5B9lg20CLsXOZXu07kzC5K4InHZpKVPHmaxmoWeASjzU XXhhvzGYJRlM67G6AHucWmGzEu0XNTCUOVzIlIkdXpQFQLKlrdL33l+MU5IT8hgvuFt+ PrbQifPtgbnHvuq64vav0beAMuFUKuWBYfYEg1746UKKxfNTI0fn/s3D8fwiFIzHttt+ aF5jsM/P55zr3Tw43Wx5yUjbOnyFVLsD91A+kX9y/f4MOGMcrAM6k86eEm/myPQGV6jY U27Q== 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=CKQ9sHHY9R0DyHHZRw2qGyaLZqKVqDbuuC10z6DY3eg=; b=Dq82CzrmdmhSkyIHGcPKbMyEyJkBR2o+od0sB9hMKpgaxr2cP54o6ozeU9UMqQ5exY Bu5VbGFwnItaS+PjbBM3D16UZCVhB9R6RtmdCTvfPIyBOs/oFkbBV80SzFN1ZkzvMqOH MFMBcHAgp/j5FOpMRfo2LoVxbgih668Y2ZrGM8Y5bSntWKa+EAacJG9xJEICN8Wm+SQu AvZ1s67Ph9vxP8e8HzXHiJ0OvlTXNyxyzf7sSt0IG+i9VSVlCHNuCVE7j13eoGMojCHF Y8STrP4Pz4e4O9LxTARQ8aSIVrNcf2a1gEbZLJrbRxFlcMd5CBrtl+VJLGOeOfX1McWi tuWA== X-Gm-Message-State: AOAM533QVp+Rv7zneXOOOtXvPu3l6SL36597J+bGcWrVI2q97WwYIlwq jIObQ2PoICz8yWB2vWWGPwdpm3zoemsPfw== X-Google-Smtp-Source: ABdhPJwetK3gHo4uP5XBg7SFIf0TvxYHZD94MCaQwZ602YPoNBZJLidNfsM8HshFP/MYgqyC8At3LQ== X-Received: by 2002:a9d:39e3:: with SMTP id y90mr42370592otb.257.1621021567065; Fri, 14 May 2021 12:46:07 -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 c131sm1015353oif.29.2021.05.14.12.46.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 12:46:06 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de, sjg@chromium.org Cc: Alexandru Gagniuc , trini@konsulko.com Subject: [PATCH RFC 04/10] [UNTESTED] image: Add support for relocating crypto_algos in linker lists Date: Fri, 14 May 2021 14:45:56 -0500 Message-Id: <20210514194602.598322-5-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210514194602.598322-1-mr.nuke.me@gmail.com> References: <20210514194602.598322-1-mr.nuke.me@gmail.com> MIME-Version: 1.0 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 Function pointers from crypto_algos array are relocated, when NEEDS_MANUAL_RELOC is set. This relocation doesn't happen if the algo is placed in a linker list. Implement this relocation. Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass Acked-by: Michal Simek --- common/image-sig.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/common/image-sig.c b/common/image-sig.c index 2b7e23f99a..b750751144 100644 --- a/common/image-sig.c +++ b/common/image-sig.c @@ -120,6 +120,13 @@ struct crypto_algo *image_get_crypto_algo(const char *full_name) crypto_algos[i].name += gd->reloc_off; crypto_algos[i].verify += gd->reloc_off; } + + crypto = ll_entry_start(struct crypto_algo, cryptos); + end = ll_entry_end(struct crypto_algo, cryptos); + for (; crypto < end; crypto++) { + crypto->name += gd->reloc_off; + crypto->verify += gd->reloc_off; + } } #endif From patchwork Fri May 14 19:45:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1478667 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=QRvfIYck; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FhfDW6dd6z9sWX for ; Sat, 15 May 2021 05:46:51 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 85FDE82B48; Fri, 14 May 2021 21:46:40 +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="QRvfIYck"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8DC5682B48; Fri, 14 May 2021 21:46:17 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc2f.google.com (mail-oo1-xc2f.google.com [IPv6:2607:f8b0:4864:20::c2f]) (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 13BD082AE1 for ; Fri, 14 May 2021 21:46:09 +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-xc2f.google.com with SMTP id l25-20020a4a35190000b029020a54735152so121412ooa.4 for ; Fri, 14 May 2021 12:46:09 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=ihV6kjyordNC+afmdqz3gH6BlCCw3B2/UCJOkIqwtF8=; b=QRvfIYcksMjKYNBfwKaeJMJGqBRFYuWW6baKlMb14jAHQSv2CKCPRC1rihRf7K7BpI dVqmfpWrRqBLPAH0JvLCN8FtWAST7uzsm7tQc5c+R5BgXTfUPEI8+N5fceYAQ7ZRETS2 QEHivVQ1DvW84HT5/sC9BZXTO0m0whHtSYDQEj+OgrkQuCjv3xvRNW/3W5VQcWDpe9gO 8Q7XC6bd1cBfHbsRsgpFyFlfp4SnhXDUXyEotyfSlxoynF3k4lAlglbVs5sQTZJ1E3TO YJlgVZSbQ/j1sTKUywj0H8NZLVLgEne3+13L5V8NWiVfzNjk/O/I9Y4xElDk1ZTNXJEH C9FA== 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=ihV6kjyordNC+afmdqz3gH6BlCCw3B2/UCJOkIqwtF8=; b=ec0cfRrhVng0+8iF2ICNgEb39nGQZyF1MYoWLvvgga8k+CaKjX2KdpVQ7taE3Lw7l2 ZolPnLblajpFzrSkOAvafkuL3BHxMYZrkNagKd2zci37sy6gjPnxLunNKVkerx8ptTKi Bv7J6Ea7JSfYL3lzgF/JHYqAxXZ5bG+ZMdrmFIYXqFoYIiilH/NcvzjRoZ9Ps0IHNdMX rtqQcYK4/4kgAYTm7SJJpkrqg2kcnT5x/72MklY7rWE4G80k254fFMGcI6vY3n7GFl2G iZFnA1HSPHTWRMImJX3N/k23dVKFxR1DADcg0eWzodpca6zjXBZ8Q1BaaBpfDzJJcJ/f LAjw== X-Gm-Message-State: AOAM530+2CogReLuMWGM3Ust/Ga9CkaExWIVc4+Y+5w0ZelC1rTC8TYY wl/y4k/l5hCnxm9mt50cqI9ZkY4/4XrSXw== X-Google-Smtp-Source: ABdhPJxS9YJ6dFhGJ04ZgBXie20oLBowTbFboRqT3PYF5c7rz4pzKhcuc9li4078vm+369pf2bgUfQ== X-Received: by 2002:a4a:cb95:: with SMTP id y21mr23930352ooq.68.1621021567670; Fri, 14 May 2021 12:46:07 -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 c131sm1015353oif.29.2021.05.14.12.46.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 12:46:07 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de, sjg@chromium.org Cc: Alexandru Gagniuc , trini@konsulko.com Subject: [PATCH RFC 05/10] image: rsa: Move verification algorithm to a linker list Date: Fri, 14 May 2021 14:45:57 -0500 Message-Id: <20210514194602.598322-6-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210514194602.598322-1-mr.nuke.me@gmail.com> References: <20210514194602.598322-1-mr.nuke.me@gmail.com> MIME-Version: 1.0 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 Move the RSA verification crytpo_algo structure out of the crypto_algos array, and into a linker list. Although it appears we are adding an #ifdef to rsa-verify.c, the gains outweigh this small inconvenience. This is because rsa_verify() is defined differently based on #ifdefs. This change allows us to have a single definition of rsa_verify(). Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- common/image-sig.c | 9 --------- lib/rsa/rsa-verify.c | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/common/image-sig.c b/common/image-sig.c index b750751144..d3be30289c 100644 --- a/common/image-sig.c +++ b/common/image-sig.c @@ -53,15 +53,6 @@ struct checksum_algo checksum_algos[] = { struct crypto_algo crypto_algos[] = { { - .name = "rsa2048", - .key_len = RSA2048_BYTES, - .verify = rsa_verify, - }, - { - .name = "rsa4096", - .key_len = RSA4096_BYTES, - .verify = rsa_verify, - }, }; struct padding_algo padding_algos[] = { diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c index aee76f42d5..06b0d82e7d 100644 --- a/lib/rsa/rsa-verify.c +++ b/lib/rsa/rsa-verify.c @@ -571,3 +571,19 @@ int rsa_verify(struct image_sign_info *info, return rsa_verify_hash(info, hash, sig, sig_len); } + +#ifndef USE_HOSTCC + +U_BOOT_CRYPTO_ALGO(rsa2048) = { + .name = "rsa2048", + .key_len = RSA2048_BYTES, + .verify = rsa_verify, +}; + +U_BOOT_CRYPTO_ALGO(rsa4096) = { + .name = "rsa4096", + .key_len = RSA4096_BYTES, + .verify = rsa_verify, +}; + +#endif From patchwork Fri May 14 19:45:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1478671 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=ugenzfhZ; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FhfFR5PSYz9sT6 for ; Sat, 15 May 2021 05:47:39 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EA29282CD0; Fri, 14 May 2021 21:47:15 +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="ugenzfhZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6CC2582AE1; Fri, 14 May 2021 21:46:23 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) (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 9D67282ACC for ; Fri, 14 May 2021 21:46:09 +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-ot1-x336.google.com with SMTP id u19-20020a0568302493b02902d61b0d29adso219888ots.10 for ; Fri, 14 May 2021 12:46:09 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=/SbqrcW8QAhnQMOc9V3+/j+LrTKTZDA7bH42Jq2tFI4=; b=ugenzfhZPnNb8KxaKcUFhJ+wskYXkJ23k6kZqGoTDaaTG0gSgl7uludH2COx8QkFOd YKasfL10H2MlR3BmLK/OsTcoXUb89FyjanLWFhl6750jU6Bn8TBUS9ldpx5Tki2OYY9n oZDTYuN+TSHovf3P9XeFTW8mx1RtPGs62/3d+DjzpPQzr431MuFsN0cITAAiSHevnZFt o3Auwi2wzwhMtqx9jgfLr26KL6ampnr69y7qz+9EiXPYXNJKbpJ9Y1CqmfA96BfjlLce qRQTuwN35/z2TnH+J0T8DQPqb2AtBvIfLy0fbjIegUH68aWx7XEg9iSpcmKXUyIpC78S LrmA== 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=/SbqrcW8QAhnQMOc9V3+/j+LrTKTZDA7bH42Jq2tFI4=; b=iNCGDG5bXmddXCHKShaJUvXeN6UEK15JB9fnxWYDpG1/hUehsrNTFyCLOML7oWmNyf IpDy/7aQWr2LWHDI5Udb0V7lXjX/Tjrc8P20+JxC1HN26Gsn0yFu3EDKW6Z8OC2y+cM/ 3ZtMHWStu9pkjXJ/BZ9rh5Q56NnRqxBPqtujxZuO5pEkuQSo4JxWEaV6N3XOryXjI2dK mJLHSm+WGsjmOTSqz5O0pIPU9Whp7Lgar1RM10s18ICzfRK0UXamtTV5Gj2J62R/bZ8L vRW7z1I3fd6yg69GKHuCcWTkyJroG7JhtpSDxp3QcZ4BiX6exi6yCAxYkXrlzYfXb16U QMtA== X-Gm-Message-State: AOAM531pw/ICxZ6Gb0Gddqnt25ekIrd0MR+EhOrfPj4c7lHirs9Oxyuf 2X3wcOj/w80bwd9HYNhnZbn50nApDjM+cw== X-Google-Smtp-Source: ABdhPJw4ODr+I6BVT9MEKlNINacQlRxmpuMPihz0o9+FGejH7A+rgnbV0uJeUbhvL8IGLIXf8/j+iQ== X-Received: by 2002:a05:6830:1693:: with SMTP id k19mr18584149otr.210.1621021568279; Fri, 14 May 2021 12:46:08 -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 c131sm1015353oif.29.2021.05.14.12.46.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 12:46:07 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de, sjg@chromium.org Cc: Alexandru Gagniuc , trini@konsulko.com Subject: [PATCH RFC 06/10] image: image-sig.c: Remove crypto_algos array Date: Fri, 14 May 2021 14:45:58 -0500 Message-Id: <20210514194602.598322-7-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210514194602.598322-1-mr.nuke.me@gmail.com> References: <20210514194602.598322-1-mr.nuke.me@gmail.com> MIME-Version: 1.0 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 Crytographic algorithms (currently RSA), are stored in linker lists. The crypto_algos array is unused, so remove it, and any logic associated with it. Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- common/image-sig.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/common/image-sig.c b/common/image-sig.c index d3be30289c..6923f0a9e9 100644 --- a/common/image-sig.c +++ b/common/image-sig.c @@ -51,10 +51,6 @@ struct checksum_algo checksum_algos[] = { }; -struct crypto_algo crypto_algos[] = { - { -}; - struct padding_algo padding_algos[] = { { .name = "pkcs-1.5", @@ -107,10 +103,6 @@ struct crypto_algo *image_get_crypto_algo(const char *full_name) if (!done) { done = true; - for (i = 0; i < ARRAY_SIZE(crypto_algos); i++) { - crypto_algos[i].name += gd->reloc_off; - crypto_algos[i].verify += gd->reloc_off; - } crypto = ll_entry_start(struct crypto_algo, cryptos); end = ll_entry_end(struct crypto_algo, cryptos); @@ -127,11 +119,6 @@ struct crypto_algo *image_get_crypto_algo(const char *full_name) return NULL; name += 1; - for (i = 0; i < ARRAY_SIZE(crypto_algos); i++) { - if (!strcmp(crypto_algos[i].name, name)) - return &crypto_algos[i]; - } - crypto = ll_entry_start(struct crypto_algo, cryptos); end = ll_entry_end(struct crypto_algo, cryptos); for (; crypto < end; crypto++) { From patchwork Fri May 14 19:45:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1478674 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=eAzSdDli; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FhfG64qCWz9sT6 for ; Sat, 15 May 2021 05:48:14 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 699A682E33; Fri, 14 May 2021 21:47:35 +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="eAzSdDli"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 082B182B31; Fri, 14 May 2021 21:46:29 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) (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 683E482AED for ; Fri, 14 May 2021 21:46:10 +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-x230.google.com with SMTP id n184so495750oia.12 for ; Fri, 14 May 2021 12:46:10 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=ewZiT/7reHG4MtQdO0sD/s4UJKfbAtV6V9NwUuahjAU=; b=eAzSdDlieaY/l7aeJh4HFdrgSEEyrmHj3s1MtwosD4mpt0gfaE8FzPOWRv41ZC2Jik GKZ20KCjVHI31dlUqEPUOyx7F2KcnTc7AJqc+6FJcG6/1mqqtMd5rA7JJj5TeQWDT5TX E/XxUakEzh/GpYTVZ01b7n1uiT4ArvJpaOncFRj/APROavG8BMP9oTF8ZJQB15RQmtOA QCJYX1BE1vSDD+8i5ND7VjW7TWGn+Xfe6b38V4YcR0RUNqBm5dZcrhYwlPsP0jIVOVDI 9adOPcAMdoMYQT8t0FgRIKFFrnU5B8P83qfLzms3eYceIsBzLX3Sc34fdGL9y+qjSKYp 10AQ== 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=ewZiT/7reHG4MtQdO0sD/s4UJKfbAtV6V9NwUuahjAU=; b=L/omkaiMf6qA8cdvWWkJqKueVB7Js+YZ8utDFw4aPD9Bab2CGwXJiUrO3iQQU+mu5g qFD4J31w1U9fzhKSOe90gHc0BFLS15yHrowMu7Z77NgEmqb8Wdw+zArXy2LBl5960n4o elPX3bcTvJWUvhtdBFFMWqEw5EoBLo3DSauSQ8VSjz2zUOW8Bqc9T4X3piPTfYxP7RIl Fq3TFeAUSadETlzvlhL9khwftijAyEe+nKtQdnqYOgbyVk5G7Thq4qEvUnvXPZcJMH7e 3F2gCRdsfxwObGVZ3V3Msx1enzQ+YEEg7BXQh/sj5zi3VNqEYnRtCGWOiRefG7JEQ1Ls o0xA== X-Gm-Message-State: AOAM530YWP033dGMAVUTXmOAwSibeRWmYuhxoxkJpIV0s8XUi5DhXPqL xAuvdiRLwTJvehKlW5hm95I8r2gcc0DAhg== X-Google-Smtp-Source: ABdhPJyycPwiDdAZIYbc/P+QwnIECTejMwUjnXSc1othIyCn/DC4y3sf/Ah7x683+ecIM7wLVtbpSg== X-Received: by 2002:aca:47ca:: with SMTP id u193mr7925983oia.69.1621021568875; Fri, 14 May 2021 12:46:08 -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 c131sm1015353oif.29.2021.05.14.12.46.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 12:46:08 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de, sjg@chromium.org Cc: Alexandru Gagniuc , trini@konsulko.com Subject: [PATCH RFC 07/10] lib: ecdsa: Remove #ifdefs from ecdsa.h Date: Fri, 14 May 2021 14:45:59 -0500 Message-Id: <20210514194602.598322-8-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210514194602.598322-1-mr.nuke.me@gmail.com> References: <20210514194602.598322-1-mr.nuke.me@gmail.com> MIME-Version: 1.0 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 It is no longer necessary to implement ecdsa_() functions as no-ops depending on config options. It is merely sufficient to provide the prototypes, as the ecdsa code is no longer linked when unused. Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- include/u-boot/ecdsa.h | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/include/u-boot/ecdsa.h b/include/u-boot/ecdsa.h index 979690d966..f6951c7346 100644 --- a/include/u-boot/ecdsa.h +++ b/include/u-boot/ecdsa.h @@ -15,7 +15,6 @@ * @see "struct crypto_algo" * @{ */ -#if IMAGE_ENABLE_SIGN /** * sign() - calculate and return signature for given input data * @@ -49,22 +48,7 @@ int ecdsa_sign(struct image_sign_info *info, const struct image_region region[], * other -ve value on error */ int ecdsa_add_verify_data(struct image_sign_info *info, void *keydest); -#else -static inline -int ecdsa_sign(struct image_sign_info *info, const struct image_region region[], - int region_count, uint8_t **sigp, uint *sig_len) -{ - return -ENXIO; -} - -static inline -int ecdsa_add_verify_data(struct image_sign_info *info, void *keydest) -{ - return -ENXIO; -} -#endif -#if IMAGE_ENABLE_VERIFY_ECDSA /** * verify() - Verify a signature against some data * @@ -78,15 +62,6 @@ int ecdsa_add_verify_data(struct image_sign_info *info, void *keydest) int ecdsa_verify(struct image_sign_info *info, const struct image_region region[], int region_count, uint8_t *sig, uint sig_len); -#else -static inline -int ecdsa_verify(struct image_sign_info *info, - const struct image_region region[], int region_count, - uint8_t *sig, uint sig_len) -{ - return -ENXIO; -} -#endif /** @} */ #define ECDSA256_BYTES (256 / 8) From patchwork Fri May 14 19:46:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1478672 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=pVOv4iwP; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FhfFh2b5pz9sWX for ; Sat, 15 May 2021 05:47:52 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D524582D47; Fri, 14 May 2021 21:47:22 +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="pVOv4iwP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 61E3682AF1; Fri, 14 May 2021 21:46:25 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) (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 CEC0982AF6 for ; Fri, 14 May 2021 21:46:10 +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-ot1-x329.google.com with SMTP id n32-20020a9d1ea30000b02902a53d6ad4bdso256451otn.3 for ; Fri, 14 May 2021 12:46:10 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=IMAEEjuCK+2gq/+wgsS5iwNDYRLXBy9KYFmq3vmPs9o=; b=pVOv4iwP8qX66trsJ7w1x8E60ULxiusnHz/e8wXOYyqvvFEVlg7wcB7JO+sDxCw1bv j6dVn//3/buRsYu55GMtl60vqVgPZ3076G/2xSnXgC3TrKfuXMpBpEHt9RItCDX1w/Ga QX8jF3L7Xe4PHHKoj/5MHyBDb8TVCycoLzlNptoRla6Cgt1I0HHwAEAhm6X9aluORdEb IfqgjVzFdFt93PqEDgfK7NbC6ngLA4NjJ20FAl9ygp9Tt+L50+NUl+rtWTnF4QrnXQcc ipeelGKJYCG/ptL93zczBJT2U5WnMyv+qr82vOwZqNGek6itO3fMXu7AhPzzFiX31cT4 ME2g== 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=IMAEEjuCK+2gq/+wgsS5iwNDYRLXBy9KYFmq3vmPs9o=; b=lB+H/EbLWdnFPdRkLjaqBnqx5qJWEfQ0TKFPvPzEDpU+nM2H7BvhswM6+Qg+Mt7GH7 OWVIFugsVfslDkhlKXpaZJCwNuRbuKq0N9oCswxAPv/UU3wgrVBa7eO8o95tQzbgWUf+ 98txbiour/QcJL9t4kH4OmMb2T+6yWsOt+fRK90UYrY9i7tiEm03qm0U2q/+GIaVebvz h9FJS8P/anFA9IRQCo2ydqM2VI7ZfDI4JKQf8gkCL4Ulu8/oRd/TJb9RHGNtnNrBYkR3 AA9/YReWr9cB6TRig2gdytROjK41Mm0ZgYCbwsG81xVtJzz66wFCRhxIQKVpCAJLrZHd XqMQ== X-Gm-Message-State: AOAM532UfTR9qSXTQSz5Sx9tGBAV4/FC04NmL0F30ssamTDdhEZLLBip IMnGesi4atXKpv3zaGrSk+symuWS1Nn8+A== X-Google-Smtp-Source: ABdhPJw/UwZpqe8Z7B0MhKOt3uxkuUtPdYAWXasy4U7EWc9yUG3FitEyMCHceF/V4YnsgbIHXrbrhg== X-Received: by 2002:a05:6830:905:: with SMTP id v5mr40391646ott.214.1621021569378; Fri, 14 May 2021 12:46:09 -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 c131sm1015353oif.29.2021.05.14.12.46.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 12:46:09 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de, sjg@chromium.org Cc: Alexandru Gagniuc , trini@konsulko.com Subject: [PATCH RFC 08/10] lib: rsa: Remove #ifdefs from rsa.h Date: Fri, 14 May 2021 14:46:00 -0500 Message-Id: <20210514194602.598322-9-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210514194602.598322-1-mr.nuke.me@gmail.com> References: <20210514194602.598322-1-mr.nuke.me@gmail.com> MIME-Version: 1.0 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 It is no longer necessary to implement rsa_() functions as no-ops depending on config options. It is merely sufficient to provide the prototypes, as the rsa code is no longer linked when unused. Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- include/u-boot/rsa.h | 47 -------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/include/u-boot/rsa.h b/include/u-boot/rsa.h index bed1c097c2..4ac373cd5e 100644 --- a/include/u-boot/rsa.h +++ b/include/u-boot/rsa.h @@ -31,7 +31,6 @@ struct rsa_public_key { struct image_sign_info; -#if IMAGE_ENABLE_SIGN /** * sign() - calculate and return signature for given input data * @@ -66,22 +65,7 @@ int rsa_sign(struct image_sign_info *info, other -ve value on error */ int rsa_add_verify_data(struct image_sign_info *info, void *keydest); -#else -static inline int rsa_sign(struct image_sign_info *info, - const struct image_region region[], int region_count, - uint8_t **sigp, uint *sig_len) -{ - return -ENXIO; -} - -static inline int rsa_add_verify_data(struct image_sign_info *info, - void *keydest) -{ - return -ENXIO; -} -#endif -#if IMAGE_ENABLE_VERIFY /** * rsa_verify_hash() - Verify a signature against a hash * @@ -124,37 +108,6 @@ int padding_pss_verify(struct image_sign_info *info, uint8_t *msg, int msg_len, const uint8_t *hash, int hash_len); #endif /* CONFIG_FIT_ENABLE_RSASSA_PSS_SUPPORT */ -#else -static inline int rsa_verify_hash(struct image_sign_info *info, - const uint8_t *hash, - uint8_t *sig, uint sig_len) -{ - return -ENXIO; -} - -static inline int rsa_verify(struct image_sign_info *info, - const struct image_region region[], int region_count, - uint8_t *sig, uint sig_len) -{ - return -ENXIO; -} - -static inline int padding_pkcs_15_verify(struct image_sign_info *info, - uint8_t *msg, int msg_len, - const uint8_t *hash, int hash_len) -{ - return -ENXIO; -} - -#ifdef CONFIG_FIT_ENABLE_RSASSA_PSS_SUPPORT -static inline int padding_pss_verify(struct image_sign_info *info, - uint8_t *msg, int msg_len, - const uint8_t *hash, int hash_len) -{ - return -ENXIO; -} -#endif /* CONFIG_FIT_ENABLE_RSASSA_PSS_SUPPORT */ -#endif #define RSA_DEFAULT_PADDING_NAME "pkcs-1.5" From patchwork Fri May 14 19:46:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1478673 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=rzMjHSrD; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FhfFw4NCVz9sT6 for ; Sat, 15 May 2021 05:48:04 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CAA9C82E1E; Fri, 14 May 2021 21:47:27 +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="rzMjHSrD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 40ADD82B73; Fri, 14 May 2021 21:46:27 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) (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 64DC182B0E for ; Fri, 14 May 2021 21:46:11 +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-x231.google.com with SMTP id n184so495806oia.12 for ; Fri, 14 May 2021 12:46:11 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=bk81blLa1UBjbZzMoO3xyDhLKEKqeQaGIQ+HkPZSCIU=; b=rzMjHSrDDCRYcNnfy0ueuvilhwMKl+PiDPaogtkdQCp0xS2VAKDBKky3lAHV2q7tZt EVonr/Z6RYREhoqRXWK6sdl69Il9VnSJzqYJF60/FnbE6u8PPDS+lKbrKZ4qYOKG6KSQ a6kdesKXGWAGEW0vSwVyS0JB3IeAO+7Oe2BZKR9NBRaFQH3UYinQQfj76/a9l2k3CBsA RFsfOLuEqDS1wWnwb2hAb0mFi2abhReIv7RoShz830IhVmSQdeJna7MCeq2MAK93IFSd 3qEzVxg85kxHfGSYy467fX0PIPGAIy6sxlod5klMvnLmq5t3vaJLgAyBUsYeVMR8CD0u zUsg== 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=bk81blLa1UBjbZzMoO3xyDhLKEKqeQaGIQ+HkPZSCIU=; b=N9aCX0LlCocT0oorIo0bI9osSiStXNtljQLl7ZL3JMV4x7gcCsmWDxX9+D0xtD9tXb Mu4fKOnTYmQm07DLqqVVbGf8W1F/sEXM1AJDMvoEcrkKJlWAPM7DY1Q93c0LJMa0I+1W x4T7p4C+hCocyjZB3x4RcKeEtKMFpuLkq8IDLVRayZZhB8zGtmXgBkgFzLyA2fFghJA6 FLAnBjGo3WO/lFQ/XekSqb2l7EyQGiikk00irIWLofS2zr3Cos68jHA/ZKP8NIa5FrU9 PlAz43YkUi680Ou340m42vVAWw4ADPyhmNLe6u9u5fCFjpOOf7VqiCXPB9SgvZLyKJ5c DLJA== X-Gm-Message-State: AOAM532cKFOHsgqYyjwl5EpkfOdygPAFwwp2eADqR56LJqfMqnDnLX06 mv96v/huVYgrSGnbdSbPrCgQcpQhIZCWww== X-Google-Smtp-Source: ABdhPJyjLAP57OpB5vWQ7ITdLWDzjfLQWDu21VW369QQpxfvNVbsayII46heCaqdMgSipyp2MPAblQ== X-Received: by 2002:aca:afd3:: with SMTP id y202mr8244072oie.90.1621021569983; Fri, 14 May 2021 12:46:09 -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 c131sm1015353oif.29.2021.05.14.12.46.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 12:46:09 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de, sjg@chromium.org Cc: Alexandru Gagniuc , trini@konsulko.com Subject: [PATCH RFC 09/10] image: Eliminate IMAGE_ENABLE_VERIFY macro Date: Fri, 14 May 2021 14:46:01 -0500 Message-Id: <20210514194602.598322-10-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210514194602.598322-1-mr.nuke.me@gmail.com> References: <20210514194602.598322-1-mr.nuke.me@gmail.com> MIME-Version: 1.0 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 macro is no longer needed for code flow or #ifdefs. Remove it. Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- include/image.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/image.h b/include/image.h index 1bda4ef725..4a7aa9358f 100644 --- a/include/image.h +++ b/include/image.h @@ -1225,19 +1225,16 @@ int calculate_hash(const void *data, int data_len, const char *algo, #if defined(USE_HOSTCC) # if defined(CONFIG_FIT_SIGNATURE) # define IMAGE_ENABLE_SIGN 1 -# define IMAGE_ENABLE_VERIFY 1 # define IMAGE_ENABLE_VERIFY_ECDSA 1 # define FIT_IMAGE_ENABLE_VERIFY 1 # include # else # define IMAGE_ENABLE_SIGN 0 -# define IMAGE_ENABLE_VERIFY 0 # define IMAGE_ENABLE_VERIFY_ECDSA 0 # define FIT_IMAGE_ENABLE_VERIFY 0 # endif #else # define IMAGE_ENABLE_SIGN 0 -# define IMAGE_ENABLE_VERIFY CONFIG_IS_ENABLED(RSA_VERIFY) # define IMAGE_ENABLE_VERIFY_ECDSA 0 # define FIT_IMAGE_ENABLE_VERIFY CONFIG_IS_ENABLED(FIT_SIGNATURE) #endif @@ -1294,7 +1291,7 @@ struct image_region { int size; }; -#if IMAGE_ENABLE_VERIFY +#if FIT_IMAGE_ENABLE_VERIFY # include #endif struct checksum_algo { From patchwork Fri May 14 19:46:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Gagniuc X-Patchwork-Id: 1478675 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=KCTqfINk; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FhfGJ6hzbz9sT6 for ; Sat, 15 May 2021 05:48:24 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 09AF382D66; Fri, 14 May 2021 21:47:43 +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="KCTqfINk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CB12882AF6; Fri, 14 May 2021 21:46:29 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) (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 27B6D82B20 for ; Fri, 14 May 2021 21:46:12 +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-ot1-x32c.google.com with SMTP id v19-20020a0568301413b0290304f00e3d88so251024otp.4 for ; Fri, 14 May 2021 12:46:12 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=q9+TWC92BkIZj/8opr5j2RddGlLlwS1NvTgmhUicAC0=; b=KCTqfINkbqq14R1LxGZCv5Rq6vi4EJm405b41100qf4nF1P1aiVpe5fmfoTtuxFCJI 7zUxzUYrQLml/D5UOdYGKihUsTOgTh/CMQ1OWY8G4rGtdCM4c62F77pRsiaz7kMyLCd3 l3a+wrDDKotOvJBmSDf0ydWbGHwwVjLmu4JgMevOO4e7nNUKPIAassRCXnPRPUuU0I4v KAbWq1L3qJ+OttlLeWVM54znsB5jeAMbrER/u23rfFtmQbl7xKrPBe1VMk+J/aFpir1R rYsY/PJawn2hjrtu1W2MZc/iYcU/tXa8AX+7fKlxZqRiAFjpN7Thjs4rJsM2D9et5P/a eqsg== 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=q9+TWC92BkIZj/8opr5j2RddGlLlwS1NvTgmhUicAC0=; b=hvjQ5KRyIbCRToQ1wEY/4fS83Hkw+GO7PmwT9mO1DtCnTLaU4Gm+xFJgwu/dzAo+K7 2NiU1OrvAa8072jK+gw1UfloUbN1r5XOT/jA2h1UKnpGWoylX0BqSktjcSy4WEDh8j6K WCp6GTTOCvMRb9tdxGkk14NbhHBYDkqRu+UPbwy3Qlov2nM4igMyiQztskwTG4AGuFvM OczQxlcwfrVlJOrAnhyad6Nv/MUR2em2tIINHP/wO9CTVSN/RM6y4Jji/5JpO6vmMCD9 XC6QASlwCurOa4Bk+WIC77mK2VOJUTUM+cvde5uBfxzr1C6UqvLxSa4uKObxg7+Q3OC1 5S+g== X-Gm-Message-State: AOAM532eQck5WlYygRirRV+UeG7gL0VfB6iUkfnweSx3wY466Ye2zDju gZVettAuyvcSQmuLmUoaPyauF0w3TbfF3w== X-Google-Smtp-Source: ABdhPJyi/RKf3exwHkKb2nda2GRktY9gTAMNYyc8nrAupMIx2qBfyKWP93b0SewMVjKE9lgeWn7E8Q== X-Received: by 2002:a05:6830:1d81:: with SMTP id y1mr22015045oti.24.1621021570645; Fri, 14 May 2021 12:46:10 -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 c131sm1015353oif.29.2021.05.14.12.46.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 12:46:10 -0700 (PDT) From: Alexandru Gagniuc To: u-boot@lists.denx.de, sjg@chromium.org Cc: Alexandru Gagniuc , trini@konsulko.com Subject: [PATCH RFC 10/10] image: Eliminate IMAGE_ENABLE_VERIFY_ECDSA macro Date: Fri, 14 May 2021 14:46:02 -0500 Message-Id: <20210514194602.598322-11-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210514194602.598322-1-mr.nuke.me@gmail.com> References: <20210514194602.598322-1-mr.nuke.me@gmail.com> MIME-Version: 1.0 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 macro is no longer needed for code flow or #ifdefs. Remove it. Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- include/image.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/image.h b/include/image.h index 4a7aa9358f..dd07771480 100644 --- a/include/image.h +++ b/include/image.h @@ -1225,17 +1225,14 @@ int calculate_hash(const void *data, int data_len, const char *algo, #if defined(USE_HOSTCC) # if defined(CONFIG_FIT_SIGNATURE) # define IMAGE_ENABLE_SIGN 1 -# define IMAGE_ENABLE_VERIFY_ECDSA 1 # define FIT_IMAGE_ENABLE_VERIFY 1 # include # else # define IMAGE_ENABLE_SIGN 0 -# define IMAGE_ENABLE_VERIFY_ECDSA 0 # define FIT_IMAGE_ENABLE_VERIFY 0 # endif #else # define IMAGE_ENABLE_SIGN 0 -# define IMAGE_ENABLE_VERIFY_ECDSA 0 # define FIT_IMAGE_ENABLE_VERIFY CONFIG_IS_ENABLED(FIT_SIGNATURE) #endif