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