|
DTS Application Library
0.2.3
Application library containing referenced objects and interfaces to common libraries
|
TLSv1 SSLv2 SSLv3 DTLSv1 support. More...
Files | |
| file | sslutil.c |
| TLSv1 SSLv2 SSLv3 DTLSv1 support. | |
Data Structures | |
| struct | ssldata |
| SSL data structure for enabling encryption on sockets. More... | |
Macros | |
| #define | COOKIE_SECRET_LENGTH 32 |
| length of cookie secret using SHA2-256 HMAC More... | |
Typedefs | |
| typedef struct ssldata | ssldata |
| Forward decleration of structure. More... | |
Enumerations | |
| enum | SSLFLAGS { SSL_TLSV1 = 1 << 0, SSL_SSLV2 = 1 << 1, SSL_SSLV3 = 1 << 2, SSL_DTLSV1 = 1 << 3, SSL_CLIENT = 1 << 4, SSL_SERVER = 1 << 5, SSL_DTLSCON = 1 << 6 } |
| SSL configuration flags. More... | |
Functions | |
| void | ssl_shutdown (void *data, int sock) |
| Shutdown the SSL connection. More... | |
| void * | tlsv1_init (const char *cacert, const char *cert, const char *key, int verify) |
| Create a SSL structure for TLSv1. More... | |
| void * | sslv2_init (const char *cacert, const char *cert, const char *key, int verify) |
| Create a SSL structure for SSLv2 (If available) More... | |
| void * | sslv3_init (const char *cacert, const char *cert, const char *key, int verify) |
| Create a SSL structure for SSLv3. More... | |
| void * | dtlsv1_init (const char *cacert, const char *cert, const char *key, int verify) |
| Create a SSL structure for DTLSv1. More... | |
| void | tlsaccept (struct fwsocket *sock, struct ssldata *orig) |
| Create SSL session for new connection. More... | |
| void | sslstartup (void) |
| Initialise SSL support this should be called at startup. More... | |
| void | dtsl_serveropts (struct fwsocket *sock) |
| Start up the DTLSv1 Server. More... | |
| struct fwsocket * | dtls_listenssl (struct fwsocket *sock) |
| Implementation of "listen" for DTLSv1. More... | |
| void | startsslclient (struct fwsocket *sock) |
| Start SSL on a client socket. More... | |
| void | dtlstimeout (struct fwsocket *sock, struct timeval *timeleft, int defusec) |
| Get DTLSv1 timeout setting todefault timeout. More... | |
| void | dtlshandltimeout (struct fwsocket *sock) |
| Handle DTLSv1 timeout. More... | |
TLSv1 SSLv2 SSLv3 DTLSv1 support.
This is part of the socket interface to upport encrypted sockets a ssldata refernece will be created and passed on socket initialization.
| #define COOKIE_SECRET_LENGTH 32 |
length of cookie secret using SHA2-256 HMAC
Definition at line 83 of file sslutil.c.
Referenced by sslstartup().
| enum SSLFLAGS |
SSL configuration flags.
Definition at line 48 of file sslutil.c.
Implementation of "listen" for DTLSv1.
| sock | Reference to server socket. |
Definition at line 731 of file sslutil.c.
References fwsocket::addr, ssldata::flags, make_socket(), objalloc(), objlock(), objunlock(), objunref(), fwsocket::proto, sockstruct::sa, setflag, fwsocket::sock, SOCK_FLAG_SSL, ssldata::ssl, fwsocket::ssl, SSL_DTLSCON, and fwsocket::type.
| void dtlshandltimeout | ( | struct fwsocket * | sock | ) |
Handle DTLSv1 timeout.
| sock | Reference to socket. |
Definition at line 846 of file sslutil.c.
References objlock(), objunlock(), ssldata::ssl, and fwsocket::ssl.
| void dtlstimeout | ( | struct fwsocket * | sock, |
| struct timeval * | timeleft, | ||
| int | defusec | ||
| ) |
Get DTLSv1 timeout setting todefault timeout.
| sock | Reference to socket. |
| timeleft | timeval to store timeleft or set to default. |
| defusec | Default timeout to set. |
Definition at line 831 of file sslutil.c.
References objlock(), objunlock(), ssldata::ssl, and fwsocket::ssl.
| void* dtlsv1_init | ( | const char * | cacert, |
| const char * | cert, | ||
| const char * | key, | ||
| int | verify | ||
| ) |
Create a SSL structure for DTLSv1.
| cacert | Path to the CA certificate[s]. |
| cert | Public certificate to use. |
| key | Private key file. |
| verify | OpenSSL flags. |
Definition at line 325 of file sslutil.c.
References ssldata::ctx, ssldata::ssl, and SSL_DTLSV1.
Referenced by socktest().
| void dtsl_serveropts | ( | struct fwsocket * | sock | ) |
Start up the DTLSv1 Server.
| sock | Reference to socket structure of DTLSv1 Server |
Definition at line 685 of file sslutil.c.
References ssldata::ctx, ssldata::flags, objlock(), objunlock(), ssldata::ssl, fwsocket::ssl, and SSL_SERVER.
Referenced by socketserver().
| void ssl_shutdown | ( | void * | data, |
| int | sock | ||
| ) |
Shutdown the SSL connection.
Extra read/write may be required if so use select on failure the port has probably gone only try 3 times.
| data | Refernece to the SSL data of socket. |
| sock | Socket FD to wait for data on. |
Definition at line 179 of file sslutil.c.
References objlock(), objunlock(), and ssldata::ssl.
| void sslstartup | ( | void | ) |
Initialise SSL support this should be called at startup.
Definition at line 639 of file sslutil.c.
References COOKIE_SECRET_LENGTH, and genrand().
Referenced by framework_init().
| void* sslv2_init | ( | const char * | cacert, |
| const char * | cert, | ||
| const char * | key, | ||
| int | verify | ||
| ) |
| void* sslv3_init | ( | const char * | cacert, |
| const char * | cert, | ||
| const char * | key, | ||
| int | verify | ||
| ) |
Create a SSL structure for SSLv3.
| cacert | Path to the CA certificate[s]. |
| cert | Public certificate to use. |
| key | Private key file. |
| verify | OpenSSL flags. |
Definition at line 311 of file sslutil.c.
References ssldata::ssl, and SSL_SSLV3.
Referenced by socktest().
| void startsslclient | ( | struct fwsocket * | sock | ) |
Start SSL on a client socket.
| sock | Reference to client socket. |
Definition at line 811 of file sslutil.c.
References ssldata::flags, fwsocket::ssl, SSL_SERVER, and fwsocket::type.
Referenced by socketclient().
Create SSL session for new connection.
| sock | Reference too new incoming socket. |
| orig | Servers SSL session to clone. |
Definition at line 382 of file sslutil.c.
References objalloc(), setflag, SOCK_FLAG_SSL, and fwsocket::ssl.
Referenced by accept_socket().
| void* tlsv1_init | ( | const char * | cacert, |
| const char * | cert, | ||
| const char * | key, | ||
| int | verify | ||
| ) |