Commit 01d3aee8 authored by Hans de Goede's avatar Hans de Goede Committed by Herbert Xu
Browse files

crypto: sha256 - Make lib/crypto/sha256.c suitable for generic use



Before this commit lib/crypto/sha256.c has only been used in the s390 and
x86 purgatory code, make it suitable for generic use:

* Export interesting symbols
* Add  -D__DISABLE_EXPORTS to CFLAGS_sha256.o for purgatory builds to
  avoid the exports for the purgatory builds
* Add to lib/crypto/Makefile and crypto/Kconfig

Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 906a4bb9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -10,6 +10,8 @@ PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y))
$(obj)/sha256.o: $(srctree)/lib/crypto/sha256.c FORCE
	$(call if_changed_rule,cc_o_c)

CFLAGS_sha256.o := -D__DISABLE_EXPORTS

$(obj)/mem.o: $(srctree)/arch/s390/lib/mem.S FORCE
	$(call if_changed_rule,as_o_S)

+2 −0
Original line number Diff line number Diff line
@@ -9,6 +9,8 @@ PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y))
$(obj)/sha256.o: $(srctree)/lib/crypto/sha256.c FORCE
	$(call if_changed_rule,cc_o_c)

CFLAGS_sha256.o := -D__DISABLE_EXPORTS

LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostdlib -z nodefaultlib
targets += purgatory.ro

+3 −0
Original line number Diff line number Diff line
@@ -849,6 +849,9 @@ config CRYPTO_SHA1_PPC_SPE
	  SHA-1 secure hash standard (DFIPS 180-4) implemented
	  using powerpc SPE SIMD instruction set.

config CRYPTO_LIB_SHA256
	tristate

config CRYPTO_SHA256
	tristate "SHA224 and SHA256 digest algorithm"
	select CRYPTO_HASH
+3 −2
Original line number Diff line number Diff line
@@ -14,8 +14,9 @@
/*
 * Stand-alone implementation of the SHA256 algorithm. It is designed to
 * have as little dependencies as possible so it can be used in the
 * kexec_file purgatory. In other cases you should use the implementation in
 * crypto/.
 * kexec_file purgatory. In other cases you should generally use the
 * hash APIs from include/crypto/hash.h. Especially when hashing large
 * amounts of data as those APIs may be hw-accelerated.
 *
 * For details see lib/crypto/sha256.c
 */
+3 −0
Original line number Diff line number Diff line
@@ -8,3 +8,6 @@ libarc4-y := arc4.o

obj-$(CONFIG_CRYPTO_LIB_DES) += libdes.o
libdes-y := des.o

obj-$(CONFIG_CRYPTO_LIB_SHA256) += libsha256.o
libsha256-y := sha256.o
Loading