X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=doc%2Fssl%2Fssl.pod;h=589fc2dbd949547e5cd388c881912d64c81138e3;hp=3375525cc51b5a0b9c342de26df866db289b9eb3;hb=dc567f624445f4f10f0a33d8d5dcb430c896965b;hpb=41ecaba97edbf3439ae43d4cf9552a9fcef1fb02 diff --git a/doc/ssl/ssl.pod b/doc/ssl/ssl.pod index 3375525cc5..589fc2dbd9 100644 --- a/doc/ssl/ssl.pod +++ b/doc/ssl/ssl.pod @@ -1,38 +1,38 @@ - =pod +=for comment openssl_manual_section:7 + =head1 NAME SSL - OpenSSL SSL/TLS library =head1 SYNOPSIS +See the individual manual pages for details. + =head1 DESCRIPTION The OpenSSL B 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 -L. - Then an B object is created as a framework to establish -TLS/SSL enabled connections (see L). +TLS/SSL enabled connections (see L). 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 B object. After the B object has been created using -L, L or -L can be used to associate the network +L, L or +L can be used to associate the network connection with the object. Then the TLS/SSL handshake is performed using -L or L +L or L respectively. -L and L are used +L and L are used to read and write data on the TLS/SSL connection. -L can be used to shut down the +L can be used to shut down the TLS/SSL connection. =head1 DATA STRUCTURES @@ -45,8 +45,8 @@ structures: =item B (SSL Method) That's a dispatch structure describing the internal B library -methods/functions which implement the various protocol versions (SSLv1, SSLv2 -and TLSv1). It's needed to create an B. +methods/functions which implement the various protocol versions (SSLv3 +TLSv1, ...). It's needed to create an B. =item B (SSL Cipher) @@ -79,7 +79,7 @@ links to mostly all other structures. =head1 HEADER FILES Currently the OpenSSL B library provides the following C header files -containing the prototypes for the data structures and and functions: +containing the prototypes for the data structures and functions: =over 4 @@ -93,9 +93,7 @@ inside this header file. =item B -That's the sub header file dealing with the SSLv2 protocol only. -I. +Unused. Present for backwards compatibility only. =item B @@ -103,13 +101,6 @@ That's the sub header file dealing with the SSLv3 protocol only. I. -=item B - -That's the sub header file dealing with the combined use of the SSLv2 and -SSLv3 protocols. -I. - =item B That's the sub header file dealing with the TLSv1 protocol only. @@ -123,52 +114,78 @@ it's already included by ssl.h>. Currently the OpenSSL B library exports 214 API functions. They are documented in the following: -=head2 DEALING WITH PROTOCOL METHODS +=head2 Dealing with Protocol Methods Here we document the various API functions which deal with the SSL/TLS protocol methods defined in B structures. =over 4 -=item SSL_METHOD *B(void); +=item const SSL_METHOD *B(void); + +Constructor for the I SSL_METHOD structure for clients, +servers or both. +See L for details. + +=item const SSL_METHOD *B(void); + +Constructor for the I SSL_METHOD structure for clients. + +=item const SSL_METHOD *B(void); + +Constructor for the I SSL_METHOD structure for servers. + +=item const SSL_METHOD *B(void); + +Constructor for the TLSv1.2 SSL_METHOD structure for clients, servers or both. + +=item const SSL_METHOD *B(void); -Constructor for the SSLv2 SSL_METHOD structure for a dedicated client. +Constructor for the TLSv1.2 SSL_METHOD structure for clients. -=item SSL_METHOD *B(void); +=item const SSL_METHOD *B(void); -Constructor for the SSLv2 SSL_METHOD structure for a dedicated server. +Constructor for the TLSv1.2 SSL_METHOD structure for servers. -=item SSL_METHOD *B(void); +=item const SSL_METHOD *B(void); -Constructor for the SSLv2 SSL_METHOD structure for combined client and server. +Constructor for the TLSv1.1 SSL_METHOD structure for clients, servers or both. -=item SSL_METHOD *B(void); +=item const SSL_METHOD *B(void); -Constructor for the SSLv3 SSL_METHOD structure for a dedicated client. +Constructor for the TLSv1.1 SSL_METHOD structure for clients. -=item SSL_METHOD *B(void); +=item const SSL_METHOD *B(void); -Constructor for the SSLv3 SSL_METHOD structure for a dedicated server. +Constructor for the TLSv1.1 SSL_METHOD structure for servers. -=item SSL_METHOD *B(void); +=item const SSL_METHOD *B(void); -Constructor for the SSLv3 SSL_METHOD structure for combined client and server. +Constructor for the TLSv1 SSL_METHOD structure for clients, servers or both. -=item SSL_METHOD *B(void); +=item const SSL_METHOD *B(void); -Constructor for the TLSv1 SSL_METHOD structure for a dedicated client. +Constructor for the TLSv1 SSL_METHOD structure for clients. -=item SSL_METHOD *B(void); +=item const SSL_METHOD *B(void); -Constructor for the TLSv1 SSL_METHOD structure for a dedicated server. +Constructor for the TLSv1 SSL_METHOD structure for servers. -=item SSL_METHOD *B(void); +=item const SSL_METHOD *B(void); -Constructor for the TLSv1 SSL_METHOD structure for combined client and server. +Constructor for the SSLv3 SSL_METHOD structure for clients, servers or both. + +=item const SSL_METHOD *B(void); + +Constructor for the SSLv3 SSL_METHOD structure for clients. + +=item const SSL_METHOD *B(void); + +Constructor for the SSLv3 SSL_METHOD structure for servers. =back -=head2 DEALING WITH CIPHERS +=head2 Dealing with Ciphers Here we document the various API functions which deal with the SSL/TLS ciphers defined in B structures. @@ -189,18 +206,18 @@ I) and the bits which are actually used (the return value). =item const char *B(SSL_CIPHER *cipher); Return the internal name of I as a string. These are the various -strings defined by the I, I and I +strings defined by the I and I definitions in the header files. -=item char *B(SSL_CIPHER *cipher); +=item const char *B(SSL_CIPHER *cipher); -Returns a string like "C" or "C" which indicates the +Returns a string like "C" or "C" which indicates the SSL/TLS protocol version to which I belongs (i.e. where it was defined in the specification the first time). =back -=head2 DEALING WITH PROTOCOL CONTEXTS +=head2 Dealing with Protocol Contexts Here we document the various API functions which deal with the SSL/TLS protocol context defined in the B structure. @@ -213,7 +230,7 @@ protocol context defined in the B structure. =item int B(SSL_CTX *ctx, SSL_SESSION *c); -=item int B(SSL_CTX *ctx); +=item int B(const SSL_CTX *ctx); =item long B(SSL_CTX *ctx, int cmd, long larg, char *parg); @@ -225,31 +242,39 @@ protocol context defined in the B structure. =item X509_STORE *B(SSL_CTX *ctx); -=item STACK *B(SSL_CTX *ctx); +=item STACK *B(const SSL_CTX *ctx); + +=item STACK *B(const SSL_CTX *ctx); =item int (*B(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey); -=item char *B(SSL_CTX *s, int idx); +=item void B(SSL_CTX *ctx); + +=item char *B(const SSL_CTX *s, int idx); =item int B(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) =item void (*B(SSL_CTX *ctx))(SSL *ssl, int cb, int ret); -=item int B(SSL_CTX *ctx); +=item int B(const SSL_CTX *ctx); + +=item void B(SSL_CTX *ctx); =item int B(SSL_CTX *ctx); -=item long B(SSL_CTX *ctx); +=item long B(const SSL_CTX *ctx); -=item int (*B(SSL_CTX *ctx))(int ok, X509_STORE_CTX *ctx); +=item int (*B(const SSL_CTX *ctx))(int ok, X509_STORE_CTX *ctx); =item int B(SSL_CTX *ctx); -=item int B(SSL_CTX *ctx, char *CAfile, char *CApath); +=item int B(SSL_CTX *ctx, const char *CAfile, const char *CApath); =item long B(SSL_CTX *ctx); -=item SSL_CTX *B(SSL_METHOD *meth); +=item SSL_CTX *B(const SSL_METHOD *meth); + +=item int SSL_CTX_up_ref(SSL_CTX *ctx); =item int B(SSL_CTX *ctx, SSL_SESSION *c); @@ -299,7 +324,7 @@ protocol context defined in the B structure. =item void B(SSL_CTX *ctx, X509_STORE *cs); -=item void B(SSL_CTX *ctx, int (*cb)(SSL_CTX *), char *arg) +=item void B(SSL_CTX *ctx, int (*cb)(), char *arg) =item int B(SSL_CTX *ctx, char *str); @@ -313,42 +338,44 @@ protocol context defined in the B structure. =item int B(SSL_CTX *ctx); -=item int B(SSL_CTX *s, int idx, char *arg); +Use the default paths to locate trusted CA certificates. There is one default +directory path and one default file path. Both are set via this call. -=item void B(SSL_CTX *ctx, void (*cb)(SSL *ssl, int cb, int ret)); +=item int B(SSL_CTX *ctx) -=item void B(SSL_CTX *ctx, unsigned long op); +Use the default directory path to locate trusted CA certificates. -=item void B(SSL_CTX *ctx, int mode); +=item int B(SSL_CTX *ctx) -=item void B(SSL_CTX *ctx, int mode); +Use the file path to locate trusted CA certificates. -=item int B(SSL_CTX *ctx, SSL_METHOD *meth); +=item int B(SSL_CTX *s, int idx, char *arg); -=item void B(SSL_CTX *ctx, long t); +=item void B(SSL_CTX *ctx, void (*cb)(SSL *ssl, int cb, int ret)); -=item long B(SSL_CTX* ctx, DH *dh); +=item void B(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); -=item long B(SSL_CTX *ctx, DH *(*cb)(void)); +=item void B(SSL_CTX *ctx, void *arg); -=item long B(SSL_CTX *ctx, RSA *rsa); +=item unsigned long B(SSL_CTX *ctx, unsigned long op); -=item SSL_CTX_set_tmp_rsa_callback +=item unsigned long B(SSL_CTX *ctx); -C(SSL_CTX *B, RSA *(*B)(SSL *B, int B, int B));> +=item unsigned long B(SSL_CTX *ctx, unsigned long op); -Sets the callback which will be called when a temporary private key is -required. The B> flag will be set if the reason for needing -a temp key is that an export ciphersuite is in use, in which case, -B> will contain the required keylength in bits. Generate a key of -appropriate size (using ???) and return it. +=item void B(SSL_CTX *ctx, int mode); -=item SSL_set_tmp_rsa_callback +=item void B(SSL_CTX *ctx, int m); -long B(SSL *ssl, RSA *(*cb)(SSL *ssl, int export, int keylength)); +=item void B(SSL_CTX *ctx, int mode); + +=item int B(SSL_CTX *ctx, const SSL_METHOD *meth); -The same as L<"SSL_CTX_set_tmp_rsa_callback">, except it operates on an SSL -session instead of a context. +=item void B(SSL_CTX *ctx, long t); + +=item long B(SSL_CTX* ctx, DH *dh); + +=item long B(SSL_CTX *ctx, DH *(*cb)(void)); =item void B(SSL_CTX *ctx, int mode, int (*cb);(void)) @@ -356,50 +383,61 @@ session instead of a context. =item int B(int type, SSL_CTX *ctx, unsigned char *d, long len); -=item int B(SSL_CTX *ctx, char *file, int type); +=item int B(SSL_CTX *ctx, const char *file, int type); =item int B(SSL_CTX *ctx, RSA *rsa); =item int B(SSL_CTX *ctx, unsigned char *d, long len); -=item int B(SSL_CTX *ctx, char *file, int type); +=item int B(SSL_CTX *ctx, const char *file, int type); =item int B(SSL_CTX *ctx, X509 *x); =item int B(SSL_CTX *ctx, int len, unsigned char *d); -=item int B(SSL_CTX *ctx, char *file, int type); +=item int B(SSL_CTX *ctx, const char *file, int type); + +=item X509 *B(const SSL_CTX *ctx); + +=item EVP_PKEY *B(const SSL_CTX *ctx); + +=item void B(SSL_CTX *ctx, unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)); + +=item int B(SSL_CTX *ctx, const char *hint); + +=item void B(SSL_CTX *ctx, unsigned int (*callback)(SSL *ssl, const char *identity, unsigned char *psk, int max_psk_len)); + =back -=head2 DEALING WITH SESSIONS +=head2 Dealing with Sessions Here we document the various API functions which deal with the SSL/TLS sessions defined in the B structures. =over 4 -=item int B(SSL_SESSION *a, SSL_SESSION *b); +=item int B(const SSL_SESSION *a, const SSL_SESSION *b); =item void B(SSL_SESSION *ss); =item char *B(SSL_SESSION *s); -=item char *B(SSL_SESSION *s, int idx); +=item char *B(const SSL_SESSION *s, int idx); =item int B(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) -=item long B(SSL_SESSION *s); +=item long B(const SSL_SESSION *s); -=item long B(SSL_SESSION *s); +=item long B(const SSL_SESSION *s); -=item unsigned long B(SSL_SESSION *a); +=item unsigned long B(const SSL_SESSION *a); =item SSL_SESSION *B(void); -=item int B(BIO *bp, SSL_SESSION *x); +=item int B(BIO *bp, const SSL_SESSION *x); -=item int B(FILE *fp, SSL_SESSION *x); +=item int B(FILE *fp, const SSL_SESSION *x); =item void B(SSL_SESSION *s, char *a); @@ -411,7 +449,7 @@ sessions defined in the B structures. =back -=head2 DEALING WITH CONNECTIONS +=head2 Dealing with Connections Here we document the various API functions which deal with the SSL/TLS connection defined in the B structure. @@ -434,7 +472,7 @@ connection defined in the B structure. =item char *B(int value); -=item int B(SSL *ssl); +=item int B(const SSL *ssl); =item void B(SSL *ssl); @@ -442,7 +480,10 @@ connection defined in the B structure. =item int B(SSL *ssl); -=item void B(SSL *t, SSL *f); +=item int B(SSL *t, const SSL *f); + +Sets the session details for B to be the same as in B. Returns 1 on +success or 0 on failure. =item long B(SSL *ssl, int cmd, long larg, char *parg); @@ -450,81 +491,102 @@ connection defined in the B structure. =item SSL *B(SSL *ssl); +SSL_dup() allows applications to configure an SSL handle for use +in multiple SSL connections, and then duplicate it prior to initiating +each connection with the duplicated handle. +Use of SSL_dup() avoids the need to repeat the configuration of the +handles for each connection. +This is used internally by L to construct +per-connection SSL handles after L. + +For SSL_dup() to work, the connection MUST be in its initial state +and MUST NOT have not yet have started the SSL handshake. +For connections that are not in their initial state SSL_dup() just +increments an internal reference count and returns the I +handle. +It may be possible to use L to recycle an SSL handle +that is not in its initial state for re-use, but this is best +avoided. +Instead, save and restore the session, if desired, and construct a +fresh handle for each connection. + =item STACK *B(STACK *sk); =item void B(SSL *ssl); -=item SSL_CTX *B(SSL *ssl); +=item SSL_CTX *B(const SSL *ssl); =item char *B(SSL *ssl); -=item X509 *B(SSL *ssl); +=item X509 *B(const SSL *ssl); + +=item const char *B(const SSL *ssl); -=item const char *B(SSL *ssl); +=item int B(const SSL *ssl); -=item int B(SSL *ssl, int *alg_bits); +=item int B(const SSL *ssl, int *alg_bits); -=item char *B(SSL *ssl, int n); +=item char *B(const SSL *ssl, int n); -=item char *B(SSL *ssl); +=item char *B(const SSL *ssl); -=item char *B(SSL *ssl); +=item char *B(const SSL *ssl); -=item STACK *B(SSL *ssl); +=item STACK *B(const SSL *ssl); -=item STACK *B(SSL *ssl); +=item STACK *B(const SSL *ssl); =item SSL_CIPHER *B(SSL *ssl); -=item long B(SSL *ssl); +=item long B(const SSL *ssl); -=item int B(SSL *ssl, int i); +=item int B(const SSL *ssl, int i); -=item char *B(SSL *ssl, int idx); +=item char *B(const SSL *ssl, int idx); =item int B(void); =item int B(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) -=item int B(SSL *ssl); +=item int B(const SSL *ssl); -=item void (*B(SSL *ssl);)(void) +=item void (*B(const SSL *ssl);)() -=item STACK *B(SSL *ssl); +=item STACK *B(const SSL *ssl); -=item X509 *B(SSL *ssl); +=item X509 *B(const SSL *ssl); -=item EVP_PKEY *B(SSL *ssl); +=item EVP_PKEY *B(const SSL *ssl); -=item int B(SSL *ssl); +=item int B(const SSL *ssl); -=item BIO *B(SSL *ssl); +=item BIO *B(const SSL *ssl); -=item int B(SSL *ssl); +=item int B(const SSL *ssl); -=item SSL_SESSION *B(SSL *ssl); +=item SSL_SESSION *B(const SSL *ssl); -=item char *B(SSL *ssl, char *buf, int len); +=item char *B(const SSL *ssl, char *buf, int len); -=item int B(SSL *ssl); +=item int B(const SSL *ssl); -=item SSL_METHOD *B(SSL *ssl); +=item const SSL_METHOD *B(SSL *ssl); -=item int B(SSL *ssl); +=item int B(const SSL *ssl); -=item long B(SSL *ssl); +=item long B(const SSL *ssl); -=item long B(SSL *ssl); +=item long B(const SSL *ssl); -=item int (*B(SSL *ssl);)(void) +=item int (*B(const SSL *ssl))(int,X509_STORE_CTX *) -=item int B(SSL *ssl); +=item int B(const SSL *ssl); -=item long B(SSL *ssl); +=item long B(const SSL *ssl); -=item char *B(SSL *ssl); +=item char *B(const SSL *ssl); -=item BIO *B(SSL *ssl); +=item BIO *B(const SSL *ssl); =item int B(SSL *ssl); @@ -536,19 +598,19 @@ connection defined in the B structure. =item int B(SSL *ssl); -=item STACK *B(char *file); - -=item void B(void); +=item STACK *B(const char *file); =item SSL *B(SSL_CTX *ctx); +=item int SSL_up_ref(SSL *s); + =item long B(SSL *ssl); -=item int B(SSL *ssl, char *buf, int num); +=item int B(SSL *ssl, void *buf, int num); -=item int B(SSL *ssl); +=item int B(const SSL *ssl); -=item int B(SSL *ssl, char *buf, int num); +=item int B(SSL *ssl, void *buf, int num); =item int B(SSL *ssl); @@ -576,7 +638,15 @@ connection defined in the B structure. =item void B(SSL *ssl, void (*cb);(void)) -=item void B(SSL *ssl, unsigned long op); +=item void B(SSL *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); + +=item void B(SSL *ctx, void *arg); + +=item unsigned long B(SSL *ssl, unsigned long op); + +=item unsigned long B(SSL *ssl); + +=item unsigned long B(SSL *ssl, unsigned long op); =item void B(SSL *ssl, int mode); @@ -588,7 +658,7 @@ connection defined in the B structure. =item void B(SSL *ssl, int mode); -=item int B(SSL *ssl, SSL_METHOD *meth); +=item int B(SSL *ssl, const SSL_METHOD *meth); =item void B(SSL *ssl, long t); @@ -602,11 +672,13 @@ connection defined in the B structure. =item int B(SSL *ssl); -=item int B(SSL *ssl); +=item OSSL_HANDSHAKE_STATE B(const SSL *ssl); + +Returns the current handshake state. -=item char *B(SSL *ssl); +=item char *B(const SSL *ssl); -=item char *B(SSL *ssl); +=item char *B(const SSL *ssl); =item long B(SSL *ssl); @@ -614,87 +686,142 @@ connection defined in the B structure. =item int B(int type, SSL *ssl, unsigned char *d, long len); -=item int B(SSL *ssl, char *file, int type); +=item int B(SSL *ssl, const char *file, int type); =item int B(SSL *ssl, RSA *rsa); =item int B(SSL *ssl, unsigned char *d, long len); -=item int B(SSL *ssl, char *file, int type); +=item int B(SSL *ssl, const char *file, int type); =item int B(SSL *ssl, X509 *x); =item int B(SSL *ssl, int len, unsigned char *d); -=item int B(SSL *ssl, char *file, int type); +=item int B(SSL *ssl, const char *file, int type); + +=item int B(const SSL *ssl); + +=item int B(const SSL *ssl); + +=item int B(const SSL *ssl); + +=item int B(const SSL *ssl); -=item int B(SSL *ssl); +=item int B(const SSL *ssl); -=item int B(SSL *ssl); +=item int B(const SSL *ssl); -=item int B(SSL *ssl); +=item int B(SSL *ssl, const void *buf, int num); -=item int B(SSL *ssl); +=item void B(SSL *ssl, unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)); -=item int B(SSL *ssl); +=item int B(SSL *ssl, const char *hint); -=item int B(s); +=item void B(SSL *ssl, unsigned int (*callback)(SSL *ssl, const char *identity, unsigned char *psk, int max_psk_len)); -=item int B(SSL *ssl, char *buf, int num); +=item const char *B(SSL *ssl); + +=item const char *B(SSL *ssl); =back +=head1 RETURN VALUES + +See the individual manual pages for details. + =head1 SEE ALSO -L, L, -L, L, -L, -L, -L, -L, -L, -L, -L, -L -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, -L, L, -L, L, -L, -L, L, -L, -L, -L, -L +L, L, +L, +L, L, +L, +L, +L, +L, +L, +L, +L, +L, +L +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L, +L =head1 HISTORY -The L document appeared in OpenSSL 0.9.2 +B, B and B where removed +in OpenSSL 1.1.0. -=cut +The return type of B was changed from void to int in +OpenSSL 1.1.0. +=head1 COPYRIGHT + +Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved. + +Licensed under the OpenSSL license (the "License"). You may not use +this file except in compliance with the License. You can obtain a copy +in the file LICENSE in the source distribution or at +L. + +=cut