1 
2 /*-
3  *
4  * New BSD License 2006
5  *
6  * Copyright (c) 2006, Jorgen Lundman
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are
11  * met:
12  *
13  * 1 Redistributions of source code must retain the above copyright
14  *   notice, this list of conditions and the following disclaimer.
15  * 2 Redistributions in binary form must reproduce the above
16  *   copyright notice, this list of conditions and the following
17  *   disclaimer in the documentation and/or other materials provided
18  *   with the distribution.
19  * 3 Neither the name of the stuff nor the names of its contributors
20  *   may be used to endorse or promote products derived from this
21  *   software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  *
35  */
36 
37 // $Id: tls.h,v 1.3 2006/06/30 01:22:58 lundman Exp $
38 // SSL/TLS Support Functions
39 // Jorgen Lundman October 17th, 2002.
40 
41 #ifdef WITH_SSL
42 
43 #ifndef TLS_H_INCLUDED
44 #define TLS_H_INCLUDED
45 
46 
47 
48 enum {TLS_CLEAR = 0, TLS_PRIV};             /* Data modes */
49 enum {TLS_NONE = 0, TLS_READ, TLS_WRITE};   /* Restart modes */
50 
51 
52 extern int net_client_SSL;
53 extern int net_server_SSL;
54 
55 extern char *ssl_tlsciphers;
56 extern char *ssl_tlsrsafile;
57 extern char *ssl_egdsocket;
58 
59 
60 
61 
62 
63 int     tls_init( void );
64 void    tls_free( void );
65 int     tls_auth( connection_t * );
66 void    tls_cont_auth( connection_t * );
67 void    tls_close( connection_t * );
68 int     tls_clauth( connection_t * );
69 void    tls_cont_clauth( connection_t * );
70 
71 int     tls_read(connection_t *node, void *buf, int num);
72 int     tls_write(connection_t *node, void *buf, int num);
73 
74 int     tls_peek(connection_t *node);
75 
76 
77 #endif // TLS_H_INCLUDED
78 #endif // WITH_SSL
79