From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Sat, 5 Jan 2013 09:10:44 +0100 Subject: [U-Boot] [RFC PATCH 12/44] image: Move hash checking into its own functions In-Reply-To: <1357350734-13737-13-git-send-email-sjg@chromium.org> References: <1357350734-13737-1-git-send-email-sjg@chromium.org> <1357350734-13737-13-git-send-email-sjg@chromium.org> Message-ID: <201301050910.45130.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Simon Glass, > The existing function is long and most of the code is indented a long > way. Before adding yet more code, split this out into its own function. > > Signed-off-by: Simon Glass > --- > common/image-fit.c | 128 > ++++++++++++++++++++++++++++------------------------ 1 files changed, 69 > insertions(+), 59 deletions(-) > > diff --git a/common/image-fit.c b/common/image-fit.c > index 7fab682..4a78a5c 100644 > --- a/common/image-fit.c > +++ b/common/image-fit.c > @@ -852,6 +852,60 @@ int calculate_hash(const void *data, int data_len, > const char *algo, return 0; > } > > +static int fit_image_check_hash(const void *fit, int noffset, const void > *data, + size_t size, char **err_msgp) > +{ > + uint8_t value[FIT_MAX_HASH_LEN]; > + int value_len; > + char *algo; > + uint8_t *fit_value; > + int fit_value_len; > +#ifndef USE_HOSTCC > + int ignore; > +#endif You can fix this with __maybe_unused, but otherwise Reviewed-by: Marek Vasut Best regards, Marek Vasut