Go to the documentation of this file.
40 const char *var_start = strstr(peer_info, var);
47 var_start += strlen(var);
48 const char *var_end = strstr(var_start,
"\n");
52 var_end = var_start + strlen(var_start);
57 var_value[var_end - var_start] =
'\0';
64 const char *optstr = peer_info ? strstr(peer_info,
"IV_PROTO=") : NULL;
68 int r = sscanf(optstr,
"IV_PROTO=%d", &proto);
69 if (r == 1 && proto > 0)
89 const char *tmp = strstr(
options,
",link-mtu");
97 if (sscanf(tmp,
",link-mtu %d,", &link_mtu) != 1 || link_mtu < 100 || link_mtu > 9900)
109 buf_printf(&buf,
",link-mtu %d", link_mtu + 1);
111 tmp += strlen(
",link-mtu ") + (link_mtu < 1000 ? 3 : 4);
122 {
"ADH-SEED-SHA",
"TLS-DH-anon-WITH-SEED-CBC-SHA"},
123 {
"AES128-GCM-SHA256",
"TLS-RSA-WITH-AES-128-GCM-SHA256"},
124 {
"AES128-SHA256",
"TLS-RSA-WITH-AES-128-CBC-SHA256"},
125 {
"AES128-SHA",
"TLS-RSA-WITH-AES-128-CBC-SHA"},
126 {
"AES256-GCM-SHA384",
"TLS-RSA-WITH-AES-256-GCM-SHA384"},
127 {
"AES256-SHA256",
"TLS-RSA-WITH-AES-256-CBC-SHA256"},
128 {
"AES256-SHA",
"TLS-RSA-WITH-AES-256-CBC-SHA"},
129 {
"CAMELLIA128-SHA256",
"TLS-RSA-WITH-CAMELLIA-128-CBC-SHA256"},
130 {
"CAMELLIA128-SHA",
"TLS-RSA-WITH-CAMELLIA-128-CBC-SHA"},
131 {
"CAMELLIA256-SHA256",
"TLS-RSA-WITH-CAMELLIA-256-CBC-SHA256"},
132 {
"CAMELLIA256-SHA",
"TLS-RSA-WITH-CAMELLIA-256-CBC-SHA"},
133 {
"DES-CBC3-SHA",
"TLS-RSA-WITH-3DES-EDE-CBC-SHA"},
134 {
"DES-CBC-SHA",
"TLS-RSA-WITH-DES-CBC-SHA"},
135 {
"DH-DSS-SEED-SHA",
"TLS-DH-DSS-WITH-SEED-CBC-SHA"},
136 {
"DHE-DSS-AES128-GCM-SHA256",
"TLS-DHE-DSS-WITH-AES-128-GCM-SHA256"},
137 {
"DHE-DSS-AES128-SHA256",
"TLS-DHE-DSS-WITH-AES-128-CBC-SHA256"},
138 {
"DHE-DSS-AES128-SHA",
"TLS-DHE-DSS-WITH-AES-128-CBC-SHA"},
139 {
"DHE-DSS-AES256-GCM-SHA384",
"TLS-DHE-DSS-WITH-AES-256-GCM-SHA384"},
140 {
"DHE-DSS-AES256-SHA256",
"TLS-DHE-DSS-WITH-AES-256-CBC-SHA256"},
141 {
"DHE-DSS-AES256-SHA",
"TLS-DHE-DSS-WITH-AES-256-CBC-SHA"},
142 {
"DHE-DSS-CAMELLIA128-SHA256",
"TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA256"},
143 {
"DHE-DSS-CAMELLIA128-SHA",
"TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA"},
144 {
"DHE-DSS-CAMELLIA256-SHA256",
"TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA256"},
145 {
"DHE-DSS-CAMELLIA256-SHA",
"TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA"},
146 {
"DHE-DSS-SEED-SHA",
"TLS-DHE-DSS-WITH-SEED-CBC-SHA"},
147 {
"DHE-RSA-AES128-GCM-SHA256",
"TLS-DHE-RSA-WITH-AES-128-GCM-SHA256"},
148 {
"DHE-RSA-AES128-SHA256",
"TLS-DHE-RSA-WITH-AES-128-CBC-SHA256"},
149 {
"DHE-RSA-AES128-SHA",
"TLS-DHE-RSA-WITH-AES-128-CBC-SHA"},
150 {
"DHE-RSA-AES256-GCM-SHA384",
"TLS-DHE-RSA-WITH-AES-256-GCM-SHA384"},
151 {
"DHE-RSA-AES256-SHA256",
"TLS-DHE-RSA-WITH-AES-256-CBC-SHA256"},
152 {
"DHE-RSA-AES256-SHA",
"TLS-DHE-RSA-WITH-AES-256-CBC-SHA"},
153 {
"DHE-RSA-CAMELLIA128-SHA256",
"TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA256"},
154 {
"DHE-RSA-CAMELLIA128-SHA",
"TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA"},
155 {
"DHE-RSA-CAMELLIA256-SHA256",
"TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA256"},
156 {
"DHE-RSA-CAMELLIA256-SHA",
"TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA"},
157 {
"DHE-RSA-CHACHA20-POLY1305",
"TLS-DHE-RSA-WITH-CHACHA20-POLY1305-SHA256"},
158 {
"DHE-RSA-SEED-SHA",
"TLS-DHE-RSA-WITH-SEED-CBC-SHA"},
159 {
"DH-RSA-SEED-SHA",
"TLS-DH-RSA-WITH-SEED-CBC-SHA"},
160 {
"ECDH-ECDSA-AES128-GCM-SHA256",
"TLS-ECDH-ECDSA-WITH-AES-128-GCM-SHA256"},
161 {
"ECDH-ECDSA-AES128-SHA256",
"TLS-ECDH-ECDSA-WITH-AES-128-CBC-SHA256"},
162 {
"ECDH-ECDSA-AES128-SHA",
"TLS-ECDH-ECDSA-WITH-AES-128-CBC-SHA"},
163 {
"ECDH-ECDSA-AES256-GCM-SHA384",
"TLS-ECDH-ECDSA-WITH-AES-256-GCM-SHA384"},
164 {
"ECDH-ECDSA-AES256-SHA256",
"TLS-ECDH-ECDSA-WITH-AES-256-CBC-SHA256"},
165 {
"ECDH-ECDSA-AES256-SHA384",
"TLS-ECDH-ECDSA-WITH-AES-256-CBC-SHA384"},
166 {
"ECDH-ECDSA-AES256-SHA",
"TLS-ECDH-ECDSA-WITH-AES-256-CBC-SHA"},
167 {
"ECDH-ECDSA-CAMELLIA128-SHA256",
"TLS-ECDH-ECDSA-WITH-CAMELLIA-128-CBC-SHA256"},
168 {
"ECDH-ECDSA-CAMELLIA128-SHA",
"TLS-ECDH-ECDSA-WITH-CAMELLIA-128-CBC-SHA"},
169 {
"ECDH-ECDSA-CAMELLIA256-SHA256",
"TLS-ECDH-ECDSA-WITH-CAMELLIA-256-CBC-SHA256"},
170 {
"ECDH-ECDSA-CAMELLIA256-SHA",
"TLS-ECDH-ECDSA-WITH-CAMELLIA-256-CBC-SHA"},
171 {
"ECDH-ECDSA-DES-CBC3-SHA",
"TLS-ECDH-ECDSA-WITH-3DES-EDE-CBC-SHA"},
172 {
"ECDH-ECDSA-DES-CBC-SHA",
"TLS-ECDH-ECDSA-WITH-DES-CBC-SHA"},
173 {
"ECDH-ECDSA-RC4-SHA",
"TLS-ECDH-ECDSA-WITH-RC4-128-SHA"},
174 {
"ECDHE-ECDSA-AES128-GCM-SHA256",
"TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256"},
175 {
"ECDHE-ECDSA-AES128-SHA256",
"TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256"},
176 {
"ECDHE-ECDSA-AES128-SHA384",
"TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA384"},
177 {
"ECDHE-ECDSA-AES128-SHA",
"TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA"},
178 {
"ECDHE-ECDSA-AES256-GCM-SHA384",
"TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384"},
179 {
"ECDHE-ECDSA-AES256-SHA256",
"TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA256"},
180 {
"ECDHE-ECDSA-AES256-SHA384",
"TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA384"},
181 {
"ECDHE-ECDSA-AES256-SHA",
"TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA"},
182 {
"ECDHE-ECDSA-CAMELLIA128-SHA256",
"TLS-ECDHE-ECDSA-WITH-CAMELLIA-128-CBC-SHA256"},
183 {
"ECDHE-ECDSA-CAMELLIA128-SHA",
"TLS-ECDHE-ECDSA-WITH-CAMELLIA-128-CBC-SHA"},
184 {
"ECDHE-ECDSA-CAMELLIA256-SHA256",
"TLS-ECDHE-ECDSA-WITH-CAMELLIA-256-CBC-SHA256"},
185 {
"ECDHE-ECDSA-CAMELLIA256-SHA",
"TLS-ECDHE-ECDSA-WITH-CAMELLIA-256-CBC-SHA"},
186 {
"ECDHE-ECDSA-CHACHA20-POLY1305",
"TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256"},
187 {
"ECDHE-ECDSA-DES-CBC3-SHA",
"TLS-ECDHE-ECDSA-WITH-3DES-EDE-CBC-SHA"},
188 {
"ECDHE-ECDSA-DES-CBC-SHA",
"TLS-ECDHE-ECDSA-WITH-DES-CBC-SHA"},
189 {
"ECDHE-ECDSA-RC4-SHA",
"TLS-ECDHE-ECDSA-WITH-RC4-128-SHA"},
190 {
"ECDHE-RSA-AES128-GCM-SHA256",
"TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256"},
191 {
"ECDHE-RSA-AES128-SHA256",
"TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256"},
192 {
"ECDHE-RSA-AES128-SHA384",
"TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA384"},
193 {
"ECDHE-RSA-AES128-SHA",
"TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA"},
194 {
"ECDHE-RSA-AES256-GCM-SHA384",
"TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384"},
195 {
"ECDHE-RSA-AES256-SHA256",
"TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA256"},
196 {
"ECDHE-RSA-AES256-SHA384",
"TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384"},
197 {
"ECDHE-RSA-AES256-SHA",
"TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA"},
198 {
"ECDHE-RSA-CAMELLIA128-SHA256",
"TLS-ECDHE-RSA-WITH-CAMELLIA-128-CBC-SHA256"},
199 {
"ECDHE-RSA-CAMELLIA128-SHA",
"TLS-ECDHE-RSA-WITH-CAMELLIA-128-CBC-SHA"},
200 {
"ECDHE-RSA-CAMELLIA256-SHA256",
"TLS-ECDHE-RSA-WITH-CAMELLIA-256-CBC-SHA256"},
201 {
"ECDHE-RSA-CAMELLIA256-SHA",
"TLS-ECDHE-RSA-WITH-CAMELLIA-256-CBC-SHA"},
202 {
"ECDHE-RSA-CHACHA20-POLY1305",
"TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256"},
203 {
"ECDHE-RSA-DES-CBC3-SHA",
"TLS-ECDHE-RSA-WITH-3DES-EDE-CBC-SHA"},
204 {
"ECDHE-RSA-DES-CBC-SHA",
"TLS-ECDHE-RSA-WITH-DES-CBC-SHA"},
205 {
"ECDHE-RSA-RC4-SHA",
"TLS-ECDHE-RSA-WITH-RC4-128-SHA"},
206 {
"ECDH-RSA-AES128-GCM-SHA256",
"TLS-ECDH-RSA-WITH-AES-128-GCM-SHA256"},
207 {
"ECDH-RSA-AES128-SHA256",
"TLS-ECDH-RSA-WITH-AES-128-CBC-SHA256"},
208 {
"ECDH-RSA-AES128-SHA384",
"TLS-ECDH-RSA-WITH-AES-128-CBC-SHA384"},
209 {
"ECDH-RSA-AES128-SHA",
"TLS-ECDH-RSA-WITH-AES-128-CBC-SHA"},
210 {
"ECDH-RSA-AES256-GCM-SHA384",
"TLS-ECDH-RSA-WITH-AES-256-GCM-SHA384"},
211 {
"ECDH-RSA-AES256-SHA256",
"TLS-ECDH-RSA-WITH-AES-256-CBC-SHA256"},
212 {
"ECDH-RSA-AES256-SHA384",
"TLS-ECDH-RSA-WITH-AES-256-CBC-SHA384"},
213 {
"ECDH-RSA-AES256-SHA",
"TLS-ECDH-RSA-WITH-AES-256-CBC-SHA"},
214 {
"ECDH-RSA-CAMELLIA128-SHA256",
"TLS-ECDH-RSA-WITH-CAMELLIA-128-CBC-SHA256"},
215 {
"ECDH-RSA-CAMELLIA128-SHA",
"TLS-ECDH-RSA-WITH-CAMELLIA-128-CBC-SHA"},
216 {
"ECDH-RSA-CAMELLIA256-SHA256",
"TLS-ECDH-RSA-WITH-CAMELLIA-256-CBC-SHA256"},
217 {
"ECDH-RSA-CAMELLIA256-SHA",
"TLS-ECDH-RSA-WITH-CAMELLIA-256-CBC-SHA"},
218 {
"ECDH-RSA-DES-CBC3-SHA",
"TLS-ECDH-RSA-WITH-3DES-EDE-CBC-SHA"},
219 {
"ECDH-RSA-DES-CBC-SHA",
"TLS-ECDH-RSA-WITH-DES-CBC-SHA"},
220 {
"ECDH-RSA-RC4-SHA",
"TLS-ECDH-RSA-WITH-RC4-128-SHA"},
221 {
"EDH-DSS-DES-CBC3-SHA",
"TLS-DHE-DSS-WITH-3DES-EDE-CBC-SHA"},
222 {
"EDH-DSS-DES-CBC-SHA",
"TLS-DHE-DSS-WITH-DES-CBC-SHA"},
223 {
"EDH-RSA-DES-CBC3-SHA",
"TLS-DHE-RSA-WITH-3DES-EDE-CBC-SHA"},
224 {
"EDH-RSA-DES-CBC-SHA",
"TLS-DHE-RSA-WITH-DES-CBC-SHA"},
225 {
"EXP-DES-CBC-SHA",
"TLS-RSA-EXPORT-WITH-DES40-CBC-SHA"},
226 {
"EXP-EDH-DSS-DES-CBC-SHA",
"TLS-DH-DSS-EXPORT-WITH-DES40-CBC-SHA"},
227 {
"EXP-EDH-RSA-DES-CBC-SHA",
"TLS-DH-RSA-EXPORT-WITH-DES40-CBC-SHA"},
228 {
"EXP-RC2-CBC-MD5",
"TLS-RSA-EXPORT-WITH-RC2-CBC-40-MD5"},
229 {
"EXP-RC4-MD5",
"TLS-RSA-EXPORT-WITH-RC4-40-MD5"},
230 {
"NULL-MD5",
"TLS-RSA-WITH-NULL-MD5"},
231 {
"NULL-SHA256",
"TLS-RSA-WITH-NULL-SHA256"},
232 {
"NULL-SHA",
"TLS-RSA-WITH-NULL-SHA"},
233 {
"PSK-3DES-EDE-CBC-SHA",
"TLS-PSK-WITH-3DES-EDE-CBC-SHA"},
234 {
"PSK-AES128-CBC-SHA",
"TLS-PSK-WITH-AES-128-CBC-SHA"},
235 {
"PSK-AES256-CBC-SHA",
"TLS-PSK-WITH-AES-256-CBC-SHA"},
236 {
"PSK-RC4-SHA",
"TLS-PSK-WITH-RC4-128-SHA"},
237 {
"RC4-MD5",
"TLS-RSA-WITH-RC4-128-MD5"},
238 {
"RC4-SHA",
"TLS-RSA-WITH-RC4-128-SHA"},
239 {
"SEED-SHA",
"TLS-RSA-WITH-SEED-CBC-SHA"},
240 {
"SRP-DSS-3DES-EDE-CBC-SHA",
"TLS-SRP-SHA-DSS-WITH-3DES-EDE-CBC-SHA"},
241 {
"SRP-DSS-AES-128-CBC-SHA",
"TLS-SRP-SHA-DSS-WITH-AES-128-CBC-SHA"},
242 {
"SRP-DSS-AES-256-CBC-SHA",
"TLS-SRP-SHA-DSS-WITH-AES-256-CBC-SHA"},
243 {
"SRP-RSA-3DES-EDE-CBC-SHA",
"TLS-SRP-SHA-RSA-WITH-3DES-EDE-CBC-SHA"},
244 {
"SRP-RSA-AES-128-CBC-SHA",
"TLS-SRP-SHA-RSA-WITH-AES-128-CBC-SHA"},
245 {
"SRP-RSA-AES-256-CBC-SHA",
"TLS-SRP-SHA-RSA-WITH-AES-256-CBC-SHA"},
246 #ifdef ENABLE_CRYPTO_OPENSSL
248 {
"DEFAULT",
"DEFAULT"},
250 {
"HIGH",
"HIGH"}, {
"!HIGH",
"!HIGH"},
251 {
"MEDIUM",
"MEDIUM"}, {
"!MEDIUM",
"!MEDIUM"},
252 {
"LOW",
"LOW"}, {
"!LOW",
"!LOW"},
253 {
"ECDH",
"ECDH"}, {
"!ECDH",
"!ECDH"},
254 {
"ECDSA",
"ECDSA"}, {
"!ECDSA",
"!ECDSA"},
255 {
"EDH",
"EDH"}, {
"!EDH",
"!EDH"},
256 {
"EXP",
"EXP"}, {
"!EXP",
"!EXP"},
257 {
"RSA",
"RSA"}, {
"!RSA",
"!RSA"},
258 {
"kRSA",
"kRSA"}, {
"!kRSA",
"!kRSA"},
259 {
"SRP",
"SRP"}, {
"!SRP",
"!SRP"},
286 int string_len = strlen(
string);
290 int element_count = 1;
292 for (
int i = 0; i < string_len; i++)
294 if (
string[i] == delimiter)
300 return element_count;
int len
Length in bytes of the actual content within the allocated memory.
struct buffer alloc_buf_gc(size_t size, struct gc_arena *gc)
int get_num_elements(const char *string, char delimiter)
Returns the occurrences of 'delimiter' in a string +1 This is typically used to find out the number e...
static const tls_cipher_name_pair tls_cipher_name_translation_table[]
SSL/TLS Cipher suite name translation table.
char * string_alloc(const char *str, struct gc_arena *gc)
const tls_cipher_name_pair * tls_get_cipher_name_pair(const char *cipher_name, size_t len)
Wrapper structure for dynamically allocated memory.
static bool buf_write(struct buffer *dest, const void *src, size_t size)
Garbage collection arena used to keep track of dynamically allocated memory.
const char * openssl_name
unsigned int extract_iv_proto(const char *peer_info)
Extracts the IV_PROTO variable and returns its value or 0 if it cannot be extracted.
const char * options_string_compat_lzo(const char *options, struct gc_arena *gc)
Takes a locally produced OCC string for TLS server mode and modifies as if the option comp-lzo was en...
char * extract_var_peer_info(const char *peer_info, const char *var, struct gc_arena *gc)
Extracts a variable from peer info, the returned string will be allocated using the supplied gc_arena...
bool buf_printf(struct buffer *buf, const char *format,...)
Get a tls_cipher_name_pair containing OpenSSL and IANA names for supplied TLS cipher name.