From patchwork Tue Dec 8 04:12:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 1412404 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=tHezSYx0; 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 4CqmxV29qWz9sW0 for ; Tue, 8 Dec 2020 15:13:02 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1AC2082309; Tue, 8 Dec 2020 05:12:41 +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="tHezSYx0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D0013823ED; Tue, 8 Dec 2020 05:12:39 +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.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_SBL_CSS,SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.2 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) (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 52AE7806C5 for ; Tue, 8 Dec 2020 05:12:37 +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-x542.google.com with SMTP id q3so11036135pgr.3 for ; Mon, 07 Dec 2020 20:12:37 -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=3Jv0/cq8aEhlDcAadjWr//5EprvpJXz6eG0e+ZJBnLQ=; b=tHezSYx0uHkAmGAeft7O+Fjq8vlc0C3j6Q7Il9a+1Ozoq95AiuewSv/AN5No1UUZ28 qAhvxr3gSUi/mrxTxQTsHKILyWu00toZGqaNBiX2whtty0mlXwp6bEuxTDy9CmJd6dRs I4lljyVkFyMdPOBAvTmFH4wAfwmTT2uwT1uD1kwaj8cQXsPkUahc/b21fadKcVoDJo1I MvTmIFTgxBK3p/iRBOgml6dkcJT9yWOJ4KnoJlxwfzR3d4sDZyX+Twip4jPt1SC1Y6Nh k0uQyJT2SpUalhc8Es6PhBB+8UcyI8goZHJUrrtcuTGzZ+SO9Kz22MbdUgzTzHptydLq MfVA== 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=3Jv0/cq8aEhlDcAadjWr//5EprvpJXz6eG0e+ZJBnLQ=; b=tkRQqVd1FiZHMFPs2CK14tWqA5/Z06ODLQNIKAf4B9OeN113reqcAuMU1R4FSyYoPP eB2GPfaJYQzJhTyTmCuvfIBkgf4bxJS5LXfS8/OLXKlHujjz5rWG1wkcI7Ck41cgxikB /kLn2rE9YcX8c4GlP5lyD8EgNHy5gFllikk8DeBWT4uHWaPMQok8U5xH9dmqimtWANoJ Ym79PuysKjSaErbwL0Dsr3JvUOkgqK/l+OnigfnKwAAhxH4rHryBeC1xZwLDFvs8pJt6 3WhhizS4rod6dXnE7T+frq8SFlSPEcZ0lAj1FDEE28C1kqf2josyNbkqZ5UBtuPSOWd0 wPbA== X-Gm-Message-State: AOAM531GrlWiW3pMLWVkBwy+4HZKr05ixI90Whenrdo3SHpa6Z6LHVEx RCJJ7QI6ZA7M5XqrfgkNy1o= X-Google-Smtp-Source: ABdhPJwrUpG/EMIwLPg5dkO3qsyCf2A0kFEgp6IOqkCkHq7WRhdMQuZmQi23AZKhACTQ2C5718hKLw== X-Received: by 2002:a63:4041:: with SMTP id n62mr21233474pga.299.1607400755809; Mon, 07 Dec 2020 20:12:35 -0800 (PST) Received: from localhost.localdomain ([45.124.203.14]) by smtp.gmail.com with ESMTPSA id j20sm6055162pfd.106.2020.12.07.20.12.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Dec 2020 20:12:34 -0800 (PST) From: Joel Stanley To: Simon Glass , Heinrich Schuchardt , Philippe REYNES Cc: u-boot@lists.denx.de Subject: [PATCH v2 2/4] image-fit: Fix FIT_CIPHER linking Date: Tue, 8 Dec 2020 14:42:14 +1030 Message-Id: <20201208041216.888902-3-joel@jms.id.au> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201208041216.888902-1-joel@jms.id.au> References: <20201208041216.888902-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/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' Move the implementation to a common file so it can be shaed between image-cipher.c and image-fit-sig.c. Signed-off-by: Joel Stanley --- v2: Fix compilation when signature and ciphering are both enabled --- common/image-fit-sig.c | 14 -------------- common/image-fit.c | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/common/image-fit-sig.c b/common/image-fit-sig.c index 5401d9411b98..d39741e9058f 100644 --- a/common/image-fit-sig.c +++ b/common/image-fit-sig.c @@ -19,20 +19,6 @@ DECLARE_GLOBAL_DATA_PTR; #define IMAGE_MAX_HASHED_NODES 100 -#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 - /** * fit_region_make_list() - Make a list of image regions * diff --git a/common/image-fit.c b/common/image-fit.c index c82d4d8015f0..664a0d00006c 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -112,6 +112,21 @@ int fit_parse_subimage(const char *spec, ulong addr_curr, } #endif /* !USE_HOSTCC */ +#ifdef USE_HOSTCC +/* Host tools use these implementations for Cipher and Signature support */ +static void *host_blob; + +void image_set_host_blob(void *blob) +{ + host_blob = blob; +} + +void *image_get_host_blob(void) +{ + return host_blob; +} +#endif /* USE_HOSTCC */ + static void fit_get_debug(const void *fit, int noffset, char *prop_name, int err) {