Commit 089df18bfe9dd6e98f34807247ec77e0e1b5f7a2

Authored by Tom Rini
1 parent 0db7f6859f

lib: move hash CONFIG options to Kconfig

Commit 94e3c8c4fd7b ("crypto/fsl - Add progressive hashing support
using hardware acceleration.") created entries for CONFIG_SHA1,
CONFIG_SHA256, CONFIG_SHA_HW_ACCEL, and CONFIG_SHA_PROG_HW_ACCEL.
However, no defconfig has migrated to it.  Complete the move by first
adding additional logic to various Kconfig files to select this when
required and then use the moveconfig tool.  In many cases we can select
these because they are required to implement other drivers.  We also
correct how we include the various hashing algorithms in SPL.

This commit was generated as follows (after Kconfig additions):

[1] tools/moveconfig.py -y SHA1 SHA256 SHA_HW_ACCEL
[2] tools/moveconfig.py -y SHA_PROG_HW_ACCEL

Note:
We cannot move SHA_HW_ACCEL and SHA_PROG_HW_ACCEL simultaneously
because there is dependency between them.

Cc: Poonam Aggrwal <poonam.aggrwal@freescale.com>
Cc: Naveen Burmi <NaveenBurmi@freescale.com>
Cc: Po Liu <po.liu@freescale.com>
Cc: Shengzhou Liu <Shengzhou.Liu@freescale.com>
Cc: Priyanka Jain <Priyanka.Jain@freescale.com>
Cc: Shaohui Xie <Shaohui.Xie@freescale.com>
Cc: Chunhe Lan <Chunhe.Lan@freescale.com>
Cc: Chander Kashyap <k.chander@samsung.com>
Cc: Steve Rae <steve.rae@raedomain.com>
Cc: Dirk Eibach <eibach@gdsys.de>
Cc: Feng Li <feng.li_2@nxp.com>
Cc: Alison Wang <alison.wang@freescale.com>
Cc: Sumit Garg <sumit.garg@nxp.com>
Cc: Mingkai Hu <Mingkai.Hu@freescale.com>
Cc: York Sun <york.sun@nxp.com>
Cc: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Akshay Saraswat <akshay.s@samsung.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>

Showing 49 changed files with 31 additions and 66 deletions Side-by-side Diff

... ... @@ -145,6 +145,7 @@
145 145 config FIT
146 146 bool "Support Flattened Image Tree"
147 147 select MD5
  148 + select SHA1
148 149 help
149 150 This option allows you to boot the new uImage structure,
150 151 Flattened Image Tree. FIT is formally a FDT, which can include
... ... @@ -159,6 +160,7 @@
159 160  
160 161 config FIT_ENABLE_SHA256_SUPPORT
161 162 bool "Support SHA256 checksum of FIT image contents"
  163 + select SHA256
162 164 default y
163 165 help
164 166 Enable this to support SHA256 checksum of FIT image contents. A
... ... @@ -2756,19 +2756,6 @@
2756 2756 Enable the hash verify command (hash -v). This adds to code
2757 2757 size a little.
2758 2758  
2759   - CONFIG_SHA1 - This option enables support of hashing using SHA1
2760   - algorithm. The hash is calculated in software.
2761   - CONFIG_SHA256 - This option enables support of hashing using
2762   - SHA256 algorithm. The hash is calculated in software.
2763   - CONFIG_SHA_HW_ACCEL - This option enables hardware acceleration
2764   - for SHA1/SHA256 hashing.
2765   - This affects the 'hash' command and also the
2766   - hash_lookup_algo() function.
2767   - CONFIG_SHA_PROG_HW_ACCEL - This option enables
2768   - hardware-acceleration for SHA1/SHA256 progressive hashing.
2769   - Data can be streamed in a block at a time and the hashing
2770   - is performed in hardware.
2771   -
2772 2759 Note: There is also a sha1sum command, which should perhaps
2773 2760 be deprecated in favour of 'hash sha1'.
2774 2761  
arch/arm/include/asm/fsl_secure_boot.h
... ... @@ -10,8 +10,6 @@
10 10 #ifdef CONFIG_CHAIN_OF_TRUST
11 11 #define CONFIG_CMD_ESBC_VALIDATE
12 12 #define CONFIG_FSL_SEC_MON
13   -#define CONFIG_SHA_HW_ACCEL
14   -#define CONFIG_SHA_PROG_HW_ACCEL
15 13  
16 14 #ifdef CONFIG_SPL_BUILD
17 15 /*
arch/arm/mach-exynos/Kconfig
... ... @@ -17,6 +17,7 @@
17 17 bool "Exynos5 SoC family"
18 18 select CPU_V7
19 19 select BOARD_EARLY_INIT_F
  20 + select SHA_HW_ACCEL
20 21 help
21 22 Samsung Exynos5 SoC family are based on ARM Cortex-A15 CPU (and
22 23 Cortex-A7 CPU in big.LITTLE configuration). There are multiple SoCs
arch/powerpc/include/asm/fsl_secure_boot.h
... ... @@ -101,7 +101,6 @@
101 101  
102 102 #define CONFIG_CMD_ESBC_VALIDATE
103 103 #define CONFIG_FSL_SEC_MON
104   -#define CONFIG_SHA_PROG_HW_ACCEL
105 104  
106 105 #ifndef CONFIG_SPL_BUILD
107 106 /*
board/freescale/common/Kconfig
... ... @@ -3,6 +3,8 @@
3 3 imply CMD_BLOB
4 4 select FSL_CAAM
5 5 select SPL_BOARD_INIT if (ARM && SPL)
  6 + select SHA_HW_ACCEL
  7 + select SHA_PROG_HW_ACCEL
6 8 bool
7 9 default y
... ... @@ -187,6 +187,7 @@
187 187 config SPL_SHA1_SUPPORT
188 188 bool "Support SHA1"
189 189 depends on SPL_FIT
  190 + select SHA1
190 191 help
191 192 Enable this to support SHA1 in FIT images within SPL. A SHA1
192 193 checksum is a 160-bit (20-byte) hash value used to check that the
... ... @@ -198,6 +199,7 @@
198 199 config SPL_SHA256_SUPPORT
199 200 bool "Support SHA256"
200 201 depends on SPL_FIT
  202 + select SHA256
201 203 help
202 204 Enable this to support SHA256 in FIT images within SPL. A SHA256
203 205 checksum is a 256-bit (32-byte) hash value used to check that the
... ... @@ -229,6 +231,8 @@
229 231  
230 232 config SPL_HASH_SUPPORT
231 233 bool "Support hashing drivers"
  234 + select SHA1
  235 + select SHA256
232 236 depends on SPL
233 237 help
234 238 Enable hashing drivers in SPL. These drivers can be used to
configs/bcm911360_entphn-ns_defconfig
... ... @@ -18,5 +18,7 @@
18 18 CONFIG_CMD_FAT=y
19 19 # CONFIG_MMC is not set
20 20 CONFIG_SYS_NS16550=y
  21 +CONFIG_SHA1=y
  22 +CONFIG_SHA256=y
21 23 CONFIG_OF_LIBFDT=y
configs/bcm911360_entphn_defconfig
... ... @@ -18,5 +18,7 @@
18 18 CONFIG_CMD_FAT=y
19 19 # CONFIG_MMC is not set
20 20 CONFIG_SYS_NS16550=y
  21 +CONFIG_SHA1=y
  22 +CONFIG_SHA256=y
21 23 CONFIG_OF_LIBFDT=y
configs/bcm911360k_defconfig
... ... @@ -18,5 +18,7 @@
18 18 CONFIG_CMD_FAT=y
19 19 # CONFIG_MMC is not set
20 20 CONFIG_SYS_NS16550=y
  21 +CONFIG_SHA1=y
  22 +CONFIG_SHA256=y
21 23 CONFIG_OF_LIBFDT=y
configs/bcm958300k-ns_defconfig
... ... @@ -18,5 +18,7 @@
18 18 CONFIG_CMD_FAT=y
19 19 # CONFIG_MMC is not set
20 20 CONFIG_SYS_NS16550=y
  21 +CONFIG_SHA1=y
  22 +CONFIG_SHA256=y
21 23 CONFIG_OF_LIBFDT=y
configs/bcm958300k_defconfig
... ... @@ -18,5 +18,7 @@
18 18 CONFIG_CMD_FAT=y
19 19 # CONFIG_MMC is not set
20 20 CONFIG_SYS_NS16550=y
  21 +CONFIG_SHA1=y
  22 +CONFIG_SHA256=y
21 23 CONFIG_OF_LIBFDT=y
configs/bcm958305k_defconfig
... ... @@ -18,5 +18,7 @@
18 18 CONFIG_CMD_FAT=y
19 19 # CONFIG_MMC is not set
20 20 CONFIG_SYS_NS16550=y
  21 +CONFIG_SHA1=y
  22 +CONFIG_SHA256=y
21 23 CONFIG_OF_LIBFDT=y
configs/bcm958622hr_defconfig
... ... @@ -16,5 +16,7 @@
16 16 CONFIG_CMD_FAT=y
17 17 # CONFIG_MMC is not set
18 18 CONFIG_SYS_NS16550=y
  19 +CONFIG_SHA1=y
  20 +CONFIG_SHA256=y
19 21 CONFIG_OF_LIBFDT=y
configs/controlcenterd_TRAILBLAZER_DEVELOP_defconfig
... ... @@ -19,4 +19,5 @@
19 19 CONFIG_SYS_NS16550=y
20 20 CONFIG_TPM_AUTH_SESSIONS=y
21 21 CONFIG_TPM=y
  22 +CONFIG_SHA1=y
configs/controlcenterd_TRAILBLAZER_defconfig
... ... @@ -19,4 +19,5 @@
19 19 CONFIG_SYS_NS16550=y
20 20 CONFIG_TPM_AUTH_SESSIONS=y
21 21 CONFIG_TPM=y
  22 +CONFIG_SHA1=y
drivers/crypto/fsl/Kconfig
1 1 config FSL_CAAM
2 2 bool "Freescale Crypto Driver Support"
  3 + select SHA_HW_ACCEL
3 4 help
4 5 Enables the Freescale's Cryptographic Accelerator and Assurance
5 6 Module (CAAM), also known as the SEC version 4 (SEC4). The driver uses
include/configs/B4860QDS.h
... ... @@ -714,7 +714,6 @@
714 714 /* Hash command with SHA acceleration supported in hardware */
715 715 #ifdef CONFIG_FSL_CAAM
716 716 #define CONFIG_CMD_HASH
717   -#define CONFIG_SHA_HW_ACCEL
718 717 #endif
719 718  
720 719 /*
include/configs/BSC9131RDB.h
... ... @@ -331,7 +331,6 @@
331 331 /* Hash command with SHA acceleration supported in hardware */
332 332 #ifdef CONFIG_FSL_CAAM
333 333 #define CONFIG_CMD_HASH
334   -#define CONFIG_SHA_HW_ACCEL
335 334 #endif
336 335  
337 336 #ifdef CONFIG_USB_EHCI_HCD
include/configs/BSC9132QDS.h
... ... @@ -528,7 +528,6 @@
528 528 /* Hash command with SHA acceleration supported in hardware */
529 529 #ifdef CONFIG_FSL_CAAM
530 530 #define CONFIG_CMD_HASH
531   -#define CONFIG_SHA_HW_ACCEL
532 531 #endif
533 532  
534 533 /*
include/configs/C29XPCIE.h
... ... @@ -444,7 +444,6 @@
444 444 /* Hash command with SHA acceleration supported in hardware */
445 445 #ifdef CONFIG_FSL_CAAM
446 446 #define CONFIG_CMD_HASH
447   -#define CONFIG_SHA_HW_ACCEL
448 447 #endif
449 448  
450 449 /*
include/configs/P1010RDB.h
... ... @@ -738,7 +738,6 @@
738 738 /* Hash command with SHA acceleration supported in hardware */
739 739 #ifdef CONFIG_FSL_CAAM
740 740 #define CONFIG_CMD_HASH
741   -#define CONFIG_SHA_HW_ACCEL
742 741 #endif
743 742  
744 743 /*
include/configs/P2041RDB.h
... ... @@ -607,7 +607,6 @@
607 607 /* Hash command with SHA acceleration supported in hardware */
608 608 #ifdef CONFIG_FSL_CAAM
609 609 #define CONFIG_CMD_HASH
610   -#define CONFIG_SHA_HW_ACCEL
611 610 #endif
612 611  
613 612 /*
include/configs/T102xQDS.h
... ... @@ -868,7 +868,6 @@
868 868 /* Hash command with SHA acceleration supported in hardware */
869 869 #ifdef CONFIG_FSL_CAAM
870 870 #define CONFIG_CMD_HASH
871   -#define CONFIG_SHA_HW_ACCEL
872 871 #endif
873 872  
874 873 #include <asm/fsl_secure_boot.h>
include/configs/T102xRDB.h
... ... @@ -887,7 +887,6 @@
887 887 /* Hash command with SHA acceleration supported in hardware */
888 888 #ifdef CONFIG_FSL_CAAM
889 889 #define CONFIG_CMD_HASH
890   -#define CONFIG_SHA_HW_ACCEL
891 890 #endif
892 891  
893 892 #include <asm/fsl_secure_boot.h>
include/configs/T1040QDS.h
... ... @@ -671,7 +671,6 @@
671 671 /* Hash command with SHA acceleration supported in hardware */
672 672 #ifdef CONFIG_FSL_CAAM
673 673 #define CONFIG_CMD_HASH
674   -#define CONFIG_SHA_HW_ACCEL
675 674 #endif
676 675  
677 676 /*
include/configs/T104xRDB.h
... ... @@ -783,7 +783,6 @@
783 783 /* Hash command with SHA acceleration supported in hardware */
784 784 #ifdef CONFIG_FSL_CAAM
785 785 #define CONFIG_CMD_HASH
786   -#define CONFIG_SHA_HW_ACCEL
787 786 #endif
788 787  
789 788 /*
include/configs/T208xQDS.h
... ... @@ -755,7 +755,6 @@
755 755 /* Hash command with SHA acceleration supported in hardware */
756 756 #ifdef CONFIG_FSL_CAAM
757 757 #define CONFIG_CMD_HASH
758   -#define CONFIG_SHA_HW_ACCEL
759 758 #endif
760 759  
761 760 /*
include/configs/T208xRDB.h
... ... @@ -700,7 +700,6 @@
700 700 /* Hash command with SHA acceleration supported in hardware */
701 701 #ifdef CONFIG_FSL_CAAM
702 702 #define CONFIG_CMD_HASH
703   -#define CONFIG_SHA_HW_ACCEL
704 703 #endif
705 704  
706 705 /*
include/configs/T4240QDS.h
... ... @@ -501,7 +501,6 @@
501 501 /* Hash command with SHA acceleration supported in hardware */
502 502 #ifdef CONFIG_FSL_CAAM
503 503 #define CONFIG_CMD_HASH
504   -#define CONFIG_SHA_HW_ACCEL
505 504 #endif
506 505  
507 506 /*
include/configs/T4240RDB.h
... ... @@ -699,7 +699,6 @@
699 699 /* Hash command with SHA acceleration supported in hardware */
700 700 #ifdef CONFIG_FSL_CAAM
701 701 #define CONFIG_CMD_HASH
702   -#define CONFIG_SHA_HW_ACCEL
703 702 #endif
704 703  
705 704  
include/configs/bcm_ep_board.h
... ... @@ -69,8 +69,6 @@
69 69 /* SHA hashing */
70 70 #define CONFIG_CMD_HASH
71 71 #define CONFIG_HASH_VERIFY
72   -#define CONFIG_SHA1
73   -#define CONFIG_SHA256
74 72  
75 73 /* Enable Time Command */
76 74  
include/configs/controlcenterd.h
... ... @@ -199,8 +199,6 @@
199 199 #define CONFIG_SF_DEFAULT_MODE 0
200 200 #endif
201 201  
202   -#define CONFIG_SHA1
203   -
204 202 /*
205 203 * MMC
206 204 */
include/configs/corenet_ds.h
... ... @@ -621,7 +621,6 @@
621 621 /* Hash command with SHA acceleration supported in hardware */
622 622 #ifdef CONFIG_FSL_CAAM
623 623 #define CONFIG_CMD_HASH
624   -#define CONFIG_SHA_HW_ACCEL
625 624 #endif
626 625  
627 626 /*
include/configs/exynos5-common.h
... ... @@ -26,7 +26,6 @@
26 26  
27 27 /* Enable ACE acceleration for SHA1 and SHA256 */
28 28 #define CONFIG_EXYNOS_ACE_SHA
29   -#define CONFIG_SHA_HW_ACCEL
30 29  
31 30 /* Power Down Modes */
32 31 #define S5P_CHECK_SLEEP 0x00000BAD
... ... @@ -139,8 +138,6 @@
139 138 /* SHA hashing */
140 139 #define CONFIG_CMD_HASH
141 140 #define CONFIG_HASH_VERIFY
142   -#define CONFIG_SHA1
143   -#define CONFIG_SHA256
144 141  
145 142 /* Enable Time Command */
146 143  
include/configs/ids8313.h
... ... @@ -542,8 +542,6 @@
542 542  
543 543 #define CONFIG_IMAGE_FORMAT_LEGACY
544 544 #define CONFIG_CMD_HASH
545   -#define CONFIG_SHA1
546   -#define CONFIG_SHA256
547 545  
548 546 #endif /* __CONFIG_H */
include/configs/imx6qdl_icore.h
... ... @@ -126,8 +126,6 @@
126 126 /* FIT */
127 127 #ifdef CONFIG_FIT
128 128 # define CONFIG_HASH_VERIFY
129   -# define CONFIG_SHA1
130   -# define CONFIG_SHA256
131 129 # define CONFIG_IMAGE_FORMAT_LEGACY
132 130 #endif
133 131  
include/configs/imx6qdl_icore_rqs.h
... ... @@ -108,8 +108,6 @@
108 108 /* FIT */
109 109 #ifdef CONFIG_FIT
110 110 # define CONFIG_HASH_VERIFY
111   -# define CONFIG_SHA1
112   -# define CONFIG_SHA256
113 111 # define CONFIG_IMAGE_FORMAT_LEGACY
114 112 #endif
115 113  
include/configs/imx6ul_geam.h
... ... @@ -125,8 +125,6 @@
125 125 /* FIT */
126 126 #ifdef CONFIG_FIT
127 127 # define CONFIG_HASH_VERIFY
128   -# define CONFIG_SHA1
129   -# define CONFIG_SHA256
130 128 # define CONFIG_IMAGE_FORMAT_LEGACY
131 129 #endif
132 130  
include/configs/imx6ul_isiot.h
... ... @@ -125,8 +125,6 @@
125 125 /* FIT */
126 126 #ifdef CONFIG_FIT
127 127 # define CONFIG_HASH_VERIFY
128   -# define CONFIG_SHA1
129   -# define CONFIG_SHA256
130 128 # define CONFIG_IMAGE_FORMAT_LEGACY
131 129 #endif
132 130  
include/configs/ls1021aiot.h
... ... @@ -306,13 +306,8 @@
306 306 #define CONFIG_MISC_INIT_R
307 307  
308 308 /* Hash command with SHA acceleration supported in hardware */
309   -
310 309 #ifdef CONFIG_FSL_CAAM
311   -
312 310 #define CONFIG_CMD_HASH
313   -
314   -#define CONFIG_SHA_HW_ACCEL
315   -
316 311 #endif
317 312  
318 313 #include <asm/fsl_secure_boot.h>
include/configs/ls1021aqds.h
... ... @@ -573,7 +573,6 @@
573 573 /* Hash command with SHA acceleration supported in hardware */
574 574 #ifdef CONFIG_FSL_CAAM
575 575 #define CONFIG_CMD_HASH
576   -#define CONFIG_SHA_HW_ACCEL
577 576 #endif
578 577  
579 578 #include <asm/fsl_secure_boot.h>
include/configs/ls1021atwr.h
... ... @@ -437,7 +437,6 @@
437 437 /* Hash command with SHA acceleration supported in hardware */
438 438 #ifdef CONFIG_FSL_CAAM
439 439 #define CONFIG_CMD_HASH
440   -#define CONFIG_SHA_HW_ACCEL
441 440 #endif
442 441  
443 442 #include <asm/fsl_secure_boot.h>
include/configs/ls1043a_common.h
... ... @@ -304,7 +304,6 @@
304 304 /* Hash command with SHA acceleration supported in hardware */
305 305 #ifdef CONFIG_FSL_CAAM
306 306 #define CONFIG_CMD_HASH
307   -#define CONFIG_SHA_HW_ACCEL
308 307 #endif
309 308  
310 309 #endif /* __LS1043A_COMMON_H */
include/configs/ls1046a_common.h
... ... @@ -233,7 +233,6 @@
233 233 /* Hash command with SHA acceleration supported in hardware */
234 234 #ifdef CONFIG_FSL_CAAM
235 235 #define CONFIG_CMD_HASH
236   -#define CONFIG_SHA_HW_ACCEL
237 236 #endif
238 237  
239 238 #endif /* __LS1046A_COMMON_H */
include/configs/ls2080a_common.h
... ... @@ -233,7 +233,6 @@
233 233 /* Hash command with SHA acceleration supported in hardware */
234 234 #ifdef CONFIG_FSL_CAAM
235 235 #define CONFIG_CMD_HASH
236   -#define CONFIG_SHA_HW_ACCEL
237 236 #endif
238 237  
239 238 #endif /* __LS2_COMMON_H */
include/configs/sandbox.h
... ... @@ -104,8 +104,6 @@
104 104  
105 105 #define CONFIG_CMD_HASH
106 106 #define CONFIG_HASH_VERIFY
107   -#define CONFIG_SHA1
108   -#define CONFIG_SHA256
109 107  
110 108 #define CONFIG_CMD_SANDBOX
111 109  
... ... @@ -30,6 +30,8 @@
30 30 #define IMAGE_ENABLE_OF_LIBFDT 1
31 31 #define CONFIG_FIT_VERBOSE 1 /* enable fit_format_{error,warning}() */
32 32 #define CONFIG_FIT_ENABLE_SHA256_SUPPORT
  33 +#define CONFIG_SHA1
  34 +#define CONFIG_SHA256
33 35  
34 36 #define IMAGE_ENABLE_IGNORE 0
35 37 #define IMAGE_INDENT_STRING ""
... ... @@ -65,8 +67,6 @@
65 67 # endif
66 68 # else
67 69 # define CONFIG_CRC32 /* FIT images need CRC32 support */
68   -# define CONFIG_SHA1 /* and SHA1 */
69   -# define CONFIG_SHA256 /* and SHA256 */
70 70 # define IMAGE_ENABLE_CRC32 1
71 71 # define IMAGE_ENABLE_MD5 1
72 72 # define IMAGE_ENABLE_SHA1 1
... ... @@ -86,7 +86,6 @@
86 86  
87 87 #if defined(CONFIG_FIT_ENABLE_SHA256_SUPPORT) || \
88 88 defined(CONFIG_SPL_SHA256_SUPPORT)
89   -#define CONFIG_SHA256
90 89 #define IMAGE_ENABLE_SHA256 1
91 90 #else
92 91 #define IMAGE_ENABLE_SHA256 0
... ... @@ -44,9 +44,9 @@
44 44 obj-y += list_sort.o
45 45 endif
46 46  
47   -obj-$(CONFIG_$(SPL_)RSA) += rsa/
48   -obj-$(CONFIG_$(SPL_)SHA1) += sha1.o
49   -obj-$(CONFIG_$(SPL_)SHA256) += sha256.o
  47 +obj-$(CONFIG_RSA) += rsa/
  48 +obj-$(CONFIG_SHA1) += sha1.o
  49 +obj-$(CONFIG_SHA256) += sha256.o
50 50  
51 51 obj-$(CONFIG_SPL_SAVEENV) += qsort.o
52 52 obj-$(CONFIG_$(SPL_)OF_LIBFDT) += libfdt/