From patchwork Wed Nov 11 11:18:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 1398170 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; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=QdNk8Bu7; 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 4CWMgv164Mz9sRK for ; Wed, 11 Nov 2020 22:19:22 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EEC7582523; Wed, 11 Nov 2020 12:19:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="QdNk8Bu7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C29C082545; Wed, 11 Nov 2020 12:19:06 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) (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 3515F824F7 for ; Wed, 11 Nov 2020 12:18:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=joel.stan@gmail.com Received: by mail-pf1-x441.google.com with SMTP id x15so101072pfm.9 for ; Wed, 11 Nov 2020 03:18:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FX1BkwrA+lvxKaBBN5lK1E6AFRT4+HWtrgVxTNcpkAg=; b=QdNk8Bu7HwhWaWrDcGiMMA65HLdY7/CkHLms6LDvr32k8yL55zPLbm1phm4ihTWL/O pjXBcwO2s12nG3h6Dn+kGK22KEz1Dap6pm6jxW6Ho19XnQ7jD5AcvJrWLvmk7L3AmFHu fCoWEbhG3MHIiEy8b94hDNXeGmTGhQ32cnKg73LqXi8ux2VgwN298qD05Gjuqi1HJIRg rYb4oySnupt5n0Bw7Rrx58lpnLPBd2I98/rboMp4HES5HqiP2ywMJ4KM1Utd01UNG5XM +50XecRKGEjHzmN7OU8QZYsVhuPTB75AZIar/0AOZdzPs6LtN6EeeJA4js0lMLIhVEbT 7dPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=FX1BkwrA+lvxKaBBN5lK1E6AFRT4+HWtrgVxTNcpkAg=; b=HnTDAfI+bA1EwD6bmUPr8WJL9k2z2nFGO8qpHIi87mGW2IWuRxTj3iTkGs8W9Nxfdc mKPz1qnPSSh0IYEdms2hDk/fjYcIHuFbOU6bDnbWpeQhxvsSb7stoVwoIGD3h5oKuBTp nKTHyMPHoFR4ryfFHYiS9cD5ir8Uz3D/xB7ok7by6b0ZvEENwTiuJ8lnonAZeel64Ff7 B/ewwxs7VmbzNtnfEbWR4z4pmUoZ/upbfwyLl5JqyfSfwLzRCxGi8a/+mRgxsnP0ZOV4 7Jt+n+pfKHE5oBOBc9aCwTakc89E2tImloyhvp9W96diRarH1xbQtU4eqBIVGq/5I7ct 0VKw== X-Gm-Message-State: AOAM532lJq9NcAEw14apC+OcieePYnHybaW3js1uYCdtnBGrV8frSWOJ nIZr79kOeFUgCqbqGDY5ugU= X-Google-Smtp-Source: ABdhPJyyQQjRkKX/HxCiqvQ6dNJNANDr9dtF8c4vgwCeO4k0dmoRNnKLxrho0JpB036DWqOZKqx3lw== X-Received: by 2002:a05:6a00:213a:b029:18b:4b8b:68c with SMTP id n26-20020a056a00213ab029018b4b8b068cmr5205488pfj.18.1605093537810; Wed, 11 Nov 2020 03:18:57 -0800 (PST) Received: from voyager.lan ([45.124.203.14]) by smtp.gmail.com with ESMTPSA id l62sm2339495pga.63.2020.11.11.03.18.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 03:18:56 -0800 (PST) From: Joel Stanley To: Simon Glass , Philippe Reynes Cc: Andrew Jeffery , u-boot@lists.denx.de Subject: [PATCH 1/3] tools/Makefile: FIT_CIPHER requires libssl Date: Wed, 11 Nov 2020 21:48:31 +1030 Message-Id: <20201111111833.741937-2-joel@jms.id.au> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111111833.741937-1-joel@jms.id.au> References: <20201111111833.741937-1-joel@jms.id.au> 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.3 at phobos.denx.de X-Virus-Status: Clean If CONFIG_FIT_CIPHER=y and CONFIG_FIT_SIGNATURE=n then mkimage and dumpimage will fail to link: /usr/bin/ld: tools/common/image-cipher.o: in function `fit_image_decrypt_data': image-cipher.c:(.text+0x9a): undefined reference to `image_get_host_blob' /usr/bin/ld: tools/common/image-cipher.o:(.data.rel+0x10): undefined reference to `EVP_aes_128_cbc' /usr/bin/ld: tools/common/image-cipher.o:(.data.rel+0x40): undefined reference to `EVP_aes_192_cbc' /usr/bin/ld: tools/common/image-cipher.o:(.data.rel+0x70): undefined reference to `EVP_aes_256_cbc' /usr/bin/ld: tools/lib/aes/aes-encrypt.o: in function `image_aes_encrypt': aes-encrypt.c:(.text+0x22): undefined reference to `EVP_CIPHER_CTX_new' /usr/bin/ld: aes-encrypt.c:(.text+0x6f): undefined reference to `EVP_EncryptInit_ex' /usr/bin/ld: aes-encrypt.c:(.text+0x8d): undefined reference to `EVP_EncryptUpdate' /usr/bin/ld: aes-encrypt.c:(.text+0xac): undefined reference to `EVP_CIPHER_CTX_free' /usr/bin/ld: aes-encrypt.c:(.text+0xf2): undefined reference to `EVP_EncryptFinal_ex' collect2: error: ld returned 1 exit status Signed-off-by: Joel Stanley Reviewed-by: Philippe Reynes --- tools/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Makefile b/tools/Makefile index 51123fd92983..103b3ab8a7f2 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -154,7 +154,7 @@ HOSTCFLAGS_kwbimage.o += -DCONFIG_KWB_SECURE endif # MXSImage needs LibSSL -ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X)$(CONFIG_FIT_SIGNATURE),) +ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X)$(CONFIG_FIT_SIGNATURE)$(CONFIG_FIT_CIPHER),) HOSTCFLAGS_kwbimage.o += \ $(shell pkg-config --cflags libssl libcrypto 2> /dev/null || echo "") HOSTLDLIBS_mkimage += \ From patchwork Wed Nov 11 11:18:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 1398172 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; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=DRSUzeNf; 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 4CWMh51SrVz9sRK for ; Wed, 11 Nov 2020 22:19:32 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5D89982553; Wed, 11 Nov 2020 12:19:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="DRSUzeNf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 427398253B; Wed, 11 Nov 2020 12:19:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) (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 D2FDD82523 for ; Wed, 11 Nov 2020 12:19:02 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=joel.stan@gmail.com Received: by mail-pg1-x543.google.com with SMTP id r10so1234488pgb.10 for ; Wed, 11 Nov 2020 03:19:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=G/9GNE7VhoOhJkbaayefee2E6NX3aN3JN1WJFb0cf8U=; b=DRSUzeNfFZas2uJo5qxra/fC4LSyzowMovhwKyeY1mK3j4Dbu5GATSlcuLnBjF8u68 B3pAYUjdvnz3EZmVn0uwlnj/6rDJmwbnhcZ3NUHTcnMt0LJFP9SnIfeAKvjVvhaSuq2O Nc6yFKgdjpDJlIvsng5kquxUvzsccxv5Fj6uC+eG91c/snt+h8luhdzjUn1y6CnA9z/n XZzc4OWNh32LKgieUEKa89RTpmB+p6bOPeKtF3htYbWLfz9Lbs6ic/iBH6Ygie1bs3PP kvdMK5aONLKZty7SMMR8yrmEvvVVIZucorPbkqLM+DZGstU78vyXPFKFZdWyFGsPFT/q FIBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=G/9GNE7VhoOhJkbaayefee2E6NX3aN3JN1WJFb0cf8U=; b=EYLl4sKmZkwHUzmJbgkaRNOlWWcuJF+vXfC6EbUEW39jjaOB4/hV/3L48L8VRdSnXr j5F1VJ5tLp/XUVQWkbKtIH0j0U3guGZd2k/EZTgoCQ8mcKz7bYXyD1QMPe3+9bfCLj58 g3U3lvfkvHXAWIj7SkCz45akLSYLMYxsKCoYsIhN3vhzocZ+frs/JcAUXXSM/i20CIET apoU7Fcw6D5JPSKW6F9G0suCUUaPGUDRYZi50/vDn94kO2++zwdpgiuLNEg1fzkABBjS 2a19abLrVGeojBNwpOP/MP/0JT8xAOTZjRz6jnwbtlcGkkMlUpHt7Hlvo+7gagmCbmMd padQ== X-Gm-Message-State: AOAM532RRTmzsuGvl+FsYj9tkUe5JkVZyQe3/M+UZFiSwaIFGNOrZ+WJ NzMQWJBrSkH5oAxX/p0KCZCap6kLiG+hoQ== X-Google-Smtp-Source: ABdhPJxo7W27lJQvbEGIGquC3rTqYM2F+S5H8P0RUL8orQD+ICrIwPcV/4v1rS5VubkigpFEcOq4pA== X-Received: by 2002:a63:1906:: with SMTP id z6mr8079715pgl.409.1605093541322; Wed, 11 Nov 2020 03:19:01 -0800 (PST) Received: from voyager.lan ([45.124.203.14]) by smtp.gmail.com with ESMTPSA id l62sm2339495pga.63.2020.11.11.03.18.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 03:19:00 -0800 (PST) From: Joel Stanley To: Simon Glass , Philippe Reynes Cc: Andrew Jeffery , u-boot@lists.denx.de Subject: [PATCH 2/3] image-cipher: Fix FIT_CIPHER linking Date: Wed, 11 Nov 2020 21:48:32 +1030 Message-Id: <20201111111833.741937-3-joel@jms.id.au> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111111833.741937-1-joel@jms.id.au> References: <20201111111833.741937-1-joel@jms.id.au> 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.3 at phobos.denx.de X-Virus-Status: Clean When CONFIG_FIT_CIPHER=y and CONFIG_FIT_SIGNATURE=n is there is no implementation of image_get_host_blob for mkimage or dumpimage: /usr/bin/ld: tools/common/image-cipher.o: in function `fit_image_decrypt_data': image-cipher.c:(.text+0x9a): undefined reference to `image_get_host_blob' The implementation is the same as common/image-fit-sig.c. Signed-off-by: Joel Stanley --- common/image-cipher.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/common/image-cipher.c b/common/image-cipher.c index 4ca9eec4ef15..fcbbceb847a5 100644 --- a/common/image-cipher.c +++ b/common/image-cipher.c @@ -15,6 +15,20 @@ DECLARE_GLOBAL_DATA_PTR; #include #include +#ifdef USE_HOSTCC +void *host_blob; + +void image_set_host_blob(void *blob) +{ + host_blob = blob; +} + +void *image_get_host_blob(void) +{ + return host_blob; +} +#endif + struct cipher_algo cipher_algos[] = { { .name = "aes128", From patchwork Wed Nov 11 11:18:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 1398173 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; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=mApM7p2v; 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 4CWMhH34rXz9sRK for ; Wed, 11 Nov 2020 22:19:43 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6A3AB8254F; Wed, 11 Nov 2020 12:19:22 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="mApM7p2v"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6D39982543; Wed, 11 Nov 2020 12:19:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) (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 65DD382538 for ; Wed, 11 Nov 2020 12:19:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=joel.stan@gmail.com Received: by mail-pj1-x1043.google.com with SMTP id g21so550425pjv.2 for ; Wed, 11 Nov 2020 03:19:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HKopjynCciycEsmJEZnP6LywxeVLtwH3Nx1mNOKEvFQ=; b=mApM7p2vSkFmSFFQMyuO61rOk6zPWefRJo8GUPQGGd36k/aD2WrSLcDR2c/AICAsLj wTfUdiov2s/7QjXzF8qQZ2nC6UwkwX7tF9eSAR6zc0zYlMhf6j6cePEOmh6G1ijzb7KO vYb3M0yBx31XSxs0dimA4CJRpTO4HGjQmAciAxiFUsw87po+CHgCZb7MdqGT3nyM3Tyj COQHy61cBhIOSCuvBd8OUOOp1oOU4eNKgoTYIiXf4fk5Z7NyanqxMJdfja1+aq9oS1bj uoFlOhKNvD4A33BkTuMpYGwf9AIM+0l4V5GEAGxrN9AzxGzpfa/BA56f/NDNyKHHjYIO fOSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=HKopjynCciycEsmJEZnP6LywxeVLtwH3Nx1mNOKEvFQ=; b=ZYIO42TrQikdN2n4ie4Qeyi1+oD+IbxUHAksrfvutpnMAmDx+f/VVXQOoIoUzKheew wcfv31bfmr/ZbDgIT+y6gYOHbD6dQaTV7t2JWNwSKgVBs15uGSb60AhvcH6cZu6bDNGG tUflhRvs+9LqKFIvV9NyVZETG4/um7gfZ2yq+ukPiBwODK2Fhh5DkQ++cM3x/WF+0eUI byhrpGArlg+JMUD4tqbshA+yDG5cuSTuC3gy5I/9ZRgFNW9/k8ORoX+Y9cfLB2d+wWdD JXWHsC4tD6brGbUdp0ocbaE3u/cvIQbpywlvRQRg50cYu2PJimp6EvHl+pUaSLBg40mA fmQw== X-Gm-Message-State: AOAM531d1ocrH8au1HmHlD8/A5sZOR8Tt4/NSQu5yxxMNF8DB9HZnULq g+N7MWDcKiBYuhz6LESw3WI= X-Google-Smtp-Source: ABdhPJx6RGM2uLSOSX0tUxdE9cT6uQPpiLrLSCzE2oDl3uzy9rErHy43DSQKVI50tvrrCTyoEgKXOA== X-Received: by 2002:a17:90a:6b04:: with SMTP id v4mr3472388pjj.101.1605093544718; Wed, 11 Nov 2020 03:19:04 -0800 (PST) Received: from voyager.lan ([45.124.203.14]) by smtp.gmail.com with ESMTPSA id l62sm2339495pga.63.2020.11.11.03.19.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 03:19:03 -0800 (PST) From: Joel Stanley To: Simon Glass , Philippe Reynes Cc: Andrew Jeffery , u-boot@lists.denx.de Subject: [PATCH 3/3] mkimge: Reject signing-related flags without FIT_SIGNATURE Date: Wed, 11 Nov 2020 21:48:33 +1030 Message-Id: <20201111111833.741937-4-joel@jms.id.au> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111111833.741937-1-joel@jms.id.au> References: <20201111111833.741937-1-joel@jms.id.au> 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.3 at phobos.denx.de X-Virus-Status: Clean When CONFIG_FIT_SIGNATURE=n the signing options are not available. If a user is careful they will notice this when looking at the help output. If they are not careful they will waste several hours wondering what they got wrong, as mkimage will silently ignore the signing related options. Make it obvious that the commands don't work by removing them from the getopt opt_string. The tool will now behave as follows: $ mkimage -f machine.its -k keys -K u-boot-pubkey.dtb -r image.fit mkimage: invalid option -- 'k' Error: Invalid option Signed-off-by: Joel Stanley --- tools/mkimage.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/mkimage.c b/tools/mkimage.c index e78608293e72..10a1b3dc8c18 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -142,6 +142,12 @@ static int add_content(int type, const char *fname) return 0; } +#ifdef CONFIG_FIT_SIGNATURE +#define OPT_STRING "a:A:b:B:c:C:d:D:e:Ef:Fk:i:K:ln:N:p:O:rR:qstT:vVx" +#else +#define OPT_STRING "a:A:b:C:d:D:e:f:i:ln:O:R:qstT:vVx" +#endif + static void process_args(int argc, char **argv) { char *ptr; @@ -149,8 +155,7 @@ static void process_args(int argc, char **argv) char *datafile = NULL; int opt; - while ((opt = getopt(argc, argv, - "a:A:b:B:c:C:d:D:e:Ef:Fk:i:K:ln:N:p:O:rR:qstT:vVx")) != -1) { + while ((opt = getopt(argc, argv, OPT_STRING)) != -1) { switch (opt) { case 'a': params.addr = strtoull(optarg, &ptr, 16);