summaryrefslogtreecommitdiff
path: root/src/lib/libssl/doc/SSL_write.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_write.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_write.3')
-rw-r--r--src/lib/libssl/doc/SSL_write.3172
1 files changed, 172 insertions, 0 deletions
diff --git a/src/lib/libssl/doc/SSL_write.3 b/src/lib/libssl/doc/SSL_write.3
new file mode 100644
index 0000000000..19dfffae1b
--- /dev/null
+++ b/src/lib/libssl/doc/SSL_write.3
@@ -0,0 +1,172 @@
1.Dd $Mdocdate: October 12 2014 $
2.Dt SSL_WRITE 3
3.Os
4.Sh NAME
5.Nm SSL_write
6.Nd write bytes to a TLS/SSL connection
7.Sh SYNOPSIS
8.In openssl/ssl.h
9.Ft int
10.Fn SSL_write "SSL *ssl" "const void *buf" "int num"
11.Sh DESCRIPTION
12.Fn SSL_write
13writes
14.Fa num
15bytes from the buffer
16.Fa buf
17into the specified
18.Fa ssl
19connection.
20.Sh NOTES
21If necessary,
22.Fn SSL_write
23will negotiate a TLS/SSL session, if not already explicitly performed by
24.Xr SSL_connect 3
25or
26.Xr SSL_accept 3 .
27If the peer requests a re-negotiation,
28it will be performed transparently during the
29.Fn SSL_write
30operation.
31The behaviour of
32.Fn SSL_write
33depends on the underlying
34.Vt BIO .
35.Pp
36For the transparent negotiation to succeed, the
37.Fa ssl
38must have been initialized to client or server mode.
39This is being done by calling
40.Xr SSL_set_connect_state 3
41or
42.Xr SSL_set_accept_state 3
43before the first call to an
44.Xr SSL_read 3
45or
46.Fn SSL_write
47function.
48.Pp
49If the underlying
50.Vt BIO
51is
52.Em blocking ,
53.Fn SSL_write
54will only return once the write operation has been finished or an error
55occurred, except when a renegotiation take place, in which case a
56.Dv SSL_ERROR_WANT_READ
57may occur.
58This behaviour can be controlled with the
59.Dv SSL_MODE_AUTO_RETRY
60flag of the
61.Xr SSL_CTX_set_mode 3
62call.
63.Pp
64If the underlying
65.Vt BIO
66is
67.Em non-blocking ,
68.Fn SSL_write
69will also return when the underlying
70.Vt BIO
71could not satisfy the needs of
72.Fn SSL_write
73to continue the operation.
74In this case a call to
75.Xr SSL_get_error 3
76with the return value of
77.Fn SSL_write
78will yield
79.Dv SSL_ERROR_WANT_READ
80or
81.Dv SSL_ERROR_WANT_WRITE .
82As at any time a re-negotiation is possible, a call to
83.Fn SSL_write
84can also cause read operations!
85The calling process then must repeat the call after taking appropriate action
86to satisfy the needs of
87.Fn SSL_write .
88The action depends on the underlying
89.Vt BIO .
90When using a non-blocking socket, nothing is to be done, but
91.Xr select 2
92can be used to check for the required condition.
93When using a buffering
94.Vt BIO ,
95like a
96.Vt BIO
97pair, data must be written into or retrieved out of the BIO before being able
98to continue.
99.Pp
100.Fn SSL_write
101will only return with success, when the complete contents of
102.Fa buf
103of length
104.Fa num
105have been written.
106This default behaviour can be changed with the
107.Dv SSL_MODE_ENABLE_PARTIAL_WRITE
108option of
109.Xr SSL_CTX_set_mode 3 .
110When this flag is set,
111.Fn SSL_write
112will also return with success when a partial write has been successfully
113completed.
114In this case the
115.Fn SSL_write
116operation is considered completed.
117The bytes are sent and a new
118.Fn SSL_write
119operation with a new buffer (with the already sent bytes removed) must be
120started.
121A partial write is performed with the size of a message block, which is 16kB
122for SSLv3/TLSv1.
123.Sh WARNING
124When an
125.Fn SSL_write
126operation has to be repeated because of
127.Dv SSL_ERROR_WANT_READ
128or
129.Dv SSL_ERROR_WANT_WRITE ,
130it must be repeated with the same arguments.
131.Pp
132When calling
133.Fn SSL_write
134with
135.Fa num Ns
136=0 bytes to be sent the behaviour is undefined.
137.Sh RETURN VALUES
138The following return values can occur:
139.Bl -tag -width Ds
140.It >0
141The write operation was successful.
142The return value is the number of bytes actually written to the TLS/SSL
143connection.
144.It 0
145The write operation was not successful.
146Probably the underlying connection was closed.
147Call
148.Xr SSL_get_error 3
149with the return value to find out whether an error occurred or the connection
150was shut down cleanly
151.Pq Dv SSL_ERROR_ZERO_RETURN .
152.Pp
153SSLv2 (deprecated) does not support a shutdown alert protocol, so it can only
154be detected whether the underlying connection was closed.
155It cannot be checked why the closure happened.
156.It <0
157The write operation was not successful, because either an error occurred or
158action must be taken by the calling process.
159Call
160.Xr SSL_get_error 3
161with the return value to find out the reason.
162.El
163.Sh SEE ALSO
164.Xr bio 3 ,
165.Xr ssl 3 ,
166.Xr SSL_accept 3 ,
167.Xr SSL_connect 3 ,
168.Xr SSL_CTX_new 3 ,
169.Xr SSL_CTX_set_mode 3 ,
170.Xr SSL_get_error 3 ,
171.Xr SSL_read 3 ,
172.Xr SSL_set_connect_state 3