-
Notifications
You must be signed in to change notification settings - Fork 45
/
constants.c
9360 lines (7818 loc) · 216 KB
/
constants.c
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
/*
* This file is automatically generated - do not manually modify it.
*
* To add or remove a constant, edit helper_script/constants.txt, then run
* helper_script/update-exported-constants.
*/
#ifdef NET_SSLEAY_32BIT_CONSTANTS
static double
#else
static uint64_t
#endif
constant (const char *name, size_t len) {
/* Initially switch on the length of the name. */
switch (len) {
case 5:
/* Names all of length 5. */
/* RSA_3 ST_OK */
/* Offset 0 gives the best switch position. */
switch (*name++) {
case 'R':
if (!memcmp(name, "SA_3", 4)) {
/* R */
#ifdef RSA_3
return RSA_3;
#else
goto not_there;
#endif
}
break;
case 'S':
if (!memcmp(name, "T_OK", 4)) {
/* S */
#ifdef SSL_ST_OK
return SSL_ST_OK;
#else
goto not_there;
#endif
}
break;
}
break;
case 6:
/* Names all of length 6. */
/* OP_ALL RSA_F4 */
/* Offset 0 gives the best switch position. */
switch (*name++) {
case 'O':
if (!memcmp(name, "P_ALL", 5)) {
/* O */
#ifdef SSL_OP_ALL
return SSL_OP_ALL;
#else
goto not_there;
#endif
}
break;
case 'R':
if (!memcmp(name, "SA_F4", 5)) {
/* R */
#ifdef RSA_F4
return RSA_F4;
#else
goto not_there;
#endif
}
break;
}
break;
case 7:
/* Names all of length 7. */
/* CB_EXIT CB_LOOP CB_READ GEN_DNS GEN_RID GEN_URI NID_dsa NID_md2 NID_md5
NID_rc4 NID_rsa NID_sha NOTHING READING ST_INIT WRITING */
/* Offset 4 gives the best switch position. */
switch (name[4]) {
case 'D':
if (!memcmp(name, "GEN_DNS", 7)) {
/* ^ */
#ifdef GEN_DNS
return GEN_DNS;
#else
goto not_there;
#endif
}
break;
case 'E':
if (!memcmp(name, "CB_READ", 7)) {
/* ^ */
#ifdef SSL_CB_READ
return SSL_CB_READ;
#else
goto not_there;
#endif
}
break;
case 'I':
if (!memcmp(name, "NOTHING", 7)) {
/* ^ */
#ifdef SSL_NOTHING
return SSL_NOTHING;
#else
goto not_there;
#endif
}
if (!memcmp(name, "READING", 7)) {
/* ^ */
#ifdef SSL_READING
return SSL_READING;
#else
goto not_there;
#endif
}
if (!memcmp(name, "WRITING", 7)) {
/* ^ */
#ifdef SSL_WRITING
return SSL_WRITING;
#else
goto not_there;
#endif
}
break;
case 'N':
if (!memcmp(name, "ST_INIT", 7)) {
/* ^ */
#ifdef SSL_ST_INIT
return SSL_ST_INIT;
#else
goto not_there;
#endif
}
break;
case 'O':
if (!memcmp(name, "CB_LOOP", 7)) {
/* ^ */
#ifdef SSL_CB_LOOP
return SSL_CB_LOOP;
#else
goto not_there;
#endif
}
break;
case 'R':
if (!memcmp(name, "GEN_RID", 7)) {
/* ^ */
#ifdef GEN_RID
return GEN_RID;
#else
goto not_there;
#endif
}
break;
case 'U':
if (!memcmp(name, "GEN_URI", 7)) {
/* ^ */
#ifdef GEN_URI
return GEN_URI;
#else
goto not_there;
#endif
}
break;
case 'X':
if (!memcmp(name, "CB_EXIT", 7)) {
/* ^ */
#ifdef SSL_CB_EXIT
return SSL_CB_EXIT;
#else
goto not_there;
#endif
}
break;
case 'd':
if (!memcmp(name, "NID_dsa", 7)) {
/* ^ */
#ifdef NID_dsa
return NID_dsa;
#else
goto not_there;
#endif
}
break;
case 'm':
if (!memcmp(name, "NID_md2", 7)) {
/* ^ */
#ifdef NID_md2
return NID_md2;
#else
goto not_there;
#endif
}
if (!memcmp(name, "NID_md5", 7)) {
/* ^ */
#ifdef NID_md5
return NID_md5;
#else
goto not_there;
#endif
}
break;
case 'r':
if (!memcmp(name, "NID_rc4", 7)) {
/* ^ */
#ifdef NID_rc4
return NID_rc4;
#else
goto not_there;
#endif
}
if (!memcmp(name, "NID_rsa", 7)) {
/* ^ */
#ifdef NID_rsa
return NID_rsa;
#else
goto not_there;
#endif
}
break;
case 's':
if (!memcmp(name, "NID_sha", 7)) {
/* ^ */
#ifdef NID_sha
return NID_sha;
#else
goto not_there;
#endif
}
break;
}
break;
case 8:
/* Names all of length 8. */
/* CB_ALERT CB_WRITE F_READ_N GEN_X400 NID_X500 NID_X509 NID_mdc2 NID_name
NID_pkcs NID_sha1 */
/* Offset 5 gives the best switch position. */
switch (name[5]) {
case '4':
if (!memcmp(name, "GEN_X400", 8)) {
/* ^ */
#ifdef GEN_X400
return GEN_X400;
#else
goto not_there;
#endif
}
break;
case '5':
if (!memcmp(name, "NID_X500", 8)) {
/* ^ */
#ifdef NID_X500
return NID_X500;
#else
goto not_there;
#endif
}
if (!memcmp(name, "NID_X509", 8)) {
/* ^ */
#ifdef NID_X509
return NID_X509;
#else
goto not_there;
#endif
}
break;
case 'D':
if (!memcmp(name, "F_READ_N", 8)) {
/* ^ */
#ifdef SSL_F_READ_N
return SSL_F_READ_N;
#else
goto not_there;
#endif
}
break;
case 'E':
if (!memcmp(name, "CB_ALERT", 8)) {
/* ^ */
#ifdef SSL_CB_ALERT
return SSL_CB_ALERT;
#else
goto not_there;
#endif
}
break;
case 'I':
if (!memcmp(name, "CB_WRITE", 8)) {
/* ^ */
#ifdef SSL_CB_WRITE
return SSL_CB_WRITE;
#else
goto not_there;
#endif
}
break;
case 'a':
if (!memcmp(name, "NID_name", 8)) {
/* ^ */
#ifdef NID_name
return NID_name;
#else
goto not_there;
#endif
}
break;
case 'd':
if (!memcmp(name, "NID_mdc2", 8)) {
/* ^ */
#ifdef NID_mdc2
return NID_mdc2;
#else
goto not_there;
#endif
}
break;
case 'h':
if (!memcmp(name, "NID_sha1", 8)) {
/* ^ */
#ifdef NID_sha1
return NID_sha1;
#else
goto not_there;
#endif
}
break;
case 'k':
if (!memcmp(name, "NID_pkcs", 8)) {
/* ^ */
#ifdef NID_pkcs
return NID_pkcs;
#else
goto not_there;
#endif
}
break;
}
break;
case 9:
/* Names all of length 9. */
/* ERROR_SSL EVP_PK_DH EVP_PK_EC F_SSL_NEW GEN_EMAIL GEN_IPADD NID_dsa_2
NID_id_ad NID_id_ce NID_id_kp NID_id_pe NID_pbes2 NID_pkcs3 NID_pkcs7
NID_pkcs9 NID_sxnet NID_title NID_undef ST_ACCEPT ST_BEFORE X509_V_OK */
/* Offset 8 gives the best switch position. */
switch (name[8]) {
case '2':
if (!memcmp(name, "NID_dsa_", 8)) {
/* 2 */
#ifdef NID_dsa_2
return NID_dsa_2;
#else
goto not_there;
#endif
}
if (!memcmp(name, "NID_pbes", 8)) {
/* 2 */
#ifdef NID_pbes2
return NID_pbes2;
#else
goto not_there;
#endif
}
break;
case '3':
if (!memcmp(name, "NID_pkcs", 8)) {
/* 3 */
#ifdef NID_pkcs3
return NID_pkcs3;
#else
goto not_there;
#endif
}
break;
case '7':
if (!memcmp(name, "NID_pkcs", 8)) {
/* 7 */
#ifdef NID_pkcs7
return NID_pkcs7;
#else
goto not_there;
#endif
}
break;
case '9':
if (!memcmp(name, "NID_pkcs", 8)) {
/* 9 */
#ifdef NID_pkcs9
return NID_pkcs9;
#else
goto not_there;
#endif
}
break;
case 'C':
if (!memcmp(name, "EVP_PK_E", 8)) {
/* C */
#ifdef EVP_PK_EC
return EVP_PK_EC;
#else
goto not_there;
#endif
}
break;
case 'D':
if (!memcmp(name, "GEN_IPAD", 8)) {
/* D */
#ifdef GEN_IPADD
return GEN_IPADD;
#else
goto not_there;
#endif
}
break;
case 'E':
if (!memcmp(name, "ST_BEFOR", 8)) {
/* E */
#ifdef SSL_ST_BEFORE
return SSL_ST_BEFORE;
#else
goto not_there;
#endif
}
break;
case 'H':
if (!memcmp(name, "EVP_PK_D", 8)) {
/* H */
#ifdef EVP_PK_DH
return EVP_PK_DH;
#else
goto not_there;
#endif
}
break;
case 'K':
if (!memcmp(name, "X509_V_O", 8)) {
/* K */
#ifdef X509_V_OK
return X509_V_OK;
#else
goto not_there;
#endif
}
break;
case 'L':
if (!memcmp(name, "ERROR_SS", 8)) {
/* L */
#ifdef SSL_ERROR_SSL
return SSL_ERROR_SSL;
#else
goto not_there;
#endif
}
if (!memcmp(name, "GEN_EMAI", 8)) {
/* L */
#ifdef GEN_EMAIL
return GEN_EMAIL;
#else
goto not_there;
#endif
}
break;
case 'T':
if (!memcmp(name, "ST_ACCEP", 8)) {
/* T */
#ifdef SSL_ST_ACCEPT
return SSL_ST_ACCEPT;
#else
goto not_there;
#endif
}
break;
case 'W':
if (!memcmp(name, "F_SSL_NE", 8)) {
/* W */
#ifdef SSL_F_SSL_NEW
return SSL_F_SSL_NEW;
#else
goto not_there;
#endif
}
break;
case 'd':
if (!memcmp(name, "NID_id_a", 8)) {
/* d */
#ifdef NID_id_ad
return NID_id_ad;
#else
goto not_there;
#endif
}
break;
case 'e':
if (!memcmp(name, "NID_id_c", 8)) {
/* e */
#ifdef NID_id_ce
return NID_id_ce;
#else
goto not_there;
#endif
}
if (!memcmp(name, "NID_id_p", 8)) {
/* e */
#ifdef NID_id_pe
return NID_id_pe;
#else
goto not_there;
#endif
}
if (!memcmp(name, "NID_titl", 8)) {
/* e */
#ifdef NID_title
return NID_title;
#else
goto not_there;
#endif
}
break;
case 'f':
if (!memcmp(name, "NID_unde", 8)) {
/* f */
#ifdef NID_undef
return NID_undef;
#else
goto not_there;
#endif
}
break;
case 'p':
if (!memcmp(name, "NID_id_k", 8)) {
/* p */
#ifdef NID_id_kp
return NID_id_kp;
#else
goto not_there;
#endif
}
break;
case 't':
if (!memcmp(name, "NID_sxne", 8)) {
/* t */
#ifdef NID_sxnet
return NID_sxnet;
#else
goto not_there;
#endif
}
break;
}
break;
case 10:
/* Names all of length 10. */
/* ERROR_NONE EVP_PKS_EC EVP_PK_DSA EVP_PK_RSA F_SSL_READ MODE_ASYNC
NID_bf_cbc NID_bf_ecb NID_crlBag NID_keyBag NID_ms_efs NID_ms_sgc
NID_ns_sgc NID_pbmac1 NID_rc4_40 NID_rsadsi NID_sha224 NID_sha256
NID_sha384 NID_sha512 R_X509_LIB SSLEAY_DIR ST_CONNECT */
/* Offset 8 gives the best switch position. */
switch (name[8]) {
case '1':
if (!memcmp(name, "NID_sha512", 10)) {
/* ^ */
#ifdef NID_sha512
return NID_sha512;
#else
goto not_there;
#endif
}
break;
case '2':
if (!memcmp(name, "NID_sha224", 10)) {
/* ^ */
#ifdef NID_sha224
return NID_sha224;
#else
goto not_there;
#endif
}
break;
case '4':
if (!memcmp(name, "NID_rc4_40", 10)) {
/* ^ */
#ifdef NID_rc4_40
return NID_rc4_40;
#else
goto not_there;
#endif
}
break;
case '5':
if (!memcmp(name, "NID_sha256", 10)) {
/* ^ */
#ifdef NID_sha256
return NID_sha256;
#else
goto not_there;
#endif
}
break;
case '8':
if (!memcmp(name, "NID_sha384", 10)) {
/* ^ */
#ifdef NID_sha384
return NID_sha384;
#else
goto not_there;
#endif
}
break;
case 'A':
if (!memcmp(name, "F_SSL_READ", 10)) {
/* ^ */
#ifdef SSL_F_SSL_READ
return SSL_F_SSL_READ;
#else
goto not_there;
#endif
}
break;
case 'C':
if (!memcmp(name, "ST_CONNECT", 10)) {
/* ^ */
#ifdef SSL_ST_CONNECT
return SSL_ST_CONNECT;
#else
goto not_there;
#endif
}
break;
case 'E':
if (!memcmp(name, "EVP_PKS_EC", 10)) {
/* ^ */
#ifdef EVP_PKS_EC
return EVP_PKS_EC;
#else
goto not_there;
#endif
}
break;
case 'I':
if (!memcmp(name, "R_X509_LIB", 10)) {
/* ^ */
#ifdef SSL_R_X509_LIB
return SSL_R_X509_LIB;
#else
goto not_there;
#endif
}
if (!memcmp(name, "SSLEAY_DIR", 10)) {
/* ^ */
#ifdef SSLEAY_DIR
return SSLEAY_DIR;
#else
goto not_there;
#endif
}
break;
case 'N':
if (!memcmp(name, "ERROR_NONE", 10)) {
/* ^ */
#ifdef SSL_ERROR_NONE
return SSL_ERROR_NONE;
#else
goto not_there;
#endif
}
if (!memcmp(name, "MODE_ASYNC", 10)) {
/* ^ */
#ifdef SSL_MODE_ASYNC
return SSL_MODE_ASYNC;
#else
goto not_there;
#endif
}
break;
case 'S':
if (!memcmp(name, "EVP_PK_DSA", 10)) {
/* ^ */
#ifdef EVP_PK_DSA
return EVP_PK_DSA;
#else
goto not_there;
#endif
}
if (!memcmp(name, "EVP_PK_RSA", 10)) {
/* ^ */
#ifdef EVP_PK_RSA
return EVP_PK_RSA;
#else
goto not_there;
#endif
}
break;
case 'a':
if (!memcmp(name, "NID_crlBag", 10)) {
/* ^ */
#ifdef NID_crlBag
return NID_crlBag;
#else
goto not_there;
#endif
}
if (!memcmp(name, "NID_keyBag", 10)) {
/* ^ */
#ifdef NID_keyBag
return NID_keyBag;
#else
goto not_there;
#endif
}
break;
case 'b':
if (!memcmp(name, "NID_bf_cbc", 10)) {
/* ^ */
#ifdef NID_bf_cbc
return NID_bf_cbc;
#else
goto not_there;
#endif
}
break;
case 'c':
if (!memcmp(name, "NID_bf_ecb", 10)) {
/* ^ */
#ifdef NID_bf_ecb
return NID_bf_ecb;
#else
goto not_there;
#endif
}
if (!memcmp(name, "NID_pbmac1", 10)) {
/* ^ */
#ifdef NID_pbmac1
return NID_pbmac1;
#else
goto not_there;
#endif
}
break;
case 'f':
if (!memcmp(name, "NID_ms_efs", 10)) {
/* ^ */
#ifdef NID_ms_efs
return NID_ms_efs;
#else
goto not_there;
#endif
}
break;
case 'g':
if (!memcmp(name, "NID_ms_sgc", 10)) {
/* ^ */
#ifdef NID_ms_sgc
return NID_ms_sgc;
#else
goto not_there;
#endif
}
if (!memcmp(name, "NID_ns_sgc", 10)) {
/* ^ */
#ifdef NID_ns_sgc
return NID_ns_sgc;
#else
goto not_there;
#endif
}
break;
case 's':
if (!memcmp(name, "NID_rsadsi", 10)) {
/* ^ */
#ifdef NID_rsadsi
return NID_rsadsi;
#else
goto not_there;
#endif
}
break;
}
break;
case 11:
/* Names all of length 11. */
/* EVP_PKS_DSA EVP_PKS_RSA EVP_PKT_ENC EVP_PKT_EXP GEN_DIRNAME NID_ad_OCSP
NID_certBag NID_des_cbc NID_des_ecb NID_des_ede NID_ext_req NID_id_pkix
NID_rc2_cbc NID_rc2_ecb NID_rc5_cbc NID_rc5_ecb NID_surname NID_x509Crl
OPENSSL_DIR OP_NO_SSLv2 OP_NO_SSLv3 OP_NO_TLSv1 R_BAD_STATE SSL3_MT_CCS
VERIFY_NONE VERIFY_PEER X509_LOOKUP */
/* Offset 9 gives the best switch position. */
switch (name[9]) {
case 'C':
if (!memcmp(name, "SSL3_MT_CCS", 11)) {
/* ^ */
#ifdef SSL3_MT_CCS
return SSL3_MT_CCS;
#else
goto not_there;
#endif
}
break;
case 'E':
if (!memcmp(name, "VERIFY_PEER", 11)) {
/* ^ */
#ifdef SSL_VERIFY_PEER
return SSL_VERIFY_PEER;
#else
goto not_there;
#endif
}
break;
case 'I':
if (!memcmp(name, "OPENSSL_DIR", 11)) {
/* ^ */
#ifdef OPENSSL_DIR
return OPENSSL_DIR;
#else
goto not_there;
#endif
}
break;
case 'M':
if (!memcmp(name, "GEN_DIRNAME", 11)) {
/* ^ */
#ifdef GEN_DIRNAME
return GEN_DIRNAME;
#else
goto not_there;
#endif
}
break;
case 'N':
if (!memcmp(name, "EVP_PKT_ENC", 11)) {
/* ^ */
#ifdef EVP_PKT_ENC
return EVP_PKT_ENC;
#else
goto not_there;
#endif
}
if (!memcmp(name, "VERIFY_NONE", 11)) {
/* ^ */
#ifdef SSL_VERIFY_NONE
return SSL_VERIFY_NONE;
#else
goto not_there;
#endif
}