diff options
author | schwarze <> | 2016-11-05 15:32:20 +0000 |
---|---|---|
committer | schwarze <> | 2016-11-05 15:32:20 +0000 |
commit | 5af30545c000c195ca6e44f207da004e5780ddb5 (patch) | |
tree | 1672f1234352c29443fcacb44e22f1b20f174d99 /src/lib/libssl/doc/SSL_CTX_set_tmp_rsa_callback.3 | |
parent | ba7c6bac5d2c870a4d1c1ce9f08db5e57c660625 (diff) | |
download | openbsd-5af30545c000c195ca6e44f207da004e5780ddb5.tar.gz openbsd-5af30545c000c195ca6e44f207da004e5780ddb5.tar.bz2 openbsd-5af30545c000c195ca6e44f207da004e5780ddb5.zip |
move manual pages from doc/ to man/ for consistency with other
libraries, in particular considering that there are unrelated
files in doc/; requested by jsing@ and beck@
Diffstat (limited to 'src/lib/libssl/doc/SSL_CTX_set_tmp_rsa_callback.3')
-rw-r--r-- | src/lib/libssl/doc/SSL_CTX_set_tmp_rsa_callback.3 | 231 |
1 files changed, 0 insertions, 231 deletions
diff --git a/src/lib/libssl/doc/SSL_CTX_set_tmp_rsa_callback.3 b/src/lib/libssl/doc/SSL_CTX_set_tmp_rsa_callback.3 deleted file mode 100644 index 253274d122..0000000000 --- a/src/lib/libssl/doc/SSL_CTX_set_tmp_rsa_callback.3 +++ /dev/null | |||
@@ -1,231 +0,0 @@ | |||
1 | .\" | ||
2 | .\" $OpenBSD: SSL_CTX_set_tmp_rsa_callback.3,v 1.2 2014/12/02 14:11:01 jmc Exp $ | ||
3 | .\" | ||
4 | .Dd $Mdocdate: December 2 2014 $ | ||
5 | .Dt SSL_CTX_SET_TMP_RSA_CALLBACK.POD 3 | ||
6 | .Os | ||
7 | .Sh NAME | ||
8 | .Nm SSL_CTX_set_tmp_rsa_callback , | ||
9 | .Nm SSL_CTX_set_tmp_rsa , | ||
10 | .Nm SSL_CTX_need_tmp_rsa , | ||
11 | .Nm SSL_set_tmp_rsa_callback , | ||
12 | .Nm SSL_set_tmp_rsa , | ||
13 | .Nm SSL_need_tmp_rsa | ||
14 | .Nd handle RSA keys for ephemeral key exchange | ||
15 | .Sh SYNOPSIS | ||
16 | .In openssl/ssl.h | ||
17 | .Ft void | ||
18 | .Fo SSL_CTX_set_tmp_rsa_callback | ||
19 | .Fa "SSL_CTX *ctx" | ||
20 | .Fa "RSA *(*tmp_rsa_callback)(SSL *ssl, int is_export, int keylength)" | ||
21 | .Fc | ||
22 | .Ft long | ||
23 | .Fn SSL_CTX_set_tmp_rsa "SSL_CTX *ctx" "RSA *rsa" | ||
24 | .Ft long | ||
25 | .Fn SSL_CTX_need_tmp_rsa "SSL_CTX *ctx" | ||
26 | .Ft void | ||
27 | .Fo SSL_set_tmp_rsa_callback | ||
28 | .Fa "SSL_CTX *ctx" | ||
29 | .Fa "RSA *(*tmp_rsa_callback)(SSL *ssl, int is_export, int keylength)" | ||
30 | .Fc | ||
31 | .Ft long | ||
32 | .Fn SSL_set_tmp_rsa "SSL *ssl" "RSA *rsa" | ||
33 | .Ft long | ||
34 | .Fn SSL_need_tmp_rsa "SSL *ssl" | ||
35 | .Ft RSA * | ||
36 | .Fn "(*tmp_rsa_callback)" "SSL *ssl" "int is_export" "int keylength" | ||
37 | .Sh DESCRIPTION | ||
38 | .Fn SSL_CTX_set_tmp_rsa_callback | ||
39 | sets the callback function for | ||
40 | .Fa ctx | ||
41 | to be used when a temporary/ephemeral RSA key is required to | ||
42 | .Fa tmp_rsa_callback . | ||
43 | The callback is inherited by all | ||
44 | .Vt SSL | ||
45 | objects newly created from | ||
46 | .Fa ctx | ||
47 | with | ||
48 | .Xr SSL_new 3 . | ||
49 | Already created SSL objects are not affected. | ||
50 | .Pp | ||
51 | .Fn SSL_CTX_set_tmp_rsa | ||
52 | sets the temporary/ephemeral RSA key to be used to be | ||
53 | .Fa rsa . | ||
54 | The key is inherited by all | ||
55 | .Vt SSL | ||
56 | objects newly created from | ||
57 | .Fa ctx | ||
58 | with | ||
59 | .Xr SSL_new 3 . | ||
60 | Already created SSL objects are not affected. | ||
61 | .Pp | ||
62 | .Fn SSL_CTX_need_tmp_rsa | ||
63 | returns 1, | ||
64 | if a temporary/ephemeral RSA key is needed for RSA-based strength-limited | ||
65 | .Sq exportable | ||
66 | ciphersuites because a RSA key with a keysize larger than 512 bits is installed. | ||
67 | .Pp | ||
68 | .Fn SSL_set_tmp_rsa_callback | ||
69 | sets the callback only for | ||
70 | .Fa ssl . | ||
71 | .Pp | ||
72 | .Fn SSL_set_tmp_rsa | ||
73 | sets the key only for | ||
74 | .Fa ssl . | ||
75 | .Pp | ||
76 | .Fn SSL_need_tmp_rsa | ||
77 | returns 1, | ||
78 | if a temporary/ephemeral RSA key is needed for RSA-based strength-limited | ||
79 | .Sq exportable | ||
80 | ciphersuites because a RSA key with a keysize larger than 512 bits is installed. | ||
81 | .Pp | ||
82 | These functions apply to SSL/TLS servers only. | ||
83 | .Sh NOTES | ||
84 | When using a cipher with RSA authentication, | ||
85 | an ephemeral RSA key exchange can take place. | ||
86 | In this case the session data are negotiated using the ephemeral/temporary RSA | ||
87 | key and the RSA key supplied and certified by the certificate chain is only | ||
88 | used for signing. | ||
89 | .Pp | ||
90 | Under previous export restrictions, ciphers with RSA keys shorter (512 bits) | ||
91 | than the usual key length of 1024 bits were created. | ||
92 | To use these ciphers with RSA keys of usual length, an ephemeral key exchange | ||
93 | must be performed, as the normal (certified) key cannot be directly used. | ||
94 | .Pp | ||
95 | Using ephemeral RSA key exchange yields forward secrecy, | ||
96 | as the connection can only be decrypted when the RSA key is known. | ||
97 | By generating a temporary RSA key inside the server application that is lost | ||
98 | when the application is left, it becomes impossible for an attacker to decrypt | ||
99 | past sessions, even if he gets hold of the normal (certified) RSA key, | ||
100 | as this key was used for signing only. | ||
101 | The downside is that creating a RSA key is computationally expensive. | ||
102 | .Pp | ||
103 | Additionally, the use of ephemeral RSA key exchange is only allowed in the TLS | ||
104 | standard when the RSA key can be used for signing only, that is, | ||
105 | for export ciphers. | ||
106 | Using ephemeral RSA key exchange for other purposes violates the standard and | ||
107 | can break interoperability with clients. | ||
108 | It is therefore strongly recommended to not use ephemeral RSA key exchange and | ||
109 | use EDH (Ephemeral Diffie-Hellman) key exchange instead in order to achieve | ||
110 | forward secrecy (see | ||
111 | .Xr SSL_CTX_set_tmp_dh_callback 3 ) . | ||
112 | .Pp | ||
113 | On OpenSSL servers ephemeral RSA key exchange is therefore disabled by default | ||
114 | and must be explicitly enabled using the | ||
115 | .Dv SSL_OP_EPHEMERAL_RSA | ||
116 | option of | ||
117 | .Xr SSL_CTX_set_options 3 , | ||
118 | violating the TLS/SSL | ||
119 | standard. | ||
120 | When ephemeral RSA key exchange is required for export ciphers, | ||
121 | it will automatically be used without this option! | ||
122 | .Pp | ||
123 | An application may either directly specify the key or can supply the key via | ||
124 | a callback function. | ||
125 | The callback approach has the advantage that the callback may generate the key | ||
126 | only in case it is actually needed. | ||
127 | However, as the generation of a RSA key is costly, | ||
128 | it will lead to a significant delay in the handshake procedure. | ||
129 | Another advantage of the callback function is that it can supply keys of | ||
130 | different size (e.g., for | ||
131 | .Dv SSL_OP_EPHEMERAL_RSA | ||
132 | usage) while the explicit setting of the key is only useful for key size of | ||
133 | 512 bits to satisfy the export restricted ciphers and does give away key length | ||
134 | if a longer key would be allowed. | ||
135 | .Pp | ||
136 | The | ||
137 | .Fa tmp_rsa_callback | ||
138 | is called with the | ||
139 | .Fa keylength | ||
140 | needed and the | ||
141 | .Fa is_export | ||
142 | information. | ||
143 | The | ||
144 | .Fa is_export | ||
145 | flag is set when the ephemeral RSA key exchange is performed with an export | ||
146 | cipher. | ||
147 | .Sh RETURN VALUES | ||
148 | .Fn SSL_CTX_set_tmp_rsa_callback | ||
149 | and | ||
150 | .Fn SSL_set_tmp_rsa_callback | ||
151 | do not return diagnostic output. | ||
152 | .Pp | ||
153 | .Fn SSL_CTX_set_tmp_rsa | ||
154 | and | ||
155 | .Fn SSL_set_tmp_rsa | ||
156 | return 1 on success and 0 on failure. | ||
157 | Check the error queue to find out the reason of failure. | ||
158 | .Pp | ||
159 | .Fn SSL_CTX_need_tmp_rsa | ||
160 | and | ||
161 | .Fn SSL_need_tmp_rsa | ||
162 | return 1 if a temporary RSA key is needed and 0 otherwise. | ||
163 | .Sh EXAMPLES | ||
164 | Generate temporary RSA keys to prepare ephemeral RSA key exchange. | ||
165 | As the generation of a RSA key costs a lot of computer time, | ||
166 | they are saved for later reuse. | ||
167 | For demonstration purposes, two keys for 512 bits and 1024 bits | ||
168 | respectively are generated. | ||
169 | .Bd -literal | ||
170 | \&... | ||
171 | |||
172 | /* Set up ephemeral RSA stuff */ | ||
173 | RSA *rsa_512 = NULL; | ||
174 | RSA *rsa_1024 = NULL; | ||
175 | |||
176 | rsa_512 = RSA_generate_key(512, RSA_F4, NULL, NULL); | ||
177 | if (rsa_512 == NULL) | ||
178 | evaluate_error_queue(); | ||
179 | |||
180 | rsa_1024 = RSA_generate_key(1024, RSA_F4, NULL, NULL); | ||
181 | if (rsa_1024 == NULL) | ||
182 | evaluate_error_queue(); | ||
183 | |||
184 | \&... | ||
185 | |||
186 | RSA * | ||
187 | tmp_rsa_callback(SSL *s, int is_export, int keylength) | ||
188 | { | ||
189 | RSA *rsa_tmp = NULL; | ||
190 | |||
191 | switch (keylength) { | ||
192 | case 512: | ||
193 | if (rsa_512) | ||
194 | rsa_tmp = rsa_512; | ||
195 | else { | ||
196 | /* | ||
197 | * generate on the fly, | ||
198 | * should not happen in this example | ||
199 | */ | ||
200 | rsa_tmp = RSA_generate_key(keylength, RSA_F4, NULL, | ||
201 | NULL); | ||
202 | rsa_512 = rsa_tmp; /* Remember for later reuse */ | ||
203 | } | ||
204 | break; | ||
205 | case 1024: | ||
206 | if (rsa_1024) | ||
207 | rsa_tmp = rsa_1024; | ||
208 | else | ||
209 | should_not_happen_in_this_example(); | ||
210 | break; | ||
211 | default: | ||
212 | /* | ||
213 | * Generating a key on the fly is very costly, | ||
214 | * so use what is there | ||
215 | */ | ||
216 | if (rsa_1024) | ||
217 | rsa_tmp = rsa_1024; | ||
218 | else | ||
219 | /* Use at least a shorter key */ | ||
220 | rsa_tmp = rsa_512; | ||
221 | } | ||
222 | return rsa_tmp; | ||
223 | } | ||
224 | .Ed | ||
225 | .Sh SEE ALSO | ||
226 | .Xr openssl 1 , | ||
227 | .Xr ssl 3 , | ||
228 | .Xr SSL_CTX_set_cipher_list 3 , | ||
229 | .Xr SSL_CTX_set_options 3 , | ||
230 | .Xr SSL_CTX_set_tmp_dh_callback 3 , | ||
231 | .Xr SSL_new 3 | ||