
-----Original Message----- From: Tom Rini [mailto:trini@konsulko.com] Sent: Tuesday, August 15, 2017 2:08 AM To: u-boot@lists.denx.de Cc: Simon Glass sjg@chromium.org; Sumit Garg sumit.garg@nxp.com Subject: [PATCH v2] hash: Compile only hardware or software versions of SHA algorithms
Commit 089df18bfe9d ("lib: move hash CONFIG options to Kconfig") moved CONFIG_SHA1, CONFIG_SHA256, CONFIG_SHA_HW_ACCEL, and CONFIG_SHA_PROG_HW_ACCEL config options to Kconfig. So in the case of SPL, CONFIG_SPL_HASH_SUPPORT enables CONFIG_SHA1 and CONFIG_SHA256 which enables SHA SW library by default. But in the case of platforms with SHA HW library support, SHA SW library becomes redundant and increases size of SPL by approx 18K. Rework the code so that we have named members and only have either software or hardware versions of the algorithm, depending on the relevant config options. Update the comment around hash_algo to reflect this as well.
Reported-by: Sumit Garg sumit.garg@nxp.com Cc: Sumit Garg sumit.garg@nxp.com Signed-off-by: Tom Rini trini@konsulko.com
Changes in v2:
- Rework to switch the struct to use named members, and have only one instance of sha1 and sha256. Re-order chunk_size in the listing so it's not in between #ifdefs.
- Take author since the patch is almost entirely different. Sumit, if you feel this is unfair, please feel free to speak-up and I'll re-post with you as Author. Your commit message was quite good, so I've reused that almost entirely.
common/hash.c | 95 +++++++++++++++++++++++++++---------------------------
1 file changed, 44 insertions(+), 51 deletions(-)
With this patch code looks much cleaner. No issues from my side with you as Author. Reviewed-by: Sumit Garg sumit.garg@nxp.com
Sumit