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