DragonFly On-Line Manual Pages

Search:
Section:

ssl(3) OpenSSL ssl(3)

NAME

SSL - OpenSSL SSL/TLS library

SYNOPSIS

DESCRIPTION

The OpenSSL ssl library implements the Secure Sockets Layer (SSL v2/v3)
and Transport Layer Security (TLS v1) protocols. It provides a rich API
which is documented here.
At first the library must be initialized; see SSL_library_init(3).
Then an SSL_CTX object is created as a framework to establish TLS/SSL
enabled connections (see SSL_CTX_new(3)). Various options regarding
certificates, algorithms etc. can be set in this object.
When a network connection has been created, it can be assigned to an
SSL object. After the SSL object has been created using SSL_new(3),
SSL_set_fd(3) or SSL_set_bio(3) can be used to associate the network
connection with the object.
Then the TLS/SSL handshake is performed using SSL_accept(3) or
SSL_connect(3) respectively. SSL_read(3) and SSL_write(3) are used to
read and write data on the TLS/SSL connection. SSL_shutdown(3) can be
used to shut down the TLS/SSL connection.

DATA STRUCTURES

Currently the OpenSSL ssl library functions deals with the following
data structures:
SSL_METHOD (SSL Method)
That's a dispatch structure describing the internal ssl library
methods/functions which implement the various protocol versions
(SSLv1, SSLv2 and TLSv1). It's needed to create an SSL_CTX.
SSL_CIPHER (SSL Cipher)
This structure holds the algorithm information for a particular
cipher which are a core part of the SSL/TLS protocol. The available
ciphers are configured on a SSL_CTX basis and the actually used
ones are then part of the SSL_SESSION.
SSL_CTX (SSL Context)
That's the global context structure which is created by a server or
client once per program life-time and which holds mainly default
values for the SSL structures which are later created for the
connections.
SSL_SESSION (SSL Session)
This is a structure containing the current TLS/SSL session details
for a connection: SSL_CIPHERs, client and server certificates,
keys, etc.
SSL (SSL Connection)
That's the main SSL/TLS structure which is created by a server or
client per established connection. This actually is the core
structure in the SSL API. Under run-time the application usually
deals with this structure which has links to mostly all other
structures.

HEADER FILES

Currently the OpenSSL ssl library provides the following C header files
containing the prototypes for the data structures and and functions:
ssl.h
That's the common header file for the SSL/TLS API. Include it into
your program to make the API of the ssl library available. It
internally includes both more private SSL headers and headers from
the crypto library. Whenever you need hard-core details on the
internals of the SSL API, look inside this header file.
ssl2.h
That's the sub header file dealing with the SSLv2 protocol only.
Usuallyyoudon'thavetoincludeitexplicitlybecauseit'salreadyincludedbyssl.h.
ssl3.h
That's the sub header file dealing with the SSLv3 protocol only.
Usuallyyoudon'thavetoincludeitexplicitlybecauseit'salreadyincludedbyssl.h.
ssl23.h
That's the sub header file dealing with the combined use of the
SSLv2 and SSLv3 protocols. Usuallyyoudon'thavetoincludeitexplicitlybecauseit'salreadyincludedbyssl.h.
tls1.h
That's the sub header file dealing with the TLSv1 protocol only.
Usuallyyoudon'thavetoincludeitexplicitlybecauseit'salreadyincludedbyssl.h.

DESCRIPTION

SSL_CTX_set_tlsext_servername_callback() sets the application callback cb
used by a server to perform any actions or configuration required based
on the servername extension received in the incoming connection. When cb
is NULL, SNI is not used. The arg value is a pointer which is passed to
the application callback.
SSL_CTX_set_tlsext_servername_arg() sets a context-specific argument to
be passed into the callback for ctx.
SSL_set_tlsext_host_name() sets the server name indication ClientHello
extension to contain the value name, or clears it if name is NULL. The
type of server name indication extension is set to
TLSEXT_NAMETYPE_host_name as defined in RFC 3546.
All three functions are implemented as macros.
The ALPN and SNI callbacks are both executed during Client Hello
processing. The servername callback is executed first, followed by the
ALPN callback.

RETURN VALUES

SSL_CTX_set_tlsext_servername_callback() and
SSL_CTX_set_tlsext_servername_arg() always return 1 indicating success.
SSL_get_servername() returns a servername extension value of the
specified type if provided in the Client Hello, or NULL otherwise.
SSL_get_servername_type() returns the servername type or -1 if no
servername is present. Currently the only supported type (defined in RFC
3546) is TLSEXT_NAMETYPE_host_name.
SSL_set_tlsext_host_name() returns 1 on success or 0 in case of an error.