@@ -73,15 +73,20 @@ if BOOT_USE_PSA_CRYPTO
73
73
74
74
config BOOT_PSA_IMG_HASH_ALG_SHA256_DEPENDENCIES
75
75
bool
76
- default y if BOOT_IMG_HASH_ALG_SHA256
76
+ default y if BOOT_SOMETHING_USES_SHA256
77
77
select PSA_WANT_ALG_SHA_256
78
78
help
79
79
Dependencies for hashing with SHA256
80
80
81
- config BOOT_ED25519_PSA_DEPENDENCIES
81
+ config BOOT_PSA_IMG_HASH_ALG_SHA512_DEPENDENCIES
82
82
bool
83
- select PSA_WANT_ALG_SHA_256
83
+ default y if BOOT_SOMETHING_USES_SHA512
84
84
select PSA_WANT_ALG_SHA_512
85
+ help
86
+ Dependencies for hashing with SHA512
87
+
88
+ config BOOT_ED25519_PSA_DEPENDENCIES
89
+ bool
85
90
select PSA_WANT_ALG_PURE_EDDSA
86
91
select PSA_WANT_ECC_TWISTED_EDWARDS_255
87
92
select PSA_WANT_ECC_MONTGOMERY_255
@@ -131,6 +136,30 @@ config SINGLE_APPLICATION_SLOT
131
136
uploading a new application overwrites the one that previously
132
137
occupied the area.
133
138
139
+ config BOOT_SOMETHING_USES_SHA256
140
+ bool
141
+ help
142
+ Hidden option that should be selected when something requires
143
+ SHA256 implementation in any form. It should be used by crypto
144
+ backends to enable support for SHA256 in code and/or hardware
145
+ drivers.
146
+
147
+ config BOOT_SOMETHING_USES_SHA384
148
+ bool
149
+ help
150
+ Hidden option that should be selected when something requires
151
+ SHA384 implementation in any form. It should be used by crypto
152
+ backends to enable support for SHA384 in code and/or hardware
153
+ drivers.
154
+
155
+ config BOOT_SOMETHING_USES_SHA512
156
+ bool
157
+ help
158
+ Hidden option that should be selected when something requires
159
+ SHA512 implementation in any form. It should be used by crypto
160
+ backends to enable support for SHA512 in code and/or hardware
161
+ drivers.
162
+
134
163
config BOOT_IMG_HASH_ALG_SHA256_ALLOW
135
164
bool
136
165
help
@@ -176,18 +205,21 @@ choice BOOT_IMG_HASH_ALG
176
205
config BOOT_IMG_HASH_ALG_SHA256
177
206
bool "SHA256"
178
207
depends on BOOT_IMG_HASH_ALG_SHA256_ALLOW
208
+ select BOOT_SOMETHING_USES_SHA256
179
209
help
180
210
SHA256 algorithm
181
211
182
212
config BOOT_IMG_HASH_ALG_SHA384
183
213
bool "SHA384"
184
214
depends on BOOT_IMG_HASH_ALG_SHA384_ALLOW
215
+ select BOOT_SOMETHING_USES_SHA384
185
216
help
186
217
SHA384 algorithm
187
218
188
219
config BOOT_IMG_HASH_ALG_SHA512
189
220
bool "SHA512"
190
221
depends on BOOT_IMG_HASH_ALG_SHA512_ALLOW
222
+ select BOOT_SOMETHING_USES_SHA512
191
223
help
192
224
SHA512 algorithm
193
225
@@ -665,14 +697,34 @@ config BOOT_ENCRYPT_X25519
665
697
help
666
698
Hidden option selecting x25519 encryption.
667
699
700
+ if BOOT_ENCRYPT_X25519 && BOOT_USE_PSA_CRYPTO
701
+
702
+ choice BOOT_HMAC_SHA
703
+ prompt "SHA used for HMAC and HKDF in encryption key exchange"
704
+ default BOOT_HMAC_SHA256
705
+ help
706
+ HMAC/HKDF sha algorithm may be selected to synchronize sha
707
+ usage with other places in code and reduce compiled in
708
+ implementations.
709
+
710
+ config BOOT_HMAC_SHA256
711
+ bool "Use SHA256 for HMAC/HKDF"
712
+ select BOOT_SOMETHING_USES_SHA256
713
+ help
714
+ This is default for ED25519.
715
+
668
716
config BOOT_HMAC_SHA512
669
717
bool "Use SHA512 for HMAC/HKDF"
670
718
depends on BOOT_ENCRYPT_X25519
671
719
depends on BOOT_USE_PSA_CRYPTO
720
+ select BOOT_SOMETHING_USES_SHA512
672
721
help
673
- By default SHA256 is used for HKDF/HMAC in key exchange expansion
674
- and verification. This options switches to SHA512. The option is
675
- mainly useful to reduce numer of compiled in SHA algorithms.
722
+ With ED25519, this option is worth selecting when SHA512 is used
723
+ for hashing of an image to reduce number of compiled sha algorithms.
724
+
725
+ endchoice # BOOT_HMAC_SHA
726
+
727
+ endif # BOOT_ENCRYPT_X25519 && BOOT_USE_PSA_CRYPTO
676
728
677
729
config BOOT_ENCRYPTION_KEY_FILE
678
730
string "Encryption key file"
0 commit comments