[PATCH 09/18] common: Move host-only logic in image-sig.c to separate file

Simon Glass sjg at chromium.org
Wed May 19 18:36:29 CEST 2021


On Mon, 17 May 2021 at 13:47, Alex G. <mr.nuke.me at gmail.com> wrote:
>
>
>
> On 5/17/21 11:38 AM, Alexandru Gagniuc wrote:
> > image-sig.c is used to map a hash or crypto algorithm name to a
> > handler of that algorithm. There is some similarity between the host
> > and target variants, with the differences worked out by #ifdefs. The
> > purpose of this change is to remove those ifdefs.
> >
> > First, copy the file to a host-only version, and remove target
> > specific code. Although it looks like we are duplicating code,
> > subsequent patches will change the way target algorithms are searched.
> > Besides we are only duplicating three string to struct mapping
> > functions. This isn't something to fuss about.
> >
> > Signed-off-by: Alexandru Gagniuc <mr.nuke.me at gmail.com>
> > ---
> >   tools/Makefile         |   5 +-
> >   tools/image-sig-host.c | 133 +++++++++++++++++++++++++++++++++++++++++
> >   2 files changed, 136 insertions(+), 2 deletions(-)
> >   create mode 100644 tools/image-sig-host.c
> >
> > diff --git a/tools/Makefile b/tools/Makefile
> > index d020c55d66..e39006b6f6 100644
> > --- a/tools/Makefile
> > +++ b/tools/Makefile
> > @@ -57,8 +57,9 @@ hostprogs-$(CONFIG_FIT_SIGNATURE) += fit_info fit_check_sign
> >
> >   hostprogs-$(CONFIG_CMD_BOOTEFI_SELFTEST) += file2include
> >
> > -FIT_OBJS-$(CONFIG_FIT) := fit_common.o fit_image.o image-host.o common/image-fit.o
> > -FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := common/image-sig.o common/image-fit-sig.o
> > +FIT_OBJS-$(CONFIG_FIT) := image-sig-host.o fit_common.o fit_image.o \
> > +                     image-host.o common/image-fit.o
> > +FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := common/image-fit-sig.o
> >   FIT_CIPHER_OBJS-$(CONFIG_FIT_CIPHER) := common/image-cipher.o
>
> This may cause a build failure with FIT_SIGNATURE disabled. I will have
> this fixed in v2. The correction is trivial.

I see a build warning for an unused variable 'i', if that is what you mean.

>
> Correct diff below for reference:
>
>   FIT_OBJS-$(CONFIG_FIT) := fit_common.o fit_image.o image-host.o
> common/image-fit.o
> -FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := common/image-sig.o
> common/image-fit-sig.o
> +FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := image-sig-host.o
> common/image-fit-sig.o
>

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list