From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Wed, 19 May 2021 10:36:29 -0600 Subject: [PATCH 09/18] common: Move host-only logic in image-sig.c to separate file In-Reply-To: <68799556-56f3-4f12-93b8-1c00a96de49d@gmail.com> References: <20210517163840.839097-1-mr.nuke.me@gmail.com> <20210517163840.839097-10-mr.nuke.me@gmail.com> <68799556-56f3-4f12-93b8-1c00a96de49d@gmail.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Mon, 17 May 2021 at 13:47, Alex G. 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 > > --- > > 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