summaryrefslogtreecommitdiff
path: root/lib/mbedtls/Kconfig
blob: 789721ee6cde0ad4849fef376d6a9ad00ef8a1dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
# For U-Boot Proper

choice
	prompt "Crypto libraries (U-Boot Proper)"
	default LEGACY_HASHING_AND_CRYPTO
	help
	  Select crypto libraries.
	  LEGACY_HASHING_AND_CRYPTO for legacy crypto libraries,
	  MBEDTLS_LIB for MbedTLS libraries.

config LEGACY_HASHING_AND_CRYPTO
	bool "legacy crypto libraries"
	select LEGACY_HASHING
	select LEGACY_CRYPTO

config MBEDTLS_LIB
	bool "MbedTLS libraries"
	select MBEDTLS_LIB_X509
endchoice

if LEGACY_HASHING_AND_CRYPTO || MBEDTLS_LIB_HASHING_ALT

config LEGACY_HASHING
	bool "Use U-Boot legacy hashing libraries"
	select MD5_LEGACY if MD5
	select SHA1_LEGACY if SHA1
	select SHA256_LEGACY if SHA256
	select SHA512_LEGACY if SHA512
	select SHA384_LEGACY if SHA384
	help
	  Enable U-Boot legacy hashing libraries.

if LEGACY_HASHING

config SHA1_LEGACY
	bool "Enable SHA1 support with legacy crypto library"
	depends on LEGACY_HASHING && SHA1
	help
	  This option enables support of hashing using SHA1 algorithm
	  with legacy crypto library.

config SHA256_LEGACY
	bool "Enable SHA256 support with legacy crypto library"
	depends on LEGACY_HASHING && SHA256
	help
	  This option enables support of hashing using SHA256 algorithm
	  with legacy crypto library.

config SHA512_LEGACY
	bool "Enable SHA512 support with legacy crypto library"
	depends on LEGACY_HASHING && SHA512
	default y if TI_SECURE_DEVICE && FIT_SIGNATURE
	help
	  This option enables support of hashing using SHA512 algorithm
	  with legacy crypto library.

config SHA384_LEGACY
	bool "Enable SHA384 support with legacy crypto library"
	depends on LEGACY_HASHING && SHA384
	select SHA512_LEGACY
	help
	  This option enables support of hashing using SHA384 algorithm
	  with legacy crypto library.

config MD5_LEGACY
	bool "Enable MD5 support with legacy crypto library"
	depends on LEGACY_HASHING && MD5
	help
	  This option enables support of hashing using MD5 algorithm
	  with legacy crypto library.

endif # LEGACY_HASHING

config LEGACY_CRYPTO
	bool "legacy certificate libraries"
	depends on LEGACY_HASHING_AND_CRYPTO
	select ASN1_DECODER_LEGACY if ASN1_DECODER
	select ASYMMETRIC_PUBLIC_KEY_LEGACY if \
		ASYMMETRIC_PUBLIC_KEY_SUBTYPE
	select RSA_PUBLIC_KEY_PARSER_LEGACY if RSA_PUBLIC_KEY_PARSER
	select X509_CERTIFICATE_PARSER_LEGACY if X509_CERTIFICATE_PARSER
	select PKCS7_MESSAGE_PARSER_LEGACY if PKCS7_MESSAGE_PARSER
	select MSCODE_PARSER_LEGACY if MSCODE_PARSER
	help
	  Enable legacy certificate libraries.

if LEGACY_CRYPTO

config ASN1_DECODER_LEGACY
	bool "ASN1 decoder with legacy certificate library"
	depends on LEGACY_CRYPTO && ASN1_DECODER
	help
	  This option chooses legacy certificate library for ASN1 decoder.

config ASYMMETRIC_PUBLIC_KEY_LEGACY
	bool "Asymmetric public key crypto with legacy certificate library"
	depends on LEGACY_CRYPTO && ASYMMETRIC_PUBLIC_KEY_SUBTYPE
	help
	  This option chooses legacy certificate library for asymmetric public
	  key crypto algorithm.

config RSA_PUBLIC_KEY_PARSER_LEGACY
	bool "RSA public key parser with legacy certificate library"
	depends on ASYMMETRIC_PUBLIC_KEY_LEGACY
	select ASN1_DECODER_LEGACY
	help
	  This option chooses legacy certificate library for RSA public key
	  parser.

config X509_CERTIFICATE_PARSER_LEGACY
	bool "X.509 certificate parser with legacy certificate library"
	depends on ASYMMETRIC_PUBLIC_KEY_LEGACY
	select ASN1_DECODER_LEGACY
	help
	  This option chooses legacy certificate library for X509 certificate
	  parser.

config PKCS7_MESSAGE_PARSER_LEGACY
	bool "PKCS#7 message parser with legacy certificate library"
	depends on X509_CERTIFICATE_PARSER_LEGACY
	select ASN1_DECODER_LEGACY
	help
	  This option chooses legacy certificate library for PKCS7 message
	  parser.

config MSCODE_PARSER_LEGACY
	bool "MS authenticode parser with legacy certificate library"
	depends on LEGACY_CRYPTO && MSCODE_PARSER
	select ASN1_DECODER_LEGACY
	help
	  This option chooses legacy certificate library for MS authenticode
	  parser.

endif # LEGACY_CRYPTO

endif # LEGACY_HASHING_AND_CRYPTO || MBEDTLS_LIB_HASHING_ALT

if MBEDTLS_LIB

config MBEDTLS_LIB_HASHING_ALT
	bool "Replace MbedTLS native hashing with U-Boot legacy libraries"
	depends on MBEDTLS_LIB && !MBEDTLS_LIB_CRYPTO
	select LEGACY_HASHING
	default y if MBEDTLS_LIB && !MBEDTLS_LIB_CRYPTO
	help
	  Enable MbedTLS hashing alternatives and replace them with legacy hashing
	  libraries.
	  This allows user to use U-Boot legacy hashing algorithms together with
	  other MbedTLS modules.
	  Mutually incompatible with MBEDTLS_LIB_CRYPTO.

config MBEDTLS_LIB_CRYPTO
	bool "Use MbedTLS native crypto libraries for hashing"
	default y if MBEDTLS_LIB
	select MD5_MBEDTLS if MD5
	select SHA1_MBEDTLS if SHA1
	select SHA256_MBEDTLS if SHA256
	select SHA512_MBEDTLS if SHA512
	select SHA384_MBEDTLS if SHA384
	help
	  Enable MbedTLS native crypto libraries.
	  Mutually incompatible with MBEDTLS_LIB_HASHING_ALT.

if MBEDTLS_LIB_CRYPTO

config SHA1_MBEDTLS
	bool "Enable SHA1 support with MbedTLS crypto library"
	depends on MBEDTLS_LIB_CRYPTO && SHA1
	help
	  This option enables support of hashing using SHA1 algorithm
	  with MbedTLS crypto library.

config SHA256_MBEDTLS
	bool "Enable SHA256 support with MbedTLS crypto library"
	depends on MBEDTLS_LIB_CRYPTO && SHA256
	help
	  This option enables support of hashing using SHA256 algorithm
	  with MbedTLS crypto library.

if SHA256_MBEDTLS

config SHA256_SMALLER
	bool "Enable SHA256 smaller implementation with MbedTLS crypto library"
	depends on SHA256_MBEDTLS
	default y if SHA256_MBEDTLS
	help
	  This option enables support of hashing using SHA256 algorithm
	  smaller implementation with MbedTLS crypto library.

endif

config SHA512_MBEDTLS
	bool "Enable SHA512 support with MbedTLS crypto library"
	depends on MBEDTLS_LIB_CRYPTO && SHA512
	default y if TI_SECURE_DEVICE && FIT_SIGNATURE
	help
	  This option enables support of hashing using SHA512 algorithm
	  with MbedTLS crypto library.

if SHA512_MBEDTLS

config SHA512_SMALLER
	bool "Enable SHA512 smaller implementation with MbedTLS crypto library"
	depends on SHA512_MBEDTLS
	default y if SHA512_MBEDTLS
	help
	  This option enables support of hashing using SHA512 algorithm
	  smaller implementation with MbedTLS crypto library.

endif

config SHA384_MBEDTLS
	bool "Enable SHA384 support with MbedTLS crypto library"
	depends on MBEDTLS_LIB_CRYPTO && SHA384
	select SHA512_MBEDTLS
	help
	  This option enables support of hashing using SHA384 algorithm
	  with MbedTLS crypto library.

config MD5_MBEDTLS
	bool "Enable MD5 support with MbedTLS crypto library"
	depends on MBEDTLS_LIB_CRYPTO && MD5
	help
	  This option enables support of hashing using MD5 algorithm
	  with MbedTLS crypto library.

config HKDF_MBEDTLS
	bool "Enable HKDF support with MbedTLS crypto library"
	depends on MBEDTLS_LIB_CRYPTO
	help
	  This option enables support of key derivation using HKDF algorithm
	  with MbedTLS crypto library.

endif # MBEDTLS_LIB_CRYPTO

config MBEDTLS_LIB_X509
	bool "MbedTLS certificate libraries"
	select ASN1_DECODER_MBEDTLS if ASN1_DECODER
	select ASYMMETRIC_PUBLIC_KEY_MBEDTLS if \
		ASYMMETRIC_PUBLIC_KEY_SUBTYPE
	select RSA_PUBLIC_KEY_PARSER_MBEDTLS if RSA_PUBLIC_KEY_PARSER
	select X509_CERTIFICATE_PARSER_MBEDTLS if X509_CERTIFICATE_PARSER
	select PKCS7_MESSAGE_PARSER_MBEDTLS if PKCS7_MESSAGE_PARSER
	select MSCODE_PARSER_MBEDTLS if MSCODE_PARSER
	help
	  Enable MbedTLS certificate libraries.

if MBEDTLS_LIB_X509

config ASN1_DECODER_MBEDTLS
	bool "ASN1 decoder with MbedTLS certificate library"
	depends on MBEDTLS_LIB_X509 && ASN1_DECODER
	help
	  This option chooses MbedTLS certificate library for ASN1 decoder.

config ASYMMETRIC_PUBLIC_KEY_MBEDTLS
	bool "Asymmetric public key crypto with MbedTLS certificate library"
	depends on MBEDTLS_LIB_X509 && ASYMMETRIC_PUBLIC_KEY_SUBTYPE
	help
	  This option chooses MbedTLS certificate library for asymmetric public
	  key crypto algorithm.

config RSA_PUBLIC_KEY_PARSER_MBEDTLS
	bool "RSA public key parser with MbedTLS certificate library"
	depends on ASYMMETRIC_PUBLIC_KEY_MBEDTLS
	select ASN1_DECODER_MBEDTLS
	help
	  This option chooses MbedTLS certificate library for RSA public key
	  parser.

config X509_CERTIFICATE_PARSER_MBEDTLS
	bool "X.509 certificate parser with MbedTLS certificate library"
	depends on ASYMMETRIC_PUBLIC_KEY_MBEDTLS
	select ASN1_DECODER_MBEDTLS
	help
	  This option chooses MbedTLS certificate library for X509 certificate
	  parser.

config PKCS7_MESSAGE_PARSER_MBEDTLS
	bool "PKCS#7 message parser with MbedTLS certificate library"
	depends on X509_CERTIFICATE_PARSER_MBEDTLS
	select ASN1_DECODER_MBEDTLS
	help
	  This option chooses MbedTLS certificate library for PKCS7 message
	  parser.

config MSCODE_PARSER_MBEDTLS
	bool "MS authenticode parser with MbedTLS certificate library"
	depends on MBEDTLS_LIB_X509 && MSCODE_PARSER
	select ASN1_DECODER_MBEDTLS
	help
	  This option chooses MbedTLS certificate library for MS authenticode
	  parser.

endif # MBEDTLS_LIB_X509

config MBEDTLS_LIB_TLS
	bool "MbedTLS TLS library"
	depends on RSA_PUBLIC_KEY_PARSER_MBEDTLS
	depends on X509_CERTIFICATE_PARSER_MBEDTLS
	depends on ASYMMETRIC_PUBLIC_KEY_MBEDTLS
	depends on ASN1_DECODER_MBEDTLS
	depends on MBEDTLS_LIB
	help
	  Enable MbedTLS TLS library. Required for HTTPs support
	  in wget

endif # MBEDTLS_LIB

# For SPL

if SPL

choice
	prompt "Crypto libraries (SPL)"
	default SPL_LEGACY_HASHING_AND_CRYPTO
	help
	  Select crypto libraries in SPL.
	  SPL_LEGACY_HASHING_AND_CRYPTO for legacy crypto libraries,
	  SPL_MBEDTLS_LIB for MbedTLS libraries.

config SPL_LEGACY_HASHING_AND_CRYPTO
	bool "legacy crypto libraries"
	select SPL_LEGACY_HASHING
	select SPL_LEGACY_CRYPTO

config SPL_MBEDTLS_LIB
	bool "MbedTLS libraries"
	select SPL_MBEDTLS_LIB_X509
endchoice

if SPL_LEGACY_HASHING_AND_CRYPTO || SPL_MBEDTLS_LIB_HASHING_ALT

config SPL_LEGACY_HASHING
	bool "Use U-Boot legacy hashing libraries (SPL)"
	select SPL_MD5_LEGACY if SPL_MD5
	select SPL_SHA1_LEGACY if SPL_SHA1
	select SPL_SHA256_LEGACY if SPL_SHA256
	select SPL_SHA512_LEGACY if SPL_SHA512
	select SPL_SHA384_LEGACY if SPL_SHA384
	help
	  Enable U-Boot legacy hashing libraries in SPL.

if SPL_LEGACY_HASHING

config SPL_SHA1_LEGACY
	bool "Enable SHA1 support with legacy crypto library (SPL)"
	depends on SPL_LEGACY_HASHING && SPL_SHA1
	help
	  This option enables support of hashing using SHA1 algorithm
	  with legacy crypto library in SPL.

config SPL_SHA256_LEGACY
	bool "Enable SHA256 support with legacy crypto library (SPL)"
	depends on SPL_LEGACY_HASHING && SPL_SHA256
	help
	  This option enables support of hashing using SHA256 algorithm
	  with legacy crypto library in SPL.

config SPL_SHA512_LEGACY
	bool "Enable SHA512 support with legacy crypto library (SPL)"
	depends on SPL_LEGACY_HASHING && SPL_SHA512
	help
	  This option enables support of hashing using SHA512 algorithm
	  with legacy crypto library in SPL.

config SPL_SHA384_LEGACY
	bool "Enable SHA384 support with legacy crypto library (SPL)"
	depends on SPL_LEGACY_HASHING && SPL_SHA384
	select SPL_SHA512_LEGACY
	help
	  This option enables support of hashing using SHA384 algorithm
	  with legacy crypto library in SPL.

config SPL_MD5_LEGACY
	bool "Enable MD5 support with legacy crypto library (SPL)"
	depends on SPL_LEGACY_HASHING && SPL_MD5
	help
	  This option enables support of hashing using MD5 algorithm
	  with legacy crypto library in SPL.

endif # SPL_LEGACY_HASHING

config SPL_LEGACY_CRYPTO
	bool "legacy certificate libraries (SPL)"
	depends on SPL_LEGACY_HASHING_AND_CRYPTO
	select SPL_ASN1_DECODER_LEGACY if SPL_ASN1_DECODER
	select SPL_ASYMMETRIC_PUBLIC_KEY_LEGACY if \
		SPL_ASYMMETRIC_PUBLIC_KEY_SUBTYPE
	select SPL_RSA_PUBLIC_KEY_PARSER_LEGACY if SPL_RSA_PUBLIC_KEY_PARSER
	help
	  Enable legacy certificate libraries in SPL.

if SPL_LEGACY_CRYPTO

config SPL_ASN1_DECODER_LEGACY
	bool "ASN1 decoder with legacy certificate library (SPL)"
	depends on SPL_LEGACY_CRYPTO && SPL_ASN1_DECODER
	help
	  This option chooses legacy certificate library for ASN1 decoder in
	  SPL.

config SPL_ASYMMETRIC_PUBLIC_KEY_LEGACY
	bool "Asymmetric public key crypto with legacy certificate library (SPL)"
	depends on SPL_LEGACY_CRYPTO && SPL_ASYMMETRIC_PUBLIC_KEY_SUBTYPE
	help
	  This option chooses legacy certificate library for asymmetric public
	  key crypto algorithm in SPL.

config SPL_RSA_PUBLIC_KEY_PARSER_LEGACY
	bool "RSA public key parser with legacy certificate library (SPL)"
	depends on SPL_ASYMMETRIC_PUBLIC_KEY_LEGACY
	select SPL_ASN1_DECODER_LEGACY
	help
	  This option chooses legacy certificate library for RSA public key
	  parser in SPL.

endif # SPL_LEGACY_CRYPTO

endif # SPL_LEGACY_HASHING_AND_CRYPTO || SPL_MBEDTLS_LIB_HASHING_ALT

if SPL_MBEDTLS_LIB

config SPL_MBEDTLS_LIB_HASHING_ALT
	bool "Replace MbedTLS native hashing with U-Boot legacy libraries (SPL)"
	depends on SPL_MBEDTLS_LIB && !SPL_MBEDTLS_LIB_CRYPTO
	select SPL_LEGACY_HASHING
	default y if SPL_MBEDTLS_LIB && !SPL_MBEDTLS_LIB_CRYPTO
	help
	  Enable MbedTLS hashing alternatives and replace them with legacy hashing
	  libraries in SPL.
	  This allows user to use U-Boot legacy hashing algorithms together with
	  other MbedTLS modules.
	  Mutually incompatible with SPL_MBEDTLS_LIB_CRYPTO.

config SPL_MBEDTLS_LIB_CRYPTO
	bool "Use MbedTLS native crypto libraries for hashing (SPL)"
	default y if SPL_MBEDTLS_LIB
	select SPL_MD5_MBEDTLS if SPL_MD5
	select SPL_SHA1_MBEDTLS if SPL_SHA1
	select SPL_SHA256_MBEDTLS if SPL_SHA256
	select SPL_SHA512_MBEDTLS if SPL_SHA512
	select SPL_SHA384_MBEDTLS if SPL_SHA384
	help
	  Enable MbedTLS native crypto libraries in SPL.

if SPL_MBEDTLS_LIB_CRYPTO

config SPL_SHA1_MBEDTLS
	bool "Enable SHA1 support with MbedTLS crypto library (SPL)"
	depends on SPL_MBEDTLS_LIB_CRYPTO && SPL_SHA1
	help
	  This option enables support of hashing using SHA1 algorithm
	  with MbedTLS crypto library in SPL.

config SPL_SHA256_MBEDTLS
	bool "Enable SHA256 support with MbedTLS crypto library (SPL)"
	depends on SPL_MBEDTLS_LIB_CRYPTO && SPL_SHA256
	help
	  This option enables support of hashing using SHA256 algorithm
	  with MbedTLS crypto library in SPL.

config SPL_SHA512_MBEDTLS
	bool "Enable SHA512 support with MbedTLS crypto library (SPL)"
	depends on SPL_MBEDTLS_LIB_CRYPTO && SPL_SHA512
	help
	  This option enables support of hashing using SHA512 algorithm
	  with MbedTLS crypto library in SPL.

config SPL_SHA384_MBEDTLS
	bool "Enable SHA384 support with MbedTLS crypto library (SPL)"
	depends on SPL_MBEDTLS_LIB_CRYPTO && SPL_SHA384
	select SPL_SHA512
	help
	  This option enables support of hashing using SHA384 algorithm
	  with MbedTLS crypto library in SPL.

config SPL_MD5_MBEDTLS
	bool "Enable MD5 support with MbedTLS crypto library (SPL)"
	depends on SPL_MBEDTLS_LIB_CRYPTO && SPL_MD5
	help
	  This option enables support of hashing using MD5 algorithm
	  with MbedTLS crypto library in SPL.

config SPL_HKDF_MBEDTLS
	bool "Enable HKDF support with MbedTLS crypto library (SPL)"
	depends on SPL_MBEDTLS_LIB_CRYPTO
	help
	  This option enables support of key derivation using HKDF algorithm
	  with MbedTLS crypto library in SPL.

endif # SPL_MBEDTLS_LIB_CRYPTO

config SPL_MBEDTLS_LIB_X509
	bool "MbedTLS certificate libraries (SPL)"
	select SPL_ASN1_DECODER_MBEDTLS if SPL_ASN1_DECODER
	select SPL_ASYMMETRIC_PUBLIC_KEY_MBEDTLS if \
		SPL_ASYMMETRIC_PUBLIC_KEY_SUBTYPE
	select SPL_RSA_PUBLIC_KEY_PARSER_MBEDTLS if SPL_RSA_PUBLIC_KEY_PARSER
	help
	  Enable MbedTLS certificate libraries in SPL.

if SPL_MBEDTLS_LIB_X509

config SPL_ASN1_DECODER_MBEDTLS
	bool "ASN1 decoder with MbedTLS certificate library (SPL)"
	depends on SPL_MBEDTLS_LIB_X509 && SPL_ASN1_DECODER
	help
	  This option chooses MbedTLS certificate library for ASN1 decoder in
	  SPL.

config SPL_ASYMMETRIC_PUBLIC_KEY_MBEDTLS
	bool "Asymmetric public key crypto with MbedTLS certificate library (SPL)"
	depends on SPL_MBEDTLS_LIB_X509 && SPL_ASYMMETRIC_PUBLIC_KEY_SUBTYPE
	help
	  This option chooses MbedTLS certificate library for asymmetric public
	  key crypto algorithm in SPL.

config SPL_RSA_PUBLIC_KEY_PARSER_MBEDTLS
	bool "RSA public key parser with MbedTLS certificate library (SPL)"
	depends on SPL_ASYMMETRIC_PUBLIC_KEY_MBEDTLS
	select SPL_ASN1_DECODER_MBEDTLS
	help
	  This option chooses MbedTLS certificate library for RSA public key
	  parser in SPL.

endif # SPL_MBEDTLS_LIB_X509

config SPL_MBEDTLS_LIB_TLS
	bool "MbedTLS TLS library (SPL)"
	depends on SPL_RSA_PUBLIC_KEY_PARSER_MBEDTLS
	depends on SPL_X509_CERTIFICATE_PARSER_MBEDTLS
	depends on SPL_ASYMMETRIC_PUBLIC_KEY_MBEDTLS
	depends on SPL_ASN1_DECODER_MBEDTLS
	depends on SPL_MBEDTLS_LIB
	help
	  Enable MbedTLS TLS library in SPL. Required for HTTPs support
	  in wget

endif # SPL_MBEDTLS_LIB

endif # SPL

# For TPL

if TPL

choice
	prompt "Crypto libraries (TPL)"
	default TPL_LEGACY_HASHING_AND_CRYPTO
	help
	  Select crypto libraries in TPL.
	  TPL_LEGACY_HASHING_AND_CRYPTO for legacy crypto libraries,
	  TPL_MBEDTLS_LIB for MbedTLS libraries.

config TPL_LEGACY_HASHING_AND_CRYPTO
	bool "legacy crypto libraries"
	select TPL_LEGACY_HASHING
	select TPL_LEGACY_CRYPTO

config TPL_MBEDTLS_LIB
	bool "MbedTLS libraries"

endchoice

if TPL_LEGACY_HASHING_AND_CRYPTO || TPL_MBEDTLS_LIB_HASHING_ALT

config TPL_LEGACY_HASHING
	bool "Use U-Boot legacy hashing libraries (TPL)"
	select TPL_MD5_LEGACY if TPL_MD5
	select TPL_SHA1_LEGACY if TPL_SHA1
	select TPL_SHA256_LEGACY if TPL_SHA256
	select TPL_SHA512_LEGACY if TPL_SHA512
	select TPL_SHA384_LEGACY if TPL_SHA384
	help
	  Enable U-Boot legacy hashing libraries in TPL.

if TPL_LEGACY_HASHING

config TPL_SHA1_LEGACY
	bool "Enable SHA1 support with legacy crypto library (TPL)"
	depends on TPL_LEGACY_HASHING && TPL_SHA1
	help
	  This option enables support of hashing using SHA1 algorithm
	  with legacy crypto library in TPL.

config TPL_SHA256_LEGACY
	bool "Enable SHA256 support with legacy crypto library (TPL)"
	depends on TPL_LEGACY_HASHING && TPL_SHA256
	help
	  This option enables support of hashing using SHA256 algorithm
	  with legacy crypto library in TPL.

config TPL_SHA512_LEGACY
	bool "Enable SHA512 support with legacy crypto library (TPL)"
	depends on TPL_LEGACY_HASHING && TPL_SHA512
	help
	  This option enables support of hashing using SHA512 algorithm
	  with legacy crypto library in TPL.

config TPL_SHA384_LEGACY
	bool "Enable SHA384 support with legacy crypto library (TPL)"
	depends on TPL_LEGACY_HASHING && TPL_SHA384
	select TPL_SHA512_LEGACY
	help
	  This option enables support of hashing using SHA384 algorithm
	  with legacy crypto library in TPL.

config TPL_MD5_LEGACY
	bool "Enable MD5 support with legacy crypto library (TPL)"
	depends on TPL_LEGACY_HASHING && TPL_MD5
	help
	  This option enables support of hashing using MD5 algorithm
	  with legacy crypto library in TPL.

endif # TPL_LEGACY_HASHING

endif # TPL_LEGACY_HASHING_AND_CRYPTO || TPL_MBEDTLS_LIB_HASHING_ALT

if TPL_MBEDTLS_LIB

config TPL_MBEDTLS_LIB_HASHING_ALT
	bool "Replace MbedTLS native hashing with U-Boot legacy libraries (TPL)"
	depends on TPL_MBEDTLS_LIB && !TPL_MBEDTLS_LIB_CRYPTO
	select TPL_LEGACY_HASHING
	default y if TPL_MBEDTLS_LIB && !TPL_MBEDTLS_LIB_CRYPTO
	help
	  Enable MbedTLS hashing alternatives and replace them with legacy hashing
	  libraries in TPL.
	  This allows user to use U-Boot legacy hashing algorithms together with
	  other MbedTLS modules.
	  Mutually incompatible with TPL_MBEDTLS_LIB_CRYPTO.

config TPL_MBEDTLS_LIB_CRYPTO
	bool "Use MbedTLS native crypto libraries for hashing (TPL)"
	default y if TPL_MBEDTLS_LIB
	select TPL_MD5_MBEDTLS if TPL_MD5
	select TPL_SHA1_MBEDTLS if TPL_SHA1
	select TPL_SHA256_MBEDTLS if TPL_SHA256
	select TPL_SHA512_MBEDTLS if TPL_SHA512
	select TPL_SHA384_MBEDTLS if TPL_SHA384
	help
	  Enable MbedTLS native crypto libraries in TPL.

if TPL_MBEDTLS_LIB_CRYPTO

config TPL_SHA1_MBEDTLS
	bool "Enable SHA1 support with MbedTLS crypto library (TPL)"
	depends on TPL_MBEDTLS_LIB_CRYPTO && TPL_SHA1
	help
	  This option enables support of hashing using SHA1 algorithm
	  with MbedTLS crypto library in TPL.

config TPL_SHA256_MBEDTLS
	bool "Enable SHA256 support with MbedTLS crypto library (TPL)"
	depends on TPL_MBEDTLS_LIB_CRYPTO && TPL_SHA256
	help
	  This option enables support of hashing using SHA256 algorithm
	  with MbedTLS crypto library in TPL.

config TPL_SHA512_MBEDTLS
	bool "Enable SHA512 support with MbedTLS crypto library (TPL)"
	depends on TPL_MBEDTLS_LIB_CRYPTO && TPL_SHA512
	help
	  This option enables support of hashing using SHA512 algorithm
	  with MbedTLS crypto library in TPL.

config TPL_SHA384_MBEDTLS
	bool "Enable SHA384 support with MbedTLS crypto library (TPL)"
	depends on TPL_MBEDTLS_LIB_CRYPTO && TPL_SHA384
	select TPL_SHA512
	help
	  This option enables support of hashing using SHA384 algorithm
	  with MbedTLS crypto library in TPL.

config TPL_MD5_MBEDTLS
	bool "Enable MD5 support with MbedTLS crypto library (TPL)"
	depends on TPL_MBEDTLS_LIB_CRYPTO && TPL_MD5
	help
	  This option enables support of hashing using MD5 algorithm
	  with MbedTLS crypto library in TPL.

config TPL_HKDF_MBEDTLS
	bool "Enable HKDF support with MbedTLS crypto library (TPL)"
	depends on TPL_MBEDTLS_LIB_CRYPTO
	help
	  This option enables support of key derivation using HKDF algorithm
	  with MbedTLS crypto library in TPL.

endif # TPL_MBEDTLS_LIB_CRYPTO

endif # TPL_MBEDTLS_LIB

endif # TPL

# For VPL

if VPL

choice
	prompt "Crypto libraries (VPL)"
	default VPL_LEGACY_HASHING_AND_CRYPTO
	help
	  Select crypto libraries in VPL.
	  VPL_LEGACY_HASHING_AND_CRYPTO for legacy crypto libraries,
	  VPL_MBEDTLS_LIB for MbedTLS libraries.

config VPL_LEGACY_HASHING_AND_CRYPTO
	bool "legacy crypto libraries"
	select VPL_LEGACY_HASHING

config VPL_MBEDTLS_LIB
	bool "MbedTLS libraries"

endchoice

if VPL_LEGACY_HASHING_AND_CRYPTO || VPL_MBEDTLS_LIB_HASHING_ALT

config VPL_LEGACY_HASHING
	bool "Use U-Boot legacy hashing libraries (VPL)"
	select VPL_MD5_LEGACY if VPL_MD5
	select VPL_SHA1_LEGACY if VPL_SHA1
	select VPL_SHA256_LEGACY if VPL_SHA256
	select VPL_SHA512_LEGACY if VPL_SHA512
	select VPL_SHA384_LEGACY if VPL_SHA384
	help
	  Enable U-Boot legacy hashing libraries in VPL.

if VPL_LEGACY_HASHING

config VPL_SHA1_LEGACY
	bool "Enable SHA1 support with legacy crypto library (VPL)"
	depends on VPL_LEGACY_HASHING && VPL_SHA1
	help
	  This option enables support of hashing using SHA1 algorithm
	  with legacy crypto library in VPL.

config VPL_SHA256_LEGACY
	bool "Enable SHA256 support with legacy crypto library (VPL)"
	depends on VPL_LEGACY_HASHING && VPL_SHA256
	help
	  This option enables support of hashing using SHA256 algorithm
	  with legacy crypto library in VPL.

config VPL_SHA512_LEGACY
	bool "Enable SHA512 support with legacy crypto library (VPL)"
	depends on VPL_LEGACY_HASHING && VPL_SHA512
	help
	  This option enables support of hashing using SHA512 algorithm
	  with legacy crypto library in VPL.

config VPL_SHA384_LEGACY
	bool "Enable SHA384 support with legacy crypto library (VPL)"
	depends on VPL_LEGACY_HASHING && VPL_SHA384
	select VPL_SHA512_LEGACY
	help
	  This option enables support of hashing using SHA384 algorithm
	  with legacy crypto library in VPL.

config VPL_MD5_LEGACY
	bool "Enable MD5 support with legacy crypto library (VPL)"
	depends on VPL_LEGACY_HASHING && VPL_MD5
	help
	  This option enables support of hashing using MD5 algorithm
	  with legacy crypto library in VPL.

endif # VPL_LEGACY_HASHING

endif # VPL_LEGACY_HASHING_AND_CRYPTO || VPL_MBEDTLS_LIB_HASHING_ALT

if VPL_MBEDTLS_LIB

config VPL_MBEDTLS_LIB_HASHING_ALT
	bool "Replace MbedTLS native hashing with U-Boot legacy libraries (VPL)"
	depends on VPL_MBEDTLS_LIB && !VPL_MBEDTLS_LIB_CRYPTO
	select VPL_LEGACY_HASHING
	default y if VPL_MBEDTLS_LIB && !VPL_MBEDTLS_LIB_CRYPTO
	help
	  Enable MbedTLS hashing alternatives and replace them with legacy hashing
	  libraries in VPL.
	  This allows user to use U-Boot legacy hashing algorithms together with
	  other MbedTLS modules.
	  Mutually incompatible with VPL_MBEDTLS_LIB_CRYPTO.

config VPL_MBEDTLS_LIB_CRYPTO
	bool "Use MbedTLS native crypto libraries for hashing (VPL)"
	default y if VPL_MBEDTLS_LIB
	select VPL_MD5_MBEDTLS if VPL_MD5
	select VPL_SHA1_MBEDTLS if VPL_SHA1
	select VPL_SHA256_MBEDTLS if VPL_SHA256
	select VPL_SHA512_MBEDTLS if VPL_SHA512
	select VPL_SHA384_MBEDTLS if VPL_SHA384
	help
	  Enable MbedTLS native crypto libraries in VPL.

if VPL_MBEDTLS_LIB_CRYPTO

config VPL_SHA1_MBEDTLS
	bool "Enable SHA1 support with MbedTLS crypto library (VPL)"
	depends on VPL_MBEDTLS_LIB_CRYPTO && VPL_SHA1
	help
	  This option enables support of hashing using SHA1 algorithm
	  with MbedTLS crypto library in VPL.

config VPL_SHA256_MBEDTLS
	bool "Enable SHA256 support with MbedTLS crypto library (VPL)"
	depends on VPL_MBEDTLS_LIB_CRYPTO && VPL_SHA256
	help
	  This option enables support of hashing using SHA256 algorithm
	  with MbedTLS crypto library in VPL.

config VPL_SHA512_MBEDTLS
	bool "Enable SHA512 support with MbedTLS crypto library (VPL)"
	depends on VPL_MBEDTLS_LIB_CRYPTO && VPL_SHA512
	help
	  This option enables support of hashing using SHA512 algorithm
	  with MbedTLS crypto library in VPL.

config VPL_SHA384_MBEDTLS
	bool "Enable SHA384 support with MbedTLS crypto library (VPL)"
	depends on VPL_MBEDTLS_LIB_CRYPTO && VPL_SHA384
	select VPL_SHA512
	help
	  This option enables support of hashing using SHA384 algorithm
	  with MbedTLS crypto library in VPL.

config VPL_MD5_MBEDTLS
	bool "Enable MD5 support with MbedTLS crypto library (VPL)"
	depends on VPL_MBEDTLS_LIB_CRYPTO && VPL_MD5
	help
	  This option enables support of hashing using MD5 algorithm
	  with MbedTLS crypto library in VPL.

config VPL_HKDF_MBEDTLS
	bool "Enable HKDF support with MbedTLS crypto library (VPL)"
	depends on VPL_MBEDTLS_LIB_CRYPTO
	help
	  This option enables support of key derivation using HKDF algorithm
	  with MbedTLS crypto library in VPL.

endif # VPL_MBEDTLS_LIB_CRYPTO

endif # VPL_MBEDTLS_LIB

endif # VPL