@@ -70,15 +70,20 @@ if BOOT_USE_PSA_CRYPTO
70
70
71
71
config BOOT_PSA_IMG_HASH_ALG_SHA256_DEPENDENCIES
72
72
bool
73
- default y if BOOT_IMG_HASH_ALG_SHA256
73
+ default y if BOOT_SOMETHING_USES_SHA256
74
74
select PSA_WANT_ALG_SHA_256
75
75
help
76
76
Dependencies for hashing with SHA256
77
77
78
- config BOOT_ED25519_PSA_DEPENDENCIES
78
+ config BOOT_PSA_IMG_HASH_ALG_SHA512_DEPENDENCIES
79
79
bool
80
- select PSA_WANT_ALG_SHA_256
80
+ default y if BOOT_SOMETHING_USES_SHA512
81
81
select PSA_WANT_ALG_SHA_512
82
+ help
83
+ Dependencies for hashing with SHA512
84
+
85
+ config BOOT_ED25519_PSA_DEPENDENCIES
86
+ bool
82
87
select PSA_WANT_ALG_PURE_EDDSA
83
88
# Seems that upstream mbedTLS does not have TE
84
89
#select PSA_WANT_ECC_TWISTED_EDWARDS_255
@@ -129,6 +134,30 @@ config SINGLE_APPLICATION_SLOT
129
134
uploading a new application overwrites the one that previously
130
135
occupied the area.
131
136
137
+ config BOOT_SOMETHING_USES_SHA256
138
+ bool
139
+ help
140
+ Hidden option that should be selected when something requires
141
+ SHA256 implementation in any form. It should be used by crypto
142
+ backends to enable support for SHA256 in code and/or hardware
143
+ drivers.
144
+
145
+ config BOOT_SOMETHING_USES_SHA384
146
+ bool
147
+ help
148
+ Hidden option that should be selected when something requires
149
+ SHA384 implementation in any form. It should be used by crypto
150
+ backends to enable support for SHA384 in code and/or hardware
151
+ drivers.
152
+
153
+ config BOOT_SOMETHING_USES_SHA512
154
+ bool
155
+ help
156
+ Hidden option that should be selected when something requires
157
+ SHA512 implementation in any form. It should be used by crypto
158
+ backends to enable support for SHA512 in code and/or hardware
159
+ drivers.
160
+
132
161
config BOOT_IMG_HASH_ALG_SHA256_ALLOW
133
162
bool
134
163
help
@@ -173,18 +202,21 @@ choice BOOT_IMG_HASH_ALG
173
202
config BOOT_IMG_HASH_ALG_SHA256
174
203
bool "SHA256"
175
204
depends on BOOT_IMG_HASH_ALG_SHA256_ALLOW
205
+ select BOOT_SOMETHING_USES_SHA256
176
206
help
177
207
SHA256 algorithm
178
208
179
209
config BOOT_IMG_HASH_ALG_SHA384
180
210
bool "SHA384"
181
211
depends on BOOT_IMG_HASH_ALG_SHA384_ALLOW
212
+ select BOOT_SOMETHING_USES_SHA384
182
213
help
183
214
SHA384 algorithm
184
215
185
216
config BOOT_IMG_HASH_ALG_SHA512
186
217
bool "SHA512"
187
218
depends on BOOT_IMG_HASH_ALG_SHA512_ALLOW
219
+ select BOOT_SOMETHING_USES_SHA512
188
220
help
189
221
SHA512 algorithm
190
222
@@ -628,14 +660,34 @@ config BOOT_ENCRYPT_X25519
628
660
help
629
661
Hidden option selecting x25519 encryption.
630
662
663
+ if BOOT_ENCRYPT_X25519 && BOOT_USE_PSA_CRYPTO
664
+
665
+ choice BOOT_HMAC_SHA
666
+ prompt "SHA used for HMAC and HKDF in encryption key exchange"
667
+ default BOOT_HMAC_SHA256
668
+ help
669
+ HMAC/HKDF sha algorithm may be selected to synchronize sha
670
+ usage with other places in code and reduce compiled in
671
+ implementations.
672
+
673
+ config BOOT_HMAC_SHA256
674
+ bool "Use SHA256 for HMAC/HKDF"
675
+ select BOOT_SOMETHING_USES_SHA256
676
+ help
677
+ This is default for ED25519.
678
+
631
679
config BOOT_HMAC_SHA512
632
680
bool "Use SHA512 for HMAC/HKDF"
633
681
depends on BOOT_ENCRYPT_X25519
634
682
depends on BOOT_USE_PSA_CRYPTO
683
+ select BOOT_SOMETHING_USES_SHA512
635
684
help
636
- By default SHA256 is used for HKDF/HMAC in key exchange expansion
637
- and verification. This options switches to SHA512. The option is
638
- mainly useful to reduce numer of compiled in SHA algorithms.
685
+ With ED25519, this option is worth selecting when SHA512 is used
686
+ for hashing of an image to reduce number of compiled sha algorithms.
687
+
688
+ endchoice # BOOT_HMAC_SHA
689
+
690
+ endif # BOOT_ENCRYPT_X25519 && BOOT_USE_PSA_CRYPTO
639
691
640
692
config BOOT_ENCRYPTION_KEY_FILE
641
693
string "Encryption key file"
0 commit comments