[2/3] lib: Allow MD5 to be enabled in SPL

Message ID 20200506140357.32050-2-sjg@chromium.org
State Accepted
Commit 8239be61bdeb228863734a890b02d10006360a65
Headers show
Series
  • [1/3] log: Allow LOG_DEBUG to always enable log output
Related show

Commit Message

Simon Glass May 6, 2020, 2:03 p.m.
At present the MD5 option cannot be enabled by board configs since it has
no Kconfig name. It is generally enabled, so long as FIT support is
present. But not all boards use FIT, particularly in SPL

Fix this and add an option for SPL as well. This allows board code to call
md5() even if FIT support is not enabled.

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

 lib/Kconfig  | 17 ++++++++++++++++-
 lib/Makefile |  2 +-
 2 files changed, 17 insertions(+), 2 deletions(-)

Comments

Tom Rini May 15, 2020, 8:53 p.m. | #1
On Wed, May 06, 2020 at 08:03:56AM -0600, Simon Glass wrote:

> At present the MD5 option cannot be enabled by board configs since it has
> no Kconfig name. It is generally enabled, so long as FIT support is
> present. But not all boards use FIT, particularly in SPL
> 
> Fix this and add an option for SPL as well. This allows board code to call
> md5() even if FIT support is not enabled.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>

Applied to u-boot/master, thanks!

Patch

diff --git a/lib/Kconfig b/lib/Kconfig
index 868de3bf3b..c3f694afc0 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -363,7 +363,22 @@  config SHA_PROG_HW_ACCEL
 	  is performed in hardware.
 
 config MD5
-	bool
+	bool "Support MD5 algorithm"
+	help
+	  This option enables MD5 support. MD5 is an algorithm designed
+	  in 1991 that produces a 16-byte digest (or checksum) from its input
+	  data. It has a number of vulnerabilities which preclude its use in
+	  security applications, but it can be useful for providing a quick
+	  checksum of a block of data.
+
+config SPL_MD5
+	bool "Support MD5 algorithm in SPL"
+	help
+	  This option enables MD5 support in SPL. MD5 is an algorithm designed
+	  in 1991 that produces a 16-byte digest (or checksum) from its input
+	  data. It has a number of vulnerabilities which preclude its use in
+	  security applications, but it can be useful for providing a quick
+	  checksum of a block of data.
 
 config CRC32C
 	bool
diff --git a/lib/Makefile b/lib/Makefile
index c6f862b0c2..6e688afa68 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -40,7 +40,6 @@  obj-$(CONFIG_GZIP_COMPRESSED) += gzip.o
 obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += smbios.o
 obj-$(CONFIG_IMAGE_SPARSE) += image-sparse.o
 obj-y += ldiv.o
-obj-$(CONFIG_MD5) += md5.o
 obj-$(CONFIG_XXHASH) += xxhash.o
 obj-y += net_utils.o
 obj-$(CONFIG_PHYSMEM) += physmem.o
@@ -59,6 +58,7 @@  obj-$(CONFIG_TPM_V2) += tpm-v2.o
 endif
 
 obj-$(CONFIG_$(SPL_)ACPIGEN) += acpi/
+obj-$(CONFIG_$(SPL_)MD5) += md5.o
 obj-$(CONFIG_$(SPL_)RSA) += rsa/
 obj-$(CONFIG_SHA1) += sha1.o
 obj-$(CONFIG_SHA256) += sha256.o