ssl.pod 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847
  1. =pod
  2. =head1 NAME
  3. ssl - OpenSSL SSL/TLS library
  4. =head1 SYNOPSIS
  5. See the individual manual pages for details.
  6. =head1 DESCRIPTION
  7. The OpenSSL B<ssl> library implements the Secure Sockets Layer (SSL v2/v3) and
  8. Transport Layer Security (TLS v1) protocols. It provides a rich API which is
  9. documented here.
  10. An B<SSL_CTX> object is created as a framework to establish
  11. TLS/SSL enabled connections (see L<SSL_CTX_new(3)>).
  12. Various options regarding certificates, algorithms etc. can be set
  13. in this object.
  14. When a network connection has been created, it can be assigned to an
  15. B<SSL> object. After the B<SSL> object has been created using
  16. L<SSL_new(3)>, L<SSL_set_fd(3)> or
  17. L<SSL_set_bio(3)> can be used to associate the network
  18. connection with the object.
  19. When the TLS/SSL handshake is performed using
  20. L<SSL_accept(3)> or L<SSL_connect(3)>
  21. respectively.
  22. L<SSL_read_ex(3)>, L<SSL_read(3)>, L<SSL_write_ex(3)> and L<SSL_write(3)> are
  23. used to read and write data on the TLS/SSL connection.
  24. L<SSL_shutdown(3)> can be used to shut down the
  25. TLS/SSL connection.
  26. =head1 DATA STRUCTURES
  27. Currently the OpenSSL B<ssl> library functions deals with the following data
  28. structures:
  29. =over 4
  30. =item B<SSL_METHOD> (SSL Method)
  31. This is a dispatch structure describing the internal B<ssl> library
  32. methods/functions which implement the various protocol versions (SSLv3
  33. TLSv1, ...). It's needed to create an B<SSL_CTX>.
  34. =item B<SSL_CIPHER> (SSL Cipher)
  35. This structure holds the algorithm information for a particular cipher which
  36. are a core part of the SSL/TLS protocol. The available ciphers are configured
  37. on a B<SSL_CTX> basis and the actual ones used are then part of the
  38. B<SSL_SESSION>.
  39. =item B<SSL_CTX> (SSL Context)
  40. This is the global context structure which is created by a server or client
  41. once per program life-time and which holds mainly default values for the
  42. B<SSL> structures which are later created for the connections.
  43. =item B<SSL_SESSION> (SSL Session)
  44. This is a structure containing the current TLS/SSL session details for a
  45. connection: B<SSL_CIPHER>s, client and server certificates, keys, etc.
  46. =item B<SSL> (SSL Connection)
  47. This is the main SSL/TLS structure which is created by a server or client per
  48. established connection. This actually is the core structure in the SSL API.
  49. At run-time the application usually deals with this structure which has
  50. links to mostly all other structures.
  51. =back
  52. =head1 HEADER FILES
  53. Currently the OpenSSL B<ssl> library provides the following C header files
  54. containing the prototypes for the data structures and functions:
  55. =over 4
  56. =item B<ssl.h>
  57. This is the common header file for the SSL/TLS API. Include it into your
  58. program to make the API of the B<ssl> library available. It internally
  59. includes both more private SSL headers and headers from the B<crypto> library.
  60. Whenever you need hard-core details on the internals of the SSL API, look
  61. inside this header file.
  62. OPENSSL_VERSION_AT_LEAST(major,minor) can be
  63. used in C<#if> statements in order to determine which version of the library is
  64. being used. This can be used to either enable optional features at compile
  65. time, or work around issues with a previous version.
  66. See L<OPENSSL_VERSION_NUMBER(3)>.
  67. =item B<ssl2.h>
  68. Unused. Present for backwards compatibility only.
  69. =item B<ssl3.h>
  70. This is the sub header file dealing with the SSLv3 protocol only.
  71. I<Usually you don't have to include it explicitly because
  72. it's already included by ssl.h>.
  73. =item B<tls1.h>
  74. This is the sub header file dealing with the TLSv1 protocol only.
  75. I<Usually you don't have to include it explicitly because
  76. it's already included by ssl.h>.
  77. =back
  78. =head1 API FUNCTIONS
  79. Currently the OpenSSL B<ssl> library exports 214 API functions.
  80. They are documented in the following:
  81. =head2 Dealing with Protocol Methods
  82. Here we document the various API functions which deal with the SSL/TLS
  83. protocol methods defined in B<SSL_METHOD> structures.
  84. =over 4
  85. =item const SSL_METHOD *B<TLS_method>(void);
  86. Constructor for the I<version-flexible> SSL_METHOD structure for clients,
  87. servers or both.
  88. See L<SSL_CTX_new(3)> for details.
  89. =item const SSL_METHOD *B<TLS_client_method>(void);
  90. Constructor for the I<version-flexible> SSL_METHOD structure for clients.
  91. =item const SSL_METHOD *B<TLS_server_method>(void);
  92. Constructor for the I<version-flexible> SSL_METHOD structure for servers.
  93. =item const SSL_METHOD *B<TLSv1_2_method>(void);
  94. Constructor for the TLSv1.2 SSL_METHOD structure for clients, servers or both.
  95. =item const SSL_METHOD *B<TLSv1_2_client_method>(void);
  96. Constructor for the TLSv1.2 SSL_METHOD structure for clients.
  97. =item const SSL_METHOD *B<TLSv1_2_server_method>(void);
  98. Constructor for the TLSv1.2 SSL_METHOD structure for servers.
  99. =item const SSL_METHOD *B<TLSv1_1_method>(void);
  100. Constructor for the TLSv1.1 SSL_METHOD structure for clients, servers or both.
  101. =item const SSL_METHOD *B<TLSv1_1_client_method>(void);
  102. Constructor for the TLSv1.1 SSL_METHOD structure for clients.
  103. =item const SSL_METHOD *B<TLSv1_1_server_method>(void);
  104. Constructor for the TLSv1.1 SSL_METHOD structure for servers.
  105. =item const SSL_METHOD *B<TLSv1_method>(void);
  106. Constructor for the TLSv1 SSL_METHOD structure for clients, servers or both.
  107. =item const SSL_METHOD *B<TLSv1_client_method>(void);
  108. Constructor for the TLSv1 SSL_METHOD structure for clients.
  109. =item const SSL_METHOD *B<TLSv1_server_method>(void);
  110. Constructor for the TLSv1 SSL_METHOD structure for servers.
  111. =item const SSL_METHOD *B<SSLv3_method>(void);
  112. Constructor for the SSLv3 SSL_METHOD structure for clients, servers or both.
  113. =item const SSL_METHOD *B<SSLv3_client_method>(void);
  114. Constructor for the SSLv3 SSL_METHOD structure for clients.
  115. =item const SSL_METHOD *B<SSLv3_server_method>(void);
  116. Constructor for the SSLv3 SSL_METHOD structure for servers.
  117. =back
  118. =head2 Dealing with Ciphers
  119. Here we document the various API functions which deal with the SSL/TLS
  120. ciphers defined in B<SSL_CIPHER> structures.
  121. =over 4
  122. =item char *B<SSL_CIPHER_description>(SSL_CIPHER *cipher, char *buf, int len);
  123. Write a string to I<buf> (with a maximum size of I<len>) containing a human
  124. readable description of I<cipher>. Returns I<buf>.
  125. =item int B<SSL_CIPHER_get_bits>(SSL_CIPHER *cipher, int *alg_bits);
  126. Determine the number of bits in I<cipher>. Because of export crippled ciphers
  127. there are two bits: The bits the algorithm supports in general (stored to
  128. I<alg_bits>) and the bits which are actually used (the return value).
  129. =item const char *B<SSL_CIPHER_get_name>(SSL_CIPHER *cipher);
  130. Return the internal name of I<cipher> as a string. These are the various
  131. strings defined by the I<SSL3_TXT_xxx> and I<TLS1_TXT_xxx>
  132. definitions in the header files.
  133. =item const char *B<SSL_CIPHER_get_version>(SSL_CIPHER *cipher);
  134. Returns a string like "C<SSLv3>" or "C<TLSv1.2>" which indicates the
  135. SSL/TLS protocol version to which I<cipher> belongs (i.e. where it was defined
  136. in the specification the first time).
  137. =back
  138. =head2 Dealing with Protocol Contexts
  139. Here we document the various API functions which deal with the SSL/TLS
  140. protocol context defined in the B<SSL_CTX> structure.
  141. =over 4
  142. =item int B<SSL_CTX_add_client_CA>(SSL_CTX *ctx, X509 *x);
  143. =item long B<SSL_CTX_add_extra_chain_cert>(SSL_CTX *ctx, X509 *x509);
  144. =item int B<SSL_CTX_add_session>(SSL_CTX *ctx, SSL_SESSION *c);
  145. =item int B<SSL_CTX_check_private_key>(const SSL_CTX *ctx);
  146. =item long B<SSL_CTX_ctrl>(SSL_CTX *ctx, int cmd, long larg, char *parg);
  147. =item void B<SSL_CTX_flush_sessions>(SSL_CTX *s, long t);
  148. =item void B<SSL_CTX_free>(SSL_CTX *a);
  149. =item char *B<SSL_CTX_get_app_data>(SSL_CTX *ctx);
  150. =item X509_STORE *B<SSL_CTX_get_cert_store>(SSL_CTX *ctx);
  151. =item STACK *B<SSL_CTX_get_ciphers>(const SSL_CTX *ctx);
  152. =item STACK *B<SSL_CTX_get_client_CA_list>(const SSL_CTX *ctx);
  153. =item int (*B<SSL_CTX_get_client_cert_cb>(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey);
  154. =item void B<SSL_CTX_get_default_read_ahead>(SSL_CTX *ctx);
  155. =item char *B<SSL_CTX_get_ex_data>(const SSL_CTX *s, int idx);
  156. =item int B<SSL_CTX_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void))
  157. =item void (*B<SSL_CTX_get_info_callback>(SSL_CTX *ctx))(SSL *ssl, int cb, int ret);
  158. =item int B<SSL_CTX_get_quiet_shutdown>(const SSL_CTX *ctx);
  159. =item void B<SSL_CTX_get_read_ahead>(SSL_CTX *ctx);
  160. =item int B<SSL_CTX_get_session_cache_mode>(SSL_CTX *ctx);
  161. =item long B<SSL_CTX_get_timeout>(const SSL_CTX *ctx);
  162. =item int (*B<SSL_CTX_get_verify_callback>(const SSL_CTX *ctx))(int ok, X509_STORE_CTX *ctx);
  163. =item int B<SSL_CTX_get_verify_mode>(SSL_CTX *ctx);
  164. =item int B<SSL_CTX_load_verify_locations>(SSL_CTX *ctx, const char *CAfile, const char *CApath);
  165. =item SSL_CTX *B<SSL_CTX_new>(const SSL_METHOD *meth);
  166. =item int SSL_CTX_up_ref(SSL_CTX *ctx);
  167. =item int B<SSL_CTX_remove_session>(SSL_CTX *ctx, SSL_SESSION *c);
  168. =item int B<SSL_CTX_sess_accept>(SSL_CTX *ctx);
  169. =item int B<SSL_CTX_sess_accept_good>(SSL_CTX *ctx);
  170. =item int B<SSL_CTX_sess_accept_renegotiate>(SSL_CTX *ctx);
  171. =item int B<SSL_CTX_sess_cache_full>(SSL_CTX *ctx);
  172. =item int B<SSL_CTX_sess_cb_hits>(SSL_CTX *ctx);
  173. =item int B<SSL_CTX_sess_connect>(SSL_CTX *ctx);
  174. =item int B<SSL_CTX_sess_connect_good>(SSL_CTX *ctx);
  175. =item int B<SSL_CTX_sess_connect_renegotiate>(SSL_CTX *ctx);
  176. =item int B<SSL_CTX_sess_get_cache_size>(SSL_CTX *ctx);
  177. =item SSL_SESSION *(*B<SSL_CTX_sess_get_get_cb>(SSL_CTX *ctx))(SSL *ssl, unsigned char *data, int len, int *copy);
  178. =item int (*B<SSL_CTX_sess_get_new_cb>(SSL_CTX *ctx)(SSL *ssl, SSL_SESSION *sess);
  179. =item void (*B<SSL_CTX_sess_get_remove_cb>(SSL_CTX *ctx)(SSL_CTX *ctx, SSL_SESSION *sess);
  180. =item int B<SSL_CTX_sess_hits>(SSL_CTX *ctx);
  181. =item int B<SSL_CTX_sess_misses>(SSL_CTX *ctx);
  182. =item int B<SSL_CTX_sess_number>(SSL_CTX *ctx);
  183. =item void B<SSL_CTX_sess_set_cache_size>(SSL_CTX *ctx, t);
  184. =item void B<SSL_CTX_sess_set_get_cb>(SSL_CTX *ctx, SSL_SESSION *(*cb)(SSL *ssl, unsigned char *data, int len, int *copy));
  185. =item void B<SSL_CTX_sess_set_new_cb>(SSL_CTX *ctx, int (*cb)(SSL *ssl, SSL_SESSION *sess));
  186. =item void B<SSL_CTX_sess_set_remove_cb>(SSL_CTX *ctx, void (*cb)(SSL_CTX *ctx, SSL_SESSION *sess));
  187. =item int B<SSL_CTX_sess_timeouts>(SSL_CTX *ctx);
  188. =item LHASH *B<SSL_CTX_sessions>(SSL_CTX *ctx);
  189. =item int B<SSL_CTX_set_app_data>(SSL_CTX *ctx, void *arg);
  190. =item void B<SSL_CTX_set_cert_store>(SSL_CTX *ctx, X509_STORE *cs);
  191. =item void B<SSL_CTX_set1_cert_store>(SSL_CTX *ctx, X509_STORE *cs);
  192. =item void B<SSL_CTX_set_cert_verify_cb>(SSL_CTX *ctx, int (*cb)(), char *arg)
  193. =item int B<SSL_CTX_set_cipher_list>(SSL_CTX *ctx, char *str);
  194. =item void B<SSL_CTX_set_client_CA_list>(SSL_CTX *ctx, STACK *list);
  195. =item void B<SSL_CTX_set_client_cert_cb>(SSL_CTX *ctx, int (*cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey));
  196. =item int B<SSL_CTX_set_ct_validation_callback>(SSL_CTX *ctx, ssl_ct_validation_cb callback, void *arg);
  197. =item void B<SSL_CTX_set_default_passwd_cb>(SSL_CTX *ctx, int (*cb);(void))
  198. =item void B<SSL_CTX_set_default_read_ahead>(SSL_CTX *ctx, int m);
  199. =item int B<SSL_CTX_set_default_verify_paths>(SSL_CTX *ctx);
  200. Use the default paths to locate trusted CA certificates. There is one default
  201. directory path and one default file path. Both are set via this call.
  202. =item int B<SSL_CTX_set_default_verify_dir>(SSL_CTX *ctx)
  203. Use the default directory path to locate trusted CA certificates.
  204. =item int B<SSL_CTX_set_default_verify_file>(SSL_CTX *ctx)
  205. Use the file path to locate trusted CA certificates.
  206. =item int B<SSL_CTX_set_ex_data>(SSL_CTX *s, int idx, char *arg);
  207. =item void B<SSL_CTX_set_info_callback>(SSL_CTX *ctx, void (*cb)(SSL *ssl, int cb, int ret));
  208. =item void B<SSL_CTX_set_msg_callback>(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg));
  209. =item void B<SSL_CTX_set_msg_callback_arg>(SSL_CTX *ctx, void *arg);
  210. =item unsigned long B<SSL_CTX_clear_options>(SSL_CTX *ctx, unsigned long op);
  211. =item unsigned long B<SSL_CTX_get_options>(SSL_CTX *ctx);
  212. =item unsigned long B<SSL_CTX_set_options>(SSL_CTX *ctx, unsigned long op);
  213. =item void B<SSL_CTX_set_quiet_shutdown>(SSL_CTX *ctx, int mode);
  214. =item void B<SSL_CTX_set_read_ahead>(SSL_CTX *ctx, int m);
  215. =item void B<SSL_CTX_set_session_cache_mode>(SSL_CTX *ctx, int mode);
  216. =item int B<SSL_CTX_set_ssl_version>(SSL_CTX *ctx, const SSL_METHOD *meth);
  217. =item void B<SSL_CTX_set_timeout>(SSL_CTX *ctx, long t);
  218. =item long B<SSL_CTX_set_tmp_dh>(SSL_CTX* ctx, DH *dh);
  219. =item long B<SSL_CTX_set_tmp_dh_callback>(SSL_CTX *ctx, DH *(*cb)(void));
  220. =item void B<SSL_CTX_set_verify>(SSL_CTX *ctx, int mode, int (*cb);(void))
  221. =item int B<SSL_CTX_use_PrivateKey>(SSL_CTX *ctx, EVP_PKEY *pkey);
  222. =item int B<SSL_CTX_use_PrivateKey_ASN1>(int type, SSL_CTX *ctx, unsigned char *d, long len);
  223. =item int B<SSL_CTX_use_PrivateKey_file>(SSL_CTX *ctx, const char *file, int type);
  224. =item int B<SSL_CTX_use_RSAPrivateKey>(SSL_CTX *ctx, RSA *rsa);
  225. =item int B<SSL_CTX_use_RSAPrivateKey_ASN1>(SSL_CTX *ctx, unsigned char *d, long len);
  226. =item int B<SSL_CTX_use_RSAPrivateKey_file>(SSL_CTX *ctx, const char *file, int type);
  227. =item int B<SSL_CTX_use_certificate>(SSL_CTX *ctx, X509 *x);
  228. =item int B<SSL_CTX_use_certificate_ASN1>(SSL_CTX *ctx, int len, unsigned char *d);
  229. =item int B<SSL_CTX_use_certificate_file>(SSL_CTX *ctx, const char *file, int type);
  230. =item int B<SSL_CTX_use_cert_and_key>(SSL_CTX *ctx, X509 *x, EVP_PKEY *pkey, STACK_OF(X509) *chain, int override);
  231. =item X509 *B<SSL_CTX_get0_certificate>(const SSL_CTX *ctx);
  232. =item EVP_PKEY *B<SSL_CTX_get0_privatekey>(const SSL_CTX *ctx);
  233. =item void B<SSL_CTX_set_psk_client_callback>(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));
  234. =item int B<SSL_CTX_use_psk_identity_hint>(SSL_CTX *ctx, const char *hint);
  235. =item void B<SSL_CTX_set_psk_server_callback>(SSL_CTX *ctx, unsigned int (*callback)(SSL *ssl, const char *identity, unsigned char *psk, int max_psk_len));
  236. =back
  237. =head2 Dealing with Sessions
  238. Here we document the various API functions which deal with the SSL/TLS
  239. sessions defined in the B<SSL_SESSION> structures.
  240. =over 4
  241. =item int B<SSL_SESSION_cmp>(const SSL_SESSION *a, const SSL_SESSION *b);
  242. =item void B<SSL_SESSION_free>(SSL_SESSION *ss);
  243. =item char *B<SSL_SESSION_get_app_data>(SSL_SESSION *s);
  244. =item char *B<SSL_SESSION_get_ex_data>(const SSL_SESSION *s, int idx);
  245. =item int B<SSL_SESSION_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void))
  246. =item long B<SSL_SESSION_get_time>(const SSL_SESSION *s);
  247. =item long B<SSL_SESSION_get_timeout>(const SSL_SESSION *s);
  248. =item unsigned long B<SSL_SESSION_hash>(const SSL_SESSION *a);
  249. =item SSL_SESSION *B<SSL_SESSION_new>(void);
  250. =item int B<SSL_SESSION_print>(BIO *bp, const SSL_SESSION *x);
  251. =item int B<SSL_SESSION_print_fp>(FILE *fp, const SSL_SESSION *x);
  252. =item int B<SSL_SESSION_set_app_data>(SSL_SESSION *s, char *a);
  253. =item int B<SSL_SESSION_set_ex_data>(SSL_SESSION *s, int idx, char *arg);
  254. =item long B<SSL_SESSION_set_time>(SSL_SESSION *s, long t);
  255. =item long B<SSL_SESSION_set_timeout>(SSL_SESSION *s, long t);
  256. =back
  257. =head2 Dealing with Connections
  258. Here we document the various API functions which deal with the SSL/TLS
  259. connection defined in the B<SSL> structure.
  260. =over 4
  261. =item int B<SSL_accept>(SSL *ssl);
  262. =item int B<SSL_add_dir_cert_subjects_to_stack>(STACK *stack, const char *dir);
  263. =item int B<SSL_add_file_cert_subjects_to_stack>(STACK *stack, const char *file);
  264. =item int B<SSL_add_client_CA>(SSL *ssl, X509 *x);
  265. =item char *B<SSL_alert_desc_string>(int value);
  266. =item char *B<SSL_alert_desc_string_long>(int value);
  267. =item char *B<SSL_alert_type_string>(int value);
  268. =item char *B<SSL_alert_type_string_long>(int value);
  269. =item int B<SSL_check_private_key>(const SSL *ssl);
  270. =item void B<SSL_clear>(SSL *ssl);
  271. =item long B<SSL_clear_num_renegotiations>(SSL *ssl);
  272. =item int B<SSL_connect>(SSL *ssl);
  273. =item int B<SSL_copy_session_id>(SSL *t, const SSL *f);
  274. Sets the session details for B<t> to be the same as in B<f>. Returns 1 on
  275. success or 0 on failure.
  276. =item long B<SSL_ctrl>(SSL *ssl, int cmd, long larg, char *parg);
  277. =item int B<SSL_do_handshake>(SSL *ssl);
  278. =item SSL *B<SSL_dup>(SSL *ssl);
  279. SSL_dup() allows applications to configure an SSL handle for use
  280. in multiple SSL connections, and then duplicate it prior to initiating
  281. each connection with the duplicated handle.
  282. Use of SSL_dup() avoids the need to repeat the configuration of the
  283. handles for each connection.
  284. For SSL_dup() to work, the connection MUST be in its initial state
  285. and MUST NOT have not yet have started the SSL handshake.
  286. For connections that are not in their initial state SSL_dup() just
  287. increments an internal reference count and returns the I<same>
  288. handle.
  289. It may be possible to use L<SSL_clear(3)> to recycle an SSL handle
  290. that is not in its initial state for re-use, but this is best
  291. avoided.
  292. Instead, save and restore the session, if desired, and construct a
  293. fresh handle for each connection.
  294. =item STACK *B<SSL_dup_CA_list>(STACK *sk);
  295. =item void B<SSL_free>(SSL *ssl);
  296. =item SSL_CTX *B<SSL_get_SSL_CTX>(const SSL *ssl);
  297. =item char *B<SSL_get_app_data>(SSL *ssl);
  298. =item X509 *B<SSL_get_certificate>(const SSL *ssl);
  299. =item const char *B<SSL_get_cipher>(const SSL *ssl);
  300. =item int B<SSL_is_dtls>(const SSL *ssl);
  301. =item int B<SSL_get_cipher_bits>(const SSL *ssl, int *alg_bits);
  302. =item char *B<SSL_get_cipher_list>(const SSL *ssl, int n);
  303. =item char *B<SSL_get_cipher_name>(const SSL *ssl);
  304. =item char *B<SSL_get_cipher_version>(const SSL *ssl);
  305. =item STACK *B<SSL_get_ciphers>(const SSL *ssl);
  306. =item STACK *B<SSL_get_client_CA_list>(const SSL *ssl);
  307. =item SSL_CIPHER *B<SSL_get_current_cipher>(SSL *ssl);
  308. =item long B<SSL_get_default_timeout>(const SSL *ssl);
  309. =item int B<SSL_get_error>(const SSL *ssl, int i);
  310. =item char *B<SSL_get_ex_data>(const SSL *ssl, int idx);
  311. =item int B<SSL_get_ex_data_X509_STORE_CTX_idx>(void);
  312. =item int B<SSL_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void))
  313. =item int B<SSL_get_fd>(const SSL *ssl);
  314. =item void (*B<SSL_get_info_callback>(const SSL *ssl);)()
  315. =item int B<SSL_get_key_update_type>(SSL *s);
  316. =item STACK *B<SSL_get_peer_cert_chain>(const SSL *ssl);
  317. =item X509 *B<SSL_get_peer_certificate>(const SSL *ssl);
  318. =item const STACK_OF(SCT) *B<SSL_get0_peer_scts>(SSL *s);
  319. =item EVP_PKEY *B<SSL_get_privatekey>(const SSL *ssl);
  320. =item int B<SSL_get_quiet_shutdown>(const SSL *ssl);
  321. =item BIO *B<SSL_get_rbio>(const SSL *ssl);
  322. =item int B<SSL_get_read_ahead>(const SSL *ssl);
  323. =item SSL_SESSION *B<SSL_get_session>(const SSL *ssl);
  324. =item char *B<SSL_get_shared_ciphers>(const SSL *ssl, char *buf, int len);
  325. =item int B<SSL_get_shutdown>(const SSL *ssl);
  326. =item const SSL_METHOD *B<SSL_get_ssl_method>(SSL *ssl);
  327. =item int B<SSL_get_state>(const SSL *ssl);
  328. =item long B<SSL_get_time>(const SSL *ssl);
  329. =item long B<SSL_get_timeout>(const SSL *ssl);
  330. =item int (*B<SSL_get_verify_callback>(const SSL *ssl))(int, X509_STORE_CTX *)
  331. =item int B<SSL_get_verify_mode>(const SSL *ssl);
  332. =item long B<SSL_get_verify_result>(const SSL *ssl);
  333. =item char *B<SSL_get_version>(const SSL *ssl);
  334. =item BIO *B<SSL_get_wbio>(const SSL *ssl);
  335. =item int B<SSL_in_accept_init>(SSL *ssl);
  336. =item int B<SSL_in_before>(SSL *ssl);
  337. =item int B<SSL_in_connect_init>(SSL *ssl);
  338. =item int B<SSL_in_init>(SSL *ssl);
  339. =item int B<SSL_is_init_finished>(SSL *ssl);
  340. =item int B<SSL_key_update>(SSL *s, int updatetype);
  341. =item STACK *B<SSL_load_client_CA_file>(const char *file);
  342. =item SSL *B<SSL_new>(SSL_CTX *ctx);
  343. =item int SSL_up_ref(SSL *s);
  344. =item long B<SSL_num_renegotiations>(SSL *ssl);
  345. =item int B<SSL_peek>(SSL *ssl, void *buf, int num);
  346. =item int B<SSL_pending>(const SSL *ssl);
  347. =item int B<SSL_read>(SSL *ssl, void *buf, int num);
  348. =item int B<SSL_renegotiate>(SSL *ssl);
  349. =item char *B<SSL_rstate_string>(SSL *ssl);
  350. =item char *B<SSL_rstate_string_long>(SSL *ssl);
  351. =item long B<SSL_session_reused>(SSL *ssl);
  352. =item void B<SSL_set_accept_state>(SSL *ssl);
  353. =item void B<SSL_set_app_data>(SSL *ssl, char *arg);
  354. =item void B<SSL_set_bio>(SSL *ssl, BIO *rbio, BIO *wbio);
  355. =item int B<SSL_set_cipher_list>(SSL *ssl, char *str);
  356. =item void B<SSL_set_client_CA_list>(SSL *ssl, STACK *list);
  357. =item void B<SSL_set_connect_state>(SSL *ssl);
  358. =item int B<SSL_set_ct_validation_callback>(SSL *ssl, ssl_ct_validation_cb callback, void *arg);
  359. =item int B<SSL_set_ex_data>(SSL *ssl, int idx, char *arg);
  360. =item int B<SSL_set_fd>(SSL *ssl, int fd);
  361. =item void B<SSL_set_info_callback>(SSL *ssl, void (*cb);(void))
  362. =item void B<SSL_set_msg_callback>(SSL *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg));
  363. =item void B<SSL_set_msg_callback_arg>(SSL *ctx, void *arg);
  364. =item unsigned long B<SSL_clear_options>(SSL *ssl, unsigned long op);
  365. =item unsigned long B<SSL_get_options>(SSL *ssl);
  366. =item unsigned long B<SSL_set_options>(SSL *ssl, unsigned long op);
  367. =item void B<SSL_set_quiet_shutdown>(SSL *ssl, int mode);
  368. =item void B<SSL_set_read_ahead>(SSL *ssl, int yes);
  369. =item int B<SSL_set_rfd>(SSL *ssl, int fd);
  370. =item int B<SSL_set_session>(SSL *ssl, SSL_SESSION *session);
  371. =item void B<SSL_set_shutdown>(SSL *ssl, int mode);
  372. =item int B<SSL_set_ssl_method>(SSL *ssl, const SSL_METHOD *meth);
  373. =item void B<SSL_set_time>(SSL *ssl, long t);
  374. =item void B<SSL_set_timeout>(SSL *ssl, long t);
  375. =item void B<SSL_set_verify>(SSL *ssl, int mode, int (*callback);(void))
  376. =item void B<SSL_set_verify_result>(SSL *ssl, long arg);
  377. =item int B<SSL_set_wfd>(SSL *ssl, int fd);
  378. =item int B<SSL_shutdown>(SSL *ssl);
  379. =item OSSL_HANDSHAKE_STATE B<SSL_get_state>(const SSL *ssl);
  380. Returns the current handshake state.
  381. =item char *B<SSL_state_string>(const SSL *ssl);
  382. =item char *B<SSL_state_string_long>(const SSL *ssl);
  383. =item long B<SSL_total_renegotiations>(SSL *ssl);
  384. =item int B<SSL_use_PrivateKey>(SSL *ssl, EVP_PKEY *pkey);
  385. =item int B<SSL_use_PrivateKey_ASN1>(int type, SSL *ssl, unsigned char *d, long len);
  386. =item int B<SSL_use_PrivateKey_file>(SSL *ssl, const char *file, int type);
  387. =item int B<SSL_use_RSAPrivateKey>(SSL *ssl, RSA *rsa);
  388. =item int B<SSL_use_RSAPrivateKey_ASN1>(SSL *ssl, unsigned char *d, long len);
  389. =item int B<SSL_use_RSAPrivateKey_file>(SSL *ssl, const char *file, int type);
  390. =item int B<SSL_use_certificate>(SSL *ssl, X509 *x);
  391. =item int B<SSL_use_certificate_ASN1>(SSL *ssl, int len, unsigned char *d);
  392. =item int B<SSL_use_certificate_file>(SSL *ssl, const char *file, int type);
  393. =item int B<SSL_use_cert_and_key>(SSL *ssl, X509 *x, EVP_PKEY *pkey, STACK_OF(X509) *chain, int override);
  394. =item int B<SSL_version>(const SSL *ssl);
  395. =item int B<SSL_want>(const SSL *ssl);
  396. =item int B<SSL_want_nothing>(const SSL *ssl);
  397. =item int B<SSL_want_read>(const SSL *ssl);
  398. =item int B<SSL_want_write>(const SSL *ssl);
  399. =item int B<SSL_want_x509_lookup>(const SSL *ssl);
  400. =item int B<SSL_write>(SSL *ssl, const void *buf, int num);
  401. =item void B<SSL_set_psk_client_callback>(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));
  402. =item int B<SSL_use_psk_identity_hint>(SSL *ssl, const char *hint);
  403. =item void B<SSL_set_psk_server_callback>(SSL *ssl, unsigned int (*callback)(SSL *ssl, const char *identity, unsigned char *psk, int max_psk_len));
  404. =item const char *B<SSL_get_psk_identity_hint>(SSL *ssl);
  405. =item const char *B<SSL_get_psk_identity>(SSL *ssl);
  406. =back
  407. =head1 RETURN VALUES
  408. See the individual manual pages for details.
  409. =head1 SEE ALSO
  410. L<openssl(1)>, L<crypto(7)>,
  411. L<CRYPTO_get_ex_new_index(3)>,
  412. L<SSL_accept(3)>, L<SSL_clear(3)>,
  413. L<SSL_connect(3)>,
  414. L<SSL_CIPHER_get_name(3)>,
  415. L<SSL_COMP_add_compression_method(3)>,
  416. L<SSL_CTX_add_extra_chain_cert(3)>,
  417. L<SSL_CTX_add_session(3)>,
  418. L<SSL_CTX_ctrl(3)>,
  419. L<SSL_CTX_flush_sessions(3)>,
  420. L<SSL_CTX_get_verify_mode(3)>,
  421. L<SSL_CTX_load_verify_locations(3)>
  422. L<SSL_CTX_new(3)>,
  423. L<SSL_CTX_sess_number(3)>,
  424. L<SSL_CTX_sess_set_cache_size(3)>,
  425. L<SSL_CTX_sess_set_get_cb(3)>,
  426. L<SSL_CTX_sessions(3)>,
  427. L<SSL_CTX_set_cert_store(3)>,
  428. L<SSL_CTX_set_cert_verify_callback(3)>,
  429. L<SSL_CTX_set_cipher_list(3)>,
  430. L<SSL_CTX_set_client_CA_list(3)>,
  431. L<SSL_CTX_set_client_cert_cb(3)>,
  432. L<SSL_CTX_set_default_passwd_cb(3)>,
  433. L<SSL_CTX_set_generate_session_id(3)>,
  434. L<SSL_CTX_set_info_callback(3)>,
  435. L<SSL_CTX_set_max_cert_list(3)>,
  436. L<SSL_CTX_set_mode(3)>,
  437. L<SSL_CTX_set_msg_callback(3)>,
  438. L<SSL_CTX_set_options(3)>,
  439. L<SSL_CTX_set_quiet_shutdown(3)>,
  440. L<SSL_CTX_set_read_ahead(3)>,
  441. L<SSL_CTX_set_security_level(3)>,
  442. L<SSL_CTX_set_session_cache_mode(3)>,
  443. L<SSL_CTX_set_session_id_context(3)>,
  444. L<SSL_CTX_set_ssl_version(3)>,
  445. L<SSL_CTX_set_timeout(3)>,
  446. L<SSL_CTX_set_tmp_dh_callback(3)>,
  447. L<SSL_CTX_set_verify(3)>,
  448. L<SSL_CTX_use_certificate(3)>,
  449. L<SSL_alert_type_string(3)>,
  450. L<SSL_do_handshake(3)>,
  451. L<SSL_enable_ct(3)>,
  452. L<SSL_get_SSL_CTX(3)>,
  453. L<SSL_get_ciphers(3)>,
  454. L<SSL_get_client_CA_list(3)>,
  455. L<SSL_get_default_timeout(3)>,
  456. L<SSL_get_error(3)>,
  457. L<SSL_get_ex_data_X509_STORE_CTX_idx(3)>,
  458. L<SSL_get_fd(3)>,
  459. L<SSL_get_peer_cert_chain(3)>,
  460. L<SSL_get_rbio(3)>,
  461. L<SSL_get_session(3)>,
  462. L<SSL_get_verify_result(3)>,
  463. L<SSL_get_version(3)>,
  464. L<SSL_load_client_CA_file(3)>,
  465. L<SSL_new(3)>,
  466. L<SSL_pending(3)>,
  467. L<SSL_read_ex(3)>,
  468. L<SSL_read(3)>,
  469. L<SSL_rstate_string(3)>,
  470. L<SSL_session_reused(3)>,
  471. L<SSL_set_bio(3)>,
  472. L<SSL_set_connect_state(3)>,
  473. L<SSL_set_fd(3)>,
  474. L<SSL_set_session(3)>,
  475. L<SSL_set_shutdown(3)>,
  476. L<SSL_shutdown(3)>,
  477. L<SSL_state_string(3)>,
  478. L<SSL_want(3)>,
  479. L<SSL_write_ex(3)>,
  480. L<SSL_write(3)>,
  481. L<SSL_SESSION_free(3)>,
  482. L<SSL_SESSION_get_time(3)>,
  483. L<d2i_SSL_SESSION(3)>,
  484. L<SSL_CTX_set_psk_client_callback(3)>,
  485. L<SSL_CTX_use_psk_identity_hint(3)>,
  486. L<SSL_get_psk_identity(3)>,
  487. L<DTLSv1_listen(3)>
  488. =head1 HISTORY
  489. B<SSLv2_client_method>, B<SSLv2_server_method> and B<SSLv2_method> were removed
  490. in OpenSSL 1.1.0.
  491. The return type of B<SSL_copy_session_id> was changed from void to int in
  492. OpenSSL 1.1.0.
  493. =head1 COPYRIGHT
  494. Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
  495. Licensed under the OpenSSL license (the "License"). You may not use
  496. this file except in compliance with the License. You can obtain a copy
  497. in the file LICENSE in the source distribution or at
  498. L<https://www.openssl.org/source/license.html>.
  499. =cut