X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=doc%2Fssl.pod;h=46ee443f5753185fb41916a19eff05534ff1ffbe;hp=558d0b5bbd8904b07f4579fd6e751c8a953cfa0f;hb=6888f2b35cc86febd882edccaad62ab1ed69d73a;hpb=1b4559977edf02dee1b7b9f7966d7d06cea7fe4a diff --git a/doc/ssl.pod b/doc/ssl.pod index 558d0b5bbd..46ee443f57 100644 --- a/doc/ssl.pod +++ b/doc/ssl.pod @@ -13,7 +13,7 @@ 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. -=head1 HEADERS +=head1 HEADER FILES Currently the OpenSSL B library provides the following C header files containing the prototypes for the data structures and and functions: @@ -25,63 +25,168 @@ containing the prototypes for the data structures and and functions: That's the common header file for the SSL/TLS API. Include it into your program to make the API of the B library available. It internally includes both more private SSL headers and headers from the B library. +Whenever you need hard-core details on the internals of the SSL API, look +inside this header file. + +=item B + +That's the sub header file dealing with the SSLv2 protocol only. +I. + +=item B + +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. +I. =back -=head1 STRUCTURES +=head1 DATA STRUCTURES -Currently the OpenSSL B library functions deal with the following data +Currently the OpenSSL B library functions deals with the following data structures: =over 4 -=item B (SSL Context) +=item B (SSL Method) -=item B (SSL Connection) +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. + +=item B (SSL Cipher) -That's the SSL/TLS structure which is created by -a server or client per established connection. +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 B basis and the actually used ones are then part of the +B. -=item B (SSL Method) +=item B (SSL Context) -=item B (SSL Cipher) +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 +B structures which are later created for the connections. =item B (SSL Session) +This is a structure containing the current SSL session details for a +connection: Bs, client and server certificates, keys, etc. + +=item B (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. + =back -=head1 FUNCTIONS +=head1 API FUNCTIONS -Currently the OpenSSL B library exports 143 API functions. +Currently the OpenSSL B library exports 214 API functions. They are documented in the following: +=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 [MACRO] B(SSL_kEDH|SSL_aNULL); +=item SSL_METHOD *B(void); + +Constructor for the SSLv2 SSL_METHOD structure for a dedicated client. -=item [MACRO] B(SSL_ST_ACCEPT|SSL_CB_EXIT); +=item SSL_METHOD *B(void); + +Constructor for the SSLv2 SSL_METHOD structure for a dedicated server. + +=item SSL_METHOD *B(void); + +Constructor for the SSLv2 SSL_METHOD structure for combined client and server. + +=item SSL_METHOD *B(void); + +Constructor for the SSLv3 SSL_METHOD structure for a dedicated client. + +=item SSL_METHOD *B(void); + +Constructor for the SSLv3 SSL_METHOD structure for a dedicated server. + +=item SSL_METHOD *B(void); + +Constructor for the SSLv3 SSL_METHOD structure for combined client and server. + +=item SSL_METHOD *B(void); + +Constructor for the TLSv1 SSL_METHOD structure for a dedicated client. + +=item SSL_METHOD *B(void); + +Constructor for the TLSv1 SSL_METHOD structure for a dedicated server. + +=item SSL_METHOD *B(void); -=item [MACRO] B(SSL_ST_ACCEPT|SSL_CB_LOOP); +Constructor for the TLSv1 SSL_METHOD structure for combined client and server. -=item [MACRO] B(SSL_ST_CONNECT|SSL_CB_EXIT); +=back -=item [MACRO] B(SSL_ST_CONNECT|SSL_CB_LOOP); +=head2 DEALING WITH CIPHERS -=item [MACRO] B(SSL_CB_ALERT|SSL_CB_READ); +Here we document the various API functions which deal with the SSL/TLS +ciphers defined in B structures. -=item [MACRO] B(SSL_CB_ALERT|SSL_CB_WRITE); +=over 4 =item char *B(SSL_CIPHER *cipher, char *buf, int len); -=item int B(SSL_CIPHER *c, int *alg_bits); +Write a string to I (with a maximum size of I) containing a human +readable description of I. Returns I. -=item char *B(SSL_CIPHER *c); +=item int B(SSL_CIPHER *cipher, int *alg_bits); -=item char *B(SSL_CIPHER *c); +Determine the number of bits in I. Because of export crippled ciphers +there are two bits: The bits the algorithm supports in general (stored to +I) and the bits which are actually used (the return value). + +=item 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 +definitions in the header files. + +=item char *B(SSL_CIPHER *cipher); + +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 + +Here we document the various API functions which deal with the SSL/TLS +protocol context defined in the B structure. + +=over 4 =item int B(SSL_CTX *ctx, X509 *x); -=item [MACRO] B(ctx,x509); +=item long B(SSL_CTX *ctx, X509 *x509); =item int B(SSL_CTX *ctx, SSL_SESSION *c); @@ -93,123 +198,134 @@ They are documented in the following: =item void B(SSL_CTX *a); -=item [MACRO] B(ctx); +=item char *B(SSL_CTX *ctx); -=item [MACRO] B(ctx); +=item X509_STORE *B(SSL_CTX *ctx); =item STACK *B(SSL_CTX *ctx); -=item [MACRO] B(ctx); +=item int (*B(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey); =item char *B(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 [MACRO] B(ctx); +=item void (*B(SSL_CTX *ctx))(SSL *ssl, int cb, int ret); =item int B(SSL_CTX *ctx); -=item [MACRO] B(ctx); +=item int B(SSL_CTX *ctx); -=item [MACRO] B(ctx); +=item long B(SSL_CTX *ctx); -=item int (*B(SSL_CTX *ctx);)(void) +=item int (*B(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 [MACRO] B(ctx); +=item long B(SSL_CTX *ctx); =item SSL_CTX *B(SSL_METHOD *meth); =item int B(SSL_CTX *ctx, SSL_SESSION *c); -=item [MACRO] B(ctx); - -=item [MACRO] B(ctx); +=item int B(SSL_CTX *ctx); -=item [MACRO] B(ctx); +=item int B(SSL_CTX *ctx); -=item [MACRO] B(ctx); +=item int B(SSL_CTX *ctx); -=item [MACRO] B(ctx); +=item int B(SSL_CTX *ctx); -=item [MACRO] B(ctx); +=item int B(SSL_CTX *ctx); -=item [MACRO] B(ctx); +=item int B(SSL_CTX *ctx); -=item [MACRO] B(ctx); +=item int B(SSL_CTX *ctx); -=item [MACRO] B(ctx); +=item int B(SSL_CTX *ctx); -=item [MACRO] B(ctx); +=item int B(SSL_CTX *ctx); -=item [MACRO] B(ctx); +=item SSL_SESSION *(*B(SSL_CTX *ctx))(SSL *ssl, unsigned char *data, int len, int *copy); -=item [MACRO] B(ctx); +=item int (*B(SSL_CTX *ctx)(SSL *ssl, SSL_SESSION *sess); -=item [MACRO] B(ctx); +=item void (*B(SSL_CTX *ctx)(SSL_CTX *ctx, SSL_SESSION *sess); -=item [MACRO] B(ctx); +=item int B(SSL_CTX *ctx); -=item [MACRO] B(ctx); +=item int B(SSL_CTX *ctx); -=item [MACRO] B(ctx,t); +=item int B(SSL_CTX *ctx); -=item [MACRO] B(ctx,cb); +=item void B(SSL_CTX *ctx,t); -=item [MACRO] B(ctx,cb); +=item void B(SSL_CTX *ctx, SSL_SESSION *(*cb)(SSL *ssl, unsigned char *data, int len, int *copy)); -=item [MACRO] B(ctx,cb); +=item void B(SSL_CTX *ctx, int (*cb)(SSL *ssl, SSL_SESSION *sess)); -=item [MACRO] B(ctx); +=item void B(SSL_CTX *ctx, void (*cb)(SSL_CTX *ctx, SSL_SESSION *sess)); -=item [MACRO] B(ctx); +=item int B(SSL_CTX *ctx); -=item [MACRO] B(ctx,arg); +=item LHASH *B(SSL_CTX *ctx); -=item [MACRO] B(ctx,cs); +=item void B(SSL_CTX *ctx, void *arg); -=item [MACRO] B(a,b,c); +=item void B(SSL_CTX *ctx, X509_STORE *cs); -=item void B(SSL_CTX *ctx, int (*cb);(void), char *arg) +=item void B(SSL_CTX *ctx, int (*cb)(SSL_CTX *), char *arg) =item int B(SSL_CTX *ctx, char *str); =item void B(SSL_CTX *ctx, STACK *list); -=item [MACRO] B(ctx,cb); +=item void B(SSL_CTX *ctx, int (*cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)); =item void B(SSL_CTX *ctx, int (*cb);(void)) -=item [MACRO] B(ctx,m); - -=item [MACRO] B(a,b,c); +=item void B(SSL_CTX *ctx, int m); =item int B(SSL_CTX *ctx); =item int B(SSL_CTX *s, int idx, char *arg); -=item [MACRO] B(ctx,cb); +=item void B(SSL_CTX *ctx, void (*cb)(SSL *ssl, int cb, int ret)); -=item [MACRO] B(ctx,op); +=item void B(SSL_CTX *ctx, unsigned long op); =item void B(SSL_CTX *ctx, int mode); -=item [MACRO] B(ctx,m); +=item void B(SSL_CTX *ctx, int mode); =item int B(SSL_CTX *ctx, SSL_METHOD *meth); -=item [MACRO] B(ctx,t); +=item void B(SSL_CTX *ctx, long t); -=item [MACRO] B(ctx,dh); +=item long B(SSL_CTX* ctx, DH *dh); -=item [MACRO] B(ctx,dh); +=item long B(SSL_CTX *ctx, DH *(*cb)(void)); -=item [MACRO] B(ctx,rsa); +=item long B(SSL_CTX *ctx, RSA *rsa); -=item [MACRO] B(ctx,cb); +=item SSL_CTX_set_tmp_rsa_callback + +C(SSL_CTX *B, RSA *(*B)(SSL *B, int B, int B));> + +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 SSL_set_tmp_rsa_callback + +long B(SSL *ssl, RSA *(*cb)(SSL *ssl, int export, int keylength)); + +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, int mode, int (*cb);(void)) @@ -231,25 +347,20 @@ They are documented in the following: =item int B(SSL_CTX *ctx, char *file, int type); -=item [MACRO] B(SSL_kDHr|SSL_kDHd|SSL_kEDH); - -=item [MACRO] B(SSL_kEDH|(SSL_AUTH_MASK^SSL_aNULL); - -=item [MACRO] B(SSL_aFZA|SSL_kFZA|SSL_eFZA); - -=item [MACRO] B(512/8); +=back -=item [MACRO] B(SSL_eNULL); +=head2 DEALING WITH SESSIONS -=item [MACRO] B(SSL_kRSA|SSL_aRSA); +Here we document the various API functions which deal with the SSL/TLS +sessions defined in the B structures. -=item [MACRO] B(1024*20); +=over 4 =item int B(SSL_SESSION *a, SSL_SESSION *b); =item void B(SSL_SESSION *ss); -=item [MACRO] B(s); +=item char *B(SSL_SESSION *s); =item char *B(SSL_SESSION *s, int idx); @@ -267,7 +378,7 @@ They are documented in the following: =item int B(FILE *fp, SSL_SESSION *x); -=item [MACRO] B(s,a); +=item void B(SSL_SESSION *s, char *a); =item int B(SSL_SESSION *s, int idx, char *arg); @@ -275,19 +386,22 @@ They are documented in the following: =item long B(SSL_SESSION *s, long t); -=item [MACRO] B(SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER); +=back + +=head2 DEALING WITH CONNECTIONS -=item [MACRO] B(SSL_SHA1); +Here we document the various API functions which deal with the SSL/TLS +connection defined in the B structure. -=item [MACRO] B(SSL_ST_CONNECT|SSL_ST_ACCEPT); +=over 4 -=item [MACRO] B(0x04|SSL_ST_INIT); +=item int B(SSL *ssl); -=item int B(SSL *s); +=item int B(STACK *stack, const char *dir); -=item int B(SSL *ssl, X509 *x); +=item int B(STACK *stack, const char *file); -=item [MACRO] B(a,b); +=item int B(SSL *ssl, X509 *x); =item char *B(int value); @@ -299,107 +413,105 @@ They are documented in the following: =item int B(SSL *ssl); -=item void B(SSL *s); +=item void B(SSL *ssl); -=item [MACRO] B(ssl); +=item long B(SSL *ssl); -=item int B(SSL *s); +=item int B(SSL *ssl); =item void B(SSL *t, SSL *f); -=item long B(SSL *s, int cmd, long larg, char *parg); +=item long B(SSL *ssl, int cmd, long larg, char *parg); -=item int B(SSL *s); +=item int B(SSL *ssl); -=item SSL *B(SSL *s); +=item SSL *B(SSL *ssl); =item STACK *B(STACK *sk); -=item [MACRO] B(a,b); - -=item void B(SSL *s); +=item void B(SSL *ssl); =item SSL_CTX *B(SSL *ssl); -=item [MACRO] B(s); +=item char *B(SSL *ssl); -=item X509 *B(SSL *s); +=item X509 *B(SSL *ssl); -=item [MACRO] B(s); +=item SSL_CIPHER *B(SSL *ssl); -=item [MACRO] B(s,np); +=item int B(SSL *ssl, int *alg_bits); -=item char *B(SSL *s, int n); +=item char *B(SSL *ssl, int n); -=item [MACRO] B(s); +=item char *B(SSL *ssl); -=item [MACRO] B(s); +=item char *B(SSL *ssl); -=item STACK *B(SSL *s); +=item STACK *B(SSL *ssl); -=item STACK *B(SSL *s); +=item STACK *B(SSL *ssl); -=item SSL_CIPHER *B(SSL *s); +=item SSL_CIPHER *B(SSL *ssl); -=item long B(SSL *s); +=item long B(SSL *ssl); -=item int B(SSL *s, int i); +=item int B(SSL *ssl, int i); -=item char *B(SSL *s, int idx); +=item char *B(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 *s); +=item int B(SSL *ssl); =item void (*B(SSL *ssl);)(void) -=item STACK *B(SSL *s); +=item STACK *B(SSL *ssl); -=item X509 *B(SSL *s); +=item X509 *B(SSL *ssl); -=item EVP_PKEY *B(SSL *s); +=item EVP_PKEY *B(SSL *ssl); -=item int B(SSL *s); +=item int B(SSL *ssl); -=item BIO *B(SSL *s); +=item BIO *B(SSL *ssl); -=item int B(SSL *s); +=item int B(SSL *ssl); =item SSL_SESSION *B(SSL *ssl); -=item char *B(SSL *s, char *buf, int len); +=item char *B(SSL *ssl, char *buf, int len); -=item int B(SSL *s); +=item int B(SSL *ssl); -=item SSL_METHOD *B(SSL *s); +=item SSL_METHOD *B(SSL *ssl); -=item [MACRO] B(a); +=item int B(SSL *ssl); -=item [MACRO] B(a); +=item long B(SSL *ssl); -=item [MACRO] B(a); +=item long B(SSL *ssl); -=item int (*B(SSL *s);)(void) +=item int (*B(SSL *ssl);)(void) -=item int B(SSL *s); +=item int B(SSL *ssl); =item long B(SSL *ssl); -=item char *B(SSL *s); +=item char *B(SSL *ssl); -=item BIO *B(SSL *s); +=item BIO *B(SSL *ssl); -=item [MACRO] B(a); +=item int B(SSL *ssl); -=item [MACRO] B(a); +=item int B(SSL *ssl); -=item [MACRO] B(a); +=item int B(SSL *ssl); -=item [MACRO] B(a); +=item int B(SSL *ssl); -=item [MACRO] B(a); +=item int B(SSL *ssl); =item STACK *B(char *file); @@ -407,77 +519,73 @@ They are documented in the following: =item SSL *B(SSL_CTX *ctx); -=item [MACRO] B(ssl); - -=item int B(SSL *s, char *buf, int num); +=item long B(SSL *ssl); -=item int B(SSL *s); +=item int B(SSL *ssl, char *buf, int num); -=item int B(SSL *s, char *buf, int num); +=item int B(SSL *ssl); -=item [MACRO] B(a,b); +=item int B(SSL *ssl, char *buf, int num); -=item int B(SSL *s); +=item int B(SSL *ssl); -=item char *B(SSL *s); +=item char *B(SSL *ssl); -=item char *B(SSL *s); +=item char *B(SSL *ssl); -=item [MACRO] B(ssl); +=item long B(SSL *ssl); -=item void B(SSL *s); +=item void B(SSL *ssl); -=item [MACRO] B(s,arg); +=item void B(SSL *ssl, char *arg); -=item void B(SSL *s, BIO *rbio, BIO *wbio); +=item void B(SSL *ssl, BIO *rbio, BIO *wbio); -=item int B(SSL *s, char *str); +=item int B(SSL *ssl, char *str); -=item void B(SSL *s, STACK *list); +=item void B(SSL *ssl, STACK *list); -=item void B(SSL *s); +=item void B(SSL *ssl); -=item int B(SSL *s, int idx, char *arg); +=item int B(SSL *ssl, int idx, char *arg); -=item int B(SSL *s, int fd); +=item int B(SSL *ssl, int fd); =item void B(SSL *ssl, void (*cb);(void)) -=item [MACRO] B(ssl,op); - -=item [MACRO] B(c,n); +=item void B(SSL *ssl, unsigned long op); -=item void B(SSL *s, int mode); +=item void B(SSL *ssl, int mode); -=item void B(SSL *s, int yes); +=item void B(SSL *ssl, int yes); -=item int B(SSL *s, int fd); +=item int B(SSL *ssl, int fd); -=item int B(SSL *s, SSL_SESSION *session); +=item int B(SSL *ssl, SSL_SESSION *session); -=item void B(SSL *s, int mode); +=item void B(SSL *ssl, int mode); -=item int B(SSL *s, SSL_METHOD *meth); +=item int B(SSL *ssl, SSL_METHOD *meth); -=item [MACRO] B(a,b); +=item void B(SSL *ssl, long t); -=item [MACRO] B(a,b); +=item void B(SSL *ssl, long t); -=item void B(SSL *s, int mode, int (*callback);(void)) +=item void B(SSL *ssl, int mode, int (*callback);(void)) =item void B(SSL *ssl, long arg); -=item int B(SSL *s, int fd); +=item int B(SSL *ssl, int fd); -=item int B(SSL *s); +=item int B(SSL *ssl); =item int B(SSL *ssl); -=item char *B(SSL *s); +=item char *B(SSL *ssl); -=item char *B(SSL *s); +=item char *B(SSL *ssl); -=item [MACRO] B(ssl); +=item long B(SSL *ssl); =item int B(SSL *ssl, EVP_PKEY *pkey); @@ -497,37 +605,19 @@ They are documented in the following: =item int B(SSL *ssl, char *file, int type); -=item int B(SSL *s); - -=item [MACRO] B(s); - -=item [MACRO] B(s); - -=item [MACRO] B(s); - -=item [MACRO] B(s); - -=item [MACRO] B(s); - -=item int B(SSL *s, char *buf, int num); +=item int B(SSL *ssl); -=item SSL_METHOD *B(void); - -=item SSL_METHOD *B(void); - -=item SSL_METHOD *B(void); - -=item SSL_METHOD *B(void); +=item int B(SSL *ssl); -=item SSL_METHOD *B(void); +=item int B(SSL *ssl); -=item SSL_METHOD *B(void); +=item int B(SSL *ssl); -=item SSL_METHOD *B(void); +=item int B(SSL *ssl); -=item SSL_METHOD *B(void); +=item int B(s); -=item SSL_METHOD *B(void); +=item int B(SSL *ssl, char *buf, int num); =back