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: 322919 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp299893ils; Wed, 11 Nov 2020 03:19:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwI0Tlq0pGhYlYMQt8t6xp+oHeMnxmBT0qGXDI39qe6aYeDv6/a7TX3hKrtNe3kZlL9/Oj4 X-Received: by 2002:a17:906:3e91:: with SMTP id a17mr24261272ejj.82.1605093560141; Wed, 11 Nov 2020 03:19:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605093560; cv=none; d=google.com; s=arc-20160816; b=PP7YPvQL0jvb0sjlpdZXMbr9f2unmc4BBFw9BBoynl04KUOKB7dpRrxRnoQ2nBPsF6 XIG1z0pdMBzLu4unD2xhu6s5iUS7OTsGyPA9hFb6UHhsPYjgAKuUKMREDzeH0md8lD4w MzErVFfVUtTWc8nQm+vo1qJx1kdVGDsVfZjA0jy64xDRkXzFC2YC+/XUSpz6V8LMVAYi mmsCOh49BInAa7LgPaU/C1VwoSXRgjGTTuf97Z/zn3yGf3ZO3xkcYWoG0aIe0TJlp5nr i0PT3s1MF6b1mZ0pl9NLUQE32FZxw0h7p55WXpB5qTN9jXZCdnwEZGN6kP14LA+oJGt4 hlsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FX1BkwrA+lvxKaBBN5lK1E6AFRT4+HWtrgVxTNcpkAg=; b=NPruLTohDsuKyNNYDQKbMtcjqcQ4QalPDOY+XK5AyqlQC8OLc20WS1LLC3PjGotyKR PFCr2OKHYr9UknTTVU3+BPCxDuYvd5VjoYRsAnUENgSTG9kj/I81GNmH4ytuPXR4QkYJ TImCJysMzwm6BEqH7MSWHjflhpR/PuSGf0heOuqNYpSJqvFXTsZR13g1rz2Y2CFdv0bK Hq9XrXrjCTzLfCR6IxqIyg2NJFFbHPrZQ11PSMJo6EvZagB4f4Kie7RsY6SB2akrruSR 5TpL7FmcB4lNzgw7DTqLFs11gD/IgYEEj3OFFzU8SnOu1IbUkahEDx6oxx3BfuvAs5Fy tF9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=QdNk8Bu7; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id r2si1052967ejb.548.2020.11.11.03.19.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 03:19:20 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=QdNk8Bu7; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de 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-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 --- tools/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.28.0 Reviewed-by: Philippe Reynes 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: 322920 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp300010ils; Wed, 11 Nov 2020 03:19:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdvjcGv+hqZc2emkuue6Z0wy1NnNVsvtB9kGlI0o5QPE8k7B5RtTP69LXvGx8o++3chOzc X-Received: by 2002:a17:906:1246:: with SMTP id u6mr24373118eja.432.1605093570392; Wed, 11 Nov 2020 03:19:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605093570; cv=none; d=google.com; s=arc-20160816; b=an2KuQesAMmltoPPyo3lSRWe+X1ezqtlH5KNOWyMlc493gBvWGMSPxF5cApxtLBNN7 eEulGujYy46ijv4ecxkTOGVzl8PH+awf7rnKvA9ct5ZByt1aH40Tju7u94TcDcJL/oQf LjpHHxUHk1HV5jaTzHYOwwPyAqrpyaqX97CtNYB/HP+pPJ2o5muaF91NUGMSq1zlT2A7 PJc2zIIChBKLTUi4ZGl2oJCTeYdBwYxVsahsK6czDR+irGg+Ll+fODyZWxj1bkTyL2ue hiloO4I/nfAwvoqqOe1OvxzQhbUb7Kxo9isMOIb3Gi167iYvhM7IEvoMHckD5ydLKSel krJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G/9GNE7VhoOhJkbaayefee2E6NX3aN3JN1WJFb0cf8U=; b=CWeDpcGRgG1O/TjUwQE3irsLD7KIJt+Rf5Pn85GsVNftobF3qENogc/1KxsCgxVVIa OIeiFxa0QMSi96feTAi9wJQ7m/ADZxxOpIzlY8e8Xksie7+8l8OHRyZfmIGjpa1ZnhW8 GyBVLF0aZEBCjOZDnM8gTCMsRKV0az9Kzjakp9FIJkbS74FqhXtDF5fpn+aPh3z7CA1D vmc8K46kq9QK7jlbMTMDVj5Pe1ePzciOxLFWqOpUWOfTHA1776eWVOI61l+luV66PUuU k1Mz8MLNyEvYy36+dDnUp2AAumK2/fTxBmvLblnfz0Ri3GwxPyzDFlQGS8PRvYVq7Zte LMsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=DRSUzeNf; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id m30si1229299edj.103.2020.11.11.03.19.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 03:19:30 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=DRSUzeNf; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de 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-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(+) -- 2.28.0 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: 322921 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp300119ils; Wed, 11 Nov 2020 03:19:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+CinGW2LK3Wt13f1tQNNvxppfVQTEVHtZReR4IDsFpfasNcpKkHiLIz94D7nH5B5Rrpvl X-Received: by 2002:a17:906:284b:: with SMTP id s11mr25754136ejc.326.1605093580971; Wed, 11 Nov 2020 03:19:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605093580; cv=none; d=google.com; s=arc-20160816; b=gWFPpXTrazs2ljWymF4jsjEZ6EV0htRfAXqUcXW3cjkkbLHfwfLUtfKcB6vRRwWKSa E7bct0yx5pp+yR2qUZIf7cuIqTBeYspMmIx+NOUK8X3YLzlnzGKJtsscqLBWwVSNaCYC iECu4KwqFQ5lIYwu5kbjd4Wwvj3rcwtsPRaUBCv+3qoj3KQL/+U4RwYZJnW8kz3Ac/Vl 8cvtw73oehCGalYNHVn2uIzkKlce7LrJZY6b6ZK14tGZYMezFCL4Mjj/jiSHdrdOWfID YoF926tE/ySPWdl1ohk01DC9bvGdGXIZr/0MS0WMCU5JSVPYYAJlS+coAiCWjydxkOZ6 jiZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HKopjynCciycEsmJEZnP6LywxeVLtwH3Nx1mNOKEvFQ=; b=aIyWIQIigy1iLm4E6R3ZjD5tdhvWD2FJ+eJLKITIWokLs/7+CSbtjRq+/UeUl1ZokJ ytdpE7+a0jS/IUkJkdgJ9T4BZ1CRw5TcWcNFMKQNS/d+uAyVkoCI8tFDFct3f/ZpWTiF ltfLmPcB20Tf7YbYpASbZQkUrVdWAAVFrqiu8mx0AHTAaRCDeZ45yZfFDcEXBRC20eK6 tdKYU83rHrao4JERFIQz2IzXD0jaRbmo9Iu70K+OOlkgKpSnBPCW3dlhWAgotVuW5QBo mgQCkY5xsq/fQ+ngpQHkdzpDfUThtQw24vZd1ejejR9Pt60AkvgkesAdiTozZMCLcE/7 EB0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=mApM7p2v; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id e16si1150095ejz.457.2020.11.11.03.19.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 03:19:40 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=mApM7p2v; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de 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-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(-) -- 2.28.0 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);