diff options
Diffstat (limited to 'src/lib/libssl/doc/SSL_get_error.3')
| -rw-r--r-- | src/lib/libssl/doc/SSL_get_error.3 | 169 |
1 files changed, 0 insertions, 169 deletions
diff --git a/src/lib/libssl/doc/SSL_get_error.3 b/src/lib/libssl/doc/SSL_get_error.3 deleted file mode 100644 index f6e5045b01..0000000000 --- a/src/lib/libssl/doc/SSL_get_error.3 +++ /dev/null | |||
| @@ -1,169 +0,0 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_get_error.3,v 1.3 2015/07/24 15:25:08 jmc Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: July 24 2015 $ | ||
| 5 | .Dt SSL_GET_ERROR 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_get_error | ||
| 9 | .Nd obtain result code for TLS/SSL I/O operation | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft int | ||
| 13 | .Fn SSL_get_error "const SSL *ssl" "int ret" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_get_error | ||
| 16 | returns a result code (suitable for the C | ||
| 17 | .Dq switch | ||
| 18 | statement) for a preceding call to | ||
| 19 | .Xr SSL_connect 3 , | ||
| 20 | .Xr SSL_accept 3 , | ||
| 21 | .Xr SSL_do_handshake 3 , | ||
| 22 | .Xr SSL_read 3 , | ||
| 23 | .Xr SSL_peek 3 , | ||
| 24 | or | ||
| 25 | .Xr SSL_write 3 | ||
| 26 | on | ||
| 27 | .Fa ssl . | ||
| 28 | The value returned by that TLS/SSL I/O function must be passed to | ||
| 29 | .Fn SSL_get_error | ||
| 30 | in parameter | ||
| 31 | .Fa ret . | ||
| 32 | .Pp | ||
| 33 | In addition to | ||
| 34 | .Fa ssl | ||
| 35 | and | ||
| 36 | .Fa ret , | ||
| 37 | .Fn SSL_get_error | ||
| 38 | inspects the current thread's OpenSSL error queue. | ||
| 39 | Thus, | ||
| 40 | .Fn SSL_get_error | ||
| 41 | must be used in the same thread that performed the TLS/SSL I/O operation, | ||
| 42 | and no other OpenSSL function calls should appear in between. | ||
| 43 | The current thread's error queue must be empty before the TLS/SSL I/O operation | ||
| 44 | is attempted, or | ||
| 45 | .Fn SSL_get_error | ||
| 46 | will not work reliably. | ||
| 47 | .Sh RETURN VALUES | ||
| 48 | The following return values can currently occur: | ||
| 49 | .Bl -tag -width Ds | ||
| 50 | .It Dv SSL_ERROR_NONE | ||
| 51 | The TLS/SSL I/O operation completed. | ||
| 52 | This result code is returned if and only if | ||
| 53 | .Fa ret | ||
| 54 | < 0. | ||
| 55 | .It Dv SSL_ERROR_ZERO_RETURN | ||
| 56 | The TLS/SSL connection has been closed. | ||
| 57 | If the protocol version is SSL 3.0 or TLS 1.0, this result code is returned | ||
| 58 | only if a closure alert has occurred in the protocol, i.e., if the connection | ||
| 59 | has been closed cleanly. | ||
| 60 | Note that in this case | ||
| 61 | .Dv SSL_ERROR_ZERO_RETURN | ||
| 62 | does not necessarily indicate that the underlying transport has been closed. | ||
| 63 | .It Dv SSL_ERROR_WANT_READ , Dv SSL_ERROR_WANT_WRITE | ||
| 64 | The operation did not complete; | ||
| 65 | the same TLS/SSL I/O function should be called again later. | ||
| 66 | If, by then, the underlying | ||
| 67 | .Vt BIO | ||
| 68 | has data available for reading (if the result code is | ||
| 69 | .Dv SSL_ERROR_WANT_READ ) | ||
| 70 | or allows writing data | ||
| 71 | .Pq Dv SSL_ERROR_WANT_WRITE , | ||
| 72 | then some TLS/SSL protocol progress will take place, | ||
| 73 | i.e., at least part of a TLS/SSL record will be read or written. | ||
| 74 | Note that the retry may again lead to a | ||
| 75 | .Dv SSL_ERROR_WANT_READ | ||
| 76 | or | ||
| 77 | .Dv SSL_ERROR_WANT_WRITE | ||
| 78 | condition. | ||
| 79 | There is no fixed upper limit for the number of iterations that may be | ||
| 80 | necessary until progress becomes visible at application protocol level. | ||
| 81 | .Pp | ||
| 82 | For socket | ||
| 83 | .Fa BIO Ns | ||
| 84 | s (e.g., when | ||
| 85 | .Fn SSL_set_fd | ||
| 86 | was used), | ||
| 87 | .Xr select 2 | ||
| 88 | or | ||
| 89 | .Xr poll 2 | ||
| 90 | on the underlying socket can be used to find out when the TLS/SSL I/O function | ||
| 91 | should be retried. | ||
| 92 | .Pp | ||
| 93 | Caveat: Any TLS/SSL I/O function can lead to either of | ||
| 94 | .Dv SSL_ERROR_WANT_READ | ||
| 95 | and | ||
| 96 | .Dv SSL_ERROR_WANT_WRITE . | ||
| 97 | In particular, | ||
| 98 | .Xr SSL_read 3 | ||
| 99 | or | ||
| 100 | .Xr SSL_peek 3 | ||
| 101 | may want to write data and | ||
| 102 | .Xr SSL_write 3 | ||
| 103 | may want | ||
| 104 | to read data. | ||
| 105 | This is mainly because TLS/SSL handshakes may occur at any time during the | ||
| 106 | protocol (initiated by either the client or the server); | ||
| 107 | .Xr SSL_read 3 , | ||
| 108 | .Xr SSL_peek 3 , | ||
| 109 | and | ||
| 110 | .Xr SSL_write 3 | ||
| 111 | will handle any pending handshakes. | ||
| 112 | .It Dv SSL_ERROR_WANT_CONNECT , Dv SSL_ERROR_WANT_ACCEPT | ||
| 113 | The operation did not complete; the same TLS/SSL I/O function should be | ||
| 114 | called again later. | ||
| 115 | The underlying BIO was not connected yet to the peer and the call would block | ||
| 116 | in | ||
| 117 | .Xr connect 2 Ns / Ns | ||
| 118 | .Xr accept 2 . | ||
| 119 | The SSL function should be | ||
| 120 | called again when the connection is established. | ||
| 121 | These messages can only appear with a | ||
| 122 | .Xr BIO_s_connect 3 | ||
| 123 | or | ||
| 124 | .Xr BIO_s_accept 3 | ||
| 125 | .Vt BIO , | ||
| 126 | respectively. | ||
| 127 | In order to find out when the connection has been successfully established, | ||
| 128 | on many platforms | ||
| 129 | .Xr select 2 | ||
| 130 | or | ||
| 131 | .Xr poll 2 | ||
| 132 | for writing on the socket file descriptor can be used. | ||
| 133 | .It Dv SSL_ERROR_WANT_X509_LOOKUP | ||
| 134 | The operation did not complete because an application callback set by | ||
| 135 | .Xr SSL_CTX_set_client_cert_cb 3 | ||
| 136 | has asked to be called again. | ||
| 137 | The TLS/SSL I/O function should be called again later. | ||
| 138 | Details depend on the application. | ||
| 139 | .It Dv SSL_ERROR_SYSCALL | ||
| 140 | Some I/O error occurred. | ||
| 141 | The OpenSSL error queue may contain more information on the error. | ||
| 142 | If the error queue is empty (i.e., | ||
| 143 | .Fn ERR_get_error | ||
| 144 | returns 0), | ||
| 145 | .Fa ret | ||
| 146 | can be used to find out more about the error: | ||
| 147 | If | ||
| 148 | .Fa ret | ||
| 149 | == 0, an | ||
| 150 | .Dv EOF | ||
| 151 | was observed that violates the protocol. | ||
| 152 | If | ||
| 153 | .Fa ret | ||
| 154 | == \(mi1, the underlying | ||
| 155 | .Vt BIO | ||
| 156 | reported an | ||
| 157 | I/O error (for socket I/O on Unix systems, consult | ||
| 158 | .Dv errno | ||
| 159 | for details). | ||
| 160 | .It Dv SSL_ERROR_SSL | ||
| 161 | A failure in the SSL library occurred, usually a protocol error. | ||
| 162 | The OpenSSL error queue contains more information on the error. | ||
| 163 | .El | ||
| 164 | .Sh SEE ALSO | ||
| 165 | .Xr err 3 , | ||
| 166 | .Xr ssl 3 | ||
| 167 | .Sh HISTORY | ||
| 168 | .Fn SSL_get_error | ||
| 169 | was added in SSLeay 0.8. | ||
