diff mbox series

[2/3] image-cipher: Fix FIT_CIPHER linking

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

Commit Message

Joel Stanley Nov. 11, 2020, 11:18 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 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 <joel@jms.id.au>

---
 common/image-cipher.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

-- 
2.28.0

Comments

Philippe REYNES Dec. 7, 2020, 5:06 p.m. UTC | #1
Hi Joel,

sorry for this very late answer ..


This patch fix this issue when only the ciphering is enabled.
But it breaks the compilation when signature and ciphering are
enabled, because both functions image_set_host_blob and
image_get_host_blob are defined twice.
So it is a NAK for me.

A simple way to fix it to move this block of code from image-fit-sig.c 
to iamge-fit.c

Regards,
Philippe


Le 11/11/2020 à 12:18, 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 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 <joel@jms.id.au>

> ---

>   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 <uboot_aes.h>

>   #include <u-boot/aes.h>

>   

> +#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",
Joel Stanley Dec. 8, 2020, 3:24 a.m. UTC | #2
On Mon, 7 Dec 2020 at 17:07, Philippe REYNES
<philippe.reynes@softathome.com> wrote:
>

> Hi Joel,

>

> sorry for this very late answer ..

>

>

> This patch fix this issue when only the ciphering is enabled.

> But it breaks the compilation when signature and ciphering are

> enabled, because both functions image_set_host_blob and

> image_get_host_blob are defined twice.

> So it is a NAK for me.

>

> A simple way to fix it to move this block of code from image-fit-sig.c

> to iamge-fit.c


Agreed, that is a better idea.

I'll send a v2.

>

> Regards,

> Philippe

>

>

> Le 11/11/2020 à 12:18, 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 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 <joel@jms.id.au>

> > ---

> >   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 <uboot_aes.h>

> >   #include <u-boot/aes.h>

> >

> > +#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",
diff mbox series

Patch

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 <uboot_aes.h>
 #include <u-boot/aes.h>
 
+#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",