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
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
|
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#include "api/s2n.h"
#include "tls/s2n_security_policies.h"
#include "tls/s2n_connection.h"
#include "utils/s2n_safety.h"
const struct s2n_security_policy security_policy_20170210 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20170210,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_default_tls13 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20210831,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20200207,
.certificate_signature_preferences = &s2n_certificate_signature_preferences_20201110,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
/*
* This security policy is derived from the following specification:
* https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-52r2.pdf
*
* Supports TLS1.2
*/
const struct s2n_security_policy security_policy_default_fips = {
.minimum_protocol_version = S2N_TLS12,
.cipher_preferences = &cipher_preferences_default_fips,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_default_fips,
.certificate_signature_preferences = &s2n_signature_preferences_default_fips,
.ecc_preferences = &s2n_ecc_preferences_default_fips,
};
const struct s2n_security_policy security_policy_20190801 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20190801,
.kem_preferences = &kem_preferences_null,
/* The discrepancy in the date exists because the signature preferences
* were named when cipher preferences and signature preferences were
* tracked separately, and we chose to keep the cipher preference
* name because customers use it.
*/
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_20190802 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20190801,
.kem_preferences = &kem_preferences_null,
/* The discrepancy in the date exists because the signature preferences
* were named when cipher preferences and signature preferences were
* tracked separately, and we chose to keep the cipher preference
* name because customers use it.
*/
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_20170405 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20170405,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_20170405_gcm = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20170405_gcm,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_elb_2015_04 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &elb_security_policy_2015_04,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_elb_2016_08 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &elb_security_policy_2016_08,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_elb_tls_1_1_2017_01 = {
.minimum_protocol_version = S2N_TLS11,
.cipher_preferences = &elb_security_policy_tls_1_1_2017_01,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_elb_tls_1_2_2017_01 = {
.minimum_protocol_version = S2N_TLS12,
.cipher_preferences = &elb_security_policy_tls_1_2_2017_01,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_elb_tls_1_2_ext_2018_06 = {
.minimum_protocol_version = S2N_TLS12,
.cipher_preferences = &elb_security_policy_tls_1_2_ext_2018_06,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_elb_fs_2018_06 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &elb_security_policy_fs_2018_06,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_elb_fs_1_2_2019_08 = {
.minimum_protocol_version = S2N_TLS12,
.cipher_preferences = &elb_security_policy_fs_1_2_2019_08,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_elb_fs_1_1_2019_08 = {
.minimum_protocol_version = S2N_TLS11,
.cipher_preferences = &elb_security_policy_fs_1_1_2019_08,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_elb_fs_1_2_Res_2019_08 = {
.minimum_protocol_version = S2N_TLS12,
.cipher_preferences = &elb_security_policy_fs_1_2_Res_2019_08,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
/* CloudFront upstream */
const struct s2n_security_policy security_policy_cloudfront_upstream = {
.minimum_protocol_version = S2N_SSLv3,
.cipher_preferences = &cipher_preferences_cloudfront_upstream,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_cloudfront_upstream_tls10 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_cloudfront_upstream_tls10,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_cloudfront_upstream_tls11 = {
.minimum_protocol_version = S2N_TLS11,
.cipher_preferences = &cipher_preferences_cloudfront_upstream_tls11,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_cloudfront_upstream_tls12 = {
.minimum_protocol_version = S2N_TLS12,
.cipher_preferences = &cipher_preferences_cloudfront_upstream_tls12,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
/* CloudFront viewer facing */
const struct s2n_security_policy security_policy_cloudfront_ssl_v_3 = {
.minimum_protocol_version = S2N_SSLv3,
.cipher_preferences = &cipher_preferences_cloudfront_ssl_v_3,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_cloudfront_tls_1_0_2014 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_cloudfront_tls_1_0_2014,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_cloudfront_tls_1_0_2016 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_cloudfront_tls_1_0_2016,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_cloudfront_tls_1_1_2016 = {
.minimum_protocol_version = S2N_TLS11,
.cipher_preferences = &cipher_preferences_cloudfront_tls_1_1_2016,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_cloudfront_tls_1_2_2018 = {
.minimum_protocol_version = S2N_TLS12,
.cipher_preferences = &cipher_preferences_cloudfront_tls_1_2_2018,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_cloudfront_tls_1_2_2019 = {
.minimum_protocol_version = S2N_TLS12,
.cipher_preferences = &cipher_preferences_cloudfront_tls_1_2_2019,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_cloudfront_tls_1_2_2021 = {
.minimum_protocol_version = S2N_TLS12,
.cipher_preferences = &cipher_preferences_cloudfront_tls_1_2_2021,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
/* CloudFront viewer facing legacy TLS 1.2 policies */
const struct s2n_security_policy security_policy_cloudfront_ssl_v_3_legacy = {
.minimum_protocol_version = S2N_SSLv3,
.cipher_preferences = &cipher_preferences_cloudfront_ssl_v_3_legacy,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_cloudfront_tls_1_0_2014_legacy = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_cloudfront_tls_1_0_2014_legacy,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_cloudfront_tls_1_0_2016_legacy = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_cloudfront_tls_1_0_2016_legacy,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_cloudfront_tls_1_1_2016_legacy = {
.minimum_protocol_version = S2N_TLS11,
.cipher_preferences = &cipher_preferences_cloudfront_tls_1_1_2016_legacy,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_cloudfront_tls_1_2_2018_legacy = {
.minimum_protocol_version = S2N_TLS12,
.cipher_preferences = &cipher_preferences_cloudfront_tls_1_2_2018_legacy,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_cloudfront_tls_1_2_2019_legacy = {
.minimum_protocol_version = S2N_TLS12,
.cipher_preferences = &cipher_preferences_cloudfront_tls_1_2_2019_legacy,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_aws_crt_sdk_ssl_v3 = {
.minimum_protocol_version = S2N_SSLv3,
.cipher_preferences = &cipher_preferences_aws_crt_sdk_ssl_v3,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_aws_crt_sdk_tls_10 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_aws_crt_sdk_default,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_aws_crt_sdk_tls_11 = {
.minimum_protocol_version = S2N_TLS11,
.cipher_preferences = &cipher_preferences_aws_crt_sdk_default,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_aws_crt_sdk_tls_12 = {
.minimum_protocol_version = S2N_TLS12,
.cipher_preferences = &cipher_preferences_aws_crt_sdk_default,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_aws_crt_sdk_tls_13 = {
.minimum_protocol_version = S2N_TLS13,
.cipher_preferences = &cipher_preferences_aws_crt_sdk_tls_13,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_kms_tls_1_0_2018_10 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_kms_tls_1_0_2018_10,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_kms_tls_1_0_2021_08 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_kms_tls_1_0_2021_08,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_kms_pq_tls_1_0_2019_06 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_kms_pq_tls_1_0_2019_06,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_kms_pq_tls_1_0_2020_02 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_kms_pq_tls_1_0_2020_02,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_pq_sike_test_tls_1_0_2019_11 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_pq_sike_test_tls_1_0_2019_11,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_pq_sike_test_tls_1_0_2020_02 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_pq_sike_test_tls_1_0_2020_02,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_kms_pq_tls_1_0_2020_07 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_kms_pq_tls_1_0_2020_07,
.kem_preferences = &kem_preferences_pq_tls_1_0_2021_05,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_pq_tls_1_0_2020_12 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_pq_tls_1_0_2020_12,
.kem_preferences = &kem_preferences_pq_tls_1_0_2021_05,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_pq_tls_1_1_2021_05_17 = {
.minimum_protocol_version = S2N_TLS11,
.cipher_preferences = &cipher_preferences_pq_tls_1_1_2021_05_17,
.kem_preferences = &kem_preferences_pq_tls_1_0_2021_05,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_pq_tls_1_0_2021_05_18 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_pq_tls_1_0_2021_05_18,
.kem_preferences = &kem_preferences_pq_tls_1_0_2021_05,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_pq_tls_1_0_2021_05_19 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_pq_tls_1_0_2021_05_19,
.kem_preferences = &kem_preferences_pq_tls_1_0_2021_05,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_pq_tls_1_0_2021_05_20 = {
.minimum_protocol_version = S2N_TLS10,
/* Yes, this is the same cipher_preferences as kms_pq_tls_1_0_2020_07. The difference between these policies is
* the ecc_preferences, with this one adding support for x25519. */
.cipher_preferences = &cipher_preferences_kms_pq_tls_1_0_2020_07,
.kem_preferences = &kem_preferences_pq_tls_1_0_2021_05,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_pq_tls_1_1_2021_05_21 = {
.minimum_protocol_version = S2N_TLS11,
.cipher_preferences = &cipher_preferences_pq_tls_1_1_2021_05_21,
.kem_preferences = &kem_preferences_pq_tls_1_0_2021_05,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_pq_tls_1_0_2021_05_22 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_pq_tls_1_0_2021_05_22,
.kem_preferences = &kem_preferences_pq_tls_1_0_2021_05,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_pq_tls_1_0_2021_05_23 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_pq_tls_1_0_2021_05_23,
.kem_preferences = &kem_preferences_pq_tls_1_0_2021_05,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_pq_tls_1_0_2021_05_24 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_pq_tls_1_0_2021_05_24,
.kem_preferences = &kem_preferences_pq_tls_1_0_2021_05,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_pq_tls_1_0_2021_05_25 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_pq_tls_1_0_2021_05_25,
.kem_preferences = &kem_preferences_pq_tls_1_0_2021_05,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_pq_tls_1_0_2021_05_26 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_pq_tls_1_0_2021_05_26,
.kem_preferences = &kem_preferences_pq_tls_1_0_2021_05,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_kms_fips_tls_1_2_2018_10 = {
.minimum_protocol_version = S2N_TLS12,
.cipher_preferences = &cipher_preferences_kms_fips_tls_1_2_2018_10,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_kms_fips_tls_1_2_2021_08 = {
.minimum_protocol_version = S2N_TLS12,
.cipher_preferences = &cipher_preferences_kms_fips_tls_1_2_2021_08,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_20140601 = {
.minimum_protocol_version = S2N_SSLv3,
.cipher_preferences = &cipher_preferences_20140601,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_20141001 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20141001,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_20150202 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20150202,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_20150214 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20150214,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_20160411 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20160411,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_20150306 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20150306,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_20160804 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20160804,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_20160824 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20160824,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_20190122 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20190122,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_20190121 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20190121,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_20190120 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20190120,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_20190214 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20190214,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_20190214_gcm = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20190214_gcm,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_20210825 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20210825,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_20210825_gcm = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20210825_gcm,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20200207,
.ecc_preferences = &s2n_ecc_preferences_20200310,
};
const struct s2n_security_policy security_policy_20170328 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20170328,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_20170328_gcm = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20170328_gcm,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_20170718 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20170718,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_20170718_gcm = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20170718_gcm,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_20201021 = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_20190122,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20201021,
.ecc_preferences = &s2n_ecc_preferences_20201021,
};
const struct s2n_security_policy security_policy_20210816 = {
.minimum_protocol_version = S2N_TLS12,
.cipher_preferences = &cipher_preferences_20210816,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20210816,
.ecc_preferences = &s2n_ecc_preferences_20210816,
};
const struct s2n_security_policy security_policy_20210816_gcm = {
.minimum_protocol_version = S2N_TLS12,
.cipher_preferences = &cipher_preferences_20210816_gcm,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20210816,
.ecc_preferences = &s2n_ecc_preferences_20210816,
};
/*
* This security policy is derived from the following specification:
* https://datatracker.ietf.org/doc/html/rfc9151
*/
const struct s2n_security_policy security_policy_rfc9151 = {
.minimum_protocol_version = S2N_TLS12,
.cipher_preferences = &cipher_preferences_rfc9151,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_rfc9151,
.certificate_signature_preferences = &s2n_certificate_signature_preferences_rfc9151,
.ecc_preferences = &s2n_ecc_preferences_20210816,
};
const struct s2n_security_policy security_policy_test_all = {
.minimum_protocol_version = S2N_SSLv3,
.cipher_preferences = &cipher_preferences_test_all,
.kem_preferences = &kem_preferences_pq_tls_1_0_2021_05,
.signature_preferences = &s2n_signature_preferences_20201021,
.ecc_preferences = &s2n_ecc_preferences_test_all,
};
const struct s2n_security_policy security_policy_test_all_tls12 = {
.minimum_protocol_version = S2N_SSLv3,
.cipher_preferences = &cipher_preferences_test_all_tls12,
.kem_preferences = &kem_preferences_pq_tls_1_0_2021_05,
.signature_preferences = &s2n_signature_preferences_20201021,
.ecc_preferences = &s2n_ecc_preferences_20201021,
};
const struct s2n_security_policy security_policy_test_all_fips = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_test_all_fips,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20201021,
.ecc_preferences = &s2n_ecc_preferences_20201021,
};
const struct s2n_security_policy security_policy_test_all_ecdsa = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_test_all_ecdsa,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20201021,
.ecc_preferences = &s2n_ecc_preferences_test_all,
};
const struct s2n_security_policy security_policy_test_all_rsa_kex = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_test_all_rsa_kex,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20140601,
.ecc_preferences = &s2n_ecc_preferences_20140601,
};
const struct s2n_security_policy security_policy_test_all_tls13 = {
.minimum_protocol_version = S2N_SSLv3,
.cipher_preferences = &cipher_preferences_test_all_tls13,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20201021,
.ecc_preferences = &s2n_ecc_preferences_test_all,
};
const struct s2n_security_policy security_policy_test_ecdsa_priority = {
.minimum_protocol_version = S2N_SSLv3,
.cipher_preferences = &cipher_preferences_test_ecdsa_priority,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20201021,
.ecc_preferences = &s2n_ecc_preferences_test_all,
};
const struct s2n_security_policy security_policy_null = {
.minimum_protocol_version = S2N_TLS10,
.cipher_preferences = &cipher_preferences_null,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_null,
.ecc_preferences = &s2n_ecc_preferences_null,
};
struct s2n_security_policy_selection security_policy_selection[] = {
{ .version="default", .security_policy=&security_policy_20170210, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="default_tls13", .security_policy=&security_policy_default_tls13, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="default_fips", .security_policy=&security_policy_default_fips, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="ELBSecurityPolicy-TLS-1-0-2015-04", .security_policy=&security_policy_elb_2015_04, .ecc_extension_required=0, .pq_kem_extension_required=0 },
/* Not a mistake. TLS-1-0-2015-05 and 2016-08 are equivalent */
{ .version="ELBSecurityPolicy-TLS-1-0-2015-05", .security_policy=&security_policy_elb_2016_08, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="ELBSecurityPolicy-2016-08", .security_policy=&security_policy_elb_2016_08, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="ELBSecurityPolicy-TLS-1-1-2017-01", .security_policy=&security_policy_elb_tls_1_1_2017_01, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="ELBSecurityPolicy-TLS-1-2-2017-01", .security_policy=&security_policy_elb_tls_1_2_2017_01, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="ELBSecurityPolicy-TLS-1-2-Ext-2018-06", .security_policy=&security_policy_elb_tls_1_2_ext_2018_06, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="ELBSecurityPolicy-FS-2018-06", .security_policy=&security_policy_elb_fs_2018_06, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="ELBSecurityPolicy-FS-1-2-2019-08", .security_policy=&security_policy_elb_fs_1_2_2019_08, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="ELBSecurityPolicy-FS-1-1-2019-08", .security_policy=&security_policy_elb_fs_1_1_2019_08, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="ELBSecurityPolicy-FS-1-2-Res-2019-08", .security_policy=&security_policy_elb_fs_1_2_Res_2019_08, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="CloudFront-Upstream", .security_policy=&security_policy_cloudfront_upstream, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="CloudFront-Upstream-TLS-1-0", .security_policy=&security_policy_cloudfront_upstream_tls10, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="CloudFront-Upstream-TLS-1-1", .security_policy=&security_policy_cloudfront_upstream_tls11, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="CloudFront-Upstream-TLS-1-2", .security_policy=&security_policy_cloudfront_upstream_tls12, .ecc_extension_required=0, .pq_kem_extension_required=0 },
/* CloudFront Viewer Facing */
{ .version="CloudFront-SSL-v-3", .security_policy=&security_policy_cloudfront_ssl_v_3, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="CloudFront-TLS-1-0-2014", .security_policy=&security_policy_cloudfront_tls_1_0_2014, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="CloudFront-TLS-1-0-2016", .security_policy=&security_policy_cloudfront_tls_1_0_2016, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="CloudFront-TLS-1-1-2016", .security_policy=&security_policy_cloudfront_tls_1_1_2016, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="CloudFront-TLS-1-2-2018", .security_policy=&security_policy_cloudfront_tls_1_2_2018, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="CloudFront-TLS-1-2-2019", .security_policy=&security_policy_cloudfront_tls_1_2_2019, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="CloudFront-TLS-1-2-2021", .security_policy=&security_policy_cloudfront_tls_1_2_2021, .ecc_extension_required=0, .pq_kem_extension_required=0 },
/* CloudFront Legacy (TLS 1.2) policies */
{ .version="CloudFront-SSL-v-3-Legacy", .security_policy=&security_policy_cloudfront_ssl_v_3_legacy, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="CloudFront-TLS-1-0-2014-Legacy", .security_policy=&security_policy_cloudfront_tls_1_0_2014_legacy, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="CloudFront-TLS-1-0-2016-Legacy", .security_policy=&security_policy_cloudfront_tls_1_0_2016_legacy, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="CloudFront-TLS-1-1-2016-Legacy", .security_policy=&security_policy_cloudfront_tls_1_1_2016_legacy, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="CloudFront-TLS-1-2-2018-Legacy", .security_policy=&security_policy_cloudfront_tls_1_2_2018_legacy, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="CloudFront-TLS-1-2-2019-Legacy", .security_policy=&security_policy_cloudfront_tls_1_2_2019_legacy, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="AWS-CRT-SDK-SSLv3.0", .security_policy=&security_policy_aws_crt_sdk_ssl_v3, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="AWS-CRT-SDK-TLSv1.0", .security_policy=&security_policy_aws_crt_sdk_tls_10, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="AWS-CRT-SDK-TLSv1.1", .security_policy=&security_policy_aws_crt_sdk_tls_11, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="AWS-CRT-SDK-TLSv1.2", .security_policy=&security_policy_aws_crt_sdk_tls_12, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="AWS-CRT-SDK-TLSv1.3", .security_policy=&security_policy_aws_crt_sdk_tls_13, .ecc_extension_required=0, .pq_kem_extension_required=0 },
/* KMS TLS Policies*/
{ .version="KMS-TLS-1-0-2018-10", .security_policy=&security_policy_kms_tls_1_0_2018_10, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="KMS-TLS-1-0-2021-08", .security_policy=&security_policy_kms_tls_1_0_2021_08, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="KMS-FIPS-TLS-1-2-2018-10", .security_policy=&security_policy_kms_fips_tls_1_2_2018_10, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="KMS-FIPS-TLS-1-2-2021-08", .security_policy=&security_policy_kms_fips_tls_1_2_2021_08, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="KMS-PQ-TLS-1-0-2019-06", .security_policy=&security_policy_kms_pq_tls_1_0_2019_06, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="KMS-PQ-TLS-1-0-2020-02", .security_policy=&security_policy_kms_pq_tls_1_0_2020_02, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="KMS-PQ-TLS-1-0-2020-07", .security_policy=&security_policy_kms_pq_tls_1_0_2020_07, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="PQ-SIKE-TEST-TLS-1-0-2019-11", .security_policy=&security_policy_pq_sike_test_tls_1_0_2019_11, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="PQ-SIKE-TEST-TLS-1-0-2020-02", .security_policy=&security_policy_pq_sike_test_tls_1_0_2020_02, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="PQ-TLS-1-0-2020-12", .security_policy=&security_policy_pq_tls_1_0_2020_12, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="PQ-TLS-1-1-2021-05-17", .security_policy=&security_policy_pq_tls_1_1_2021_05_17, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="PQ-TLS-1-0-2021-05-18", .security_policy=&security_policy_pq_tls_1_0_2021_05_18, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="PQ-TLS-1-0-2021-05-19", .security_policy=&security_policy_pq_tls_1_0_2021_05_19, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="PQ-TLS-1-0-2021-05-20", .security_policy=&security_policy_pq_tls_1_0_2021_05_20, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="PQ-TLS-1-1-2021-05-21", .security_policy=&security_policy_pq_tls_1_1_2021_05_21, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="PQ-TLS-1-0-2021-05-22", .security_policy=&security_policy_pq_tls_1_0_2021_05_22, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="PQ-TLS-1-0-2021-05-23", .security_policy=&security_policy_pq_tls_1_0_2021_05_23, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="PQ-TLS-1-0-2021-05-24", .security_policy=&security_policy_pq_tls_1_0_2021_05_24, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="PQ-TLS-1-0-2021-05-25", .security_policy=&security_policy_pq_tls_1_0_2021_05_25, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="PQ-TLS-1-0-2021-05-26", .security_policy=&security_policy_pq_tls_1_0_2021_05_26, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20140601", .security_policy=&security_policy_20140601, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20141001", .security_policy=&security_policy_20141001, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20150202", .security_policy=&security_policy_20150202, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20150214", .security_policy=&security_policy_20150214, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20150306", .security_policy=&security_policy_20150306, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20160411", .security_policy=&security_policy_20160411, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20160804", .security_policy=&security_policy_20160804, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20160824", .security_policy=&security_policy_20160824, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20170210", .security_policy=&security_policy_20170210, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20170328", .security_policy=&security_policy_20170328, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20170328_gcm", .security_policy=&security_policy_20170328_gcm, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20190214", .security_policy=&security_policy_20190214, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20190214_gcm", .security_policy=&security_policy_20190214_gcm, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20210825", .security_policy=&security_policy_20210825, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20210825_gcm", .security_policy=&security_policy_20210825_gcm, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20170405", .security_policy=&security_policy_20170405, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20170405_gcm", .security_policy=&security_policy_20170405_gcm, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20170718", .security_policy=&security_policy_20170718, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20170718_gcm", .security_policy=&security_policy_20170718_gcm, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20190120", .security_policy=&security_policy_20190120, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20190121", .security_policy=&security_policy_20190121, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20190122", .security_policy=&security_policy_20190122, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20190801", .security_policy=&security_policy_20190801, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20190802", .security_policy=&security_policy_20190802, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20200207", .security_policy=&security_policy_test_all_tls13, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20201021", .security_policy=&security_policy_20201021, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20210816", .security_policy=&security_policy_20210816, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="20210816_GCM", .security_policy=&security_policy_20210816_gcm, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="rfc9151", .security_policy=&security_policy_rfc9151, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="test_all", .security_policy=&security_policy_test_all, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="test_all_fips", .security_policy=&security_policy_test_all_fips, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="test_all_ecdsa", .security_policy=&security_policy_test_all_ecdsa, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="test_all_rsa_kex", .security_policy=&security_policy_test_all_rsa_kex, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="test_ecdsa_priority", .security_policy=&security_policy_test_ecdsa_priority, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="test_all_tls12", .security_policy=&security_policy_test_all_tls12, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="test_all_tls13", .security_policy=&security_policy_test_all_tls13, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version="null", .security_policy=&security_policy_null, .ecc_extension_required=0, .pq_kem_extension_required=0 },
{ .version=NULL, .security_policy=NULL, .ecc_extension_required=0, .pq_kem_extension_required=0 }
};
int s2n_find_security_policy_from_version(const char *version, const struct s2n_security_policy **security_policy)
{
POSIX_ENSURE_REF(version);
POSIX_ENSURE_REF(security_policy);
for (int i = 0; security_policy_selection[i].version != NULL; i++) {
if (!strcasecmp(version, security_policy_selection[i].version)) {
*security_policy = security_policy_selection[i].security_policy;
return 0;
}
}
POSIX_BAIL(S2N_ERR_INVALID_SECURITY_POLICY);
}
int s2n_config_set_cipher_preferences(struct s2n_config *config, const char *version)
{
const struct s2n_security_policy *security_policy = NULL;
POSIX_GUARD(s2n_find_security_policy_from_version(version, &security_policy));
POSIX_ENSURE_REF(security_policy);
POSIX_ENSURE_REF(security_policy->cipher_preferences);
POSIX_ENSURE_REF(security_policy->kem_preferences);
POSIX_ENSURE_REF(security_policy->signature_preferences);
POSIX_ENSURE_REF(security_policy->ecc_preferences);
/* If the security policy's minimum version is higher than what libcrypto supports, return an error. */
POSIX_ENSURE((security_policy->minimum_protocol_version <= s2n_get_highest_fully_supported_tls_version()), S2N_ERR_PROTOCOL_VERSION_UNSUPPORTED);
config->security_policy = security_policy;
return 0;
}
int s2n_connection_set_cipher_preferences(struct s2n_connection *conn, const char *version)
{
const struct s2n_security_policy *security_policy = NULL;
POSIX_GUARD(s2n_find_security_policy_from_version(version, &security_policy));
POSIX_ENSURE_REF(security_policy);
POSIX_ENSURE_REF(security_policy->cipher_preferences);
POSIX_ENSURE_REF(security_policy->kem_preferences);
POSIX_ENSURE_REF(security_policy->signature_preferences);
POSIX_ENSURE_REF(security_policy->ecc_preferences);
/* If the security policy's minimum version is higher than what libcrypto supports, return an error. */
POSIX_ENSURE((security_policy->minimum_protocol_version <= s2n_get_highest_fully_supported_tls_version()), S2N_ERR_PROTOCOL_VERSION_UNSUPPORTED);
conn->security_policy_override = security_policy;
return 0;
}
int s2n_security_policies_init()
{
for (int i = 0; security_policy_selection[i].version != NULL; i++) {
const struct s2n_security_policy *security_policy = security_policy_selection[i].security_policy;
POSIX_ENSURE_REF(security_policy);
const struct s2n_cipher_preferences *cipher_preference = security_policy->cipher_preferences;
POSIX_ENSURE_REF(cipher_preference);
const struct s2n_kem_preferences *kem_preference = security_policy->kem_preferences;
POSIX_ENSURE_REF(kem_preference);
const struct s2n_ecc_preferences *ecc_preference = security_policy->ecc_preferences;
POSIX_ENSURE_REF(ecc_preference);
POSIX_GUARD(s2n_check_ecc_preferences_curves_list(ecc_preference));
const struct s2n_signature_preferences *certificate_signature_preference = security_policy->certificate_signature_preferences;
if (certificate_signature_preference != NULL) {
POSIX_GUARD_RESULT(s2n_validate_certificate_signature_preferences(certificate_signature_preference));
}
if (security_policy != &security_policy_null) {
/* All policies must have at least one ecc curve configured. */
S2N_ERROR_IF(ecc_preference->count == 0, S2N_ERR_INVALID_SECURITY_POLICY);
}
for (int j = 0; j < cipher_preference->count; j++) {
struct s2n_cipher_suite *cipher = cipher_preference->suites[j];
POSIX_ENSURE_REF(cipher);
if (cipher->minimum_required_tls_version >= S2N_TLS13) {
security_policy_selection[i].supports_tls13 = 1;
}
/* Sanity check that valid tls13 has minimum tls version set correctly */
S2N_ERROR_IF(s2n_is_valid_tls13_cipher(cipher->iana_value) ^
(cipher->minimum_required_tls_version >= S2N_TLS13), S2N_ERR_INVALID_SECURITY_POLICY);
if (s2n_cipher_suite_requires_ecc_extension(cipher)) {
security_policy_selection[i].ecc_extension_required = 1;
}
if (s2n_cipher_suite_requires_pq_extension(cipher)) {
security_policy_selection[i].pq_kem_extension_required = 1;
}
}
POSIX_GUARD(s2n_validate_kem_preferences(kem_preference, security_policy_selection[i].pq_kem_extension_required));
}
return 0;
}
bool s2n_ecc_is_extension_required(const struct s2n_security_policy *security_policy)
{
if (security_policy == NULL) {
return false;
}
for (int i = 0; security_policy_selection[i].version != NULL; i++) {
if (security_policy_selection[i].security_policy == security_policy) {
return 1 == security_policy_selection[i].ecc_extension_required;
}
}
/* If cipher preference is not in the official list, compute the result */
const struct s2n_cipher_preferences *cipher_preferences = security_policy->cipher_preferences;
if (cipher_preferences == NULL) {
return false;
}
for (uint8_t i = 0; i < cipher_preferences->count; i++) {
if (s2n_cipher_suite_requires_ecc_extension(cipher_preferences->suites[i])) {
return true;
}
}
return false;
}
bool s2n_pq_kem_is_extension_required(const struct s2n_security_policy *security_policy)
{
if (security_policy == NULL) {
return false;
}
for (int i = 0; security_policy_selection[i].version != NULL; i++) {
if (security_policy_selection[i].security_policy == security_policy) {
return 1 == security_policy_selection[i].pq_kem_extension_required;
}
}
/* If cipher preference is not in the official list, compute the result */
const struct s2n_cipher_preferences *cipher_preferences = security_policy->cipher_preferences;
if (cipher_preferences == NULL) {
return false;
}
for (uint8_t i = 0; i < cipher_preferences->count; i++) {
if (s2n_cipher_suite_requires_pq_extension(cipher_preferences->suites[i])) {
return true;
}
}
return false;
}
/* Checks whether cipher preference supports TLS 1.3 based on whether it is configured
* with TLS 1.3 ciphers. Returns true or false.
*/
bool s2n_security_policy_supports_tls13(const struct s2n_security_policy *security_policy)
{
if (security_policy == NULL) {
return false;
}
for (uint8_t i = 0; security_policy_selection[i].version != NULL; i++) {
if (security_policy_selection[i].security_policy == security_policy) {
return security_policy_selection[i].supports_tls13 == 1;
}
}
/* if cipher preference is not in the official list, compute the result */
const struct s2n_cipher_preferences *cipher_preferences = security_policy->cipher_preferences;
if (cipher_preferences == NULL) {
return false;
}
for (uint8_t i = 0; i < cipher_preferences->count; i++) {
if (cipher_preferences->suites[i]->minimum_required_tls_version >= S2N_TLS13) {
return true;
}
}
return false;
}
int s2n_connection_is_valid_for_cipher_preferences(struct s2n_connection *conn, const char *version)
{
POSIX_ENSURE_REF(conn);
POSIX_ENSURE_REF(version);
POSIX_ENSURE_REF(conn->secure);
POSIX_ENSURE_REF(conn->secure->cipher_suite);
const struct s2n_security_policy *security_policy = NULL;
POSIX_GUARD(s2n_find_security_policy_from_version(version, &security_policy));
POSIX_ENSURE_REF(security_policy);
/* make sure we dont use a tls version lower than that configured by the version */
if (s2n_connection_get_actual_protocol_version(conn) < security_policy->minimum_protocol_version) {
return 0;
}
struct s2n_cipher_suite *cipher = conn->secure->cipher_suite;
POSIX_ENSURE_REF(cipher);
for (int i = 0; i < security_policy->cipher_preferences->count; ++i) {
if (0 == memcmp(security_policy->cipher_preferences->suites[i]->iana_value, cipher->iana_value, S2N_TLS_CIPHER_SUITE_LEN)) {
return 1;
}
}
return 0;
}
int s2n_validate_kem_preferences(const struct s2n_kem_preferences *kem_preferences, bool pq_kem_extension_required) {
POSIX_ENSURE_REF(kem_preferences);
/* Basic sanity checks to assert that the count is 0 if and only if the associated list is NULL */
POSIX_ENSURE(S2N_IFF(kem_preferences->tls13_kem_group_count == 0, kem_preferences->tls13_kem_groups == NULL),
S2N_ERR_INVALID_SECURITY_POLICY);
POSIX_ENSURE(S2N_IFF(kem_preferences->kem_count == 0, kem_preferences->kems == NULL),
S2N_ERR_INVALID_SECURITY_POLICY);
POSIX_ENSURE(kem_preferences->tls13_kem_group_count <= S2N_SUPPORTED_KEM_GROUPS_COUNT, S2N_ERR_ARRAY_INDEX_OOB);
/* The PQ KEM extension is applicable only to TLS 1.2 */
if (pq_kem_extension_required) {
POSIX_ENSURE(kem_preferences->kem_count > 0, S2N_ERR_INVALID_SECURITY_POLICY);
POSIX_ENSURE(kem_preferences->kems != NULL, S2N_ERR_INVALID_SECURITY_POLICY);
} else {
POSIX_ENSURE(kem_preferences->kem_count == 0, S2N_ERR_INVALID_SECURITY_POLICY);
POSIX_ENSURE(kem_preferences->kems == NULL, S2N_ERR_INVALID_SECURITY_POLICY);
}
return S2N_SUCCESS;
}
S2N_RESULT s2n_validate_certificate_signature_preferences(const struct s2n_signature_preferences *certificate_signature_preferences)
{
RESULT_ENSURE_REF(certificate_signature_preferences);
size_t rsa_pss_scheme_count = 0;
for (size_t i = 0; i < certificate_signature_preferences->count; i++) {
if (certificate_signature_preferences->signature_schemes[i]->libcrypto_nid == NID_rsassaPss) {
rsa_pss_scheme_count++;
}
}
/*
* https://github.com/aws/s2n-tls/issues/3435
*
* The Openssl function used to parse signatures off certificates does not differentiate between any rsa pss
* signature schemes. Therefore a security policy with a certificate signatures preference list must include
* all rsa_pss signature schemes. */
RESULT_ENSURE(rsa_pss_scheme_count == NUM_RSA_PSS_SCHEMES || rsa_pss_scheme_count == 0, S2N_ERR_INVALID_SECURITY_POLICY);
return S2N_RESULT_OK;
}
|