diff options
Diffstat (limited to 'src/lib/libssl/ssl_locl.h')
-rw-r--r-- | src/lib/libssl/ssl_locl.h | 875 |
1 files changed, 0 insertions, 875 deletions
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h deleted file mode 100644 index 74b699a48c..0000000000 --- a/src/lib/libssl/ssl_locl.h +++ /dev/null | |||
@@ -1,875 +0,0 @@ | |||
1 | /* $OpenBSD: ssl_locl.h,v 1.100 2015/07/24 07:57:48 doug Exp $ */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | /* ==================================================================== | ||
59 | * Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved. | ||
60 | * | ||
61 | * Redistribution and use in source and binary forms, with or without | ||
62 | * modification, are permitted provided that the following conditions | ||
63 | * are met: | ||
64 | * | ||
65 | * 1. Redistributions of source code must retain the above copyright | ||
66 | * notice, this list of conditions and the following disclaimer. | ||
67 | * | ||
68 | * 2. Redistributions in binary form must reproduce the above copyright | ||
69 | * notice, this list of conditions and the following disclaimer in | ||
70 | * the documentation and/or other materials provided with the | ||
71 | * distribution. | ||
72 | * | ||
73 | * 3. All advertising materials mentioning features or use of this | ||
74 | * software must display the following acknowledgment: | ||
75 | * "This product includes software developed by the OpenSSL Project | ||
76 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
77 | * | ||
78 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
79 | * endorse or promote products derived from this software without | ||
80 | * prior written permission. For written permission, please contact | ||
81 | * openssl-core@openssl.org. | ||
82 | * | ||
83 | * 5. Products derived from this software may not be called "OpenSSL" | ||
84 | * nor may "OpenSSL" appear in their names without prior written | ||
85 | * permission of the OpenSSL Project. | ||
86 | * | ||
87 | * 6. Redistributions of any form whatsoever must retain the following | ||
88 | * acknowledgment: | ||
89 | * "This product includes software developed by the OpenSSL Project | ||
90 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
91 | * | ||
92 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
93 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
94 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
95 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
96 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
97 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
98 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
99 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
100 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
101 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
102 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
103 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
104 | * ==================================================================== | ||
105 | * | ||
106 | * This product includes cryptographic software written by Eric Young | ||
107 | * (eay@cryptsoft.com). This product includes software written by Tim | ||
108 | * Hudson (tjh@cryptsoft.com). | ||
109 | * | ||
110 | */ | ||
111 | /* ==================================================================== | ||
112 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | ||
113 | * ECC cipher suite support in OpenSSL originally developed by | ||
114 | * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project. | ||
115 | */ | ||
116 | /* ==================================================================== | ||
117 | * Copyright 2005 Nokia. All rights reserved. | ||
118 | * | ||
119 | * The portions of the attached software ("Contribution") is developed by | ||
120 | * Nokia Corporation and is licensed pursuant to the OpenSSL open source | ||
121 | * license. | ||
122 | * | ||
123 | * The Contribution, originally written by Mika Kousa and Pasi Eronen of | ||
124 | * Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites | ||
125 | * support (see RFC 4279) to OpenSSL. | ||
126 | * | ||
127 | * No patent licenses or other rights except those expressly stated in | ||
128 | * the OpenSSL open source license shall be deemed granted or received | ||
129 | * expressly, by implication, estoppel, or otherwise. | ||
130 | * | ||
131 | * No assurances are provided by Nokia that the Contribution does not | ||
132 | * infringe the patent or other intellectual property rights of any third | ||
133 | * party or that the license provides you with all the necessary rights | ||
134 | * to make use of the Contribution. | ||
135 | * | ||
136 | * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN | ||
137 | * ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA | ||
138 | * SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY | ||
139 | * OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR | ||
140 | * OTHERWISE. | ||
141 | */ | ||
142 | |||
143 | #ifndef HEADER_SSL_LOCL_H | ||
144 | #define HEADER_SSL_LOCL_H | ||
145 | |||
146 | #include <sys/types.h> | ||
147 | |||
148 | #include <errno.h> | ||
149 | #include <stdlib.h> | ||
150 | #include <string.h> | ||
151 | #include <time.h> | ||
152 | #include <unistd.h> | ||
153 | |||
154 | #include <openssl/opensslconf.h> | ||
155 | #include <openssl/bio.h> | ||
156 | #include <openssl/buffer.h> | ||
157 | #include <openssl/dsa.h> | ||
158 | #include <openssl/err.h> | ||
159 | #include <openssl/rsa.h> | ||
160 | #include <openssl/ssl.h> | ||
161 | #include <openssl/stack.h> | ||
162 | |||
163 | #define c2l(c,l) (l = ((unsigned long)(*((c)++))) , \ | ||
164 | l|=(((unsigned long)(*((c)++)))<< 8), \ | ||
165 | l|=(((unsigned long)(*((c)++)))<<16), \ | ||
166 | l|=(((unsigned long)(*((c)++)))<<24)) | ||
167 | |||
168 | /* NOTE - c is not incremented as per c2l */ | ||
169 | #define c2ln(c,l1,l2,n) { \ | ||
170 | c+=n; \ | ||
171 | l1=l2=0; \ | ||
172 | switch (n) { \ | ||
173 | case 8: l2 =((unsigned long)(*(--(c))))<<24; \ | ||
174 | case 7: l2|=((unsigned long)(*(--(c))))<<16; \ | ||
175 | case 6: l2|=((unsigned long)(*(--(c))))<< 8; \ | ||
176 | case 5: l2|=((unsigned long)(*(--(c)))); \ | ||
177 | case 4: l1 =((unsigned long)(*(--(c))))<<24; \ | ||
178 | case 3: l1|=((unsigned long)(*(--(c))))<<16; \ | ||
179 | case 2: l1|=((unsigned long)(*(--(c))))<< 8; \ | ||
180 | case 1: l1|=((unsigned long)(*(--(c)))); \ | ||
181 | } \ | ||
182 | } | ||
183 | |||
184 | #define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ | ||
185 | *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ | ||
186 | *((c)++)=(unsigned char)(((l)>>16)&0xff), \ | ||
187 | *((c)++)=(unsigned char)(((l)>>24)&0xff)) | ||
188 | |||
189 | #define n2l(c,l) (l =((unsigned long)(*((c)++)))<<24, \ | ||
190 | l|=((unsigned long)(*((c)++)))<<16, \ | ||
191 | l|=((unsigned long)(*((c)++)))<< 8, \ | ||
192 | l|=((unsigned long)(*((c)++)))) | ||
193 | |||
194 | #define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24)&0xff), \ | ||
195 | *((c)++)=(unsigned char)(((l)>>16)&0xff), \ | ||
196 | *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ | ||
197 | *((c)++)=(unsigned char)(((l) )&0xff)) | ||
198 | |||
199 | #define l2n8(l,c) (*((c)++)=(unsigned char)(((l)>>56)&0xff), \ | ||
200 | *((c)++)=(unsigned char)(((l)>>48)&0xff), \ | ||
201 | *((c)++)=(unsigned char)(((l)>>40)&0xff), \ | ||
202 | *((c)++)=(unsigned char)(((l)>>32)&0xff), \ | ||
203 | *((c)++)=(unsigned char)(((l)>>24)&0xff), \ | ||
204 | *((c)++)=(unsigned char)(((l)>>16)&0xff), \ | ||
205 | *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ | ||
206 | *((c)++)=(unsigned char)(((l) )&0xff)) | ||
207 | |||
208 | /* NOTE - c is not incremented as per l2c */ | ||
209 | #define l2cn(l1,l2,c,n) { \ | ||
210 | c+=n; \ | ||
211 | switch (n) { \ | ||
212 | case 8: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \ | ||
213 | case 7: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \ | ||
214 | case 6: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \ | ||
215 | case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ | ||
216 | case 4: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \ | ||
217 | case 3: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \ | ||
218 | case 2: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \ | ||
219 | case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ | ||
220 | } \ | ||
221 | } | ||
222 | |||
223 | #define n2s(c,s) ((s=(((unsigned int)(c[0]))<< 8)| \ | ||
224 | (((unsigned int)(c[1])) )),c+=2) | ||
225 | #define s2n(s,c) ((c[0]=(unsigned char)(((s)>> 8)&0xff), \ | ||
226 | c[1]=(unsigned char)(((s) )&0xff)),c+=2) | ||
227 | |||
228 | #define n2l3(c,l) ((l =(((unsigned long)(c[0]))<<16)| \ | ||
229 | (((unsigned long)(c[1]))<< 8)| \ | ||
230 | (((unsigned long)(c[2])) )),c+=3) | ||
231 | |||
232 | #define l2n3(l,c) ((c[0]=(unsigned char)(((l)>>16)&0xff), \ | ||
233 | c[1]=(unsigned char)(((l)>> 8)&0xff), \ | ||
234 | c[2]=(unsigned char)(((l) )&0xff)),c+=3) | ||
235 | |||
236 | /* LOCAL STUFF */ | ||
237 | |||
238 | #define SSL_DECRYPT 0 | ||
239 | #define SSL_ENCRYPT 1 | ||
240 | |||
241 | /* | ||
242 | * Define the Bitmasks for SSL_CIPHER.algorithms. | ||
243 | * This bits are used packed as dense as possible. If new methods/ciphers | ||
244 | * etc will be added, the bits a likely to change, so this information | ||
245 | * is for internal library use only, even though SSL_CIPHER.algorithms | ||
246 | * can be publicly accessed. | ||
247 | * Use the according functions for cipher management instead. | ||
248 | * | ||
249 | * The bit mask handling in the selection and sorting scheme in | ||
250 | * ssl_create_cipher_list() has only limited capabilities, reflecting | ||
251 | * that the different entities within are mutually exclusive: | ||
252 | * ONLY ONE BIT PER MASK CAN BE SET AT A TIME. | ||
253 | */ | ||
254 | |||
255 | /* Bits for algorithm_mkey (key exchange algorithm) */ | ||
256 | #define SSL_kRSA 0x00000001L /* RSA key exchange */ | ||
257 | #define SSL_kDHE 0x00000008L /* tmp DH key no DH cert */ | ||
258 | #define SSL_kECDHr 0x00000020L /* ECDH cert, RSA CA cert */ | ||
259 | #define SSL_kECDHe 0x00000040L /* ECDH cert, ECDSA CA cert */ | ||
260 | #define SSL_kECDHE 0x00000080L /* ephemeral ECDH */ | ||
261 | #define SSL_kGOST 0x00000200L /* GOST key exchange */ | ||
262 | |||
263 | /* Bits for algorithm_auth (server authentication) */ | ||
264 | #define SSL_aRSA 0x00000001L /* RSA auth */ | ||
265 | #define SSL_aDSS 0x00000002L /* DSS auth */ | ||
266 | #define SSL_aNULL 0x00000004L /* no auth (i.e. use ADH or AECDH) */ | ||
267 | #define SSL_aECDH 0x00000010L /* Fixed ECDH auth (kECDHe or kECDHr) */ | ||
268 | #define SSL_aECDSA 0x00000040L /* ECDSA auth*/ | ||
269 | #define SSL_aGOST01 0x00000200L /* GOST R 34.10-2001 signature auth */ | ||
270 | |||
271 | |||
272 | /* Bits for algorithm_enc (symmetric encryption) */ | ||
273 | #define SSL_DES 0x00000001L | ||
274 | #define SSL_3DES 0x00000002L | ||
275 | #define SSL_RC4 0x00000004L | ||
276 | #define SSL_IDEA 0x00000008L | ||
277 | #define SSL_eNULL 0x00000010L | ||
278 | #define SSL_AES128 0x00000020L | ||
279 | #define SSL_AES256 0x00000040L | ||
280 | #define SSL_CAMELLIA128 0x00000080L | ||
281 | #define SSL_CAMELLIA256 0x00000100L | ||
282 | #define SSL_eGOST2814789CNT 0x00000200L | ||
283 | #define SSL_AES128GCM 0x00000400L | ||
284 | #define SSL_AES256GCM 0x00000800L | ||
285 | #define SSL_CHACHA20POLY1305 0x00001000L | ||
286 | |||
287 | #define SSL_AES (SSL_AES128|SSL_AES256|SSL_AES128GCM|SSL_AES256GCM) | ||
288 | #define SSL_CAMELLIA (SSL_CAMELLIA128|SSL_CAMELLIA256) | ||
289 | |||
290 | |||
291 | /* Bits for algorithm_mac (symmetric authentication) */ | ||
292 | |||
293 | #define SSL_MD5 0x00000001L | ||
294 | #define SSL_SHA1 0x00000002L | ||
295 | #define SSL_GOST94 0x00000004L | ||
296 | #define SSL_GOST89MAC 0x00000008L | ||
297 | #define SSL_SHA256 0x00000010L | ||
298 | #define SSL_SHA384 0x00000020L | ||
299 | /* Not a real MAC, just an indication it is part of cipher */ | ||
300 | #define SSL_AEAD 0x00000040L | ||
301 | #define SSL_STREEBOG256 0x00000080L | ||
302 | #define SSL_STREEBOG512 0x00000100L | ||
303 | |||
304 | /* Bits for algorithm_ssl (protocol version) */ | ||
305 | #define SSL_SSLV3 0x00000002L | ||
306 | #define SSL_TLSV1 SSL_SSLV3 /* for now */ | ||
307 | #define SSL_TLSV1_2 0x00000004L | ||
308 | |||
309 | |||
310 | /* Bits for algorithm2 (handshake digests and other extra flags) */ | ||
311 | |||
312 | #define SSL_HANDSHAKE_MAC_MD5 0x10 | ||
313 | #define SSL_HANDSHAKE_MAC_SHA 0x20 | ||
314 | #define SSL_HANDSHAKE_MAC_GOST94 0x40 | ||
315 | #define SSL_HANDSHAKE_MAC_SHA256 0x80 | ||
316 | #define SSL_HANDSHAKE_MAC_SHA384 0x100 | ||
317 | #define SSL_HANDSHAKE_MAC_STREEBOG256 0x200 | ||
318 | #define SSL_HANDSHAKE_MAC_STREEBOG512 0x400 | ||
319 | #define SSL_HANDSHAKE_MAC_DEFAULT (SSL_HANDSHAKE_MAC_MD5 | SSL_HANDSHAKE_MAC_SHA) | ||
320 | |||
321 | /* When adding new digest in the ssl_ciph.c and increment SSM_MD_NUM_IDX | ||
322 | * make sure to update this constant too */ | ||
323 | #define SSL_MAX_DIGEST 8 | ||
324 | |||
325 | #define SSL3_CK_ID 0x03000000 | ||
326 | #define SSL3_CK_VALUE_MASK 0x0000ffff | ||
327 | |||
328 | #define TLS1_PRF_DGST_MASK (0xff << TLS1_PRF_DGST_SHIFT) | ||
329 | |||
330 | #define TLS1_PRF_DGST_SHIFT 10 | ||
331 | #define TLS1_PRF_MD5 (SSL_HANDSHAKE_MAC_MD5 << TLS1_PRF_DGST_SHIFT) | ||
332 | #define TLS1_PRF_SHA1 (SSL_HANDSHAKE_MAC_SHA << TLS1_PRF_DGST_SHIFT) | ||
333 | #define TLS1_PRF_SHA256 (SSL_HANDSHAKE_MAC_SHA256 << TLS1_PRF_DGST_SHIFT) | ||
334 | #define TLS1_PRF_SHA384 (SSL_HANDSHAKE_MAC_SHA384 << TLS1_PRF_DGST_SHIFT) | ||
335 | #define TLS1_PRF_GOST94 (SSL_HANDSHAKE_MAC_GOST94 << TLS1_PRF_DGST_SHIFT) | ||
336 | #define TLS1_PRF_STREEBOG256 (SSL_HANDSHAKE_MAC_STREEBOG256 << TLS1_PRF_DGST_SHIFT) | ||
337 | #define TLS1_PRF (TLS1_PRF_MD5 | TLS1_PRF_SHA1) | ||
338 | |||
339 | /* Stream MAC for GOST ciphersuites from cryptopro draft | ||
340 | * (currently this also goes into algorithm2) */ | ||
341 | #define TLS1_STREAM_MAC 0x04 | ||
342 | |||
343 | /* | ||
344 | * SSL_CIPHER_ALGORITHM2_VARIABLE_NONCE_IN_RECORD is an algorithm2 flag that | ||
345 | * indicates that the variable part of the nonce is included as a prefix of | ||
346 | * the record (AES-GCM, for example, does this with an 8-byte variable nonce.) | ||
347 | */ | ||
348 | #define SSL_CIPHER_ALGORITHM2_VARIABLE_NONCE_IN_RECORD (1 << 22) | ||
349 | |||
350 | /* | ||
351 | * SSL_CIPHER_ALGORITHM2_AEAD is an algorithm2 flag that indicates the cipher | ||
352 | * is implemented via an EVP_AEAD. | ||
353 | */ | ||
354 | #define SSL_CIPHER_ALGORITHM2_AEAD (1 << 23) | ||
355 | |||
356 | /* | ||
357 | * SSL_CIPHER_AEAD_FIXED_NONCE_LEN returns the number of bytes of fixed nonce | ||
358 | * for an SSL_CIPHER with the SSL_CIPHER_ALGORITHM2_AEAD flag. | ||
359 | */ | ||
360 | #define SSL_CIPHER_AEAD_FIXED_NONCE_LEN(ssl_cipher) \ | ||
361 | (((ssl_cipher->algorithm2 >> 24) & 0xf) * 2) | ||
362 | |||
363 | /* | ||
364 | * Cipher strength information. | ||
365 | */ | ||
366 | #define SSL_STRONG_MASK 0x000001fcL | ||
367 | #define SSL_STRONG_NONE 0x00000004L | ||
368 | #define SSL_LOW 0x00000020L | ||
369 | #define SSL_MEDIUM 0x00000040L | ||
370 | #define SSL_HIGH 0x00000080L | ||
371 | |||
372 | /* | ||
373 | * The keylength (measured in RSA key bits, I guess) for temporary keys. | ||
374 | * Cipher argument is so that this can be variable in the future. | ||
375 | */ | ||
376 | #define SSL_C_PKEYLENGTH(c) 1024 | ||
377 | |||
378 | /* Check if an SSL structure is using DTLS. */ | ||
379 | #define SSL_IS_DTLS(s) (s->method->ssl3_enc->enc_flags & SSL_ENC_FLAG_DTLS) | ||
380 | |||
381 | /* See if we need explicit IV. */ | ||
382 | #define SSL_USE_EXPLICIT_IV(s) \ | ||
383 | (s->method->ssl3_enc->enc_flags & SSL_ENC_FLAG_EXPLICIT_IV) | ||
384 | |||
385 | /* See if we use signature algorithms extension. */ | ||
386 | #define SSL_USE_SIGALGS(s) \ | ||
387 | (s->method->ssl3_enc->enc_flags & SSL_ENC_FLAG_SIGALGS) | ||
388 | |||
389 | /* Allow TLS 1.2 ciphersuites: applies to DTLS 1.2 as well as TLS 1.2. */ | ||
390 | #define SSL_USE_TLS1_2_CIPHERS(s) \ | ||
391 | (s->method->ssl3_enc->enc_flags & SSL_ENC_FLAG_TLS1_2_CIPHERS) | ||
392 | |||
393 | /* Mostly for SSLv3 */ | ||
394 | #define SSL_PKEY_RSA_ENC 0 | ||
395 | #define SSL_PKEY_RSA_SIGN 1 | ||
396 | #define SSL_PKEY_DSA_SIGN 2 | ||
397 | #define SSL_PKEY_DH_RSA 3 | ||
398 | #define SSL_PKEY_DH_DSA 4 | ||
399 | #define SSL_PKEY_ECC 5 | ||
400 | #define SSL_PKEY_GOST01 6 | ||
401 | #define SSL_PKEY_NUM 7 | ||
402 | |||
403 | /* SSL_kRSA <- RSA_ENC | (RSA_TMP & RSA_SIGN) | | ||
404 | * <- (EXPORT & (RSA_ENC | RSA_TMP) & RSA_SIGN) | ||
405 | * SSL_kDH <- DH_ENC & (RSA_ENC | RSA_SIGN | DSA_SIGN) | ||
406 | * SSL_kDHE <- RSA_ENC | RSA_SIGN | DSA_SIGN | ||
407 | * SSL_aRSA <- RSA_ENC | RSA_SIGN | ||
408 | * SSL_aDSS <- DSA_SIGN | ||
409 | */ | ||
410 | |||
411 | /* | ||
412 | #define CERT_INVALID 0 | ||
413 | #define CERT_PUBLIC_KEY 1 | ||
414 | #define CERT_PRIVATE_KEY 2 | ||
415 | */ | ||
416 | |||
417 | /* From ECC-TLS draft, used in encoding the curve type in | ||
418 | * ECParameters | ||
419 | */ | ||
420 | #define EXPLICIT_PRIME_CURVE_TYPE 1 | ||
421 | #define EXPLICIT_CHAR2_CURVE_TYPE 2 | ||
422 | #define NAMED_CURVE_TYPE 3 | ||
423 | |||
424 | typedef struct cert_pkey_st { | ||
425 | X509 *x509; | ||
426 | EVP_PKEY *privatekey; | ||
427 | /* Digest to use when signing */ | ||
428 | const EVP_MD *digest; | ||
429 | } CERT_PKEY; | ||
430 | |||
431 | typedef struct cert_st { | ||
432 | /* Current active set */ | ||
433 | CERT_PKEY *key; /* ALWAYS points to an element of the pkeys array | ||
434 | * Probably it would make more sense to store | ||
435 | * an index, not a pointer. */ | ||
436 | |||
437 | /* The following masks are for the key and auth | ||
438 | * algorithms that are supported by the certs below */ | ||
439 | int valid; | ||
440 | unsigned long mask_k; | ||
441 | unsigned long mask_a; | ||
442 | |||
443 | DH *dh_tmp; | ||
444 | DH *(*dh_tmp_cb)(SSL *ssl, int is_export, int keysize); | ||
445 | int dh_tmp_auto; | ||
446 | |||
447 | EC_KEY *ecdh_tmp; | ||
448 | EC_KEY *(*ecdh_tmp_cb)(SSL *ssl, int is_export, int keysize); | ||
449 | int ecdh_tmp_auto; | ||
450 | |||
451 | CERT_PKEY pkeys[SSL_PKEY_NUM]; | ||
452 | |||
453 | int references; /* >1 only if SSL_copy_session_id is used */ | ||
454 | } CERT; | ||
455 | |||
456 | |||
457 | typedef struct sess_cert_st { | ||
458 | STACK_OF(X509) *cert_chain; /* as received from peer */ | ||
459 | |||
460 | /* The 'peer_...' members are used only by clients. */ | ||
461 | int peer_cert_type; | ||
462 | |||
463 | CERT_PKEY *peer_key; /* points to an element of peer_pkeys (never NULL!) */ | ||
464 | CERT_PKEY peer_pkeys[SSL_PKEY_NUM]; | ||
465 | /* Obviously we don't have the private keys of these, | ||
466 | * so maybe we shouldn't even use the CERT_PKEY type here. */ | ||
467 | |||
468 | DH *peer_dh_tmp; | ||
469 | EC_KEY *peer_ecdh_tmp; | ||
470 | |||
471 | int references; /* actually always 1 at the moment */ | ||
472 | } SESS_CERT; | ||
473 | |||
474 | |||
475 | /*#define SSL_DEBUG */ | ||
476 | /*#define RSA_DEBUG */ | ||
477 | |||
478 | /* This is for the SSLv3/TLSv1.0 differences in crypto/hash stuff | ||
479 | * It is a bit of a mess of functions, but hell, think of it as | ||
480 | * an opaque structure :-) */ | ||
481 | typedef struct ssl3_enc_method { | ||
482 | int (*enc)(SSL *, int); | ||
483 | int (*mac)(SSL *, unsigned char *, int); | ||
484 | int (*setup_key_block)(SSL *); | ||
485 | int (*generate_master_secret)(SSL *, unsigned char *, | ||
486 | unsigned char *, int); | ||
487 | int (*change_cipher_state)(SSL *, int); | ||
488 | int (*final_finish_mac)(SSL *, const char *, int, unsigned char *); | ||
489 | int finish_mac_length; | ||
490 | int (*cert_verify_mac)(SSL *, int, unsigned char *); | ||
491 | const char *client_finished_label; | ||
492 | int client_finished_label_len; | ||
493 | const char *server_finished_label; | ||
494 | int server_finished_label_len; | ||
495 | int (*alert_value)(int); | ||
496 | int (*export_keying_material)(SSL *, unsigned char *, size_t, | ||
497 | const char *, size_t, const unsigned char *, size_t, | ||
498 | int use_context); | ||
499 | /* Flags indicating protocol version requirements. */ | ||
500 | unsigned int enc_flags; | ||
501 | } SSL3_ENC_METHOD; | ||
502 | |||
503 | /* | ||
504 | * Flag values for enc_flags. | ||
505 | */ | ||
506 | |||
507 | /* Uses explicit IV. */ | ||
508 | #define SSL_ENC_FLAG_EXPLICIT_IV (1 << 0) | ||
509 | |||
510 | /* Uses signature algorithms extension. */ | ||
511 | #define SSL_ENC_FLAG_SIGALGS (1 << 1) | ||
512 | |||
513 | /* Uses SHA256 default PRF. */ | ||
514 | #define SSL_ENC_FLAG_SHA256_PRF (1 << 2) | ||
515 | |||
516 | /* Is DTLS. */ | ||
517 | #define SSL_ENC_FLAG_DTLS (1 << 3) | ||
518 | |||
519 | /* Allow TLS 1.2 ciphersuites: applies to DTLS 1.2 as well as TLS 1.2. */ | ||
520 | #define SSL_ENC_FLAG_TLS1_2_CIPHERS (1 << 4) | ||
521 | |||
522 | /* | ||
523 | * ssl_aead_ctx_st contains information about an AEAD that is being used to | ||
524 | * encrypt an SSL connection. | ||
525 | */ | ||
526 | struct ssl_aead_ctx_st { | ||
527 | EVP_AEAD_CTX ctx; | ||
528 | /* | ||
529 | * fixed_nonce contains any bytes of the nonce that are fixed for all | ||
530 | * records. | ||
531 | */ | ||
532 | unsigned char fixed_nonce[8]; | ||
533 | unsigned char fixed_nonce_len; | ||
534 | unsigned char variable_nonce_len; | ||
535 | unsigned char tag_len; | ||
536 | /* | ||
537 | * variable_nonce_in_record is non-zero if the variable nonce | ||
538 | * for a record is included as a prefix before the ciphertext. | ||
539 | */ | ||
540 | char variable_nonce_in_record; | ||
541 | }; | ||
542 | |||
543 | extern SSL3_ENC_METHOD ssl3_undef_enc_method; | ||
544 | extern SSL_CIPHER ssl3_ciphers[]; | ||
545 | |||
546 | SSL_METHOD *ssl_bad_method(int ver); | ||
547 | const char *ssl_version_string(int ver); | ||
548 | uint16_t ssl_max_server_version(SSL *s); | ||
549 | |||
550 | extern SSL3_ENC_METHOD TLSv1_enc_data; | ||
551 | extern SSL3_ENC_METHOD TLSv1_1_enc_data; | ||
552 | extern SSL3_ENC_METHOD TLSv1_2_enc_data; | ||
553 | extern SSL3_ENC_METHOD SSLv3_enc_data; | ||
554 | extern SSL3_ENC_METHOD DTLSv1_enc_data; | ||
555 | |||
556 | void ssl_clear_cipher_ctx(SSL *s); | ||
557 | int ssl_clear_bad_session(SSL *s); | ||
558 | CERT *ssl_cert_new(void); | ||
559 | CERT *ssl_cert_dup(CERT *cert); | ||
560 | int ssl_cert_inst(CERT **o); | ||
561 | void ssl_cert_free(CERT *c); | ||
562 | SESS_CERT *ssl_sess_cert_new(void); | ||
563 | void ssl_sess_cert_free(SESS_CERT *sc); | ||
564 | int ssl_set_peer_cert_type(SESS_CERT *c, int type); | ||
565 | int ssl_get_new_session(SSL *s, int session); | ||
566 | int ssl_get_prev_session(SSL *s, unsigned char *session, int len, | ||
567 | const unsigned char *limit); | ||
568 | int ssl_cipher_id_cmp(const SSL_CIPHER *a, const SSL_CIPHER *b); | ||
569 | DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER, ssl_cipher_id); | ||
570 | int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap, | ||
571 | const SSL_CIPHER * const *bp); | ||
572 | STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s, const unsigned char *p, | ||
573 | int num); | ||
574 | int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, | ||
575 | unsigned char *p); | ||
576 | STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth, | ||
577 | STACK_OF(SSL_CIPHER) **pref, STACK_OF(SSL_CIPHER) **sorted, | ||
578 | const char *rule_str); | ||
579 | void ssl_update_cache(SSL *s, int mode); | ||
580 | int ssl_cipher_get_evp(const SSL_SESSION *s, const EVP_CIPHER **enc, | ||
581 | const EVP_MD **md, int *mac_pkey_type, int *mac_secret_size); | ||
582 | int ssl_cipher_get_evp_aead(const SSL_SESSION *s, const EVP_AEAD **aead); | ||
583 | int ssl_get_handshake_digest(int i, long *mask, const EVP_MD **md); | ||
584 | |||
585 | int ssl_verify_cert_chain(SSL *s, STACK_OF(X509) *sk); | ||
586 | int ssl_undefined_function(SSL *s); | ||
587 | int ssl_undefined_void_function(void); | ||
588 | int ssl_undefined_const_function(const SSL *s); | ||
589 | CERT_PKEY *ssl_get_server_send_pkey(const SSL *s); | ||
590 | X509 *ssl_get_server_send_cert(const SSL *); | ||
591 | EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *c, const EVP_MD **pmd); | ||
592 | DH *ssl_get_auto_dh(SSL *s); | ||
593 | int ssl_cert_type(X509 *x, EVP_PKEY *pkey); | ||
594 | void ssl_set_cert_masks(CERT *c, const SSL_CIPHER *cipher); | ||
595 | STACK_OF(SSL_CIPHER) *ssl_get_ciphers_by_id(SSL *s); | ||
596 | int ssl_verify_alarm_type(long type); | ||
597 | void ssl_load_ciphers(void); | ||
598 | |||
599 | const SSL_CIPHER *ssl3_get_cipher_by_char(const unsigned char *p); | ||
600 | int ssl3_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p); | ||
601 | int ssl3_init_finished_mac(SSL *s); | ||
602 | int ssl3_send_server_certificate(SSL *s); | ||
603 | int ssl3_send_newsession_ticket(SSL *s); | ||
604 | int ssl3_send_cert_status(SSL *s); | ||
605 | int ssl3_get_finished(SSL *s, int state_a, int state_b); | ||
606 | int ssl3_setup_key_block(SSL *s); | ||
607 | int ssl3_send_change_cipher_spec(SSL *s, int state_a, int state_b); | ||
608 | int ssl3_change_cipher_state(SSL *s, int which); | ||
609 | void ssl3_cleanup_key_block(SSL *s); | ||
610 | int ssl3_do_write(SSL *s, int type); | ||
611 | int ssl3_send_alert(SSL *s, int level, int desc); | ||
612 | int ssl3_generate_master_secret(SSL *s, unsigned char *out, | ||
613 | unsigned char *p, int len); | ||
614 | int ssl3_get_req_cert_type(SSL *s, unsigned char *p); | ||
615 | long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok); | ||
616 | int ssl3_send_finished(SSL *s, int a, int b, const char *sender, int slen); | ||
617 | int ssl3_num_ciphers(void); | ||
618 | const SSL_CIPHER *ssl3_get_cipher(unsigned int u); | ||
619 | const SSL_CIPHER *ssl3_get_cipher_by_id(unsigned int id); | ||
620 | const SSL_CIPHER *ssl3_get_cipher_by_value(uint16_t value); | ||
621 | uint16_t ssl3_cipher_get_value(const SSL_CIPHER *c); | ||
622 | int ssl3_renegotiate(SSL *ssl); | ||
623 | |||
624 | int ssl3_renegotiate_check(SSL *ssl); | ||
625 | |||
626 | int ssl3_dispatch_alert(SSL *s); | ||
627 | int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek); | ||
628 | int ssl3_write_bytes(SSL *s, int type, const void *buf, int len); | ||
629 | int ssl3_final_finish_mac(SSL *s, const char *sender, int slen, | ||
630 | unsigned char *p); | ||
631 | int ssl3_cert_verify_mac(SSL *s, int md_nid, unsigned char *p); | ||
632 | void ssl3_finish_mac(SSL *s, const unsigned char *buf, int len); | ||
633 | int ssl3_enc(SSL *s, int send_data); | ||
634 | int n_ssl3_mac(SSL *ssl, unsigned char *md, int send_data); | ||
635 | void ssl3_free_digest_list(SSL *s); | ||
636 | unsigned long ssl3_output_cert_chain(SSL *s, X509 *x); | ||
637 | SSL_CIPHER *ssl3_choose_cipher(SSL *ssl, STACK_OF(SSL_CIPHER) *clnt, | ||
638 | STACK_OF(SSL_CIPHER) *srvr); | ||
639 | int ssl3_setup_buffers(SSL *s); | ||
640 | int ssl3_setup_init_buffer(SSL *s); | ||
641 | int ssl3_setup_read_buffer(SSL *s); | ||
642 | int ssl3_setup_write_buffer(SSL *s); | ||
643 | int ssl3_release_read_buffer(SSL *s); | ||
644 | int ssl3_release_write_buffer(SSL *s); | ||
645 | int ssl3_digest_cached_records(SSL *s); | ||
646 | int ssl3_new(SSL *s); | ||
647 | void ssl3_free(SSL *s); | ||
648 | int ssl3_accept(SSL *s); | ||
649 | int ssl3_connect(SSL *s); | ||
650 | int ssl3_read(SSL *s, void *buf, int len); | ||
651 | int ssl3_peek(SSL *s, void *buf, int len); | ||
652 | int ssl3_write(SSL *s, const void *buf, int len); | ||
653 | int ssl3_shutdown(SSL *s); | ||
654 | void ssl3_clear(SSL *s); | ||
655 | long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg); | ||
656 | long ssl3_ctx_ctrl(SSL_CTX *s, int cmd, long larg, void *parg); | ||
657 | long ssl3_callback_ctrl(SSL *s, int cmd, void (*fp)(void)); | ||
658 | long ssl3_ctx_callback_ctrl(SSL_CTX *s, int cmd, void (*fp)(void)); | ||
659 | int ssl3_pending(const SSL *s); | ||
660 | |||
661 | unsigned char *ssl3_handshake_msg_start(SSL *s, uint8_t htype); | ||
662 | void ssl3_handshake_msg_finish(SSL *s, unsigned int len); | ||
663 | int ssl3_handshake_write(SSL *s); | ||
664 | |||
665 | void ssl3_record_sequence_increment(unsigned char *seq); | ||
666 | int ssl3_do_change_cipher_spec(SSL *ssl); | ||
667 | long ssl3_default_timeout(void); | ||
668 | |||
669 | int ssl23_read(SSL *s, void *buf, int len); | ||
670 | int ssl23_peek(SSL *s, void *buf, int len); | ||
671 | int ssl23_write(SSL *s, const void *buf, int len); | ||
672 | long ssl23_default_timeout(void); | ||
673 | |||
674 | long tls1_default_timeout(void); | ||
675 | int dtls1_do_write(SSL *s, int type); | ||
676 | int ssl3_read_n(SSL *s, int n, int max, int extend); | ||
677 | int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek); | ||
678 | int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, | ||
679 | unsigned int len); | ||
680 | unsigned char *dtls1_set_message_header(SSL *s, unsigned char *p, | ||
681 | unsigned char mt, unsigned long len, unsigned long frag_off, | ||
682 | unsigned long frag_len); | ||
683 | |||
684 | int dtls1_write_app_data_bytes(SSL *s, int type, const void *buf, int len); | ||
685 | int dtls1_write_bytes(SSL *s, int type, const void *buf, int len); | ||
686 | |||
687 | int dtls1_send_change_cipher_spec(SSL *s, int a, int b); | ||
688 | int dtls1_send_finished(SSL *s, int a, int b, const char *sender, int slen); | ||
689 | unsigned long dtls1_output_cert_chain(SSL *s, X509 *x); | ||
690 | int dtls1_read_failed(SSL *s, int code); | ||
691 | int dtls1_buffer_message(SSL *s, int ccs); | ||
692 | int dtls1_retransmit_message(SSL *s, unsigned short seq, | ||
693 | unsigned long frag_off, int *found); | ||
694 | int dtls1_get_queue_priority(unsigned short seq, int is_ccs); | ||
695 | int dtls1_retransmit_buffered_messages(SSL *s); | ||
696 | void dtls1_clear_record_buffer(SSL *s); | ||
697 | int dtls1_get_message_header(unsigned char *data, | ||
698 | struct hm_header_st *msg_hdr); | ||
699 | void dtls1_get_ccs_header(unsigned char *data, struct ccs_header_st *ccs_hdr); | ||
700 | void dtls1_reset_seq_numbers(SSL *s, int rw); | ||
701 | void dtls1_build_sequence_number(unsigned char *dst, unsigned char *seq, | ||
702 | unsigned short epoch); | ||
703 | long dtls1_default_timeout(void); | ||
704 | struct timeval* dtls1_get_timeout(SSL *s, struct timeval* timeleft); | ||
705 | int dtls1_check_timeout_num(SSL *s); | ||
706 | int dtls1_handle_timeout(SSL *s); | ||
707 | const SSL_CIPHER *dtls1_get_cipher(unsigned int u); | ||
708 | void dtls1_start_timer(SSL *s); | ||
709 | void dtls1_stop_timer(SSL *s); | ||
710 | int dtls1_is_timer_expired(SSL *s); | ||
711 | void dtls1_double_timeout(SSL *s); | ||
712 | int dtls1_send_newsession_ticket(SSL *s); | ||
713 | unsigned int dtls1_min_mtu(void); | ||
714 | |||
715 | /* some client-only functions */ | ||
716 | int ssl3_client_hello(SSL *s); | ||
717 | int ssl3_get_server_hello(SSL *s); | ||
718 | int ssl3_get_certificate_request(SSL *s); | ||
719 | int ssl3_get_new_session_ticket(SSL *s); | ||
720 | int ssl3_get_cert_status(SSL *s); | ||
721 | int ssl3_get_server_done(SSL *s); | ||
722 | int ssl3_send_client_verify(SSL *s); | ||
723 | int ssl3_send_client_certificate(SSL *s); | ||
724 | int ssl_do_client_cert_cb(SSL *s, X509 **px509, EVP_PKEY **ppkey); | ||
725 | int ssl3_send_client_key_exchange(SSL *s); | ||
726 | int ssl3_get_key_exchange(SSL *s); | ||
727 | int ssl3_get_server_certificate(SSL *s); | ||
728 | int ssl3_check_cert_and_algorithm(SSL *s); | ||
729 | int ssl3_check_finished(SSL *s); | ||
730 | int ssl3_send_next_proto(SSL *s); | ||
731 | |||
732 | int dtls1_client_hello(SSL *s); | ||
733 | int dtls1_send_client_certificate(SSL *s); | ||
734 | int dtls1_send_client_key_exchange(SSL *s); | ||
735 | int dtls1_send_client_verify(SSL *s); | ||
736 | |||
737 | /* some server-only functions */ | ||
738 | int ssl3_get_client_hello(SSL *s); | ||
739 | int ssl3_send_server_hello(SSL *s); | ||
740 | int ssl3_send_hello_request(SSL *s); | ||
741 | int ssl3_send_server_key_exchange(SSL *s); | ||
742 | int ssl3_send_certificate_request(SSL *s); | ||
743 | int ssl3_send_server_done(SSL *s); | ||
744 | int ssl3_get_client_certificate(SSL *s); | ||
745 | int ssl3_get_client_key_exchange(SSL *s); | ||
746 | int ssl3_get_cert_verify(SSL *s); | ||
747 | int ssl3_get_next_proto(SSL *s); | ||
748 | |||
749 | int dtls1_send_hello_request(SSL *s); | ||
750 | int dtls1_send_server_hello(SSL *s); | ||
751 | int dtls1_send_server_certificate(SSL *s); | ||
752 | int dtls1_send_server_key_exchange(SSL *s); | ||
753 | int dtls1_send_certificate_request(SSL *s); | ||
754 | int dtls1_send_server_done(SSL *s); | ||
755 | |||
756 | int ssl23_accept(SSL *s); | ||
757 | int ssl23_connect(SSL *s); | ||
758 | int ssl23_read_bytes(SSL *s, int n); | ||
759 | int ssl23_write_bytes(SSL *s); | ||
760 | int tls_any_accept(SSL *s); | ||
761 | int tls_any_connect(SSL *s); | ||
762 | |||
763 | int tls1_new(SSL *s); | ||
764 | void tls1_free(SSL *s); | ||
765 | void tls1_clear(SSL *s); | ||
766 | long tls1_ctrl(SSL *s, int cmd, long larg, void *parg); | ||
767 | long tls1_callback_ctrl(SSL *s, int cmd, void (*fp)(void)); | ||
768 | |||
769 | int dtls1_new(SSL *s); | ||
770 | int dtls1_accept(SSL *s); | ||
771 | int dtls1_connect(SSL *s); | ||
772 | void dtls1_free(SSL *s); | ||
773 | void dtls1_clear(SSL *s); | ||
774 | long dtls1_ctrl(SSL *s, int cmd, long larg, void *parg); | ||
775 | int dtls1_shutdown(SSL *s); | ||
776 | |||
777 | long dtls1_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok); | ||
778 | int dtls1_get_record(SSL *s); | ||
779 | int do_dtls1_write(SSL *s, int type, const unsigned char *buf, | ||
780 | unsigned int len); | ||
781 | int dtls1_dispatch_alert(SSL *s); | ||
782 | int dtls1_enc(SSL *s, int snd); | ||
783 | |||
784 | int ssl_init_wbio_buffer(SSL *s, int push); | ||
785 | void ssl_free_wbio_buffer(SSL *s); | ||
786 | |||
787 | int tls1_change_cipher_state(SSL *s, int which); | ||
788 | int tls1_setup_key_block(SSL *s); | ||
789 | int tls1_enc(SSL *s, int snd); | ||
790 | int tls1_final_finish_mac(SSL *s, const char *str, int slen, unsigned char *p); | ||
791 | int tls1_cert_verify_mac(SSL *s, int md_nid, unsigned char *p); | ||
792 | int tls1_mac(SSL *ssl, unsigned char *md, int snd); | ||
793 | int tls1_generate_master_secret(SSL *s, unsigned char *out, | ||
794 | unsigned char *p, int len); | ||
795 | int tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen, | ||
796 | const char *label, size_t llen, const unsigned char *p, size_t plen, | ||
797 | int use_context); | ||
798 | int tls1_alert_code(int code); | ||
799 | int ssl3_alert_code(int code); | ||
800 | int ssl_ok(SSL *s); | ||
801 | |||
802 | int ssl_check_srvr_ecc_cert_and_alg(X509 *x, SSL *s); | ||
803 | |||
804 | SSL_COMP *ssl3_comp_find(STACK_OF(SSL_COMP) *sk, int n); | ||
805 | |||
806 | int tls1_ec_curve_id2nid(uint16_t curve_id); | ||
807 | uint16_t tls1_ec_nid2curve_id(int nid); | ||
808 | int tls1_check_curve(SSL *s, const unsigned char *p, size_t len); | ||
809 | int tls1_get_shared_curve(SSL *s); | ||
810 | |||
811 | unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, | ||
812 | unsigned char *limit); | ||
813 | |||
814 | unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *p, | ||
815 | unsigned char *limit); | ||
816 | |||
817 | int ssl_parse_clienthello_tlsext(SSL *s, unsigned char **data, | ||
818 | unsigned char *d, int n, int *al); | ||
819 | int ssl_parse_serverhello_tlsext(SSL *s, unsigned char **data, | ||
820 | unsigned char *d, int n, int *al); | ||
821 | int ssl_prepare_clienthello_tlsext(SSL *s); | ||
822 | int ssl_prepare_serverhello_tlsext(SSL *s); | ||
823 | int ssl_check_clienthello_tlsext_early(SSL *s); | ||
824 | int ssl_check_clienthello_tlsext_late(SSL *s); | ||
825 | int ssl_check_serverhello_tlsext(SSL *s); | ||
826 | |||
827 | #define tlsext_tick_md EVP_sha256 | ||
828 | int tls1_process_ticket(SSL *s, const unsigned char *session_id, int len, | ||
829 | const unsigned char *limit, SSL_SESSION **ret); | ||
830 | int tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk, | ||
831 | const EVP_MD *md); | ||
832 | int tls12_get_sigid(const EVP_PKEY *pk); | ||
833 | const EVP_MD *tls12_get_hash(unsigned char hash_alg); | ||
834 | |||
835 | EVP_MD_CTX* ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md); | ||
836 | void ssl_clear_hash_ctx(EVP_MD_CTX **hash); | ||
837 | int ssl_add_serverhello_renegotiate_ext(SSL *s, unsigned char *p, | ||
838 | int *len, int maxlen); | ||
839 | int ssl_parse_serverhello_renegotiate_ext(SSL *s, const unsigned char *d, | ||
840 | int len, int *al); | ||
841 | int ssl_add_clienthello_renegotiate_ext(SSL *s, unsigned char *p, | ||
842 | int *len, int maxlen); | ||
843 | int ssl_parse_clienthello_renegotiate_ext(SSL *s, const unsigned char *d, | ||
844 | int len, int *al); | ||
845 | long ssl_get_algorithm2(SSL *s); | ||
846 | int tls1_process_sigalgs(SSL *s, const unsigned char *data, int dsize); | ||
847 | int tls12_get_req_sig_algs(SSL *s, unsigned char *p); | ||
848 | |||
849 | int tls1_check_ec_server_key(SSL *s); | ||
850 | int tls1_check_ec_tmp_key(SSL *s); | ||
851 | |||
852 | int ssl_add_clienthello_use_srtp_ext(SSL *s, unsigned char *p, | ||
853 | int *len, int maxlen); | ||
854 | int ssl_parse_clienthello_use_srtp_ext(SSL *s, const unsigned char *d, | ||
855 | int len, int *al); | ||
856 | int ssl_add_serverhello_use_srtp_ext(SSL *s, unsigned char *p, | ||
857 | int *len, int maxlen); | ||
858 | int ssl_parse_serverhello_use_srtp_ext(SSL *s, const unsigned char *d, | ||
859 | int len, int *al); | ||
860 | |||
861 | /* s3_cbc.c */ | ||
862 | void ssl3_cbc_copy_mac(unsigned char *out, const SSL3_RECORD *rec, | ||
863 | unsigned md_size, unsigned orig_len); | ||
864 | int ssl3_cbc_remove_padding(const SSL *s, SSL3_RECORD *rec, | ||
865 | unsigned block_size, unsigned mac_size); | ||
866 | int tls1_cbc_remove_padding(const SSL *s, SSL3_RECORD *rec, | ||
867 | unsigned block_size, unsigned mac_size); | ||
868 | char ssl3_cbc_record_digest_supported(const EVP_MD_CTX *ctx); | ||
869 | int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx, unsigned char *md_out, | ||
870 | size_t *md_out_size, const unsigned char header[13], | ||
871 | const unsigned char *data, size_t data_plus_mac_size, | ||
872 | size_t data_plus_mac_plus_padding_size, const unsigned char *mac_secret, | ||
873 | unsigned mac_secret_length, char is_sslv3); | ||
874 | |||
875 | #endif | ||