Fix CVE-2017-6891 in minitasn1 code
[platform/upstream/gnutls.git] / lib / priority_options.h
1 /* ANSI-C code produced by gperf version 3.0.4 */
2 /* Command-line: gperf -t priority_options.gperf  */
3 /* Computed positions: -k'9,$' */
4
5 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
6       && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
7       && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
8       && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
9       && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
10       && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
11       && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
12       && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
13       && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
14       && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
15       && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
16       && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
17       && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
18       && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
19       && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
20       && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
21       && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
22       && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
23       && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
24       && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
25       && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
26       && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
27       && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
28 /* The character set is not based on ISO-646.  */
29 #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
30 #endif
31
32 #line 1 "priority_options.gperf"
33
34 typedef void (*option_set_func)(gnutls_priority_t);
35 static const struct priority_options_st *in_word_set(register const char *str, register unsigned int len);
36 #line 7 "priority_options.gperf"
37 struct priority_options_st { const char *name; option_set_func func; };
38
39 #define TOTAL_KEYWORDS 24
40 #define MIN_WORD_LENGTH 6
41 #define MAX_WORD_LENGTH 27
42 #define MIN_HASH_VALUE 6
43 #define MAX_HASH_VALUE 42
44 /* maximum key range = 37, duplicates = 0 */
45
46 #ifdef __GNUC__
47 __inline
48 #else
49 #ifdef __cplusplus
50 inline
51 #endif
52 #endif
53 static unsigned int
54 hash (register const char *str, register unsigned int len)
55 {
56   static const unsigned char asso_values[] =
57     {
58       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
59       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
60       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
61       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
62       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
63       15, 43, 43,  5, 43, 43, 10, 43, 43, 43,
64       43, 43, 43, 43, 43,  5, 43, 43, 43, 10,
65       43, 30,  0,  0, 43,  5,  5,  0,  0,  5,
66       43, 43, 15,  0,  5,  0,  0,  0, 43,  0,
67       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
68       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
69       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
70       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
71       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
72       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
73       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
74       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
75       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
76       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
77       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
78       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
79       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
80       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
81       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
82       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
83       43, 43, 43, 43, 43, 43
84     };
85   register int hval = len;
86
87   switch (hval)
88     {
89       default:
90         hval += asso_values[(unsigned char)str[8]];
91       /*FALLTHROUGH*/
92       case 8:
93       case 7:
94       case 6:
95         break;
96     }
97   return hval + asso_values[(unsigned char)str[len - 1]];
98 }
99
100 #ifdef __GNUC__
101 __inline
102 #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
103 __attribute__ ((__gnu_inline__))
104 #endif
105 #endif
106 const struct priority_options_st *
107 in_word_set (register const char *str, register unsigned int len)
108 {
109   static const struct priority_options_st wordlist[] =
110     {
111       {""}, {""}, {""}, {""}, {""}, {""},
112 #line 10 "priority_options.gperf"
113       {"DUMBFW", enable_dumbfw},
114       {""}, {""}, {""}, {""},
115 #line 9 "priority_options.gperf"
116       {"COMPAT", enable_compat},
117 #line 28 "priority_options.gperf"
118       {"PROFILE_HIGH", enable_profile_high},
119 #line 11 "priority_options.gperf"
120       {"NO_EXTENSIONS", enable_no_extensions},
121 #line 27 "priority_options.gperf"
122       {"PROFILE_MEDIUM", enable_profile_medium},
123       {""},
124 #line 25 "priority_options.gperf"
125       {"PROFILE_LOW", enable_profile_low},
126 #line 22 "priority_options.gperf"
127       {"DISABLE_WILDCARDS", disable_wildcards},
128 #line 29 "priority_options.gperf"
129       {"PROFILE_ULTRA", enable_profile_ultra},
130 #line 26 "priority_options.gperf"
131       {"PROFILE_LEGACY", enable_profile_legacy},
132       {""},
133 #line 12 "priority_options.gperf"
134       {"STATELESS_COMPRESSION", enable_stateless_compression},
135 #line 24 "priority_options.gperf"
136       {"PROFILE_VERY_WEAK", enable_profile_very_weak},
137       {""},
138 #line 15 "priority_options.gperf"
139       {"SSL3_RECORD_VERSION", enable_ssl3_record_version},
140 #line 14 "priority_options.gperf"
141       {"VERIFY_DISABLE_CRL_CHECKS", disable_crl_checks},
142 #line 21 "priority_options.gperf"
143       {"DISABLE_SAFE_RENEGOTIATION", disable_safe_renegotiation},
144 #line 30 "priority_options.gperf"
145       {"PROFILE_SUITEB128", enable_profile_suiteb128},
146 #line 19 "priority_options.gperf"
147       {"SAFE_RENEGOTIATION", enable_safe_renegotiation},
148       {""},
149 #line 18 "priority_options.gperf"
150       {"UNSAFE_RENEGOTIATION", enable_unsafe_renegotiation},
151 #line 16 "priority_options.gperf"
152       {"LATEST_RECORD_VERSION", enable_latest_record_version},
153 #line 31 "priority_options.gperf"
154       {"PROFILE_SUITEB192", enable_profile_suiteb192},
155       {""}, {""},
156 #line 13 "priority_options.gperf"
157       {"VERIFY_ALLOW_SIGN_RSA_MD5", enable_verify_allow_rsa_md5},
158 #line 20 "priority_options.gperf"
159       {"PARTIAL_RENEGOTIATION", enable_partial_safe_renegotiation},
160 #line 17 "priority_options.gperf"
161       {"VERIFY_ALLOW_X509_V1_CA_CRT", dummy_func},
162       {""}, {""}, {""},
163 #line 32 "priority_options.gperf"
164       {"NEW_PADDING", dummy_func},
165 #line 23 "priority_options.gperf"
166       {"SERVER_PRECEDENCE", enable_server_precedence}
167     };
168
169   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
170     {
171       register int key = hash (str, len);
172
173       if (key <= MAX_HASH_VALUE && key >= 0)
174         {
175           register const char *s = wordlist[key].name;
176
177           if (*str == *s && !strcmp (str + 1, s + 1))
178             return &wordlist[key];
179         }
180     }
181   return 0;
182 }