diff mbox series

[v2,2/4] image-fit: Fix FIT_CIPHER linking

Message ID 20201208041216.888902-3-joel@jms.id.au
State New
Headers show
Series mkimage usability fixes | expand

Commit Message

Joel Stanley Dec. 8, 2020, 4:12 a.m. UTC
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 <joel@jms.id.au>

---
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(-)

-- 
2.29.2

Comments

Philippe REYNES Dec. 8, 2020, 3:26 p.m. UTC | #1
Hi Joel


Le 08/12/2020 à 05:12, Joel Stanley a écrit :
> 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 <joel@jms.id.au>

     Reviewed-by: Philippe Reynes <philippe.reynes@softathome.com>

> ---

> 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)

>   {

Regards,
Philippe
Tom Rini Jan. 23, 2021, 5:46 p.m. UTC | #2
On Tue, Dec 08, 2020 at 02:42:14PM +1030, Joel Stanley wrote:

> 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 <joel@jms.id.au>


Applied to u-boot/master, thanks!

-- 
Tom
diff mbox series

Patch

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)
 {