diff options
Diffstat (limited to 'src/lib/libssl/src/doc')
105 files changed, 4672 insertions, 627 deletions
diff --git a/src/lib/libssl/src/doc/HOWTO/certificates.txt b/src/lib/libssl/src/doc/HOWTO/certificates.txt new file mode 100644 index 0000000000..88048645db --- /dev/null +++ b/src/lib/libssl/src/doc/HOWTO/certificates.txt | |||
@@ -0,0 +1,85 @@ | |||
1 | <DRAFT!> | ||
2 | HOWTO certificates | ||
3 | |||
4 | How you handle certificates depend a great deal on what your role is. | ||
5 | Your role can be one or several of: | ||
6 | |||
7 | - User of some client software | ||
8 | - User of some server software | ||
9 | - Certificate authority | ||
10 | |||
11 | This file is for users who wish to get a certificate of their own. | ||
12 | Certificate authorities should read ca.txt. | ||
13 | |||
14 | In all the cases shown below, the standard configuration file, as | ||
15 | compiled into openssl, will be used. You may find it in /etc/, | ||
16 | /usr/local/ssr/ or somewhere else. The name is openssl.cnf, and | ||
17 | is better described in another HOWTO <config.txt?>. If you want to | ||
18 | use a different configuration file, use the argument '-config {file}' | ||
19 | with the command shown below. | ||
20 | |||
21 | |||
22 | Certificates are related to public key cryptography by containing a | ||
23 | public key. To be useful, there must be a corresponding private key | ||
24 | somewhere. With OpenSSL, public keys are easily derived from private | ||
25 | keys, so before you create a certificate or a certificate request, you | ||
26 | need to create a private key. | ||
27 | |||
28 | Private keys are generated with 'openssl genrsa' if you want a RSA | ||
29 | private key, or 'openssl gendsa' if you want a DSA private key. More | ||
30 | info on how to handle these commands are found in the manual pages for | ||
31 | those commands or by running them with the argument '-h'. For the | ||
32 | sake of the description in this file, let's assume that the private | ||
33 | key ended up in the file privkey.pem (which is the default in some | ||
34 | cases). | ||
35 | |||
36 | |||
37 | Let's start with the most normal way of getting a certificate. Most | ||
38 | often, you want or need to get a certificate from a certificate | ||
39 | authority. To handle that, the certificate authority needs a | ||
40 | certificate request (or, as some certificate authorities like to put | ||
41 | it, "certificate signing request", since that's exactly what they do, | ||
42 | they sign it and give you the result back, thus making it authentic | ||
43 | according to their policies) from you. To generate a request, use the | ||
44 | command 'openssl req' like this: | ||
45 | |||
46 | openssl req -new -key privkey.pem -out cert.csr | ||
47 | |||
48 | Now, cert.csr can be sent to the certificate authority, if they can | ||
49 | handle files in PEM format. If not, use the extra argument '-outform' | ||
50 | followed by the keyword for the format to use (see another HOWTO | ||
51 | <formats.txt?>). In some cases, that isn't sufficient and you will | ||
52 | have to be more creative. | ||
53 | |||
54 | When the certificate authority has then done the checks the need to | ||
55 | do (and probably gotten payment from you), they will hand over your | ||
56 | new certificate to you. | ||
57 | |||
58 | |||
59 | [fill in on how to create a self-signed certificate] | ||
60 | |||
61 | |||
62 | If you created everything yourself, or if the certificate authority | ||
63 | was kind enough, your certificate is a raw DER thing in PEM format. | ||
64 | Your key most definitely is if you have followed the examples above. | ||
65 | However, some (most?) certificate authorities will encode them with | ||
66 | things like PKCS7 or PKCS12, or something else. Depending on your | ||
67 | applications, this may be perfectly OK, it all depends on what they | ||
68 | know how to decode. If not, There are a number of OpenSSL tools to | ||
69 | convert between some (most?) formats. | ||
70 | |||
71 | So, depending on your application, you may have to convert your | ||
72 | certificate and your key to various formats, most often also putting | ||
73 | them together into one file. The ways to do this is described in | ||
74 | another HOWTO <formats.txt?>, I will just mention the simplest case. | ||
75 | In the case of a raw DER thing in PEM format, and assuming that's all | ||
76 | right for yor applications, simply concatenating the certificate and | ||
77 | the key into a new file and using that one should be enough. With | ||
78 | some applications, you don't even have to do that. | ||
79 | |||
80 | |||
81 | By now, you have your cetificate and your private key and can start | ||
82 | using the software that depend on it. | ||
83 | |||
84 | -- | ||
85 | Richard Levitte | ||
diff --git a/src/lib/libssl/src/doc/apps/CA.pl.pod b/src/lib/libssl/src/doc/apps/CA.pl.pod index 63cd1320cc..58e0f52001 100644 --- a/src/lib/libssl/src/doc/apps/CA.pl.pod +++ b/src/lib/libssl/src/doc/apps/CA.pl.pod | |||
@@ -13,6 +13,7 @@ B<CA.pl> | |||
13 | [B<-help>] | 13 | [B<-help>] |
14 | [B<-newcert>] | 14 | [B<-newcert>] |
15 | [B<-newreq>] | 15 | [B<-newreq>] |
16 | [B<-newreq-nodes>] | ||
16 | [B<-newca>] | 17 | [B<-newca>] |
17 | [B<-xsign>] | 18 | [B<-xsign>] |
18 | [B<-sign>] | 19 | [B<-sign>] |
@@ -46,6 +47,10 @@ written to the file "newreq.pem". | |||
46 | creates a new certificate request. The private key and request are | 47 | creates a new certificate request. The private key and request are |
47 | written to the file "newreq.pem". | 48 | written to the file "newreq.pem". |
48 | 49 | ||
50 | =item B<-newreq-nowdes> | ||
51 | |||
52 | is like B<-newreq> except that the private key will not be encrypted. | ||
53 | |||
49 | =item B<-newca> | 54 | =item B<-newca> |
50 | 55 | ||
51 | creates a new CA hierarchy for use with the B<ca> program (or the B<-signcert> | 56 | creates a new CA hierarchy for use with the B<ca> program (or the B<-signcert> |
diff --git a/src/lib/libssl/src/doc/apps/ca.pod b/src/lib/libssl/src/doc/apps/ca.pod index d352925864..c2ca8f2400 100644 --- a/src/lib/libssl/src/doc/apps/ca.pod +++ b/src/lib/libssl/src/doc/apps/ca.pod | |||
@@ -13,6 +13,7 @@ B<openssl> B<ca> | |||
13 | [B<-name section>] | 13 | [B<-name section>] |
14 | [B<-gencrl>] | 14 | [B<-gencrl>] |
15 | [B<-revoke file>] | 15 | [B<-revoke file>] |
16 | [B<-subj arg>] | ||
16 | [B<-crldays days>] | 17 | [B<-crldays days>] |
17 | [B<-crlhours hours>] | 18 | [B<-crlhours hours>] |
18 | [B<-crlexts section>] | 19 | [B<-crlexts section>] |
@@ -33,9 +34,11 @@ B<openssl> B<ca> | |||
33 | [B<-spkac file>] | 34 | [B<-spkac file>] |
34 | [B<-ss_cert file>] | 35 | [B<-ss_cert file>] |
35 | [B<-preserveDN>] | 36 | [B<-preserveDN>] |
37 | [B<-noemailDN>] | ||
36 | [B<-batch>] | 38 | [B<-batch>] |
37 | [B<-msie_hack>] | 39 | [B<-msie_hack>] |
38 | [B<-extensions section>] | 40 | [B<-extensions section>] |
41 | [B<-extfile section>] | ||
39 | 42 | ||
40 | =head1 DESCRIPTION | 43 | =head1 DESCRIPTION |
41 | 44 | ||
@@ -54,6 +57,11 @@ The options descriptions will be divided into each purpose. | |||
54 | 57 | ||
55 | specifies the configuration file to use. | 58 | specifies the configuration file to use. |
56 | 59 | ||
60 | =item B<-name section> | ||
61 | |||
62 | specifies the configuration file section to use (overrides | ||
63 | B<default_ca> in the B<ca> section). | ||
64 | |||
57 | =item B<-in filename> | 65 | =item B<-in filename> |
58 | 66 | ||
59 | an input filename containing a single certificate request to be | 67 | an input filename containing a single certificate request to be |
@@ -104,6 +112,7 @@ the 'ps' utility) this option should be used with caution. | |||
104 | 112 | ||
105 | the key password source. For more information about the format of B<arg> | 113 | the key password source. For more information about the format of B<arg> |
106 | see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. | 114 | see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. |
115 | |||
107 | =item B<-verbose> | 116 | =item B<-verbose> |
108 | 117 | ||
109 | this prints extra details about the operations being performed. | 118 | this prints extra details about the operations being performed. |
@@ -154,6 +163,15 @@ is the same as the request. This is largely for compatibility with the | |||
154 | older IE enrollment control which would only accept certificates if their | 163 | older IE enrollment control which would only accept certificates if their |
155 | DNs match the order of the request. This is not needed for Xenroll. | 164 | DNs match the order of the request. This is not needed for Xenroll. |
156 | 165 | ||
166 | =item B<-noemailDN> | ||
167 | |||
168 | The DN of a certificate can contain the EMAIL field if present in the | ||
169 | request DN, however it is good policy just having the e-mail set into | ||
170 | the altName extension of the certificate. When this option is set the | ||
171 | EMAIL field is removed from the certificate' subject and set only in | ||
172 | the, eventually present, extensions. The B<email_in_dn> keyword can be | ||
173 | used in the configuration file to enable this behaviour. | ||
174 | |||
157 | =item B<-batch> | 175 | =item B<-batch> |
158 | 176 | ||
159 | this sets the batch mode. In this mode no questions will be asked | 177 | this sets the batch mode. In this mode no questions will be asked |
@@ -162,9 +180,16 @@ and all certificates will be certified automatically. | |||
162 | =item B<-extensions section> | 180 | =item B<-extensions section> |
163 | 181 | ||
164 | the section of the configuration file containing certificate extensions | 182 | the section of the configuration file containing certificate extensions |
165 | to be added when a certificate is issued. If no extension section is | 183 | to be added when a certificate is issued (defaults to B<x509_extensions> |
166 | present then a V1 certificate is created. If the extension section | 184 | unless the B<-extfile> option is used). If no extension section is |
167 | is present (even if it is empty) then a V3 certificate is created. | 185 | present then, a V1 certificate is created. If the extension section |
186 | is present (even if it is empty), then a V3 certificate is created. | ||
187 | |||
188 | =item B<-extfile file> | ||
189 | |||
190 | an additional configuration file to read certificate extensions from | ||
191 | (using the default section unless the B<-extensions> option is also | ||
192 | used). | ||
168 | 193 | ||
169 | =back | 194 | =back |
170 | 195 | ||
@@ -189,6 +214,12 @@ the number of hours before the next CRL is due. | |||
189 | 214 | ||
190 | a filename containing a certificate to revoke. | 215 | a filename containing a certificate to revoke. |
191 | 216 | ||
217 | =item B<-subj arg> | ||
218 | |||
219 | supersedes subject name given in the request. | ||
220 | The arg must be formatted as I</type0=value0/type1=value1/type2=...>, | ||
221 | characters may be escaped by \ (backslash), no spaces are skipped. | ||
222 | |||
192 | =item B<-crlexts section> | 223 | =item B<-crlexts section> |
193 | 224 | ||
194 | the section of the configuration file containing CRL extensions to | 225 | the section of the configuration file containing CRL extensions to |
@@ -202,8 +233,20 @@ that some software (for example Netscape) can't handle V2 CRLs. | |||
202 | 233 | ||
203 | =head1 CONFIGURATION FILE OPTIONS | 234 | =head1 CONFIGURATION FILE OPTIONS |
204 | 235 | ||
205 | The options for B<ca> are contained in the B<ca> section of the | 236 | The section of the configuration file containing options for B<ca> |
206 | configuration file. Many of these are identical to command line | 237 | is found as follows: If the B<-name> command line option is used, |
238 | then it names the section to be used. Otherwise the section to | ||
239 | be used must be named in the B<default_ca> option of the B<ca> section | ||
240 | of the configuration file (or in the default section of the | ||
241 | configuration file). Besides B<default_ca>, the following options are | ||
242 | read directly from the B<ca> section: | ||
243 | RANDFILE | ||
244 | preserve | ||
245 | msie_hack | ||
246 | With the exception of B<RANDFILE>, this is probably a bug and may | ||
247 | change in future releases. | ||
248 | |||
249 | Many of the configuration file options are identical to command line | ||
207 | options. Where the option is present in the configuration file | 250 | options. Where the option is present in the configuration file |
208 | and the command line the command line value is used. Where an | 251 | and the command line the command line value is used. Where an |
209 | option is described as mandatory then it must be present in | 252 | option is described as mandatory then it must be present in |
@@ -294,6 +337,12 @@ the same as B<-crlexts>. | |||
294 | 337 | ||
295 | the same as B<-preserveDN> | 338 | the same as B<-preserveDN> |
296 | 339 | ||
340 | =item B<email_in_dn> | ||
341 | |||
342 | the same as B<-noemailDN>. If you want the EMAIL field to be removed | ||
343 | from the DN of the certificate simply set this to 'no'. If not present | ||
344 | the default is to allow for the EMAIL filed in the certificate's DN. | ||
345 | |||
297 | =item B<msie_hack> | 346 | =item B<msie_hack> |
298 | 347 | ||
299 | the same as B<-msie_hack> | 348 | the same as B<-msie_hack> |
@@ -303,6 +352,37 @@ the same as B<-msie_hack> | |||
303 | the same as B<-policy>. Mandatory. See the B<POLICY FORMAT> section | 352 | the same as B<-policy>. Mandatory. See the B<POLICY FORMAT> section |
304 | for more information. | 353 | for more information. |
305 | 354 | ||
355 | =item B<nameopt>, B<certopt> | ||
356 | |||
357 | these options allow the format used to display the certificate details | ||
358 | when asking the user to confirm signing. All the options supported by | ||
359 | the B<x509> utilities B<-nameopt> and B<-certopt> switches can be used | ||
360 | here, except the B<no_signame> and B<no_sigdump> are permanently set | ||
361 | and cannot be disabled (this is because the certificate signature cannot | ||
362 | be displayed because the certificate has not been signed at this point). | ||
363 | |||
364 | For convenience the values B<default_ca> are accepted by both to produce | ||
365 | a reasonable output. | ||
366 | |||
367 | If neither option is present the format used in earlier versions of | ||
368 | OpenSSL is used. Use of the old format is B<strongly> discouraged because | ||
369 | it only displays fields mentioned in the B<policy> section, mishandles | ||
370 | multicharacter string types and does not display extensions. | ||
371 | |||
372 | =item B<copy_extensions> | ||
373 | |||
374 | determines how extensions in certificate requests should be handled. | ||
375 | If set to B<none> or this option is not present then extensions are | ||
376 | ignored and not copied to the certificate. If set to B<copy> then any | ||
377 | extensions present in the request that are not already present are copied | ||
378 | to the certificate. If set to B<copyall> then all extensions in the | ||
379 | request are copied to the certificate: if the extension is already present | ||
380 | in the certificate it is deleted first. See the B<WARNINGS> section before | ||
381 | using this option. | ||
382 | |||
383 | The main use of this option is to allow a certificate request to supply | ||
384 | values for certain extensions such as subjectAltName. | ||
385 | |||
306 | =back | 386 | =back |
307 | 387 | ||
308 | =head1 POLICY FORMAT | 388 | =head1 POLICY FORMAT |
@@ -392,6 +472,11 @@ A sample configuration file with the relevant sections for B<ca>: | |||
392 | default_md = md5 # md to use | 472 | default_md = md5 # md to use |
393 | 473 | ||
394 | policy = policy_any # default policy | 474 | policy = policy_any # default policy |
475 | email_in_dn = no # Don't add the email into cert DN | ||
476 | |||
477 | nameopt = default_ca # Subject name display option | ||
478 | certopt = default_ca # Certificate display option | ||
479 | copy_extensions = none # Don't copy extensions from request | ||
395 | 480 | ||
396 | [ policy_any ] | 481 | [ policy_any ] |
397 | countryName = supplied | 482 | countryName = supplied |
@@ -406,7 +491,7 @@ A sample configuration file with the relevant sections for B<ca>: | |||
406 | The B<ca> command is quirky and at times downright unfriendly. | 491 | The B<ca> command is quirky and at times downright unfriendly. |
407 | 492 | ||
408 | The B<ca> utility was originally meant as an example of how to do things | 493 | The B<ca> utility was originally meant as an example of how to do things |
409 | in a CA. It was not supposed be be used as a full blown CA itself: | 494 | in a CA. It was not supposed to be used as a full blown CA itself: |
410 | nevertheless some people are using it for this purpose. | 495 | nevertheless some people are using it for this purpose. |
411 | 496 | ||
412 | The B<ca> command is effectively a single user command: no locking is | 497 | The B<ca> command is effectively a single user command: no locking is |
@@ -457,10 +542,6 @@ The use of an in memory text database can cause problems when large | |||
457 | numbers of certificates are present because, as the name implies | 542 | numbers of certificates are present because, as the name implies |
458 | the database has to be kept in memory. | 543 | the database has to be kept in memory. |
459 | 544 | ||
460 | Certificate request extensions are ignored: some kind of "policy" should | ||
461 | be included to use certain static extensions and certain extensions | ||
462 | from the request. | ||
463 | |||
464 | It is not possible to certify two certificates with the same DN: this | 545 | It is not possible to certify two certificates with the same DN: this |
465 | is a side effect of how the text database is indexed and it cannot easily | 546 | is a side effect of how the text database is indexed and it cannot easily |
466 | be fixed without introducing other problems. Some S/MIME clients can use | 547 | be fixed without introducing other problems. Some S/MIME clients can use |
@@ -473,13 +554,39 @@ exposed at either a command or interface level so a more friendly utility | |||
473 | B<CA.pl> help a little but not very much. | 554 | B<CA.pl> help a little but not very much. |
474 | 555 | ||
475 | Any fields in a request that are not present in a policy are silently | 556 | Any fields in a request that are not present in a policy are silently |
476 | deleted. This does not happen if the B<-preserveDN> option is used but | 557 | deleted. This does not happen if the B<-preserveDN> option is used. To |
477 | the extra fields are not displayed when the user is asked to certify | 558 | enforce the absence of the EMAIL field within the DN, as suggested by |
478 | a request. The behaviour should be more friendly and configurable. | 559 | RFCs, regardless the contents of the request' subject the B<-noemailDN> |
560 | option can be used. The behaviour should be more friendly and | ||
561 | configurable. | ||
479 | 562 | ||
480 | Cancelling some commands by refusing to certify a certificate can | 563 | Cancelling some commands by refusing to certify a certificate can |
481 | create an empty file. | 564 | create an empty file. |
482 | 565 | ||
566 | =head1 WARNINGS | ||
567 | |||
568 | The B<copy_extensions> option should be used with caution. If care is | ||
569 | not taken then it can be a security risk. For example if a certificate | ||
570 | request contains a basicConstraints extension with CA:TRUE and the | ||
571 | B<copy_extensions> value is set to B<copyall> and the user does not spot | ||
572 | this when the certificate is displayed then this will hand the requestor | ||
573 | a valid CA certificate. | ||
574 | |||
575 | This situation can be avoided by setting B<copy_extensions> to B<copy> | ||
576 | and including basicConstraints with CA:FALSE in the configuration file. | ||
577 | Then if the request contains a basicConstraints extension it will be | ||
578 | ignored. | ||
579 | |||
580 | It is advisable to also include values for other extensions such | ||
581 | as B<keyUsage> to prevent a request supplying its own values. | ||
582 | |||
583 | Additional restrictions can be placed on the CA certificate itself. | ||
584 | For example if the CA certificate has: | ||
585 | |||
586 | basicConstraints = CA:TRUE, pathlen:0 | ||
587 | |||
588 | then even if a certificate is issued with CA:TRUE it will not be valid. | ||
589 | |||
483 | =head1 SEE ALSO | 590 | =head1 SEE ALSO |
484 | 591 | ||
485 | L<req(1)|req(1)>, L<spkac(1)|spkac(1)>, L<x509(1)|x509(1)>, L<CA.pl(1)|CA.pl(1)>, | 592 | L<req(1)|req(1)>, L<spkac(1)|spkac(1)>, L<x509(1)|x509(1)>, L<CA.pl(1)|CA.pl(1)>, |
diff --git a/src/lib/libssl/src/doc/apps/enc.pod b/src/lib/libssl/src/doc/apps/enc.pod index a68ddca139..ddf081617f 100644 --- a/src/lib/libssl/src/doc/apps/enc.pod +++ b/src/lib/libssl/src/doc/apps/enc.pod | |||
@@ -21,6 +21,7 @@ B<openssl enc -ciphername> | |||
21 | [B<-p>] | 21 | [B<-p>] |
22 | [B<-P>] | 22 | [B<-P>] |
23 | [B<-bufsize number>] | 23 | [B<-bufsize number>] |
24 | [B<-nopad>] | ||
24 | [B<-debug>] | 25 | [B<-debug>] |
25 | 26 | ||
26 | =head1 DESCRIPTION | 27 | =head1 DESCRIPTION |
@@ -122,6 +123,10 @@ or decryption. | |||
122 | 123 | ||
123 | set the buffer size for I/O | 124 | set the buffer size for I/O |
124 | 125 | ||
126 | =item B<-nopad> | ||
127 | |||
128 | disable standard block padding | ||
129 | |||
125 | =item B<-debug> | 130 | =item B<-debug> |
126 | 131 | ||
127 | debug the BIOs used for I/O. | 132 | debug the BIOs used for I/O. |
@@ -150,11 +155,14 @@ Some of the ciphers do not have large keys and others have security | |||
150 | implications if not used correctly. A beginner is advised to just use | 155 | implications if not used correctly. A beginner is advised to just use |
151 | a strong block cipher in CBC mode such as bf or des3. | 156 | a strong block cipher in CBC mode such as bf or des3. |
152 | 157 | ||
153 | All the block ciphers use PKCS#5 padding also known as standard block | 158 | All the block ciphers normally use PKCS#5 padding also known as standard block |
154 | padding: this allows a rudimentary integrity or password check to be | 159 | padding: this allows a rudimentary integrity or password check to be |
155 | performed. However since the chance of random data passing the test is | 160 | performed. However since the chance of random data passing the test is |
156 | better than 1 in 256 it isn't a very good test. | 161 | better than 1 in 256 it isn't a very good test. |
157 | 162 | ||
163 | If padding is disabled then the input data must be a multiple of the cipher | ||
164 | block length. | ||
165 | |||
158 | All RC2 ciphers have the same key and effective key length. | 166 | All RC2 ciphers have the same key and effective key length. |
159 | 167 | ||
160 | Blowfish and RC5 algorithms use a 128 bit key. | 168 | Blowfish and RC5 algorithms use a 128 bit key. |
@@ -256,8 +264,8 @@ The B<-A> option when used with large files doesn't work properly. | |||
256 | 264 | ||
257 | There should be an option to allow an iteration count to be included. | 265 | There should be an option to allow an iteration count to be included. |
258 | 266 | ||
259 | Like the EVP library the B<enc> program only supports a fixed number of | 267 | The B<enc> program only supports a fixed number of algorithms with |
260 | algorithms with certain parameters. So if, for example, you want to use RC2 | 268 | certain parameters. So if, for example, you want to use RC2 with a |
261 | with a 76 bit key or RC4 with an 84 bit key you can't use this program. | 269 | 76 bit key or RC4 with an 84 bit key you can't use this program. |
262 | 270 | ||
263 | =cut | 271 | =cut |
diff --git a/src/lib/libssl/src/doc/apps/ocsp.pod b/src/lib/libssl/src/doc/apps/ocsp.pod new file mode 100644 index 0000000000..da201b95e6 --- /dev/null +++ b/src/lib/libssl/src/doc/apps/ocsp.pod | |||
@@ -0,0 +1,348 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | ocsp - Online Certificate Status Protocol utility | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<openssl> B<ocsp> | ||
10 | [B<-out file>] | ||
11 | [B<-issuer file>] | ||
12 | [B<-cert file>] | ||
13 | [B<-serial n>] | ||
14 | [B<-req_text>] | ||
15 | [B<-resp_text>] | ||
16 | [B<-text>] | ||
17 | [B<-reqout file>] | ||
18 | [B<-respout file>] | ||
19 | [B<-reqin file>] | ||
20 | [B<-respin file>] | ||
21 | [B<-nonce>] | ||
22 | [B<-no_nonce>] | ||
23 | [B<-url responder_url>] | ||
24 | [B<-host host:n>] | ||
25 | [B<-path>] | ||
26 | [B<-CApath file>] | ||
27 | [B<-CAfile file>] | ||
28 | [B<-VAfile file>] | ||
29 | [B<-verify_certs file>] | ||
30 | [B<-noverify>] | ||
31 | [B<-trust_other>] | ||
32 | [B<-no_intern>] | ||
33 | [B<-no_sig_verify>] | ||
34 | [B<-no_cert_verify>] | ||
35 | [B<-no_chain>] | ||
36 | [B<-no_cert_checks>] | ||
37 | [B<-validity_period nsec>] | ||
38 | [B<-status_age nsec>] | ||
39 | |||
40 | =head1 DESCRIPTION | ||
41 | |||
42 | B<WARNING: this documentation is preliminary and subject to change.> | ||
43 | |||
44 | The Online Certificate Status Protocol (OCSP) enables applications to | ||
45 | determine the (revocation) state of an identified certificate (RFC 2560). | ||
46 | |||
47 | The B<ocsp> command performs many common OCSP tasks. It can be used | ||
48 | to print out requests and responses, create requests and send queries | ||
49 | to an OCSP responder and behave like a mini OCSP server itself. | ||
50 | |||
51 | =head1 OCSP CLIENT OPTIONS | ||
52 | |||
53 | =over 4 | ||
54 | |||
55 | =item B<-out filename> | ||
56 | |||
57 | specify output filename, default is standard output. | ||
58 | |||
59 | =item B<-issuer filename> | ||
60 | |||
61 | This specifies the current issuer certificate. This option can be used | ||
62 | multiple times. The certificate specified in B<filename> must be in | ||
63 | PEM format. | ||
64 | |||
65 | =item B<-cert filename> | ||
66 | |||
67 | Add the certificate B<filename> to the request. The issuer certificate | ||
68 | is taken from the previous B<issuer> option, or an error occurs if no | ||
69 | issuer certificate is specified. | ||
70 | |||
71 | =item B<-serial num> | ||
72 | |||
73 | Same as the B<cert> option except the certificate with serial number | ||
74 | B<num> is added to the request. The serial number is interpreted as a | ||
75 | decimal integer unless preceded by B<0x>. Negative integers can also | ||
76 | be specified by preceding the value by a B<-> sign. | ||
77 | |||
78 | =item B<-signer filename>, B<-signkey filename> | ||
79 | |||
80 | Sign the OCSP request using the certificate specified in the B<signer> | ||
81 | option and the private key specified by the B<signkey> option. If | ||
82 | the B<signkey> option is not present then the private key is read | ||
83 | from the same file as the certificate. If neither option is specified then | ||
84 | the OCSP request is not signed. | ||
85 | |||
86 | =item B<-nonce>, B<-no_nonce> | ||
87 | |||
88 | Add an OCSP nonce extension to a request or disable OCSP nonce addition. | ||
89 | Normally if an OCSP request is input using the B<respin> option no | ||
90 | nonce is added: using the B<nonce> option will force addition of a nonce. | ||
91 | If an OCSP request is being created (using B<cert> and B<serial> options) | ||
92 | a nonce is automatically added specifying B<no_nonce> overrides this. | ||
93 | |||
94 | =item B<-req_text>, B<-resp_text>, B<-text> | ||
95 | |||
96 | print out the text form of the OCSP request, response or both respectively. | ||
97 | |||
98 | =item B<-reqout file>, B<-respout file> | ||
99 | |||
100 | write out the DER encoded certificate request or response to B<file>. | ||
101 | |||
102 | =item B<-reqin file>, B<-respin file> | ||
103 | |||
104 | read OCSP request or response file from B<file>. These option are ignored | ||
105 | if OCSP request or response creation is implied by other options (for example | ||
106 | with B<serial>, B<cert> and B<host> options). | ||
107 | |||
108 | =item B<-url responder_url> | ||
109 | |||
110 | specify the responder URL. Both HTTP and HTTPS (SSL/TLS) URLs can be specified. | ||
111 | |||
112 | =item B<-host hostname:port>, B<-path pathname> | ||
113 | |||
114 | if the B<host> option is present then the OCSP request is sent to the host | ||
115 | B<hostname> on port B<port>. B<path> specifies the HTTP path name to use | ||
116 | or "/" by default. | ||
117 | |||
118 | =item B<-CAfile file>, B<-CApath pathname> | ||
119 | |||
120 | file or pathname containing trusted CA certificates. These are used to verify | ||
121 | the signature on the OCSP response. | ||
122 | |||
123 | =item B<-verify_certs file> | ||
124 | |||
125 | file containing additional certificates to search when attempting to locate | ||
126 | the OCSP response signing certificate. Some responders omit the actual signer's | ||
127 | certificate from the response: this option can be used to supply the necessary | ||
128 | certificate in such cases. | ||
129 | |||
130 | =item B<-trust_other> | ||
131 | |||
132 | the certificates specified by the B<-verify_certs> option should be explicitly | ||
133 | trusted and no additional checks will be performed on them. This is useful | ||
134 | when the complete responder certificate chain is not available or trusting a | ||
135 | root CA is not appropriate. | ||
136 | |||
137 | =item B<-VAfile file> | ||
138 | |||
139 | file containing explicitly trusted responder certificates. Equivalent to the | ||
140 | B<-verify_certs> and B<-trust_other> options. | ||
141 | |||
142 | =item B<-noverify> | ||
143 | |||
144 | don't attempt to verify the OCSP response signature or the nonce values. This | ||
145 | option will normally only be used for debugging since it disables all verification | ||
146 | of the responders certificate. | ||
147 | |||
148 | =item B<-no_intern> | ||
149 | |||
150 | ignore certificates contained in the OCSP response when searching for the | ||
151 | signers certificate. With this option the signers certificate must be specified | ||
152 | with either the B<-verify_certs> or B<-VAfile> options. | ||
153 | |||
154 | =item B<-no_sig_verify> | ||
155 | |||
156 | don't check the signature on the OCSP response. Since this option tolerates invalid | ||
157 | signatures on OCSP responses it will normally only be used for testing purposes. | ||
158 | |||
159 | =item B<-no_cert_verify> | ||
160 | |||
161 | don't verify the OCSP response signers certificate at all. Since this option allows | ||
162 | the OCSP response to be signed by any certificate it should only be used for | ||
163 | testing purposes. | ||
164 | |||
165 | =item B<-no_chain> | ||
166 | |||
167 | do not use certificates in the response as additional untrusted CA | ||
168 | certificates. | ||
169 | |||
170 | =item B<-no_cert_checks> | ||
171 | |||
172 | don't perform any additional checks on the OCSP response signers certificate. | ||
173 | That is do not make any checks to see if the signers certificate is authorised | ||
174 | to provide the necessary status information: as a result this option should | ||
175 | only be used for testing purposes. | ||
176 | |||
177 | =item B<-validity_period nsec>, B<-status_age age> | ||
178 | |||
179 | these options specify the range of times, in seconds, which will be tolerated | ||
180 | in an OCSP response. Each certificate status response includes a B<notBefore> time and | ||
181 | an optional B<notAfter> time. The current time should fall between these two values, but | ||
182 | the interval between the two times may be only a few seconds. In practice the OCSP | ||
183 | responder and clients clocks may not be precisely synchronised and so such a check | ||
184 | may fail. To avoid this the B<-validity_period> option can be used to specify an | ||
185 | acceptable error range in seconds, the default value is 5 minutes. | ||
186 | |||
187 | If the B<notAfter> time is omitted from a response then this means that new status | ||
188 | information is immediately available. In this case the age of the B<notBefore> field | ||
189 | is checked to see it is not older than B<age> seconds old. By default this additional | ||
190 | check is not performed. | ||
191 | |||
192 | =back | ||
193 | |||
194 | =head1 OCSP SERVER OPTIONS | ||
195 | |||
196 | =over 4 | ||
197 | |||
198 | =item B<-index indexfile> | ||
199 | |||
200 | B<indexfile> is a text index file in B<ca> format containing certificate revocation | ||
201 | information. | ||
202 | |||
203 | If the B<index> option is specified the B<ocsp> utility is in responder mode, otherwise | ||
204 | it is in client mode. The request(s) the responder processes can be either specified on | ||
205 | the command line (using B<issuer> and B<serial> options), supplied in a file (using the | ||
206 | B<respin> option) or via external OCSP clients (if B<port> or B<url> is specified). | ||
207 | |||
208 | If the B<index> option is present then the B<CA> and B<rsigner> options must also be | ||
209 | present. | ||
210 | |||
211 | =item B<-CA file> | ||
212 | |||
213 | CA certificate corresponding to the revocation information in B<indexfile>. | ||
214 | |||
215 | =item B<-rsigner file> | ||
216 | |||
217 | The certificate to sign OCSP responses with. | ||
218 | |||
219 | =item B<-rother file> | ||
220 | |||
221 | Additional certificates to include in the OCSP response. | ||
222 | |||
223 | =item B<-resp_no_certs> | ||
224 | |||
225 | Don't include any certificates in the OCSP response. | ||
226 | |||
227 | =item B<-resp_key_id> | ||
228 | |||
229 | Identify the signer certificate using the key ID, default is to use the subject name. | ||
230 | |||
231 | =item B<-rkey file> | ||
232 | |||
233 | The private key to sign OCSP responses with: if not present the file specified in the | ||
234 | B<rsigner> option is used. | ||
235 | |||
236 | =item B<-port portnum> | ||
237 | |||
238 | Port to listen for OCSP requests on. The port may also be specified using the B<url> | ||
239 | option. | ||
240 | |||
241 | =item B<-nrequest number> | ||
242 | |||
243 | The OCSP server will exit after receiving B<number> requests, default unlimited. | ||
244 | |||
245 | =item B<-nmin minutes>, B<-ndays days> | ||
246 | |||
247 | Number of minutes or days when fresh revocation information is available: used in the | ||
248 | B<nextUpdate> field. If neither option is present then the B<nextUpdate> field is | ||
249 | omitted meaning fresh revocation information is immediately available. | ||
250 | |||
251 | =back | ||
252 | |||
253 | =head1 OCSP Response verification. | ||
254 | |||
255 | OCSP Response follows the rules specified in RFC2560. | ||
256 | |||
257 | Initially the OCSP responder certificate is located and the signature on | ||
258 | the OCSP request checked using the responder certificate's public key. | ||
259 | |||
260 | Then a normal certificate verify is performed on the OCSP responder certificate | ||
261 | building up a certificate chain in the process. The locations of the trusted | ||
262 | certificates used to build the chain can be specified by the B<CAfile> | ||
263 | and B<CApath> options or they will be looked for in the standard OpenSSL | ||
264 | certificates directory. | ||
265 | |||
266 | If the initial verify fails then the OCSP verify process halts with an | ||
267 | error. | ||
268 | |||
269 | Otherwise the issuing CA certificate in the request is compared to the OCSP | ||
270 | responder certificate: if there is a match then the OCSP verify succeeds. | ||
271 | |||
272 | Otherwise the OCSP responder certificate's CA is checked against the issuing | ||
273 | CA certificate in the request. If there is a match and the OCSPSigning | ||
274 | extended key usage is present in the OCSP responder certificate then the | ||
275 | OCSP verify succeeds. | ||
276 | |||
277 | Otherwise the root CA of the OCSP responders CA is checked to see if it | ||
278 | is trusted for OCSP signing. If it is the OCSP verify succeeds. | ||
279 | |||
280 | If none of these checks is successful then the OCSP verify fails. | ||
281 | |||
282 | What this effectively means if that if the OCSP responder certificate is | ||
283 | authorised directly by the CA it is issuing revocation information about | ||
284 | (and it is correctly configured) then verification will succeed. | ||
285 | |||
286 | If the OCSP responder is a "global responder" which can give details about | ||
287 | multiple CAs and has its own separate certificate chain then its root | ||
288 | CA can be trusted for OCSP signing. For example: | ||
289 | |||
290 | openssl x509 -in ocspCA.pem -addtrust OCSPSigning -out trustedCA.pem | ||
291 | |||
292 | Alternatively the responder certificate itself can be explicitly trusted | ||
293 | with the B<-VAfile> option. | ||
294 | |||
295 | =head1 NOTES | ||
296 | |||
297 | As noted, most of the verify options are for testing or debugging purposes. | ||
298 | Normally only the B<-CApath>, B<-CAfile> and (if the responder is a 'global | ||
299 | VA') B<-VAfile> options need to be used. | ||
300 | |||
301 | The OCSP server is only useful for test and demonstration purposes: it is | ||
302 | not really usable as a full OCSP responder. It contains only a very | ||
303 | simple HTTP request handling and can only handle the POST form of OCSP | ||
304 | queries. It also handles requests serially meaning it cannot respond to | ||
305 | new requests until it has processed the current one. The text index file | ||
306 | format of revocation is also inefficient for large quantities of revocation | ||
307 | data. | ||
308 | |||
309 | It is possible to run the B<ocsp> application in responder mode via a CGI | ||
310 | script using the B<respin> and B<respout> options. | ||
311 | |||
312 | =head1 EXAMPLES | ||
313 | |||
314 | Create an OCSP request and write it to a file: | ||
315 | |||
316 | openssl ocsp -issuer issuer.pem -cert c1.pem -cert c2.pem -reqout req.der | ||
317 | |||
318 | Send a query to an OCSP responder with URL http://ocsp.myhost.com/ save the | ||
319 | response to a file and print it out in text form | ||
320 | |||
321 | openssl ocsp -issuer issuer.pem -cert c1.pem -cert c2.pem \ | ||
322 | -url http://ocsp.myhost.com/ -resp_text -respout resp.der | ||
323 | |||
324 | Read in an OCSP response and print out text form: | ||
325 | |||
326 | openssl ocsp -respin resp.der -text | ||
327 | |||
328 | OCSP server on port 8888 using a standard B<ca> configuration, and a separate | ||
329 | responder certificate. All requests and responses are printed to a file. | ||
330 | |||
331 | openssl ocsp -index demoCA/index.txt -port 8888 -rsigner rcert.pem -CA demoCA/cacert.pem | ||
332 | -text -out log.txt | ||
333 | |||
334 | As above but exit after processing one request: | ||
335 | |||
336 | openssl ocsp -index demoCA/index.txt -port 8888 -rsigner rcert.pem -CA demoCA/cacert.pem | ||
337 | -nrequest 1 | ||
338 | |||
339 | Query status information using internally generated request: | ||
340 | |||
341 | openssl ocsp -index demoCA/index.txt -rsigner rcert.pem -CA demoCA/cacert.pem | ||
342 | -issuer demoCA/cacert.pem -serial 1 | ||
343 | |||
344 | Query status information using request read from a file, write response to a | ||
345 | second file. | ||
346 | |||
347 | openssl ocsp -index demoCA/index.txt -rsigner rcert.pem -CA demoCA/cacert.pem | ||
348 | -reqin req.der -respout resp.der | ||
diff --git a/src/lib/libssl/src/doc/apps/openssl.pod b/src/lib/libssl/src/doc/apps/openssl.pod index 0cbd199d79..07dd80eabe 100644 --- a/src/lib/libssl/src/doc/apps/openssl.pod +++ b/src/lib/libssl/src/doc/apps/openssl.pod | |||
@@ -121,10 +121,18 @@ Generation of DSA Parameters. | |||
121 | 121 | ||
122 | Generation of RSA Parameters. | 122 | Generation of RSA Parameters. |
123 | 123 | ||
124 | =item L<B<ocsp>|ocsp(1)> | ||
125 | |||
126 | Online Certificate Status Protocol utility. | ||
127 | |||
124 | =item L<B<passwd>|passwd(1)> | 128 | =item L<B<passwd>|passwd(1)> |
125 | 129 | ||
126 | Generation of hashed passwords. | 130 | Generation of hashed passwords. |
127 | 131 | ||
132 | =item L<B<pkcs12>|pkcs12(1)> | ||
133 | |||
134 | PKCS#12 Data Management. | ||
135 | |||
128 | =item L<B<pkcs7>|pkcs7(1)> | 136 | =item L<B<pkcs7>|pkcs7(1)> |
129 | 137 | ||
130 | PKCS#7 Data Management. | 138 | PKCS#7 Data Management. |
diff --git a/src/lib/libssl/src/doc/apps/passwd.pod b/src/lib/libssl/src/doc/apps/passwd.pod index 6e098940c7..07d849c824 100644 --- a/src/lib/libssl/src/doc/apps/passwd.pod +++ b/src/lib/libssl/src/doc/apps/passwd.pod | |||
@@ -13,6 +13,7 @@ B<openssl passwd> | |||
13 | [B<-salt> I<string>] | 13 | [B<-salt> I<string>] |
14 | [B<-in> I<file>] | 14 | [B<-in> I<file>] |
15 | [B<-stdin>] | 15 | [B<-stdin>] |
16 | [B<-noverify>] | ||
16 | [B<-quiet>] | 17 | [B<-quiet>] |
17 | [B<-table>] | 18 | [B<-table>] |
18 | {I<password>} | 19 | {I<password>} |
@@ -22,7 +23,7 @@ B<openssl passwd> | |||
22 | The B<passwd> command computes the hash of a password typed at | 23 | The B<passwd> command computes the hash of a password typed at |
23 | run-time or the hash of each password in a list. The password list is | 24 | run-time or the hash of each password in a list. The password list is |
24 | taken from the named file for option B<-in file>, from stdin for | 25 | taken from the named file for option B<-in file>, from stdin for |
25 | option B<-stdin>, and from the command line otherwise. | 26 | option B<-stdin>, or from the command line, or from the terminal otherwise. |
26 | The Unix standard algorithm B<crypt> and the MD5-based BSD password | 27 | The Unix standard algorithm B<crypt> and the MD5-based BSD password |
27 | algorithm B<1> and its Apache variant B<apr1> are available. | 28 | algorithm B<1> and its Apache variant B<apr1> are available. |
28 | 29 | ||
@@ -45,6 +46,7 @@ Use the B<apr1> algorithm (Apache variant of the BSD algorithm). | |||
45 | =item B<-salt> I<string> | 46 | =item B<-salt> I<string> |
46 | 47 | ||
47 | Use the specified salt. | 48 | Use the specified salt. |
49 | When reading a password from the terminal, this implies B<-noverify>. | ||
48 | 50 | ||
49 | =item B<-in> I<file> | 51 | =item B<-in> I<file> |
50 | 52 | ||
@@ -54,6 +56,10 @@ Read passwords from I<file>. | |||
54 | 56 | ||
55 | Read passwords from B<stdin>. | 57 | Read passwords from B<stdin>. |
56 | 58 | ||
59 | =item B<-noverify> | ||
60 | |||
61 | Don't verify when reading a password from the terminal. | ||
62 | |||
57 | =item B<-quiet> | 63 | =item B<-quiet> |
58 | 64 | ||
59 | Don't output warnings when passwords given at the command line are truncated. | 65 | Don't output warnings when passwords given at the command line are truncated. |
diff --git a/src/lib/libssl/src/doc/apps/pkcs12.pod b/src/lib/libssl/src/doc/apps/pkcs12.pod index 7e0307dda0..7d84146293 100644 --- a/src/lib/libssl/src/doc/apps/pkcs12.pod +++ b/src/lib/libssl/src/doc/apps/pkcs12.pod | |||
@@ -262,7 +262,7 @@ the one corresponding to the private key. Certain software which requires | |||
262 | a private key and certificate and assumes the first certificate in the | 262 | a private key and certificate and assumes the first certificate in the |
263 | file is the one corresponding to the private key: this may not always | 263 | file is the one corresponding to the private key: this may not always |
264 | be the case. Using the B<-clcerts> option will solve this problem by only | 264 | be the case. Using the B<-clcerts> option will solve this problem by only |
265 | outputing the certificate corresponding to the private key. If the CA | 265 | outputting the certificate corresponding to the private key. If the CA |
266 | certificates are required then they can be output to a separate file using | 266 | certificates are required then they can be output to a separate file using |
267 | the B<-nokeys -cacerts> options to just output CA certificates. | 267 | the B<-nokeys -cacerts> options to just output CA certificates. |
268 | 268 | ||
diff --git a/src/lib/libssl/src/doc/apps/pkcs7.pod b/src/lib/libssl/src/doc/apps/pkcs7.pod index 4e9bd6e46b..9871c0e0cd 100644 --- a/src/lib/libssl/src/doc/apps/pkcs7.pod +++ b/src/lib/libssl/src/doc/apps/pkcs7.pod | |||
@@ -78,7 +78,7 @@ The PEM PKCS#7 format uses the header and footer lines: | |||
78 | -----BEGIN PKCS7----- | 78 | -----BEGIN PKCS7----- |
79 | -----END PKCS7----- | 79 | -----END PKCS7----- |
80 | 80 | ||
81 | For compatability with some CAs it will also accept: | 81 | For compatibility with some CAs it will also accept: |
82 | 82 | ||
83 | -----BEGIN CERTIFICATE----- | 83 | -----BEGIN CERTIFICATE----- |
84 | -----END CERTIFICATE----- | 84 | -----END CERTIFICATE----- |
diff --git a/src/lib/libssl/src/doc/apps/rand.pod b/src/lib/libssl/src/doc/apps/rand.pod index cbf8768801..75745ca002 100644 --- a/src/lib/libssl/src/doc/apps/rand.pod +++ b/src/lib/libssl/src/doc/apps/rand.pod | |||
@@ -15,7 +15,7 @@ I<num> | |||
15 | =head1 DESCRIPTION | 15 | =head1 DESCRIPTION |
16 | 16 | ||
17 | The B<rand> command outputs I<num> pseudo-random bytes after seeding | 17 | The B<rand> command outputs I<num> pseudo-random bytes after seeding |
18 | the random number generater once. As in other B<openssl> command | 18 | the random number generator once. As in other B<openssl> command |
19 | line tools, PRNG seeding uses the file I<$HOME/>B<.rnd> or B<.rnd> | 19 | line tools, PRNG seeding uses the file I<$HOME/>B<.rnd> or B<.rnd> |
20 | in addition to the files given in the B<-rand> option. A new | 20 | in addition to the files given in the B<-rand> option. A new |
21 | I<$HOME>/B<.rnd> or B<.rnd> file will be written back if enough | 21 | I<$HOME>/B<.rnd> or B<.rnd> file will be written back if enough |
diff --git a/src/lib/libssl/src/doc/apps/req.pod b/src/lib/libssl/src/doc/apps/req.pod index a3f54f45a3..10e4e12a5c 100644 --- a/src/lib/libssl/src/doc/apps/req.pod +++ b/src/lib/libssl/src/doc/apps/req.pod | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | =head1 NAME | 4 | =head1 NAME |
5 | 5 | ||
6 | req - PKCS#10 certificate and certificate generating utility. | 6 | req - PKCS#10 certificate request and certificate generating utility. |
7 | 7 | ||
8 | =head1 SYNOPSIS | 8 | =head1 SYNOPSIS |
9 | 9 | ||
@@ -15,6 +15,7 @@ B<openssl> B<req> | |||
15 | [B<-out filename>] | 15 | [B<-out filename>] |
16 | [B<-passout arg>] | 16 | [B<-passout arg>] |
17 | [B<-text>] | 17 | [B<-text>] |
18 | [B<-pubkey>] | ||
18 | [B<-noout>] | 19 | [B<-noout>] |
19 | [B<-verify>] | 20 | [B<-verify>] |
20 | [B<-modulus>] | 21 | [B<-modulus>] |
@@ -28,12 +29,18 @@ B<openssl> B<req> | |||
28 | [B<-keyout filename>] | 29 | [B<-keyout filename>] |
29 | [B<-[md5|sha1|md2|mdc2]>] | 30 | [B<-[md5|sha1|md2|mdc2]>] |
30 | [B<-config filename>] | 31 | [B<-config filename>] |
32 | [B<-subj arg>] | ||
31 | [B<-x509>] | 33 | [B<-x509>] |
32 | [B<-days n>] | 34 | [B<-days n>] |
35 | [B<-set_serial n>] | ||
33 | [B<-asn1-kludge>] | 36 | [B<-asn1-kludge>] |
34 | [B<-newhdr>] | 37 | [B<-newhdr>] |
35 | [B<-extensions section>] | 38 | [B<-extensions section>] |
36 | [B<-reqexts section>] | 39 | [B<-reqexts section>] |
40 | [B<-utf8>] | ||
41 | [B<-nameopt>] | ||
42 | [B<-batch>] | ||
43 | [B<-verbose>] | ||
37 | 44 | ||
38 | =head1 DESCRIPTION | 45 | =head1 DESCRIPTION |
39 | 46 | ||
@@ -82,6 +89,10 @@ see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. | |||
82 | 89 | ||
83 | prints out the certificate request in text form. | 90 | prints out the certificate request in text form. |
84 | 91 | ||
92 | =item B<-pubkey> | ||
93 | |||
94 | outputs the public key. | ||
95 | |||
85 | =item B<-noout> | 96 | =item B<-noout> |
86 | 97 | ||
87 | this option prevents output of the encoded version of the request. | 98 | this option prevents output of the encoded version of the request. |
@@ -154,18 +165,33 @@ this allows an alternative configuration file to be specified, | |||
154 | this overrides the compile time filename or any specified in | 165 | this overrides the compile time filename or any specified in |
155 | the B<OPENSSL_CONF> environment variable. | 166 | the B<OPENSSL_CONF> environment variable. |
156 | 167 | ||
168 | =item B<-subj arg> | ||
169 | |||
170 | sets subject name for new request or supersedes the subject name | ||
171 | when processing a request. | ||
172 | The arg must be formatted as I</type0=value0/type1=value1/type2=...>, | ||
173 | characters may be escaped by \ (backslash), no spaces are skipped. | ||
174 | |||
157 | =item B<-x509> | 175 | =item B<-x509> |
158 | 176 | ||
159 | this option outputs a self signed certificate instead of a certificate | 177 | this option outputs a self signed certificate instead of a certificate |
160 | request. This is typically used to generate a test certificate or | 178 | request. This is typically used to generate a test certificate or |
161 | a self signed root CA. The extensions added to the certificate | 179 | a self signed root CA. The extensions added to the certificate |
162 | (if any) are specified in the configuration file. | 180 | (if any) are specified in the configuration file. Unless specified |
181 | using the B<set_serial> option B<0> will be used for the serial | ||
182 | number. | ||
163 | 183 | ||
164 | =item B<-days n> | 184 | =item B<-days n> |
165 | 185 | ||
166 | when the B<-x509> option is being used this specifies the number of | 186 | when the B<-x509> option is being used this specifies the number of |
167 | days to certify the certificate for. The default is 30 days. | 187 | days to certify the certificate for. The default is 30 days. |
168 | 188 | ||
189 | =item B<-set_serial n> | ||
190 | |||
191 | serial number to use when outputting a self signed certificate. This | ||
192 | may be specified as a decimal value or a hex value if preceded by B<0x>. | ||
193 | It is possible to use negative serial numbers but this is not recommended. | ||
194 | |||
169 | =item B<-extensions section> | 195 | =item B<-extensions section> |
170 | 196 | ||
171 | =item B<-reqexts section> | 197 | =item B<-reqexts section> |
@@ -176,6 +202,20 @@ request extensions. This allows several different sections to | |||
176 | be used in the same configuration file to specify requests for | 202 | be used in the same configuration file to specify requests for |
177 | a variety of purposes. | 203 | a variety of purposes. |
178 | 204 | ||
205 | =item B<-utf8> | ||
206 | |||
207 | this option causes field values to be interpreted as UTF8 strings, by | ||
208 | default they are interpreted as ASCII. This means that the field | ||
209 | values, whether prompted from a terminal or obtained from a | ||
210 | configuration file, must be valid UTF8 strings. | ||
211 | |||
212 | =item B<-nameopt option> | ||
213 | |||
214 | option which determines how the subject or issuer names are displayed. The | ||
215 | B<option> argument can be a single option or multiple options separated by | ||
216 | commas. Alternatively the B<-nameopt> switch may be used more than once to | ||
217 | set multiple options. See the L<x509(1)|x509(1)> manual page for details. | ||
218 | |||
179 | =item B<-asn1-kludge> | 219 | =item B<-asn1-kludge> |
180 | 220 | ||
181 | by default the B<req> command outputs certificate requests containing | 221 | by default the B<req> command outputs certificate requests containing |
@@ -196,6 +236,14 @@ It should be noted that very few CAs still require the use of this option. | |||
196 | Adds the word B<NEW> to the PEM file header and footer lines on the outputed | 236 | Adds the word B<NEW> to the PEM file header and footer lines on the outputed |
197 | request. Some software (Netscape certificate server) and some CAs need this. | 237 | request. Some software (Netscape certificate server) and some CAs need this. |
198 | 238 | ||
239 | =item B<-batch> | ||
240 | |||
241 | non-interactive mode. | ||
242 | |||
243 | =item B<-verbose> | ||
244 | |||
245 | print extra details about the operations being performed. | ||
246 | |||
199 | =back | 247 | =back |
200 | 248 | ||
201 | =head1 CONFIGURATION FILE FORMAT | 249 | =head1 CONFIGURATION FILE FORMAT |
@@ -292,6 +340,13 @@ if set to the value B<no> this disables prompting of certificate fields | |||
292 | and just takes values from the config file directly. It also changes the | 340 | and just takes values from the config file directly. It also changes the |
293 | expected format of the B<distinguished_name> and B<attributes> sections. | 341 | expected format of the B<distinguished_name> and B<attributes> sections. |
294 | 342 | ||
343 | =item B<utf8> | ||
344 | |||
345 | if set to the value B<yes> then field values to be interpreted as UTF8 | ||
346 | strings, by default they are interpreted as ASCII. This means that | ||
347 | the field values, whether prompted from a terminal or obtained from a | ||
348 | configuration file, must be valid UTF8 strings. | ||
349 | |||
295 | =item B<attributes> | 350 | =item B<attributes> |
296 | 351 | ||
297 | this specifies the section containing any request attributes: its format | 352 | this specifies the section containing any request attributes: its format |
diff --git a/src/lib/libssl/src/doc/apps/rsa.pod b/src/lib/libssl/src/doc/apps/rsa.pod index f0e613ed05..ef74f1adff 100644 --- a/src/lib/libssl/src/doc/apps/rsa.pod +++ b/src/lib/libssl/src/doc/apps/rsa.pod | |||
@@ -136,7 +136,7 @@ and Microsoft IIS .key files, this uses unsalted RC4 for its encryption. | |||
136 | It is not very secure and so should only be used when necessary. | 136 | It is not very secure and so should only be used when necessary. |
137 | 137 | ||
138 | Some newer version of IIS have additional data in the exported .key | 138 | Some newer version of IIS have additional data in the exported .key |
139 | files. To use thse with the utility view the file with a binary editor | 139 | files. To use these with the utility, view the file with a binary editor |
140 | and look for the string "private-key", then trace back to the byte | 140 | and look for the string "private-key", then trace back to the byte |
141 | sequence 0x30, 0x82 (this is an ASN1 SEQUENCE). Copy all the data | 141 | sequence 0x30, 0x82 (this is an ASN1 SEQUENCE). Copy all the data |
142 | from this point onwards to another file and use that as the input | 142 | from this point onwards to another file and use that as the input |
diff --git a/src/lib/libssl/src/doc/apps/s_client.pod b/src/lib/libssl/src/doc/apps/s_client.pod index 078ff086c3..7fca9cbdbd 100644 --- a/src/lib/libssl/src/doc/apps/s_client.pod +++ b/src/lib/libssl/src/doc/apps/s_client.pod | |||
@@ -18,6 +18,7 @@ B<openssl> B<s_client> | |||
18 | [B<-pause>] | 18 | [B<-pause>] |
19 | [B<-showcerts>] | 19 | [B<-showcerts>] |
20 | [B<-debug>] | 20 | [B<-debug>] |
21 | [B<-msg>] | ||
21 | [B<-nbio_test>] | 22 | [B<-nbio_test>] |
22 | [B<-state>] | 23 | [B<-state>] |
23 | [B<-nbio>] | 24 | [B<-nbio>] |
@@ -32,8 +33,8 @@ B<openssl> B<s_client> | |||
32 | [B<-no_tls1>] | 33 | [B<-no_tls1>] |
33 | [B<-bugs>] | 34 | [B<-bugs>] |
34 | [B<-cipher cipherlist>] | 35 | [B<-cipher cipherlist>] |
35 | [B<-rand file(s)>] | ||
36 | [B<-engine id>] | 36 | [B<-engine id>] |
37 | [B<-rand file(s)>] | ||
37 | 38 | ||
38 | =head1 DESCRIPTION | 39 | =head1 DESCRIPTION |
39 | 40 | ||
@@ -112,6 +113,10 @@ prints out the SSL session states. | |||
112 | 113 | ||
113 | print extensive debugging information including a hex dump of all traffic. | 114 | print extensive debugging information including a hex dump of all traffic. |
114 | 115 | ||
116 | =item B<-msg> | ||
117 | |||
118 | show all protocol messages with hex dump. | ||
119 | |||
115 | =item B<-nbio_test> | 120 | =item B<-nbio_test> |
116 | 121 | ||
117 | tests non-blocking I/O | 122 | tests non-blocking I/O |
@@ -132,7 +137,7 @@ input. | |||
132 | 137 | ||
133 | =item B<-quiet> | 138 | =item B<-quiet> |
134 | 139 | ||
135 | inhibit printing of session and certificate information. This implicitely | 140 | inhibit printing of session and certificate information. This implicitly |
136 | turns on B<-ign_eof> as well. | 141 | turns on B<-ign_eof> as well. |
137 | 142 | ||
138 | =item B<-ssl2>, B<-ssl3>, B<-tls1>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1> | 143 | =item B<-ssl2>, B<-ssl3>, B<-tls1>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1> |
@@ -158,6 +163,13 @@ the server determines which cipher suite is used it should take the first | |||
158 | supported cipher in the list sent by the client. See the B<ciphers> | 163 | supported cipher in the list sent by the client. See the B<ciphers> |
159 | command for more information. | 164 | command for more information. |
160 | 165 | ||
166 | =item B<-engine id> | ||
167 | |||
168 | specifying an engine (by it's unique B<id> string) will cause B<s_client> | ||
169 | to attempt to obtain a functional reference to the specified engine, | ||
170 | thus initialising it if needed. The engine will then be set as the default | ||
171 | for all available algorithms. | ||
172 | |||
161 | =item B<-rand file(s)> | 173 | =item B<-rand file(s)> |
162 | 174 | ||
163 | a file or files containing random data used to seed the random number | 175 | a file or files containing random data used to seed the random number |
@@ -166,13 +178,6 @@ Multiple files can be specified separated by a OS-dependent character. | |||
166 | The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for | 178 | The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for |
167 | all others. | 179 | all others. |
168 | 180 | ||
169 | =item B<-engine id> | ||
170 | |||
171 | specifying an engine (by it's unique B<id> string) will cause B<s_client> | ||
172 | to attempt to obtain a functional reference to the specified engine, | ||
173 | thus initialising it if needed. The engine will then be set as the default | ||
174 | for all available algorithms. | ||
175 | |||
176 | =back | 181 | =back |
177 | 182 | ||
178 | =head1 CONNECTED COMMANDS | 183 | =head1 CONNECTED COMMANDS |
@@ -180,7 +185,7 @@ for all available algorithms. | |||
180 | If a connection is established with an SSL server then any data received | 185 | If a connection is established with an SSL server then any data received |
181 | from the server is displayed and any key presses will be sent to the | 186 | from the server is displayed and any key presses will be sent to the |
182 | server. When used interactively (which means neither B<-quiet> nor B<-ign_eof> | 187 | server. When used interactively (which means neither B<-quiet> nor B<-ign_eof> |
183 | have been given), the session will be renegociated if the line begins with an | 188 | have been given), the session will be renegotiated if the line begins with an |
184 | B<R>, and if the line begins with a B<Q> or if end of file is reached, the | 189 | B<R>, and if the line begins with a B<Q> or if end of file is reached, the |
185 | connection will be closed down. | 190 | connection will be closed down. |
186 | 191 | ||
diff --git a/src/lib/libssl/src/doc/apps/s_server.pod b/src/lib/libssl/src/doc/apps/s_server.pod index 313116ab66..4b1e4260ef 100644 --- a/src/lib/libssl/src/doc/apps/s_server.pod +++ b/src/lib/libssl/src/doc/apps/s_server.pod | |||
@@ -21,6 +21,7 @@ B<openssl> B<s_server> | |||
21 | [B<-nbio_test>] | 21 | [B<-nbio_test>] |
22 | [B<-crlf>] | 22 | [B<-crlf>] |
23 | [B<-debug>] | 23 | [B<-debug>] |
24 | [B<-msg>] | ||
24 | [B<-state>] | 25 | [B<-state>] |
25 | [B<-CApath directory>] | 26 | [B<-CApath directory>] |
26 | [B<-CAfile filename>] | 27 | [B<-CAfile filename>] |
@@ -39,8 +40,9 @@ B<openssl> B<s_server> | |||
39 | [B<-hack>] | 40 | [B<-hack>] |
40 | [B<-www>] | 41 | [B<-www>] |
41 | [B<-WWW>] | 42 | [B<-WWW>] |
42 | [B<-rand file(s)>] | 43 | [B<-HTTP>] |
43 | [B<-engine id>] | 44 | [B<-engine id>] |
45 | [B<-rand file(s)>] | ||
44 | 46 | ||
45 | =head1 DESCRIPTION | 47 | =head1 DESCRIPTION |
46 | 48 | ||
@@ -135,6 +137,10 @@ prints out the SSL session states. | |||
135 | 137 | ||
136 | print extensive debugging information including a hex dump of all traffic. | 138 | print extensive debugging information including a hex dump of all traffic. |
137 | 139 | ||
140 | =item B<-msg> | ||
141 | |||
142 | show all protocol messages with hex dump. | ||
143 | |||
138 | =item B<-nbio_test> | 144 | =item B<-nbio_test> |
139 | 145 | ||
140 | tests non blocking I/O | 146 | tests non blocking I/O |
@@ -188,13 +194,13 @@ emulates a simple web server. Pages will be resolved relative to the | |||
188 | current directory, for example if the URL https://myhost/page.html is | 194 | current directory, for example if the URL https://myhost/page.html is |
189 | requested the file ./page.html will be loaded. | 195 | requested the file ./page.html will be loaded. |
190 | 196 | ||
191 | =item B<-rand file(s)> | 197 | =item B<-HTTP> |
192 | 198 | ||
193 | a file or files containing random data used to seed the random number | 199 | emulates a simple web server. Pages will be resolved relative to the |
194 | generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). | 200 | current directory, for example if the URL https://myhost/page.html is |
195 | Multiple files can be specified separated by a OS-dependent character. | 201 | requested the file ./page.html will be loaded. The files loaded are |
196 | The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for | 202 | assumed to contain a complete and correct HTTP response (lines that |
197 | all others. | 203 | are part of the HTTP response line and headers must end with CRLF). |
198 | 204 | ||
199 | =item B<-engine id> | 205 | =item B<-engine id> |
200 | 206 | ||
@@ -203,6 +209,14 @@ to attempt to obtain a functional reference to the specified engine, | |||
203 | thus initialising it if needed. The engine will then be set as the default | 209 | thus initialising it if needed. The engine will then be set as the default |
204 | for all available algorithms. | 210 | for all available algorithms. |
205 | 211 | ||
212 | =item B<-rand file(s)> | ||
213 | |||
214 | a file or files containing random data used to seed the random number | ||
215 | generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). | ||
216 | Multiple files can be specified separated by a OS-dependent character. | ||
217 | The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for | ||
218 | all others. | ||
219 | |||
206 | =back | 220 | =back |
207 | 221 | ||
208 | =head1 CONNECTED COMMANDS | 222 | =head1 CONNECTED COMMANDS |
diff --git a/src/lib/libssl/src/doc/apps/verify.pod b/src/lib/libssl/src/doc/apps/verify.pod index 90455525d1..ea5c29c150 100644 --- a/src/lib/libssl/src/doc/apps/verify.pod +++ b/src/lib/libssl/src/doc/apps/verify.pod | |||
@@ -200,13 +200,13 @@ the signature of the certificate is invalid. Unused. | |||
200 | 200 | ||
201 | the certificate is not yet valid: the notBefore date is after the current time. | 201 | the certificate is not yet valid: the notBefore date is after the current time. |
202 | 202 | ||
203 | =item B<10 X509_V_ERR_CRL_NOT_YET_VALID: CRL is not yet valid> | 203 | =item B<10 X509_V_ERR_CERT_HAS_EXPIRED: certificate has expired> |
204 | 204 | ||
205 | the CRL is not yet valid. Unused. | 205 | the certificate has expired: that is the notAfter date is before the current time. |
206 | 206 | ||
207 | =item B<11 X509_V_ERR_CERT_HAS_EXPIRED: Certificate has expired> | 207 | =item B<11 X509_V_ERR_CRL_NOT_YET_VALID: CRL is not yet valid> |
208 | 208 | ||
209 | the certificate has expired: that is the notAfter date is before the current time. | 209 | the CRL is not yet valid. Unused. |
210 | 210 | ||
211 | =item B<12 X509_V_ERR_CRL_HAS_EXPIRED: CRL has expired> | 211 | =item B<12 X509_V_ERR_CRL_HAS_EXPIRED: CRL has expired> |
212 | 212 | ||
diff --git a/src/lib/libssl/src/doc/apps/version.pod b/src/lib/libssl/src/doc/apps/version.pod index 5d261a6405..e00324c446 100644 --- a/src/lib/libssl/src/doc/apps/version.pod +++ b/src/lib/libssl/src/doc/apps/version.pod | |||
@@ -46,6 +46,10 @@ compilation flags. | |||
46 | 46 | ||
47 | platform setting. | 47 | platform setting. |
48 | 48 | ||
49 | =item B<-d> | ||
50 | |||
51 | OPENSSLDIR setting. | ||
52 | |||
49 | =back | 53 | =back |
50 | 54 | ||
51 | =head1 NOTES | 55 | =head1 NOTES |
@@ -53,4 +57,8 @@ platform setting. | |||
53 | The output of B<openssl version -a> would typically be used when sending | 57 | The output of B<openssl version -a> would typically be used when sending |
54 | in a bug report. | 58 | in a bug report. |
55 | 59 | ||
60 | =head1 HISTORY | ||
61 | |||
62 | The B<-d> option was added in OpenSSL 0.9.7. | ||
63 | |||
56 | =cut | 64 | =cut |
diff --git a/src/lib/libssl/src/doc/apps/x509.pod b/src/lib/libssl/src/doc/apps/x509.pod index 84f76cb421..23367b7659 100644 --- a/src/lib/libssl/src/doc/apps/x509.pod +++ b/src/lib/libssl/src/doc/apps/x509.pod | |||
@@ -36,6 +36,7 @@ B<openssl> B<x509> | |||
36 | [B<-addreject arg>] | 36 | [B<-addreject arg>] |
37 | [B<-setalias arg>] | 37 | [B<-setalias arg>] |
38 | [B<-days arg>] | 38 | [B<-days arg>] |
39 | [B<-set_serial n>] | ||
39 | [B<-signkey filename>] | 40 | [B<-signkey filename>] |
40 | [B<-x509toreq>] | 41 | [B<-x509toreq>] |
41 | [B<-req>] | 42 | [B<-req>] |
@@ -112,6 +113,13 @@ prints out the certificate in text form. Full details are output including the | |||
112 | public key, signature algorithms, issuer and subject names, serial number | 113 | public key, signature algorithms, issuer and subject names, serial number |
113 | any extensions present and any trust settings. | 114 | any extensions present and any trust settings. |
114 | 115 | ||
116 | =item B<-certopt option> | ||
117 | |||
118 | customise the output format used with B<-text>. The B<option> argument can be | ||
119 | a single option or multiple options separated by commas. The B<-certopt> switch | ||
120 | may be also be used more than once to set multiple options. See the B<TEXT OPTIONS> | ||
121 | section for more information. | ||
122 | |||
115 | =item B<-noout> | 123 | =item B<-noout> |
116 | 124 | ||
117 | this option prevents output of the encoded version of the request. | 125 | this option prevents output of the encoded version of the request. |
@@ -141,9 +149,10 @@ outputs the issuer name. | |||
141 | 149 | ||
142 | =item B<-nameopt option> | 150 | =item B<-nameopt option> |
143 | 151 | ||
144 | option which determine how the subject or issuer names are displayed. This | 152 | option which determines how the subject or issuer names are displayed. The |
145 | option may be used more than once to set multiple options. See the B<NAME | 153 | B<option> argument can be a single option or multiple options separated by |
146 | OPTIONS> section for more information. | 154 | commas. Alternatively the B<-nameopt> switch may be used more than once to |
155 | set multiple options. See the B<NAME OPTIONS> section for more information. | ||
147 | 156 | ||
148 | =item B<-email> | 157 | =item B<-email> |
149 | 158 | ||
@@ -163,7 +172,8 @@ prints out the start and expiry dates of a certificate. | |||
163 | 172 | ||
164 | =item B<-fingerprint> | 173 | =item B<-fingerprint> |
165 | 174 | ||
166 | prints out the digest of the DER encoded version of the whole certificate. | 175 | prints out the digest of the DER encoded version of the whole certificate |
176 | (see digest options). | ||
167 | 177 | ||
168 | =item B<-C> | 178 | =item B<-C> |
169 | 179 | ||
@@ -292,6 +302,16 @@ is used to pass the required private key. | |||
292 | by default a certificate is expected on input. With this option a | 302 | by default a certificate is expected on input. With this option a |
293 | certificate request is expected instead. | 303 | certificate request is expected instead. |
294 | 304 | ||
305 | =item B<-set_serial n> | ||
306 | |||
307 | specifies the serial number to use. This option can be used with either | ||
308 | the B<-signkey> or B<-CA> options. If used in conjunction with the B<-CA> | ||
309 | option the serial number file (as specified by the B<-CAserial> or | ||
310 | B<-CAcreateserial> options) is not used. | ||
311 | |||
312 | The serial number can be decimal or hex (if preceded by B<0x>). Negative | ||
313 | serial numbers can also be specified but their use is not recommended. | ||
314 | |||
295 | =item B<-CA filename> | 315 | =item B<-CA filename> |
296 | 316 | ||
297 | specifies the CA certificate to be used for signing. When this option is | 317 | specifies the CA certificate to be used for signing. When this option is |
@@ -372,12 +392,12 @@ options. | |||
372 | =item B<multiline> | 392 | =item B<multiline> |
373 | 393 | ||
374 | a multiline format. It is equivalent B<esc_ctrl>, B<esc_msb>, B<sep_multiline>, | 394 | a multiline format. It is equivalent B<esc_ctrl>, B<esc_msb>, B<sep_multiline>, |
375 | B<spc_eq> and B<lname>. | 395 | B<spc_eq>, B<lname> and B<align>. |
376 | 396 | ||
377 | =item B<esc_2253> | 397 | =item B<esc_2253> |
378 | 398 | ||
379 | escape the "special" characters required by RFC2253 in a field That is | 399 | escape the "special" characters required by RFC2253 in a field That is |
380 | B<,+"E<lt>E<gt>;>. Additionally B<#> is escaped at the beginnging of a string | 400 | B<,+"E<lt>E<gt>;>. Additionally B<#> is escaped at the beginning of a string |
381 | and a space character at the beginning or end of a string. | 401 | and a space character at the beginning or end of a string. |
382 | 402 | ||
383 | =item B<esc_ctrl> | 403 | =item B<esc_ctrl> |
@@ -431,7 +451,7 @@ B<#XXXX...> format. | |||
431 | 451 | ||
432 | dump non character string types (for example OCTET STRING) if this | 452 | dump non character string types (for example OCTET STRING) if this |
433 | option is not set then non character string types will be displayed | 453 | option is not set then non character string types will be displayed |
434 | as though each content octet repesents a single character. | 454 | as though each content octet represents a single character. |
435 | 455 | ||
436 | =item B<dump_all> | 456 | =item B<dump_all> |
437 | 457 | ||
@@ -467,6 +487,11 @@ not display the field at all. B<sname> uses the "short name" form | |||
467 | B<oid> represents the OID in numerical form and is useful for | 487 | B<oid> represents the OID in numerical form and is useful for |
468 | diagnostic purpose. | 488 | diagnostic purpose. |
469 | 489 | ||
490 | =item B<align> | ||
491 | |||
492 | align field values for a more readable output. Only usable with | ||
493 | B<sep_multiline>. | ||
494 | |||
470 | =item B<spc_eq> | 495 | =item B<spc_eq> |
471 | 496 | ||
472 | places spaces round the B<=> character which follows the field | 497 | places spaces round the B<=> character which follows the field |
@@ -474,6 +499,87 @@ name. | |||
474 | 499 | ||
475 | =back | 500 | =back |
476 | 501 | ||
502 | =head1 TEXT OPTIONS | ||
503 | |||
504 | As well as customising the name output format, it is also possible to | ||
505 | customise the actual fields printed using the B<certopt> options when | ||
506 | the B<text> option is present. The default behaviour is to print all fields. | ||
507 | |||
508 | =item B<compatible> | ||
509 | |||
510 | use the old format. This is equivalent to specifying no output options at all. | ||
511 | |||
512 | =item B<no_header> | ||
513 | |||
514 | don't print header information: that is the lines saying "Certificate" and "Data". | ||
515 | |||
516 | =item B<no_version> | ||
517 | |||
518 | don't print out the version number. | ||
519 | |||
520 | =item B<no_serial> | ||
521 | |||
522 | don't print out the serial number. | ||
523 | |||
524 | =item B<no_signame> | ||
525 | |||
526 | don't print out the signature algorithm used. | ||
527 | |||
528 | =item B<no_validity> | ||
529 | |||
530 | don't print the validity, that is the B<notBefore> and B<notAfter> fields. | ||
531 | |||
532 | =item B<no_subject> | ||
533 | |||
534 | don't print out the subject name. | ||
535 | |||
536 | =item B<no_issuer> | ||
537 | |||
538 | don't print out the issuer name. | ||
539 | |||
540 | =item B<no_pubkey> | ||
541 | |||
542 | don't print out the public key. | ||
543 | |||
544 | =item B<no_sigdump> | ||
545 | |||
546 | don't give a hexadecimal dump of the certificate signature. | ||
547 | |||
548 | =item B<no_aux> | ||
549 | |||
550 | don't print out certificate trust information. | ||
551 | |||
552 | =item B<no_extensions> | ||
553 | |||
554 | don't print out any X509V3 extensions. | ||
555 | |||
556 | =item B<ext_default> | ||
557 | |||
558 | retain default extension behaviour: attempt to print out unsupported certificate extensions. | ||
559 | |||
560 | =item B<ext_error> | ||
561 | |||
562 | print an error message for unsupported certificate extensions. | ||
563 | |||
564 | =item B<ext_parse> | ||
565 | |||
566 | ASN1 parse unsupported extensions. | ||
567 | |||
568 | =item B<ext_dump> | ||
569 | |||
570 | hex dump unsupported extensions. | ||
571 | |||
572 | =item B<ca_default> | ||
573 | |||
574 | the value used by the B<ca> utility, equivalent to B<no_issuer>, B<no_pubkey>, B<no_header>, | ||
575 | B<no_version>, B<no_sigdump> and B<no_signame>. | ||
576 | |||
577 | |||
578 | |||
579 | =over 4 | ||
580 | |||
581 | =back | ||
582 | |||
477 | =head1 EXAMPLES | 583 | =head1 EXAMPLES |
478 | 584 | ||
479 | Note: in these examples the '\' means the example should be all on one | 585 | Note: in these examples the '\' means the example should be all on one |
@@ -498,7 +604,7 @@ Display the certificate subject name in RFC2253 form: | |||
498 | Display the certificate subject name in oneline form on a terminal | 604 | Display the certificate subject name in oneline form on a terminal |
499 | supporting UTF8: | 605 | supporting UTF8: |
500 | 606 | ||
501 | openssl x509 -in cert.pem -noout -subject -nameopt oneline -nameopt -escmsb | 607 | openssl x509 -in cert.pem -noout -subject -nameopt oneline,-escmsb |
502 | 608 | ||
503 | Display the certificate MD5 fingerprint: | 609 | Display the certificate MD5 fingerprint: |
504 | 610 | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_f_md.pod b/src/lib/libssl/src/doc/crypto/BIO_f_md.pod index c32504dfb1..0d24083e6d 100644 --- a/src/lib/libssl/src/doc/crypto/BIO_f_md.pod +++ b/src/lib/libssl/src/doc/crypto/BIO_f_md.pod | |||
@@ -28,7 +28,7 @@ BIO_gets(), if its B<size> parameter is large enough finishes the | |||
28 | digest calculation and returns the digest value. BIO_puts() is | 28 | digest calculation and returns the digest value. BIO_puts() is |
29 | not supported. | 29 | not supported. |
30 | 30 | ||
31 | BIO_reset() reinitializes a digest BIO. | 31 | BIO_reset() reinitialises a digest BIO. |
32 | 32 | ||
33 | BIO_set_md() sets the message digest of BIO B<b> to B<md>: this | 33 | BIO_set_md() sets the message digest of BIO B<b> to B<md>: this |
34 | must be called to initialize a digest BIO before any data is | 34 | must be called to initialize a digest BIO before any data is |
diff --git a/src/lib/libssl/src/doc/crypto/BIO_new_bio_pair.pod b/src/lib/libssl/src/doc/crypto/BIO_new_bio_pair.pod index 2256ba9d34..1a8dbc577b 100644 --- a/src/lib/libssl/src/doc/crypto/BIO_new_bio_pair.pod +++ b/src/lib/libssl/src/doc/crypto/BIO_new_bio_pair.pod | |||
@@ -12,7 +12,8 @@ BIO_new_bio_pair - create a new BIO pair | |||
12 | 12 | ||
13 | =head1 DESCRIPTION | 13 | =head1 DESCRIPTION |
14 | 14 | ||
15 | BIO_new_bio_pair() creates a buffering BIO pair. It has two endpoints between | 15 | BIO_new_bio_pair() creates a buffering BIO pair based on the |
16 | L<SSL_set_bio(3)|SSL_set_bio(3)> method. The BIO pair has two endpoints between which | ||
16 | data can be buffered. Its typical use is to connect one endpoint as underlying | 17 | data can be buffered. Its typical use is to connect one endpoint as underlying |
17 | input/output BIO to an SSL and access the other one controlled by the program | 18 | input/output BIO to an SSL and access the other one controlled by the program |
18 | instead of accessing the network connection directly. | 19 | instead of accessing the network connection directly. |
@@ -38,7 +39,7 @@ without having to go through the SSL-interface. | |||
38 | BIO *internal_bio, *network_bio; | 39 | BIO *internal_bio, *network_bio; |
39 | ... | 40 | ... |
40 | BIO_new_bio_pair(internal_bio, 0, network_bio, 0); | 41 | BIO_new_bio_pair(internal_bio, 0, network_bio, 0); |
41 | SSL_set_bio(ssl, internal_bio); | 42 | SSL_set_bio(ssl, internal_bio, internal_bio); |
42 | SSL_operations(); | 43 | SSL_operations(); |
43 | ... | 44 | ... |
44 | 45 | ||
@@ -67,7 +68,7 @@ and must be transfered to the network. Use BIO_ctrl_get_read_request() to | |||
67 | find out, how many bytes must be written into the buffer before the | 68 | find out, how many bytes must be written into the buffer before the |
68 | SSL_operation() can successfully be continued. | 69 | SSL_operation() can successfully be continued. |
69 | 70 | ||
70 | =head1 IMPORTANT | 71 | =head1 WARNING |
71 | 72 | ||
72 | As the data is buffered, SSL_operation() may return with a ERROR_SSL_WANT_READ | 73 | As the data is buffered, SSL_operation() may return with a ERROR_SSL_WANT_READ |
73 | condition, but there is still data in the write buffer. An application must | 74 | condition, but there is still data in the write buffer. An application must |
diff --git a/src/lib/libssl/src/doc/crypto/BIO_s_accept.pod b/src/lib/libssl/src/doc/crypto/BIO_s_accept.pod index c49da7fb02..55e4b730b9 100644 --- a/src/lib/libssl/src/doc/crypto/BIO_s_accept.pod +++ b/src/lib/libssl/src/doc/crypto/BIO_s_accept.pod | |||
@@ -10,31 +10,31 @@ BIO_get_bind_mode, BIO_do_accept - accept BIO | |||
10 | 10 | ||
11 | #include <openssl/bio.h> | 11 | #include <openssl/bio.h> |
12 | 12 | ||
13 | BIO_METHOD * BIO_s_accept(void); | 13 | BIO_METHOD *BIO_s_accept(void); |
14 | 14 | ||
15 | #define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name) | 15 | long BIO_set_accept_port(BIO *b, char *name); |
16 | #define BIO_get_accept_port(b) BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0) | 16 | char *BIO_get_accept_port(BIO *b); |
17 | 17 | ||
18 | BIO *BIO_new_accept(char *host_port); | 18 | BIO *BIO_new_accept(char *host_port); |
19 | 19 | ||
20 | #define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,1,(n)?"a":NULL) | 20 | long BIO_set_nbio_accept(BIO *b, int n); |
21 | #define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(char *)bio) | 21 | long BIO_set_accept_bios(BIO *b, char *bio); |
22 | 22 | ||
23 | #define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL) | 23 | long BIO_set_bind_mode(BIO *b, long mode); |
24 | #define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL) | 24 | long BIO_get_bind_mode(BIO *b, long dummy); |
25 | 25 | ||
26 | #define BIO_BIND_NORMAL 0 | 26 | #define BIO_BIND_NORMAL 0 |
27 | #define BIO_BIND_REUSEADDR_IF_UNUSED 1 | 27 | #define BIO_BIND_REUSEADDR_IF_UNUSED 1 |
28 | #define BIO_BIND_REUSEADDR 2 | 28 | #define BIO_BIND_REUSEADDR 2 |
29 | 29 | ||
30 | #define BIO_do_accept(b) BIO_do_handshake(b) | 30 | int BIO_do_accept(BIO *b); |
31 | 31 | ||
32 | =head1 DESCRIPTION | 32 | =head1 DESCRIPTION |
33 | 33 | ||
34 | BIO_s_accept() returns the accept BIO method. This is a wrapper | 34 | BIO_s_accept() returns the accept BIO method. This is a wrapper |
35 | round the platform's TCP/IP socket accept routines. | 35 | round the platform's TCP/IP socket accept routines. |
36 | 36 | ||
37 | Using accept BIOs TCP/IP connections can be accepted and data | 37 | Using accept BIOs, TCP/IP connections can be accepted and data |
38 | transferred using only BIO routines. In this way any platform | 38 | transferred using only BIO routines. In this way any platform |
39 | specific operations are hidden by the BIO abstraction. | 39 | specific operations are hidden by the BIO abstraction. |
40 | 40 | ||
@@ -92,7 +92,7 @@ BIO_do_accept() serves two functions. When it is first | |||
92 | called, after the accept BIO has been setup, it will attempt | 92 | called, after the accept BIO has been setup, it will attempt |
93 | to create the accept socket and bind an address to it. Second | 93 | to create the accept socket and bind an address to it. Second |
94 | and subsequent calls to BIO_do_accept() will await an incoming | 94 | and subsequent calls to BIO_do_accept() will await an incoming |
95 | connection. | 95 | connection, or request a retry in non blocking mode. |
96 | 96 | ||
97 | =head1 NOTES | 97 | =head1 NOTES |
98 | 98 | ||
@@ -130,6 +130,17 @@ however because the accept BIO will still accept additional incoming | |||
130 | connections. This can be resolved by using BIO_pop() (see above) | 130 | connections. This can be resolved by using BIO_pop() (see above) |
131 | and freeing up the accept BIO after the initial connection. | 131 | and freeing up the accept BIO after the initial connection. |
132 | 132 | ||
133 | If the underlying accept socket is non-blocking and BIO_do_accept() is | ||
134 | called to await an incoming connection it is possible for | ||
135 | BIO_should_io_special() with the reason BIO_RR_ACCEPT. If this happens | ||
136 | then it is an indication that an accept attempt would block: the application | ||
137 | should take appropriate action to wait until the underlying socket has | ||
138 | accepted a connection and retry the call. | ||
139 | |||
140 | BIO_set_accept_port(), BIO_get_accept_port(), BIO_set_nbio_accept(), | ||
141 | BIO_set_accept_bios(), BIO_set_bind_mode(), BIO_get_bind_mode() and | ||
142 | BIO_do_accept() are macros. | ||
143 | |||
133 | =head1 RETURN VALUES | 144 | =head1 RETURN VALUES |
134 | 145 | ||
135 | TBA | 146 | TBA |
diff --git a/src/lib/libssl/src/doc/crypto/BIO_s_connect.pod b/src/lib/libssl/src/doc/crypto/BIO_s_connect.pod index fe1aa679d4..bcf7d8dcac 100644 --- a/src/lib/libssl/src/doc/crypto/BIO_s_connect.pod +++ b/src/lib/libssl/src/doc/crypto/BIO_s_connect.pod | |||
@@ -13,25 +13,27 @@ BIO_set_nbio, BIO_do_connect - connect BIO | |||
13 | 13 | ||
14 | BIO_METHOD * BIO_s_connect(void); | 14 | BIO_METHOD * BIO_s_connect(void); |
15 | 15 | ||
16 | #define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0,(char *)name) | 16 | BIO *BIO_new_connect(char *name); |
17 | #define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1,(char *)port) | ||
18 | #define BIO_set_conn_ip(b,ip) BIO_ctrl(b,BIO_C_SET_CONNECT,2,(char *)ip) | ||
19 | #define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)port) | ||
20 | #define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0) | ||
21 | #define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1) | ||
22 | #define BIO_get_conn_ip(b,ip) BIO_ptr_ctrl(b,BIO_C_SET_CONNECT,2) | ||
23 | #define BIO_get_conn_int_port(b,port) BIO_int_ctrl(b,BIO_C_SET_CONNECT,3,port) | ||
24 | 17 | ||
25 | #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) | 18 | long BIO_set_conn_hostname(BIO *b, char *name); |
19 | long BIO_set_conn_port(BIO *b, char *port); | ||
20 | long BIO_set_conn_ip(BIO *b, char *ip); | ||
21 | long BIO_set_conn_int_port(BIO *b, char *port); | ||
22 | char *BIO_get_conn_hostname(BIO *b); | ||
23 | char *BIO_get_conn_port(BIO *b); | ||
24 | char *BIO_get_conn_ip(BIO *b, dummy); | ||
25 | long BIO_get_conn_int_port(BIO *b, int port); | ||
26 | 26 | ||
27 | #define BIO_do_connect(b) BIO_do_handshake(b) | 27 | long BIO_set_nbio(BIO *b, long n); |
28 | |||
29 | int BIO_do_connect(BIO *b); | ||
28 | 30 | ||
29 | =head1 DESCRIPTION | 31 | =head1 DESCRIPTION |
30 | 32 | ||
31 | BIO_s_connect() returns the connect BIO method. This is a wrapper | 33 | BIO_s_connect() returns the connect BIO method. This is a wrapper |
32 | round the platform's TCP/IP socket connection routines. | 34 | round the platform's TCP/IP socket connection routines. |
33 | 35 | ||
34 | Using connect BIOs TCP/IP connections can be made and data | 36 | Using connect BIOs, TCP/IP connections can be made and data |
35 | transferred using only BIO routines. In this way any platform | 37 | transferred using only BIO routines. In this way any platform |
36 | specific operations are hidden by the BIO abstraction. | 38 | specific operations are hidden by the BIO abstraction. |
37 | 39 | ||
@@ -54,7 +56,7 @@ BIO_get_fd() places the underlying socket in B<c> if it is not NULL, | |||
54 | it also returns the socket . If B<c> is not NULL it should be of | 56 | it also returns the socket . If B<c> is not NULL it should be of |
55 | type (int *). | 57 | type (int *). |
56 | 58 | ||
57 | BIO_set_conn_hostname() uses the string B<name> to set the hostname | 59 | BIO_set_conn_hostname() uses the string B<name> to set the hostname. |
58 | The hostname can be an IP address. The hostname can also include the | 60 | The hostname can be an IP address. The hostname can also include the |
59 | port in the form hostname:port . It is also acceptable to use the | 61 | port in the form hostname:port . It is also acceptable to use the |
60 | form "hostname/any/other/path" or "hostname:port/any/other/path". | 62 | form "hostname/any/other/path" or "hostname:port/any/other/path". |
@@ -87,6 +89,9 @@ is set. Blocking I/O is the default. The call to BIO_set_nbio() | |||
87 | should be made before the connection is established because | 89 | should be made before the connection is established because |
88 | non blocking I/O is set during the connect process. | 90 | non blocking I/O is set during the connect process. |
89 | 91 | ||
92 | BIO_new_connect() combines BIO_new() and BIO_set_conn_hostname() into | ||
93 | a single call: that is it creates a new connect BIO with B<name>. | ||
94 | |||
90 | BIO_do_connect() attempts to connect the supplied BIO. It returns 1 | 95 | BIO_do_connect() attempts to connect the supplied BIO. It returns 1 |
91 | if the connection was established successfully. A zero or negative | 96 | if the connection was established successfully. A zero or negative |
92 | value is returned if the connection could not be established, the | 97 | value is returned if the connection could not be established, the |
@@ -123,6 +128,11 @@ then this is an indication that a connection attempt would block, | |||
123 | the application should then take appropriate action to wait until | 128 | the application should then take appropriate action to wait until |
124 | the underlying socket has connected and retry the call. | 129 | the underlying socket has connected and retry the call. |
125 | 130 | ||
131 | BIO_set_conn_hostname(), BIO_set_conn_port(), BIO_set_conn_ip(), | ||
132 | BIO_set_conn_int_port(), BIO_get_conn_hostname(), BIO_get_conn_port(), | ||
133 | BIO_get_conn_ip(), BIO_get_conn_int_port(), BIO_set_nbio() and | ||
134 | BIO_do_connect() are macros. | ||
135 | |||
126 | =head1 RETURN VALUES | 136 | =head1 RETURN VALUES |
127 | 137 | ||
128 | BIO_s_connect() returns the connect BIO method. | 138 | BIO_s_connect() returns the connect BIO method. |
diff --git a/src/lib/libssl/src/doc/crypto/BIO_s_socket.pod b/src/lib/libssl/src/doc/crypto/BIO_s_socket.pod index 253185185c..1c8d3a9110 100644 --- a/src/lib/libssl/src/doc/crypto/BIO_s_socket.pod +++ b/src/lib/libssl/src/doc/crypto/BIO_s_socket.pod | |||
@@ -8,10 +8,10 @@ BIO_s_socket, BIO_new_socket - socket BIO | |||
8 | 8 | ||
9 | #include <openssl/bio.h> | 9 | #include <openssl/bio.h> |
10 | 10 | ||
11 | BIO_METHOD * BIO_s_socket(void); | 11 | BIO_METHOD *BIO_s_socket(void); |
12 | 12 | ||
13 | #define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) | 13 | long BIO_set_fd(BIO *b, int fd, long close_flag); |
14 | #define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c) | 14 | long BIO_get_fd(BIO *b, int *c); |
15 | 15 | ||
16 | BIO *BIO_new_socket(int sock, int close_flag); | 16 | BIO *BIO_new_socket(int sock, int close_flag); |
17 | 17 | ||
@@ -27,10 +27,10 @@ If the close flag is set then the socket is shut down and closed | |||
27 | when the BIO is freed. | 27 | when the BIO is freed. |
28 | 28 | ||
29 | BIO_set_fd() sets the socket of BIO B<b> to B<fd> and the close | 29 | BIO_set_fd() sets the socket of BIO B<b> to B<fd> and the close |
30 | flag to B<c>. | 30 | flag to B<close_flag>. |
31 | 31 | ||
32 | BIO_get_fd() places the socket in B<c> if it is not NULL, it also | 32 | BIO_get_fd() places the socket in B<c> if it is not NULL, it also |
33 | returns the socket . If B<c> is not NULL it should be of type (int *). | 33 | returns the socket. If B<c> is not NULL it should be of type (int *). |
34 | 34 | ||
35 | BIO_new_socket() returns a socket BIO using B<sock> and B<close_flag>. | 35 | BIO_new_socket() returns a socket BIO using B<sock> and B<close_flag>. |
36 | 36 | ||
@@ -44,6 +44,8 @@ platforms sockets are not file descriptors and use distinct I/O routines, | |||
44 | Windows is one such platform. Any code mixing the two will not work on | 44 | Windows is one such platform. Any code mixing the two will not work on |
45 | all platforms. | 45 | all platforms. |
46 | 46 | ||
47 | BIO_set_fd() and BIO_get_fd() are macros. | ||
48 | |||
47 | =head1 RETURN VALUES | 49 | =head1 RETURN VALUES |
48 | 50 | ||
49 | BIO_s_socket() returns the socket BIO method. | 51 | BIO_s_socket() returns the socket BIO method. |
diff --git a/src/lib/libssl/src/doc/crypto/BN_add.pod b/src/lib/libssl/src/doc/crypto/BN_add.pod index 7baed2d492..88c7a799ee 100644 --- a/src/lib/libssl/src/doc/crypto/BN_add.pod +++ b/src/lib/libssl/src/doc/crypto/BN_add.pod | |||
@@ -2,8 +2,9 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | BN_add, BN_sub, BN_mul, BN_div, BN_sqr, BN_mod, BN_mod_mul, BN_exp, | 5 | BN_add, BN_sub, BN_mul, BN_sqr, BN_div, BN_mod, BN_nnmod, BN_mod_add, |
6 | BN_mod_exp, BN_gcd - arithmetic operations on BIGNUMs | 6 | BN_mod_sub, BN_mod_mul, BN_mod_sqr, BN_exp, BN_mod_exp, BN_gcd - |
7 | arithmetic operations on BIGNUMs | ||
7 | 8 | ||
8 | =head1 SYNOPSIS | 9 | =head1 SYNOPSIS |
9 | 10 | ||
@@ -15,16 +16,26 @@ BN_mod_exp, BN_gcd - arithmetic operations on BIGNUMs | |||
15 | 16 | ||
16 | int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); | 17 | int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); |
17 | 18 | ||
19 | int BN_sqr(BIGNUM *r, BIGNUM *a, BN_CTX *ctx); | ||
20 | |||
18 | int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *a, const BIGNUM *d, | 21 | int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *a, const BIGNUM *d, |
19 | BN_CTX *ctx); | 22 | BN_CTX *ctx); |
20 | 23 | ||
21 | int BN_sqr(BIGNUM *r, BIGNUM *a, BN_CTX *ctx); | ||
22 | |||
23 | int BN_mod(BIGNUM *rem, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); | 24 | int BN_mod(BIGNUM *rem, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); |
24 | 25 | ||
25 | int BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, | 26 | int BN_nnmod(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); |
27 | |||
28 | int BN_mod_add(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m, | ||
29 | BN_CTX *ctx); | ||
30 | |||
31 | int BN_mod_sub(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m, | ||
32 | BN_CTX *ctx); | ||
33 | |||
34 | int BN_mod_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m, | ||
26 | BN_CTX *ctx); | 35 | BN_CTX *ctx); |
27 | 36 | ||
37 | int BN_mod_sqr(BIGNUM *r, BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); | ||
38 | |||
28 | int BN_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BN_CTX *ctx); | 39 | int BN_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BN_CTX *ctx); |
29 | 40 | ||
30 | int BN_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p, | 41 | int BN_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p, |
@@ -34,45 +45,59 @@ BN_mod_exp, BN_gcd - arithmetic operations on BIGNUMs | |||
34 | 45 | ||
35 | =head1 DESCRIPTION | 46 | =head1 DESCRIPTION |
36 | 47 | ||
37 | BN_add() adds B<a> and B<b> and places the result in B<r> (C<r=a+b>). | 48 | BN_add() adds I<a> and I<b> and places the result in I<r> (C<r=a+b>). |
38 | B<r> may be the same B<BIGNUM> as B<a> or B<b>. | 49 | I<r> may be the same B<BIGNUM> as I<a> or I<b>. |
39 | 50 | ||
40 | BN_sub() subtracts B<b> from B<a> and places the result in B<r> (C<r=a-b>). | 51 | BN_sub() subtracts I<b> from I<a> and places the result in I<r> (C<r=a-b>). |
41 | 52 | ||
42 | BN_mul() multiplies B<a> and B<b> and places the result in B<r> (C<r=a*b>). | 53 | BN_mul() multiplies I<a> and I<b> and places the result in I<r> (C<r=a*b>). |
43 | B<r> may be the same B<BIGNUM> as B<a> or B<b>. | 54 | I<r> may be the same B<BIGNUM> as I<a> or I<b>. |
44 | For multiplication by powers of 2, use L<BN_lshift(3)|BN_lshift(3)>. | 55 | For multiplication by powers of 2, use L<BN_lshift(3)|BN_lshift(3)>. |
45 | 56 | ||
46 | BN_div() divides B<a> by B<d> and places the result in B<dv> and the | 57 | BN_sqr() takes the square of I<a> and places the result in I<r> |
47 | remainder in B<rem> (C<dv=a/d, rem=a%d>). Either of B<dv> and B<rem> may | 58 | (C<r=a^2>). I<r> and I<a> may be the same B<BIGNUM>. |
48 | be NULL, in which case the respective value is not returned. | 59 | This function is faster than BN_mul(r,a,a). |
60 | |||
61 | BN_div() divides I<a> by I<d> and places the result in I<dv> and the | ||
62 | remainder in I<rem> (C<dv=a/d, rem=a%d>). Either of I<dv> and I<rem> may | ||
63 | be B<NULL>, in which case the respective value is not returned. | ||
64 | The result is rounded towards zero; thus if I<a> is negative, the | ||
65 | remainder will be zero or negative. | ||
49 | For division by powers of 2, use BN_rshift(3). | 66 | For division by powers of 2, use BN_rshift(3). |
50 | 67 | ||
51 | BN_sqr() takes the square of B<a> and places the result in B<r> | 68 | BN_mod() corresponds to BN_div() with I<dv> set to B<NULL>. |
52 | (C<r=a^2>). B<r> and B<a> may be the same B<BIGNUM>. | 69 | |
53 | This function is faster than BN_mul(r,a,a). | 70 | BN_nnmod() reduces I<a> modulo I<m> and places the non-negative |
71 | remainder in I<r>. | ||
72 | |||
73 | BN_mod_add() adds I<a> to I<b> modulo I<m> and places the non-negative | ||
74 | result in I<r>. | ||
75 | |||
76 | BN_mod_sub() subtracts I<b> from I<a> modulo I<m> and places the | ||
77 | non-negative result in I<r>. | ||
54 | 78 | ||
55 | BN_mod() find the remainder of B<a> divided by B<m> and places it in | 79 | BN_mod_mul() multiplies I<a> by I<b> and finds the non-negative |
56 | B<rem> (C<rem=a%m>). | 80 | remainder respective to modulus I<m> (C<r=(a*b) mod m>). I<r> may be |
81 | the same B<BIGNUM> as I<a> or I<b>. For more efficient algorithms for | ||
82 | repeated computations using the same modulus, see | ||
83 | L<BN_mod_mul_montgomery(3)|BN_mod_mul_montgomery(3)> and | ||
84 | L<BN_mod_mul_reciprocal(3)|BN_mod_mul_reciprocal(3)>. | ||
57 | 85 | ||
58 | BN_mod_mul() multiplies B<a> by B<b> and finds the remainder when | 86 | BN_mod_sqr() takes the square of I<a> modulo B<m> and places the |
59 | divided by B<m> (C<r=(a*b)%m>). B<r> may be the same B<BIGNUM> as B<a> | 87 | result in I<r>. |
60 | or B<b>. For a more efficient algorithm, see | ||
61 | L<BN_mod_mul_montgomery(3)|BN_mod_mul_montgomery(3)>; for repeated | ||
62 | computations using the same modulus, see L<BN_mod_mul_reciprocal(3)|BN_mod_mul_reciprocal(3)>. | ||
63 | 88 | ||
64 | BN_exp() raises B<a> to the B<p>-th power and places the result in B<r> | 89 | BN_exp() raises I<a> to the I<p>-th power and places the result in I<r> |
65 | (C<r=a^p>). This function is faster than repeated applications of | 90 | (C<r=a^p>). This function is faster than repeated applications of |
66 | BN_mul(). | 91 | BN_mul(). |
67 | 92 | ||
68 | BN_mod_exp() computes B<a> to the B<p>-th power modulo B<m> (C<r=a^p % | 93 | BN_mod_exp() computes I<a> to the I<p>-th power modulo I<m> (C<r=a^p % |
69 | m>). This function uses less time and space than BN_exp(). | 94 | m>). This function uses less time and space than BN_exp(). |
70 | 95 | ||
71 | BN_gcd() computes the greatest common divisor of B<a> and B<b> and | 96 | BN_gcd() computes the greatest common divisor of I<a> and I<b> and |
72 | places the result in B<r>. B<r> may be the same B<BIGNUM> as B<a> or | 97 | places the result in I<r>. I<r> may be the same B<BIGNUM> as I<a> or |
73 | B<b>. | 98 | I<b>. |
74 | 99 | ||
75 | For all functions, B<ctx> is a previously allocated B<BN_CTX> used for | 100 | For all functions, I<ctx> is a previously allocated B<BN_CTX> used for |
76 | temporary variables; see L<BN_CTX_new(3)|BN_CTX_new(3)>. | 101 | temporary variables; see L<BN_CTX_new(3)|BN_CTX_new(3)>. |
77 | 102 | ||
78 | Unless noted otherwise, the result B<BIGNUM> must be different from | 103 | Unless noted otherwise, the result B<BIGNUM> must be different from |
@@ -91,9 +116,11 @@ L<BN_add_word(3)|BN_add_word(3)>, L<BN_set_bit(3)|BN_set_bit(3)> | |||
91 | 116 | ||
92 | =head1 HISTORY | 117 | =head1 HISTORY |
93 | 118 | ||
94 | BN_add(), BN_sub(), BN_div(), BN_sqr(), BN_mod(), BN_mod_mul(), | 119 | BN_add(), BN_sub(), BN_sqr(), BN_div(), BN_mod(), BN_mod_mul(), |
95 | BN_mod_exp() and BN_gcd() are available in all versions of SSLeay and | 120 | BN_mod_exp() and BN_gcd() are available in all versions of SSLeay and |
96 | OpenSSL. The B<ctx> argument to BN_mul() was added in SSLeay | 121 | OpenSSL. The I<ctx> argument to BN_mul() was added in SSLeay |
97 | 0.9.1b. BN_exp() appeared in SSLeay 0.9.0. | 122 | 0.9.1b. BN_exp() appeared in SSLeay 0.9.0. |
123 | BN_nnmod(), BN_mod_add(), BN_mod_sub(), and BN_mod_sqr() were added in | ||
124 | OpenSSL 0.9.7. | ||
98 | 125 | ||
99 | =cut | 126 | =cut |
diff --git a/src/lib/libssl/src/doc/crypto/BN_bn2bin.pod b/src/lib/libssl/src/doc/crypto/BN_bn2bin.pod index 4f78574ed0..a4b17ca60a 100644 --- a/src/lib/libssl/src/doc/crypto/BN_bn2bin.pod +++ b/src/lib/libssl/src/doc/crypto/BN_bn2bin.pod | |||
@@ -49,7 +49,7 @@ with a leading '-' for negative numbers, to the B<BIO> or B<FILE> | |||
49 | B<fp>. | 49 | B<fp>. |
50 | 50 | ||
51 | BN_bn2mpi() and BN_mpi2bn() convert B<BIGNUM>s from and to a format | 51 | BN_bn2mpi() and BN_mpi2bn() convert B<BIGNUM>s from and to a format |
52 | that consists of the number's length in bytes represented as a 3-byte | 52 | that consists of the number's length in bytes represented as a 4-byte |
53 | big-endian number, and the number itself in big-endian format, where | 53 | big-endian number, and the number itself in big-endian format, where |
54 | the most significant bit signals a negative number (the representation | 54 | the most significant bit signals a negative number (the representation |
55 | of numbers with the MSB set is prefixed with null byte). | 55 | of numbers with the MSB set is prefixed with null byte). |
diff --git a/src/lib/libssl/src/doc/crypto/BN_mod_mul_montgomery.pod b/src/lib/libssl/src/doc/crypto/BN_mod_mul_montgomery.pod index f3cee924b9..6b16351b92 100644 --- a/src/lib/libssl/src/doc/crypto/BN_mod_mul_montgomery.pod +++ b/src/lib/libssl/src/doc/crypto/BN_mod_mul_montgomery.pod | |||
@@ -36,22 +36,23 @@ using the same modulus. | |||
36 | BN_MONT_CTX_new() allocates and initializes a B<BN_MONT_CTX> structure. | 36 | BN_MONT_CTX_new() allocates and initializes a B<BN_MONT_CTX> structure. |
37 | BN_MONT_CTX_init() initializes an existing uninitialized B<BN_MONT_CTX>. | 37 | BN_MONT_CTX_init() initializes an existing uninitialized B<BN_MONT_CTX>. |
38 | 38 | ||
39 | BN_MONT_CTX_set() sets up the B<mont> structure from the modulus B<m> | 39 | BN_MONT_CTX_set() sets up the I<mont> structure from the modulus I<m> |
40 | by precomputing its inverse and a value R. | 40 | by precomputing its inverse and a value R. |
41 | 41 | ||
42 | BN_MONT_CTX_copy() copies the B<BN_MONT_CTX> B<from> to B<to>. | 42 | BN_MONT_CTX_copy() copies the B<BN_MONT_CTX> I<from> to I<to>. |
43 | 43 | ||
44 | BN_MONT_CTX_free() frees the components of the B<BN_MONT_CTX>, and, if | 44 | BN_MONT_CTX_free() frees the components of the B<BN_MONT_CTX>, and, if |
45 | it was created by BN_MONT_CTX_new(), also the structure itself. | 45 | it was created by BN_MONT_CTX_new(), also the structure itself. |
46 | 46 | ||
47 | BN_mod_mul_montgomery() computes Mont(B<a>,B<b>):=B<a>*B<b>*R^-1 and places | 47 | BN_mod_mul_montgomery() computes Mont(I<a>,I<b>):=I<a>*I<b>*R^-1 and places |
48 | the result in B<r>. | 48 | the result in I<r>. |
49 | 49 | ||
50 | BN_from_montgomery() performs the Montgomery reduction B<r> = B<a>*R^-1. | 50 | BN_from_montgomery() performs the Montgomery reduction I<r> = I<a>*R^-1. |
51 | 51 | ||
52 | BN_to_montgomery() computes Mont(B<a>,R^2), i.e. B<a>*R. | 52 | BN_to_montgomery() computes Mont(I<a>,R^2), i.e. I<a>*R. |
53 | Note that I<a> must be non-negative and smaller than the modulus. | ||
53 | 54 | ||
54 | For all functions, B<ctx> is a previously allocated B<BN_CTX> used for | 55 | For all functions, I<ctx> is a previously allocated B<BN_CTX> used for |
55 | temporary variables. | 56 | temporary variables. |
56 | 57 | ||
57 | The B<BN_MONT_CTX> structure is defined as follows: | 58 | The B<BN_MONT_CTX> structure is defined as follows: |
@@ -79,6 +80,11 @@ BN_MONT_CTX_init() and BN_MONT_CTX_free() have no return values. | |||
79 | For the other functions, 1 is returned for success, 0 on error. | 80 | For the other functions, 1 is returned for success, 0 on error. |
80 | The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | 81 | The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. |
81 | 82 | ||
83 | =head1 WARNING | ||
84 | |||
85 | The inputs must be reduced modulo B<m>, otherwise the result will be | ||
86 | outside the expected range. | ||
87 | |||
82 | =head1 SEE ALSO | 88 | =head1 SEE ALSO |
83 | 89 | ||
84 | L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<BN_add(3)|BN_add(3)>, | 90 | L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<BN_add(3)|BN_add(3)>, |
diff --git a/src/lib/libssl/src/doc/crypto/BN_rand.pod b/src/lib/libssl/src/doc/crypto/BN_rand.pod index 5406552ba4..18301a396a 100644 --- a/src/lib/libssl/src/doc/crypto/BN_rand.pod +++ b/src/lib/libssl/src/doc/crypto/BN_rand.pod | |||
@@ -14,6 +14,8 @@ BN_rand, BN_pseudo_rand - generate pseudo-random number | |||
14 | 14 | ||
15 | int BN_rand_range(BIGNUM *rnd, BIGNUM *range); | 15 | int BN_rand_range(BIGNUM *rnd, BIGNUM *range); |
16 | 16 | ||
17 | int BN_pseudo_rand_range(BIGNUM *rnd, int bits, int top, int bottom); | ||
18 | |||
17 | =head1 DESCRIPTION | 19 | =head1 DESCRIPTION |
18 | 20 | ||
19 | BN_rand() generates a cryptographically strong pseudo-random number of | 21 | BN_rand() generates a cryptographically strong pseudo-random number of |
@@ -31,6 +33,8 @@ protocols, but usually not for key generation etc. | |||
31 | 33 | ||
32 | BN_rand_range() generates a cryptographically strong pseudo-random | 34 | BN_rand_range() generates a cryptographically strong pseudo-random |
33 | number B<rnd> in the range 0 <lt>= B<rnd> E<lt> B<range>. | 35 | number B<rnd> in the range 0 <lt>= B<rnd> E<lt> B<range>. |
36 | BN_pseudo_rand_range() does the same, but is based on BN_pseudo_rand(), | ||
37 | and hence numbers generated by it are not necessarily unpredictable. | ||
34 | 38 | ||
35 | The PRNG must be seeded prior to calling BN_rand() or BN_rand_range(). | 39 | The PRNG must be seeded prior to calling BN_rand() or BN_rand_range(). |
36 | 40 | ||
@@ -49,5 +53,6 @@ L<RAND_add(3)|RAND_add(3)>, L<RAND_bytes(3)|RAND_bytes(3)> | |||
49 | BN_rand() is available in all versions of SSLeay and OpenSSL. | 53 | BN_rand() is available in all versions of SSLeay and OpenSSL. |
50 | BN_pseudo_rand() was added in OpenSSL 0.9.5. The B<top> == -1 case | 54 | BN_pseudo_rand() was added in OpenSSL 0.9.5. The B<top> == -1 case |
51 | and the function BN_rand_range() were added in OpenSSL 0.9.6a. | 55 | and the function BN_rand_range() were added in OpenSSL 0.9.6a. |
56 | BN_pseudo_rand_range() was added in OpenSSL 0.9.6c. | ||
52 | 57 | ||
53 | =cut | 58 | =cut |
diff --git a/src/lib/libssl/src/doc/crypto/BN_swap.pod b/src/lib/libssl/src/doc/crypto/BN_swap.pod new file mode 100644 index 0000000000..79efaa1446 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BN_swap.pod | |||
@@ -0,0 +1,23 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_swap - exchange BIGNUMs | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bn.h> | ||
10 | |||
11 | void BN_swap(BIGNUM *a, BIGNUM *b); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | BN_swap() exchanges the values of I<a> and I<b>. | ||
16 | |||
17 | L<bn(3)|bn(3)> | ||
18 | |||
19 | =head1 HISTORY | ||
20 | |||
21 | BN_swap was added in OpenSSL 0.9.7. | ||
22 | |||
23 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_zero.pod b/src/lib/libssl/src/doc/crypto/BN_zero.pod index 2f33876498..3c64a65697 100644 --- a/src/lib/libssl/src/doc/crypto/BN_zero.pod +++ b/src/lib/libssl/src/doc/crypto/BN_zero.pod | |||
@@ -12,7 +12,7 @@ operations | |||
12 | int BN_zero(BIGNUM *a); | 12 | int BN_zero(BIGNUM *a); |
13 | int BN_one(BIGNUM *a); | 13 | int BN_one(BIGNUM *a); |
14 | 14 | ||
15 | BIGNUM *BN_value_one(void); | 15 | const BIGNUM *BN_value_one(void); |
16 | 16 | ||
17 | int BN_set_word(BIGNUM *a, unsigned long w); | 17 | int BN_set_word(BIGNUM *a, unsigned long w); |
18 | unsigned long BN_get_word(BIGNUM *a); | 18 | unsigned long BN_get_word(BIGNUM *a); |
diff --git a/src/lib/libssl/src/doc/crypto/DH_set_method.pod b/src/lib/libssl/src/doc/crypto/DH_set_method.pod index 62088eea1b..d990bf8786 100644 --- a/src/lib/libssl/src/doc/crypto/DH_set_method.pod +++ b/src/lib/libssl/src/doc/crypto/DH_set_method.pod | |||
@@ -82,8 +82,8 @@ the default engine for Diffie-Hellman opertaions is used. | |||
82 | 82 | ||
83 | =head1 RETURN VALUES | 83 | =head1 RETURN VALUES |
84 | 84 | ||
85 | DH_OpenSSL() and DH_get_default_method() return pointers to the respective | 85 | DH_OpenSSL() and DH_get_default_openssl_method() return pointers to the |
86 | DH_METHODs. | 86 | respective B<DH_METHOD>s. |
87 | 87 | ||
88 | DH_set_default_openssl_method() returns no value. | 88 | DH_set_default_openssl_method() returns no value. |
89 | 89 | ||
diff --git a/src/lib/libssl/src/doc/crypto/DSA_set_method.pod b/src/lib/libssl/src/doc/crypto/DSA_set_method.pod index c56dfd0f47..36a1052d27 100644 --- a/src/lib/libssl/src/doc/crypto/DSA_set_method.pod +++ b/src/lib/libssl/src/doc/crypto/DSA_set_method.pod | |||
@@ -90,7 +90,7 @@ struct | |||
90 | =head1 RETURN VALUES | 90 | =head1 RETURN VALUES |
91 | 91 | ||
92 | DSA_OpenSSL() and DSA_get_default_openssl_method() return pointers to the | 92 | DSA_OpenSSL() and DSA_get_default_openssl_method() return pointers to the |
93 | respective DSA_METHODs. | 93 | respective B<DSA_METHOD>s. |
94 | 94 | ||
95 | DSA_set_default_openssl_method() returns no value. | 95 | DSA_set_default_openssl_method() returns no value. |
96 | 96 | ||
diff --git a/src/lib/libssl/src/doc/crypto/ERR_get_error.pod b/src/lib/libssl/src/doc/crypto/ERR_get_error.pod index 3551bacb8d..9fdedbcb91 100644 --- a/src/lib/libssl/src/doc/crypto/ERR_get_error.pod +++ b/src/lib/libssl/src/doc/crypto/ERR_get_error.pod | |||
@@ -2,8 +2,10 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | ERR_get_error, ERR_peek_error, ERR_get_error_line, ERR_peek_error_line, | 5 | ERR_get_error, ERR_peek_error, ERR_peek_last_error, |
6 | ERR_get_error_line_data, ERR_peek_error_line_data - obtain error code and data | 6 | ERR_get_error_line, ERR_peek_error_line, ERR_peek_last_error_line, |
7 | ERR_get_error_line_data, ERR_peek_error_line_data, | ||
8 | ERR_peek_error_line_data - obtain error code and data | ||
7 | 9 | ||
8 | =head1 SYNOPSIS | 10 | =head1 SYNOPSIS |
9 | 11 | ||
@@ -11,22 +13,29 @@ ERR_get_error_line_data, ERR_peek_error_line_data - obtain error code and data | |||
11 | 13 | ||
12 | unsigned long ERR_get_error(void); | 14 | unsigned long ERR_get_error(void); |
13 | unsigned long ERR_peek_error(void); | 15 | unsigned long ERR_peek_error(void); |
16 | unsigned long ERR_peek_last_error(void); | ||
14 | 17 | ||
15 | unsigned long ERR_get_error_line(const char **file, int *line); | 18 | unsigned long ERR_get_error_line(const char **file, int *line); |
16 | unsigned long ERR_peek_error_line(const char **file, int *line); | 19 | unsigned long ERR_peek_error_line(const char **file, int *line); |
20 | unsigned long ERR_peek_last_error_line(const char **file, int *line); | ||
17 | 21 | ||
18 | unsigned long ERR_get_error_line_data(const char **file, int *line, | 22 | unsigned long ERR_get_error_line_data(const char **file, int *line, |
19 | const char **data, int *flags); | 23 | const char **data, int *flags); |
20 | unsigned long ERR_peek_error_line_data(const char **file, int *line, | 24 | unsigned long ERR_peek_error_line_data(const char **file, int *line, |
21 | const char **data, int *flags); | 25 | const char **data, int *flags); |
26 | unsigned long ERR_peek_last_error_line_data(const char **file, int *line, | ||
27 | const char **data, int *flags); | ||
22 | 28 | ||
23 | =head1 DESCRIPTION | 29 | =head1 DESCRIPTION |
24 | 30 | ||
25 | ERR_get_error() returns the last error code from the thread's error | 31 | ERR_get_error() returns the earliest error code from the thread's error |
26 | queue and removes the entry. This function can be called repeatedly | 32 | queue and removes the entry. This function can be called repeatedly |
27 | until there are no more error codes to return. | 33 | until there are no more error codes to return. |
28 | 34 | ||
29 | ERR_peek_error() returns the last error code from the thread's | 35 | ERR_peek_error() returns the earliest error code from the thread's |
36 | error queue without modifying it. | ||
37 | |||
38 | ERR_peek_last_error() returns the latest error code from the thread's | ||
30 | error queue without modifying it. | 39 | error queue without modifying it. |
31 | 40 | ||
32 | See L<ERR_GET_LIB(3)|ERR_GET_LIB(3)> for obtaining information about | 41 | See L<ERR_GET_LIB(3)|ERR_GET_LIB(3)> for obtaining information about |
@@ -34,12 +43,14 @@ location and reason of the error, and | |||
34 | L<ERR_error_string(3)|ERR_error_string(3)> for human-readable error | 43 | L<ERR_error_string(3)|ERR_error_string(3)> for human-readable error |
35 | messages. | 44 | messages. |
36 | 45 | ||
37 | ERR_get_error_line() and ERR_peek_error_line() are the same as the | 46 | ERR_get_error_line(), ERR_peek_error_line() and |
38 | above, but they additionally store the file name and line number where | 47 | ERR_peek_last_error_line() are the same as the above, but they |
48 | additionally store the file name and line number where | ||
39 | the error occurred in *B<file> and *B<line>, unless these are B<NULL>. | 49 | the error occurred in *B<file> and *B<line>, unless these are B<NULL>. |
40 | 50 | ||
41 | ERR_get_error_line_data() and ERR_peek_error_line_data() store | 51 | ERR_get_error_line_data(), ERR_peek_error_line_data() and |
42 | additional data and flags associated with the error code in *B<data> | 52 | ERR_get_last_error_line_data() store additional data and flags |
53 | associated with the error code in *B<data> | ||
43 | and *B<flags>, unless these are B<NULL>. *B<data> contains a string | 54 | and *B<flags>, unless these are B<NULL>. *B<data> contains a string |
44 | if *B<flags>&B<ERR_TXT_STRING>. If it has been allocated by OPENSSL_malloc(), | 55 | if *B<flags>&B<ERR_TXT_STRING>. If it has been allocated by OPENSSL_malloc(), |
45 | *B<flags>&B<ERR_TXT_MALLOCED> is true. | 56 | *B<flags>&B<ERR_TXT_MALLOCED> is true. |
@@ -59,5 +70,7 @@ ERR_get_error(), ERR_peek_error(), ERR_get_error_line() and | |||
59 | ERR_peek_error_line() are available in all versions of SSLeay and | 70 | ERR_peek_error_line() are available in all versions of SSLeay and |
60 | OpenSSL. ERR_get_error_line_data() and ERR_peek_error_line_data() | 71 | OpenSSL. ERR_get_error_line_data() and ERR_peek_error_line_data() |
61 | were added in SSLeay 0.9.0. | 72 | were added in SSLeay 0.9.0. |
73 | ERR_peek_last_error(), ERR_peek_last_error_line() and | ||
74 | ERR_peek_last_error_line_data() were added in OpenSSL 0.9.7. | ||
62 | 75 | ||
63 | =cut | 76 | =cut |
diff --git a/src/lib/libssl/src/doc/crypto/EVP_BytesToKey.pod b/src/lib/libssl/src/doc/crypto/EVP_BytesToKey.pod new file mode 100644 index 0000000000..5ce4add082 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/EVP_BytesToKey.pod | |||
@@ -0,0 +1,67 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EVP_BytesToKey - password based encryption routine | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/evp.h> | ||
10 | |||
11 | int EVP_BytesToKey(const EVP_CIPHER *type,const EVP_MD *md, | ||
12 | const unsigned char *salt, | ||
13 | const unsigned char *data, int datal, int count, | ||
14 | unsigned char *key,unsigned char *iv); | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | EVP_BytesToKey() derives a key and IV from various parameters. B<type> is | ||
19 | the cipher to derive the key and IV for. B<md> is the message digest to use. | ||
20 | The B<salt> paramter is used as a salt in the derivation: it should point to | ||
21 | an 8 byte buffer or NULL if no salt is used. B<data> is a buffer containing | ||
22 | B<datal> bytes which is used to derive the keying data. B<count> is the | ||
23 | iteration count to use. The derived key and IV will be written to B<key> | ||
24 | and B<iv> respectively. | ||
25 | |||
26 | =head1 NOTES | ||
27 | |||
28 | A typical application of this function is to derive keying material for an | ||
29 | encryption algorithm from a password in the B<data> parameter. | ||
30 | |||
31 | Increasing the B<count> parameter slows down the algorithm which makes it | ||
32 | harder for an attacker to peform a brute force attack using a large number | ||
33 | of candidate passwords. | ||
34 | |||
35 | If the total key and IV length is less than the digest length and | ||
36 | B<MD5> is used then the derivation algorithm is compatible with PKCS#5 v1.5 | ||
37 | otherwise a non standard extension is used to derive the extra data. | ||
38 | |||
39 | Newer applications should use more standard algorithms such as PKCS#5 | ||
40 | v2.0 for key derivation. | ||
41 | |||
42 | =head1 KEY DERIVATION ALGORITHM | ||
43 | |||
44 | The key and IV is derived by concatenating D_1, D_2, etc until | ||
45 | enough data is available for the key and IV. D_i is defined as: | ||
46 | |||
47 | D_i = HASH^count(D_(i-1) || data || salt) | ||
48 | |||
49 | where || denotes concatentaion, D_0 is empty, HASH is the digest | ||
50 | algorithm in use, HASH^1(data) is simply HASH(data), HASH^2(data) | ||
51 | is HASH(HASH(data)) and so on. | ||
52 | |||
53 | The initial bytes are used for the key and the subsequent bytes for | ||
54 | the IV. | ||
55 | |||
56 | =head1 RETURN VALUES | ||
57 | |||
58 | EVP_BytesToKey() returns the size of the derived key in bytes. | ||
59 | |||
60 | =head1 SEE ALSO | ||
61 | |||
62 | L<evp(3)|evp(3)>, L<rand(3)|rand(3)>, | ||
63 | L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>, | ||
64 | |||
65 | =head1 HISTORY | ||
66 | |||
67 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_DigestInit.pod b/src/lib/libssl/src/doc/crypto/EVP_DigestInit.pod index fefc858f7e..acd4d0167a 100644 --- a/src/lib/libssl/src/doc/crypto/EVP_DigestInit.pod +++ b/src/lib/libssl/src/doc/crypto/EVP_DigestInit.pod | |||
@@ -2,9 +2,10 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | EVP_DigestInit, EVP_DigestUpdate, EVP_DigestFinal, EVP_MAX_MD_SIZE, | 5 | EVP_MD_CTX_init, EVP_MD_CTX_create, EVP_DigestInit_ex, EVP_DigestUpdate, |
6 | EVP_MD_CTX_copy, EVP_MD_type, EVP_MD_pkey_type, EVP_MD_size, EVP_MD_block_size, | 6 | EVP_DigestFinal_ex, EVP_MD_CTX_cleanup, EVP_MD_CTX_destroy, EVP_MAX_MD_SIZE, |
7 | EVP_MD_CTX_md, EVP_MD_CTX_size, EVP_MD_CTX_block_size, EVP_MD_CTX_type, | 7 | EVP_MD_CTX_copy_ex EVP_MD_CTX_copy, EVP_MD_type, EVP_MD_pkey_type, EVP_MD_size, |
8 | EVP_MD_block_size, EVP_MD_CTX_md, EVP_MD_CTX_size, EVP_MD_CTX_block_size, EVP_MD_CTX_type, | ||
8 | EVP_md_null, EVP_md2, EVP_md5, EVP_sha, EVP_sha1, EVP_dss, EVP_dss1, EVP_mdc2, | 9 | EVP_md_null, EVP_md2, EVP_md5, EVP_sha, EVP_sha1, EVP_dss, EVP_dss1, EVP_mdc2, |
9 | EVP_ripemd160, EVP_get_digestbyname, EVP_get_digestbynid, EVP_get_digestbyobj - | 10 | EVP_ripemd160, EVP_get_digestbyname, EVP_get_digestbynid, EVP_get_digestbyobj - |
10 | EVP digest routines | 11 | EVP digest routines |
@@ -13,15 +14,28 @@ EVP digest routines | |||
13 | 14 | ||
14 | #include <openssl/evp.h> | 15 | #include <openssl/evp.h> |
15 | 16 | ||
16 | void EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); | 17 | void EVP_MD_CTX_init(EVP_MD_CTX *ctx); |
17 | void EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt); | 18 | EVP_MD_CTX *EVP_MD_CTX_create(void); |
18 | void EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, | 19 | |
20 | int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl); | ||
21 | int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt); | ||
22 | int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, | ||
19 | unsigned int *s); | 23 | unsigned int *s); |
20 | 24 | ||
21 | #define EVP_MAX_MD_SIZE (16+20) /* The SSLv3 md5+sha1 type */ | 25 | int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx); |
26 | void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx); | ||
27 | |||
28 | int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out,const EVP_MD_CTX *in); | ||
29 | |||
30 | int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); | ||
31 | int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, | ||
32 | unsigned int *s); | ||
22 | 33 | ||
23 | int EVP_MD_CTX_copy(EVP_MD_CTX *out,EVP_MD_CTX *in); | 34 | int EVP_MD_CTX_copy(EVP_MD_CTX *out,EVP_MD_CTX *in); |
24 | 35 | ||
36 | #define EVP_MAX_MD_SIZE (16+20) /* The SSLv3 md5+sha1 type */ | ||
37 | |||
38 | |||
25 | #define EVP_MD_type(e) ((e)->type) | 39 | #define EVP_MD_type(e) ((e)->type) |
26 | #define EVP_MD_pkey_type(e) ((e)->pkey_type) | 40 | #define EVP_MD_pkey_type(e) ((e)->pkey_type) |
27 | #define EVP_MD_size(e) ((e)->md_size) | 41 | #define EVP_MD_size(e) ((e)->md_size) |
@@ -32,15 +46,15 @@ EVP digest routines | |||
32 | #define EVP_MD_CTX_block_size(e) EVP_MD_block_size((e)->digest) | 46 | #define EVP_MD_CTX_block_size(e) EVP_MD_block_size((e)->digest) |
33 | #define EVP_MD_CTX_type(e) EVP_MD_type((e)->digest) | 47 | #define EVP_MD_CTX_type(e) EVP_MD_type((e)->digest) |
34 | 48 | ||
35 | EVP_MD *EVP_md_null(void); | 49 | const EVP_MD *EVP_md_null(void); |
36 | EVP_MD *EVP_md2(void); | 50 | const EVP_MD *EVP_md2(void); |
37 | EVP_MD *EVP_md5(void); | 51 | const EVP_MD *EVP_md5(void); |
38 | EVP_MD *EVP_sha(void); | 52 | const EVP_MD *EVP_sha(void); |
39 | EVP_MD *EVP_sha1(void); | 53 | const EVP_MD *EVP_sha1(void); |
40 | EVP_MD *EVP_dss(void); | 54 | const EVP_MD *EVP_dss(void); |
41 | EVP_MD *EVP_dss1(void); | 55 | const EVP_MD *EVP_dss1(void); |
42 | EVP_MD *EVP_mdc2(void); | 56 | const EVP_MD *EVP_mdc2(void); |
43 | EVP_MD *EVP_ripemd160(void); | 57 | const EVP_MD *EVP_ripemd160(void); |
44 | 58 | ||
45 | const EVP_MD *EVP_get_digestbyname(const char *name); | 59 | const EVP_MD *EVP_get_digestbyname(const char *name); |
46 | #define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) | 60 | #define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) |
@@ -50,25 +64,48 @@ EVP digest routines | |||
50 | 64 | ||
51 | The EVP digest routines are a high level interface to message digests. | 65 | The EVP digest routines are a high level interface to message digests. |
52 | 66 | ||
53 | EVP_DigestInit() initializes a digest context B<ctx> to use a digest | 67 | EVP_MD_CTX_init() initializes digest contet B<ctx>. |
54 | B<type>: this will typically be supplied by a function such as | 68 | |
55 | EVP_sha1(). | 69 | EVP_MD_CTX_create() allocates, initializes and returns a digest contet. |
70 | |||
71 | EVP_DigestInit_ex() sets up digest context B<ctx> to use a digest | ||
72 | B<type> from ENGINE B<impl>. B<ctx> must be initialized before calling this | ||
73 | function. B<type> will typically be supplied by a functionsuch as EVP_sha1(). | ||
74 | If B<impl> is NULL then the default implementation of digest B<type> is used. | ||
56 | 75 | ||
57 | EVP_DigestUpdate() hashes B<cnt> bytes of data at B<d> into the | 76 | EVP_DigestUpdate() hashes B<cnt> bytes of data at B<d> into the |
58 | digest context B<ctx>. This function can be called several times on the | 77 | digest context B<ctx>. This function can be called several times on the |
59 | same B<ctx> to hash additional data. | 78 | same B<ctx> to hash additional data. |
60 | 79 | ||
61 | EVP_DigestFinal() retrieves the digest value from B<ctx> and places | 80 | EVP_DigestFinal_ex() retrieves the digest value from B<ctx> and places |
62 | it in B<md>. If the B<s> parameter is not NULL then the number of | 81 | it in B<md>. If the B<s> parameter is not NULL then the number of |
63 | bytes of data written (i.e. the length of the digest) will be written | 82 | bytes of data written (i.e. the length of the digest) will be written |
64 | to the integer at B<s>, at most B<EVP_MAX_MD_SIZE> bytes will be written. | 83 | to the integer at B<s>, at most B<EVP_MAX_MD_SIZE> bytes will be written. |
65 | After calling EVP_DigestFinal() no additional calls to EVP_DigestUpdate() | 84 | After calling EVP_DigestFinal_ex() no additional calls to EVP_DigestUpdate() |
66 | can be made, but EVP_DigestInit() can be called to initialize a new | 85 | can be made, but EVP_DigestInit_ex() can be called to initialize a new |
67 | digest operation. | 86 | digest operation. |
68 | 87 | ||
69 | EVP_MD_CTX_copy() can be used to copy the message digest state from | 88 | EVP_MD_CTX_cleanup() cleans up digest context B<ctx>, it should be called |
89 | after a digest context is no longer needed. | ||
90 | |||
91 | EVP_MD_CTX_destroy() cleans up digest context B<ctx> and frees up the | ||
92 | space allocated to it, it should be called only on a context created | ||
93 | using EVP_MD_CTX_create(). | ||
94 | |||
95 | EVP_MD_CTX_copy_ex() can be used to copy the message digest state from | ||
70 | B<in> to B<out>. This is useful if large amounts of data are to be | 96 | B<in> to B<out>. This is useful if large amounts of data are to be |
71 | hashed which only differ in the last few bytes. | 97 | hashed which only differ in the last few bytes. B<out> must be initialized |
98 | before calling this function. | ||
99 | |||
100 | EVP_DigestInit() behaves in the same way as EVP_DigestInit_ex() except | ||
101 | the passed context B<ctx> does not have to be initialized, and it always | ||
102 | uses the default digest implementation. | ||
103 | |||
104 | EVP_DigestFinal() is similar to EVP_DigestFinal_ex() except the digest | ||
105 | contet B<ctx> is automatically cleaned up. | ||
106 | |||
107 | EVP_MD_CTX_copy() is similar to EVP_MD_CTX_copy_ex() except the destination | ||
108 | B<out> does not have to be initialized. | ||
72 | 109 | ||
73 | EVP_MD_size() and EVP_MD_CTX_size() return the size of the message digest | 110 | EVP_MD_size() and EVP_MD_CTX_size() return the size of the message digest |
74 | when passed an B<EVP_MD> or an B<EVP_MD_CTX> structure, i.e. the size of the | 111 | when passed an B<EVP_MD> or an B<EVP_MD_CTX> structure, i.e. the size of the |
@@ -107,9 +144,10 @@ using, for example, OpenSSL_add_all_digests() for these functions to work. | |||
107 | 144 | ||
108 | =head1 RETURN VALUES | 145 | =head1 RETURN VALUES |
109 | 146 | ||
110 | EVP_DigestInit(), EVP_DigestUpdate() and EVP_DigestFinal() do not return values. | 147 | EVP_DigestInit_ex(), EVP_DigestUpdate() and EVP_DigestFinal_ex() return 1 for |
148 | success and 0 for failure. | ||
111 | 149 | ||
112 | EVP_MD_CTX_copy() returns 1 if successful or 0 for failure. | 150 | EVP_MD_CTX_copy_ex() returns 1 if successful or 0 for failure. |
113 | 151 | ||
114 | EVP_MD_type(), EVP_MD_pkey_type() and EVP_MD_type() return the NID of the | 152 | EVP_MD_type(), EVP_MD_pkey_type() and EVP_MD_type() return the NID of the |
115 | corresponding OBJECT IDENTIFIER or NID_undef if none exists. | 153 | corresponding OBJECT IDENTIFIER or NID_undef if none exists. |
@@ -134,6 +172,19 @@ transparent to the digest used and much more flexible. | |||
134 | SHA1 is the digest of choice for new applications. The other digest algorithms | 172 | SHA1 is the digest of choice for new applications. The other digest algorithms |
135 | are still in common use. | 173 | are still in common use. |
136 | 174 | ||
175 | For most applications the B<impl> parameter to EVP_DigestInit_ex() will be | ||
176 | set to NULL to use the default digest implementation. | ||
177 | |||
178 | The functions EVP_DigestInit(), EVP_DigestFinal() and EVP_MD_CTX_copy() are | ||
179 | obsolete but are retained to maintain compatibility with existing code. New | ||
180 | applications should use EVP_DigestInit_ex(), EVP_DigestFinal_ex() and | ||
181 | EVP_MD_CTX_copy_ex() because they can efficiently reuse a digest context | ||
182 | instead of initializing and cleaning it up on each call and allow non default | ||
183 | implementations of digests to be specified. | ||
184 | |||
185 | In OpenSSL 0.9.7 and later if digest contexts are not cleaned up after use | ||
186 | memory leaks will occur. | ||
187 | |||
137 | =head1 EXAMPLE | 188 | =head1 EXAMPLE |
138 | 189 | ||
139 | This example digests the data "Test Message\n" and "Hello World\n", using the | 190 | This example digests the data "Test Message\n" and "Hello World\n", using the |
@@ -165,10 +216,12 @@ digest name passed on the command line. | |||
165 | exit(1); | 216 | exit(1); |
166 | } | 217 | } |
167 | 218 | ||
168 | EVP_DigestInit(&mdctx, md); | 219 | EVP_MD_CTX_init(&mdctx); |
220 | EVP_DigestInit_ex(&mdctx, md, NULL); | ||
169 | EVP_DigestUpdate(&mdctx, mess1, strlen(mess1)); | 221 | EVP_DigestUpdate(&mdctx, mess1, strlen(mess1)); |
170 | EVP_DigestUpdate(&mdctx, mess2, strlen(mess2)); | 222 | EVP_DigestUpdate(&mdctx, mess2, strlen(mess2)); |
171 | EVP_DigestFinal(&mdctx, md_value, &md_len); | 223 | EVP_DigestFinal_ex(&mdctx, md_value, &md_len); |
224 | EVP_MD_CTX_cleanup(&mdctx); | ||
172 | 225 | ||
173 | printf("Digest is: "); | 226 | printf("Digest is: "); |
174 | for(i = 0; i < md_len; i++) printf("%02x", md_value[i]); | 227 | for(i = 0; i < md_len; i++) printf("%02x", md_value[i]); |
@@ -177,17 +230,10 @@ digest name passed on the command line. | |||
177 | 230 | ||
178 | =head1 BUGS | 231 | =head1 BUGS |
179 | 232 | ||
180 | Several of the functions do not return values: maybe they should. Although the | ||
181 | internal digest operations will never fail some future hardware based operations | ||
182 | might. | ||
183 | |||
184 | The link between digests and signing algorithms results in a situation where | 233 | The link between digests and signing algorithms results in a situation where |
185 | EVP_sha1() must be used with RSA and EVP_dss1() must be used with DSS | 234 | EVP_sha1() must be used with RSA and EVP_dss1() must be used with DSS |
186 | even though they are identical digests. | 235 | even though they are identical digests. |
187 | 236 | ||
188 | The size of an B<EVP_MD_CTX> structure is determined at compile time: this results | ||
189 | in code that must be recompiled if the size of B<EVP_MD_CTX> increases. | ||
190 | |||
191 | =head1 SEE ALSO | 237 | =head1 SEE ALSO |
192 | 238 | ||
193 | L<evp(3)|evp(3)>, L<HMAC(3)|HMAC(3)>, L<MD2(3)|MD2(3)>, | 239 | L<evp(3)|evp(3)>, L<HMAC(3)|HMAC(3)>, L<MD2(3)|MD2(3)>, |
@@ -199,4 +245,7 @@ L<SHA1(3)|SHA1(3)> | |||
199 | EVP_DigestInit(), EVP_DigestUpdate() and EVP_DigestFinal() are | 245 | EVP_DigestInit(), EVP_DigestUpdate() and EVP_DigestFinal() are |
200 | available in all versions of SSLeay and OpenSSL. | 246 | available in all versions of SSLeay and OpenSSL. |
201 | 247 | ||
248 | EVP_DigestInit_ex(), EVP_DigestFinal_ex() and EVP_MD_CTX_copy_ex() | ||
249 | were added in OpenSSL 0.9.7. | ||
250 | |||
202 | =cut | 251 | =cut |
diff --git a/src/lib/libssl/src/doc/crypto/EVP_EncryptInit.pod b/src/lib/libssl/src/doc/crypto/EVP_EncryptInit.pod index 9afe2396e2..371b6a2287 100644 --- a/src/lib/libssl/src/doc/crypto/EVP_EncryptInit.pod +++ b/src/lib/libssl/src/doc/crypto/EVP_EncryptInit.pod | |||
@@ -2,43 +2,65 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | EVP_EncryptInit, EVP_EncryptUpdate, EVP_EncryptFinal, EVP_DecryptInit, | 5 | EVP_CIPHER_CTX_init, EVP_EncryptInit_ex, EVP_EncryptUpdate, |
6 | EVP_DecryptUpdate, EVP_DecryptFinal, EVP_CipherInit, EVP_CipherUpdate, | 6 | EVP_EncryptFinal_ex, EVP_DecryptInit_ex, EVP_DecryptUpdate, |
7 | EVP_CipherFinal, EVP_CIPHER_CTX_set_key_length, EVP_CIPHER_CTX_ctrl, | 7 | EVP_DecryptFinal_ex, EVP_CipherInit_ex, EVP_CipherUpdate, |
8 | EVP_CIPHER_CTX_cleanup, EVP_get_cipherbyname, EVP_get_cipherbynid, | 8 | EVP_CipherFinal_ex, EVP_CIPHER_CTX_set_key_length, |
9 | EVP_get_cipherbyobj, EVP_CIPHER_nid, EVP_CIPHER_block_size, | 9 | EVP_CIPHER_CTX_ctrl, EVP_CIPHER_CTX_cleanup, EVP_EncryptInit, |
10 | EVP_CIPHER_key_length, EVP_CIPHER_iv_length, EVP_CIPHER_flags, | 10 | EVP_EncryptFinal, EVP_DecryptInit, EVP_DecryptFinal, |
11 | EVP_CIPHER_mode, EVP_CIPHER_type, EVP_CIPHER_CTX_cipher, EVP_CIPHER_CTX_nid, | 11 | EVP_CipherInit, EVP_CipherFinal, EVP_get_cipherbyname, |
12 | EVP_CIPHER_CTX_block_size, EVP_CIPHER_CTX_key_length, EVP_CIPHER_CTX_iv_length, | 12 | EVP_get_cipherbynid, EVP_get_cipherbyobj, EVP_CIPHER_nid, |
13 | EVP_CIPHER_CTX_get_app_data, EVP_CIPHER_CTX_set_app_data, EVP_CIPHER_CTX_type, | 13 | EVP_CIPHER_block_size, EVP_CIPHER_key_length, EVP_CIPHER_iv_length, |
14 | EVP_CIPHER_CTX_flags, EVP_CIPHER_CTX_mode, EVP_CIPHER_param_to_asn1, | 14 | EVP_CIPHER_flags, EVP_CIPHER_mode, EVP_CIPHER_type, EVP_CIPHER_CTX_cipher, |
15 | EVP_CIPHER_asn1_to_param - EVP cipher routines | 15 | EVP_CIPHER_CTX_nid, EVP_CIPHER_CTX_block_size, EVP_CIPHER_CTX_key_length, |
16 | EVP_CIPHER_CTX_iv_length, EVP_CIPHER_CTX_get_app_data, | ||
17 | EVP_CIPHER_CTX_set_app_data, EVP_CIPHER_CTX_type, EVP_CIPHER_CTX_flags, | ||
18 | EVP_CIPHER_CTX_mode, EVP_CIPHER_param_to_asn1, EVP_CIPHER_asn1_to_param, | ||
19 | EVP_CIPHER_CTX_set_padding - EVP cipher routines | ||
16 | 20 | ||
17 | =head1 SYNOPSIS | 21 | =head1 SYNOPSIS |
18 | 22 | ||
19 | #include <openssl/evp.h> | 23 | #include <openssl/evp.h> |
20 | 24 | ||
21 | int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | 25 | int EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a); |
22 | unsigned char *key, unsigned char *iv); | 26 | |
27 | int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | ||
28 | ENGINE *impl, unsigned char *key, unsigned char *iv); | ||
23 | int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 29 | int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, |
24 | int *outl, unsigned char *in, int inl); | 30 | int *outl, unsigned char *in, int inl); |
31 | int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
32 | int *outl); | ||
33 | |||
34 | int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | ||
35 | ENGINE *impl, unsigned char *key, unsigned char *iv); | ||
36 | int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
37 | int *outl, unsigned char *in, int inl); | ||
38 | int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, | ||
39 | int *outl); | ||
40 | |||
41 | int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | ||
42 | ENGINE *impl, unsigned char *key, unsigned char *iv, int enc); | ||
43 | int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
44 | int *outl, unsigned char *in, int inl); | ||
45 | int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, | ||
46 | int *outl); | ||
47 | |||
48 | int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | ||
49 | unsigned char *key, unsigned char *iv); | ||
25 | int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, | 50 | int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, |
26 | int *outl); | 51 | int *outl); |
27 | 52 | ||
28 | int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | 53 | int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, |
29 | unsigned char *key, unsigned char *iv); | 54 | unsigned char *key, unsigned char *iv); |
30 | int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
31 | int *outl, unsigned char *in, int inl); | ||
32 | int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, | 55 | int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, |
33 | int *outl); | 56 | int *outl); |
34 | 57 | ||
35 | int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | 58 | int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, |
36 | unsigned char *key, unsigned char *iv, int enc); | 59 | unsigned char *key, unsigned char *iv, int enc); |
37 | int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
38 | int *outl, unsigned char *in, int inl); | ||
39 | int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, | 60 | int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, |
40 | int *outl); | 61 | int *outl); |
41 | 62 | ||
63 | int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *x, int padding); | ||
42 | int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); | 64 | int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); |
43 | int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); | 65 | int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); |
44 | int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); | 66 | int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); |
@@ -74,14 +96,19 @@ EVP_CIPHER_asn1_to_param - EVP cipher routines | |||
74 | The EVP cipher routines are a high level interface to certain | 96 | The EVP cipher routines are a high level interface to certain |
75 | symmetric ciphers. | 97 | symmetric ciphers. |
76 | 98 | ||
77 | EVP_EncryptInit() initializes a cipher context B<ctx> for encryption | 99 | EVP_CIPHER_CTX_init() initializes cipher contex B<ctx>. |
78 | with cipher B<type>. B<type> is normally supplied by a function such | 100 | |
79 | as EVP_des_cbc() . B<key> is the symmetric key to use and B<iv> is the | 101 | EVP_EncryptInit_ex() sets up cipher context B<ctx> for encryption |
80 | IV to use (if necessary), the actual number of bytes used for the | 102 | with cipher B<type> from ENGINE B<impl>. B<ctx> must be initialized |
81 | key and IV depends on the cipher. It is possible to set all parameters | 103 | before calling this function. B<type> is normally supplied |
82 | to NULL except B<type> in an initial call and supply the remaining | 104 | by a function such as EVP_des_cbc(). If B<impl> is NULL then the |
83 | parameters in subsequent calls, all of which have B<type> set to NULL. | 105 | default implementation is used. B<key> is the symmetric key to use |
84 | This is done when the default cipher parameters are not appropriate. | 106 | and B<iv> is the IV to use (if necessary), the actual number of bytes |
107 | used for the key and IV depends on the cipher. It is possible to set | ||
108 | all parameters to NULL except B<type> in an initial call and supply | ||
109 | the remaining parameters in subsequent calls, all of which have B<type> | ||
110 | set to NULL. This is done when the default cipher parameters are not | ||
111 | appropriate. | ||
85 | 112 | ||
86 | EVP_EncryptUpdate() encrypts B<inl> bytes from the buffer B<in> and | 113 | EVP_EncryptUpdate() encrypts B<inl> bytes from the buffer B<in> and |
87 | writes the encrypted version to B<out>. This function can be called | 114 | writes the encrypted version to B<out>. This function can be called |
@@ -89,32 +116,49 @@ multiple times to encrypt successive blocks of data. The amount | |||
89 | of data written depends on the block alignment of the encrypted data: | 116 | of data written depends on the block alignment of the encrypted data: |
90 | as a result the amount of data written may be anything from zero bytes | 117 | as a result the amount of data written may be anything from zero bytes |
91 | to (inl + cipher_block_size - 1) so B<outl> should contain sufficient | 118 | to (inl + cipher_block_size - 1) so B<outl> should contain sufficient |
92 | room. The actual number of bytes written is placed in B<outl>. | 119 | room. The actual number of bytes written is placed in B<outl>. |
120 | |||
121 | If padding is enabled (the default) then EVP_EncryptFinal_ex() encrypts | ||
122 | the "final" data, that is any data that remains in a partial block. | ||
123 | It uses L<standard block padding|/NOTES> (aka PKCS padding). The encrypted | ||
124 | final data is written to B<out> which should have sufficient space for | ||
125 | one cipher block. The number of bytes written is placed in B<outl>. After | ||
126 | this function is called the encryption operation is finished and no further | ||
127 | calls to EVP_EncryptUpdate() should be made. | ||
93 | 128 | ||
94 | EVP_EncryptFinal() encrypts the "final" data, that is any data that | 129 | If padding is disabled then EVP_EncryptFinal_ex() will not encrypt any more |
95 | remains in a partial block. It uses L<standard block padding|/NOTES> (aka PKCS | 130 | data and it will return an error if any data remains in a partial block: |
96 | padding). The encrypted final data is written to B<out> which should | 131 | that is if the total data length is not a multiple of the block size. |
97 | have sufficient space for one cipher block. The number of bytes written | ||
98 | is placed in B<outl>. After this function is called the encryption operation | ||
99 | is finished and no further calls to EVP_EncryptUpdate() should be made. | ||
100 | 132 | ||
101 | EVP_DecryptInit(), EVP_DecryptUpdate() and EVP_DecryptFinal() are the | 133 | EVP_DecryptInit_ex(), EVP_DecryptUpdate() and EVP_DecryptFinal_ex() are the |
102 | corresponding decryption operations. EVP_DecryptFinal() will return an | 134 | corresponding decryption operations. EVP_DecryptFinal() will return an |
103 | error code if the final block is not correctly formatted. The parameters | 135 | error code if padding is enabled and the final block is not correctly |
104 | and restrictions are identical to the encryption operations except that | 136 | formatted. The parameters and restrictions are identical to the encryption |
105 | the decrypted data buffer B<out> passed to EVP_DecryptUpdate() should | 137 | operations except that if padding is enabled the decrypted data buffer B<out> |
106 | have sufficient room for (B<inl> + cipher_block_size) bytes unless the | 138 | passed to EVP_DecryptUpdate() should have sufficient room for |
107 | cipher block size is 1 in which case B<inl> bytes is sufficient. | 139 | (B<inl> + cipher_block_size) bytes unless the cipher block size is 1 in |
108 | 140 | which case B<inl> bytes is sufficient. | |
109 | EVP_CipherInit(), EVP_CipherUpdate() and EVP_CipherFinal() are functions | 141 | |
110 | that can be used for decryption or encryption. The operation performed | 142 | EVP_CipherInit_ex(), EVP_CipherUpdate() and EVP_CipherFinal_ex() are |
111 | depends on the value of the B<enc> parameter. It should be set to 1 for | 143 | functions that can be used for decryption or encryption. The operation |
112 | encryption, 0 for decryption and -1 to leave the value unchanged (the | 144 | performed depends on the value of the B<enc> parameter. It should be set |
113 | actual value of 'enc' being supplied in a previous call). | 145 | to 1 for encryption, 0 for decryption and -1 to leave the value unchanged |
114 | 146 | (the actual value of 'enc' being supplied in a previous call). | |
115 | EVP_CIPHER_CTX_cleanup() clears all information from a cipher context. | 147 | |
116 | It should be called after all operations using a cipher are complete | 148 | EVP_CIPHER_CTX_cleanup() clears all information from a cipher context |
117 | so sensitive information does not remain in memory. | 149 | and free up any allocated memory associate with it. It should be called |
150 | after all operations using a cipher are complete so sensitive information | ||
151 | does not remain in memory. | ||
152 | |||
153 | EVP_EncryptInit(), EVP_DecryptInit() and EVP_CipherInit() behave in a | ||
154 | similar way to EVP_EncryptInit_ex(), EVP_DecryptInit_ex and | ||
155 | EVP_CipherInit_ex() except the B<ctx> paramter does not need to be | ||
156 | initialized and they always use the default cipher implementation. | ||
157 | |||
158 | EVP_EncryptFinal(), EVP_DecryptFinal() and EVP_CipherFinal() behave in a | ||
159 | similar way to EVP_EncryptFinal_ex(), EVP_DecryptFinal_ex() and | ||
160 | EVP_CipherFinal_ex() except B<ctx> is automatically cleaned up | ||
161 | after the call. | ||
118 | 162 | ||
119 | EVP_get_cipherbyname(), EVP_get_cipherbynid() and EVP_get_cipherbyobj() | 163 | EVP_get_cipherbyname(), EVP_get_cipherbynid() and EVP_get_cipherbyobj() |
120 | return an EVP_CIPHER structure when passed a cipher name, a NID or an | 164 | return an EVP_CIPHER structure when passed a cipher name, a NID or an |
@@ -125,6 +169,13 @@ passed an B<EVP_CIPHER> or B<EVP_CIPHER_CTX> structure. The actual NID | |||
125 | value is an internal value which may not have a corresponding OBJECT | 169 | value is an internal value which may not have a corresponding OBJECT |
126 | IDENTIFIER. | 170 | IDENTIFIER. |
127 | 171 | ||
172 | EVP_CIPHER_CTX_set_padding() enables or disables padding. By default | ||
173 | encryption operations are padded using standard block padding and the | ||
174 | padding is checked and removed when decrypting. If the B<pad> parameter | ||
175 | is zero then no padding is performed, the total amount of data encrypted | ||
176 | or decrypted must then be a multiple of the block size or an error will | ||
177 | occur. | ||
178 | |||
128 | EVP_CIPHER_key_length() and EVP_CIPHER_CTX_key_length() return the key | 179 | EVP_CIPHER_key_length() and EVP_CIPHER_CTX_key_length() return the key |
129 | length of a cipher when passed an B<EVP_CIPHER> or B<EVP_CIPHER_CTX> | 180 | length of a cipher when passed an B<EVP_CIPHER> or B<EVP_CIPHER_CTX> |
130 | structure. The constant B<EVP_MAX_KEY_LENGTH> is the maximum key length | 181 | structure. The constant B<EVP_MAX_KEY_LENGTH> is the maximum key length |
@@ -185,14 +236,14 @@ RC5 can be set. | |||
185 | 236 | ||
186 | =head1 RETURN VALUES | 237 | =head1 RETURN VALUES |
187 | 238 | ||
188 | EVP_EncryptInit(), EVP_EncryptUpdate() and EVP_EncryptFinal() return 1 for success | 239 | EVP_CIPHER_CTX_init, EVP_EncryptInit_ex(), EVP_EncryptUpdate() and |
189 | and 0 for failure. | 240 | EVP_EncryptFinal_ex() return 1 for success and 0 for failure. |
190 | 241 | ||
191 | EVP_DecryptInit() and EVP_DecryptUpdate() return 1 for success and 0 for failure. | 242 | EVP_DecryptInit_ex() and EVP_DecryptUpdate() return 1 for success and 0 for failure. |
192 | EVP_DecryptFinal() returns 0 if the decrypt failed or 1 for success. | 243 | EVP_DecryptFinal_ex() returns 0 if the decrypt failed or 1 for success. |
193 | 244 | ||
194 | EVP_CipherInit() and EVP_CipherUpdate() return 1 for success and 0 for failure. | 245 | EVP_CipherInit_ex() and EVP_CipherUpdate() return 1 for success and 0 for failure. |
195 | EVP_CipherFinal() returns 1 for a decryption failure or 1 for success. | 246 | EVP_CipherFinal_ex() returns 0 for a decryption failure or 1 for success. |
196 | 247 | ||
197 | EVP_CIPHER_CTX_cleanup() returns 1 for success and 0 for failure. | 248 | EVP_CIPHER_CTX_cleanup() returns 1 for success and 0 for failure. |
198 | 249 | ||
@@ -207,6 +258,8 @@ size. | |||
207 | EVP_CIPHER_key_length() and EVP_CIPHER_CTX_key_length() return the key | 258 | EVP_CIPHER_key_length() and EVP_CIPHER_CTX_key_length() return the key |
208 | length. | 259 | length. |
209 | 260 | ||
261 | EVP_CIPHER_CTX_set_padding() always returns 1. | ||
262 | |||
210 | EVP_CIPHER_iv_length() and EVP_CIPHER_CTX_iv_length() return the IV | 263 | EVP_CIPHER_iv_length() and EVP_CIPHER_CTX_iv_length() return the IV |
211 | length or zero if the cipher does not use an IV. | 264 | length or zero if the cipher does not use an IV. |
212 | 265 | ||
@@ -301,25 +354,26 @@ encrypted then 5 padding bytes of value 5 will be added. | |||
301 | 354 | ||
302 | When decrypting the final block is checked to see if it has the correct form. | 355 | When decrypting the final block is checked to see if it has the correct form. |
303 | 356 | ||
304 | Although the decryption operation can produce an error, it is not a strong | 357 | Although the decryption operation can produce an error if padding is enabled, |
305 | test that the input data or key is correct. A random block has better than | 358 | it is not a strong test that the input data or key is correct. A random block |
306 | 1 in 256 chance of being of the correct format and problems with the | 359 | has better than 1 in 256 chance of being of the correct format and problems with |
307 | input data earlier on will not produce a final decrypt error. | 360 | the input data earlier on will not produce a final decrypt error. |
308 | 361 | ||
309 | The functions EVP_EncryptInit(), EVP_EncryptUpdate(), EVP_EncryptFinal(), | 362 | If padding is disabled then the decryption operation will always succeed if |
310 | EVP_DecryptInit(), EVP_DecryptUpdate(), EVP_CipherInit() and EVP_CipherUpdate() | 363 | the total amount of data decrypted is a multiple of the block size. |
311 | and EVP_CIPHER_CTX_cleanup() did not return errors in OpenSSL version 0.9.5a or | 364 | |
312 | earlier. Software only versions of encryption algorithms will never return | 365 | The functions EVP_EncryptInit(), EVP_EncryptFinal(), EVP_DecryptInit(), |
313 | error codes for these functions, unless there is a programming error (for example | 366 | EVP_CipherInit() and EVP_CipherFinal() are obsolete but are retained for |
314 | and attempt to set the key before the cipher is set in EVP_EncryptInit() ). | 367 | compatibility with existing code. New code should use EVP_EncryptInit_ex(), |
368 | EVP_EncryptFinal_ex(), EVP_DecryptInit_ex(), EVP_DecryptFinal_ex(), | ||
369 | EVP_CipherInit_ex() and EVP_CipherFinal_ex() because they can reuse an | ||
370 | existing context without allocating and freeing it up on each call. | ||
315 | 371 | ||
316 | =head1 BUGS | 372 | =head1 BUGS |
317 | 373 | ||
318 | For RC5 the number of rounds can currently only be set to 8, 12 or 16. This is | 374 | For RC5 the number of rounds can currently only be set to 8, 12 or 16. This is |
319 | a limitation of the current RC5 code rather than the EVP interface. | 375 | a limitation of the current RC5 code rather than the EVP interface. |
320 | 376 | ||
321 | It should be possible to disable PKCS padding: currently it isn't. | ||
322 | |||
323 | EVP_MAX_KEY_LENGTH and EVP_MAX_IV_LENGTH only refer to the internal ciphers with | 377 | EVP_MAX_KEY_LENGTH and EVP_MAX_IV_LENGTH only refer to the internal ciphers with |
324 | default key lengths. If custom ciphers exceed these values the results are | 378 | default key lengths. If custom ciphers exceed these values the results are |
325 | unpredictable. This is because it has become standard practice to define a | 379 | unpredictable. This is because it has become standard practice to define a |
@@ -333,22 +387,113 @@ for certain common S/MIME ciphers (RC2, DES, triple DES) in CBC mode. | |||
333 | Get the number of rounds used in RC5: | 387 | Get the number of rounds used in RC5: |
334 | 388 | ||
335 | int nrounds; | 389 | int nrounds; |
336 | EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GET_RC5_ROUNDS, 0, &i); | 390 | EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GET_RC5_ROUNDS, 0, &nrounds); |
337 | 391 | ||
338 | Get the RC2 effective key length: | 392 | Get the RC2 effective key length: |
339 | 393 | ||
340 | int key_bits; | 394 | int key_bits; |
341 | EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GET_RC2_KEY_BITS, 0, &i); | 395 | EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GET_RC2_KEY_BITS, 0, &key_bits); |
342 | 396 | ||
343 | Set the number of rounds used in RC5: | 397 | Set the number of rounds used in RC5: |
344 | 398 | ||
345 | int nrounds; | 399 | int nrounds; |
346 | EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_RC5_ROUNDS, i, NULL); | 400 | EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_RC5_ROUNDS, nrounds, NULL); |
347 | 401 | ||
348 | Set the number of rounds used in RC2: | 402 | Set the effective key length used in RC2: |
403 | |||
404 | int key_bits; | ||
405 | EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_RC2_KEY_BITS, key_bits, NULL); | ||
406 | |||
407 | Encrypt a string using blowfish: | ||
408 | |||
409 | int do_crypt(char *outfile) | ||
410 | { | ||
411 | unsigned char outbuf[1024]; | ||
412 | int outlen, tmplen; | ||
413 | /* Bogus key and IV: we'd normally set these from | ||
414 | * another source. | ||
415 | */ | ||
416 | unsigned char key[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; | ||
417 | unsigned char iv[] = {1,2,3,4,5,6,7,8}; | ||
418 | char intext[] = "Some Crypto Text"; | ||
419 | EVP_CIPHER_CTX ctx; | ||
420 | FILE *out; | ||
421 | EVP_CIPHER_CTX_init(&ctx); | ||
422 | EVP_EncryptInit_ex(&ctx, NULL, EVP_bf_cbc(), key, iv); | ||
423 | |||
424 | if(!EVP_EncryptUpdate(&ctx, outbuf, &outlen, intext, strlen(intext))) | ||
425 | { | ||
426 | /* Error */ | ||
427 | return 0; | ||
428 | } | ||
429 | /* Buffer passed to EVP_EncryptFinal() must be after data just | ||
430 | * encrypted to avoid overwriting it. | ||
431 | */ | ||
432 | if(!EVP_EncryptFinal_ex(&ctx, outbuf + outlen, &tmplen)) | ||
433 | { | ||
434 | /* Error */ | ||
435 | return 0; | ||
436 | } | ||
437 | outlen += tmplen; | ||
438 | EVP_CIPHER_CTX_cleanup(&ctx); | ||
439 | /* Need binary mode for fopen because encrypted data is | ||
440 | * binary data. Also cannot use strlen() on it because | ||
441 | * it wont be null terminated and may contain embedded | ||
442 | * nulls. | ||
443 | */ | ||
444 | out = fopen(outfile, "wb"); | ||
445 | fwrite(outbuf, 1, outlen, out); | ||
446 | fclose(out); | ||
447 | return 1; | ||
448 | } | ||
449 | |||
450 | The ciphertext from the above example can be decrypted using the B<openssl> | ||
451 | utility with the command line: | ||
452 | |||
453 | S<openssl bf -in cipher.bin -K 000102030405060708090A0B0C0D0E0F -iv 0102030405060708 -d> | ||
454 | |||
455 | General encryption, decryption function example using FILE I/O and RC2 with an | ||
456 | 80 bit key: | ||
457 | |||
458 | int do_crypt(FILE *in, FILE *out, int do_encrypt) | ||
459 | { | ||
460 | /* Allow enough space in output buffer for additional block */ | ||
461 | inbuf[1024], outbuf[1024 + EVP_MAX_BLOCK_LENGTH]; | ||
462 | int inlen, outlen; | ||
463 | /* Bogus key and IV: we'd normally set these from | ||
464 | * another source. | ||
465 | */ | ||
466 | unsigned char key[] = "0123456789"; | ||
467 | unsigned char iv[] = "12345678"; | ||
468 | /* Don't set key or IV because we will modify the parameters */ | ||
469 | EVP_CIPHER_CTX_init(&ctx); | ||
470 | EVP_CipherInit_ex(&ctx, EVP_rc2(), NULL, NULL, NULL, do_encrypt); | ||
471 | EVP_CIPHER_CTX_set_key_length(&ctx, 10); | ||
472 | /* We finished modifying parameters so now we can set key and IV */ | ||
473 | EVP_CipherInit_ex(&ctx, NULL, NULL, key, iv, do_encrypt); | ||
474 | |||
475 | for(;;) | ||
476 | { | ||
477 | inlen = fread(inbuf, 1, 1024, in); | ||
478 | if(inlen <= 0) break; | ||
479 | if(!EVP_CipherUpdate(&ctx, outbuf, &outlen, inbuf, inlen)) | ||
480 | { | ||
481 | /* Error */ | ||
482 | return 0; | ||
483 | } | ||
484 | fwrite(outbuf, 1, outlen, out); | ||
485 | } | ||
486 | if(!EVP_CipherFinal_ex(&ctx, outbuf, &outlen)) | ||
487 | { | ||
488 | /* Error */ | ||
489 | return 0; | ||
490 | } | ||
491 | fwrite(outbuf, 1, outlen, out); | ||
492 | |||
493 | EVP_CIPHER_CTX_cleanup(&ctx); | ||
494 | return 1; | ||
495 | } | ||
349 | 496 | ||
350 | int nrounds; | ||
351 | EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_RC2_KEY_BITS, i, NULL); | ||
352 | 497 | ||
353 | =head1 SEE ALSO | 498 | =head1 SEE ALSO |
354 | 499 | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_SignInit.pod b/src/lib/libssl/src/doc/crypto/EVP_SignInit.pod index d5ce245ecd..b1ac129430 100644 --- a/src/lib/libssl/src/doc/crypto/EVP_SignInit.pod +++ b/src/lib/libssl/src/doc/crypto/EVP_SignInit.pod | |||
@@ -8,10 +8,12 @@ EVP_SignInit, EVP_SignUpdate, EVP_SignFinal - EVP signing functions | |||
8 | 8 | ||
9 | #include <openssl/evp.h> | 9 | #include <openssl/evp.h> |
10 | 10 | ||
11 | void EVP_SignInit(EVP_MD_CTX *ctx, const EVP_MD *type); | 11 | int EVP_SignInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl); |
12 | void EVP_SignUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt); | 12 | int EVP_SignUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt); |
13 | int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *sig,unsigned int *s, EVP_PKEY *pkey); | 13 | int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *sig,unsigned int *s, EVP_PKEY *pkey); |
14 | 14 | ||
15 | void EVP_SignInit(EVP_MD_CTX *ctx, const EVP_MD *type); | ||
16 | |||
15 | int EVP_PKEY_size(EVP_PKEY *pkey); | 17 | int EVP_PKEY_size(EVP_PKEY *pkey); |
16 | 18 | ||
17 | =head1 DESCRIPTION | 19 | =head1 DESCRIPTION |
@@ -19,9 +21,9 @@ EVP_SignInit, EVP_SignUpdate, EVP_SignFinal - EVP signing functions | |||
19 | The EVP signature routines are a high level interface to digital | 21 | The EVP signature routines are a high level interface to digital |
20 | signatures. | 22 | signatures. |
21 | 23 | ||
22 | EVP_SignInit() initializes a signing context B<ctx> to using digest | 24 | EVP_SignInit_ex() sets up signing context B<ctx> to use digest |
23 | B<type>: this will typically be supplied by a function such as | 25 | B<type> from ENGINE B<impl>. B<ctx> must be initialized with |
24 | EVP_sha1(). | 26 | EVP_MD_CTX_init() before calling this function. |
25 | 27 | ||
26 | EVP_SignUpdate() hashes B<cnt> bytes of data at B<d> into the | 28 | EVP_SignUpdate() hashes B<cnt> bytes of data at B<d> into the |
27 | signature context B<ctx>. This function can be called several times on the | 29 | signature context B<ctx>. This function can be called several times on the |
@@ -31,18 +33,18 @@ EVP_SignFinal() signs the data in B<ctx> using the private key B<pkey> | |||
31 | and places the signature in B<sig>. If the B<s> parameter is not NULL | 33 | and places the signature in B<sig>. If the B<s> parameter is not NULL |
32 | then the number of bytes of data written (i.e. the length of the signature) | 34 | then the number of bytes of data written (i.e. the length of the signature) |
33 | will be written to the integer at B<s>, at most EVP_PKEY_size(pkey) bytes | 35 | will be written to the integer at B<s>, at most EVP_PKEY_size(pkey) bytes |
34 | will be written. After calling EVP_SignFinal() no additional calls to | 36 | will be written. |
35 | EVP_SignUpdate() can be made, but EVP_SignInit() can be called to initialize | 37 | |
36 | a new signature operation. | 38 | EVP_SignInit() initializes a signing context B<ctx> to use the default |
39 | implementation of digest B<type>. | ||
37 | 40 | ||
38 | EVP_PKEY_size() returns the maximum size of a signature in bytes. The actual | 41 | EVP_PKEY_size() returns the maximum size of a signature in bytes. The actual |
39 | signature returned by EVP_SignFinal() may be smaller. | 42 | signature returned by EVP_SignFinal() may be smaller. |
40 | 43 | ||
41 | =head1 RETURN VALUES | 44 | =head1 RETURN VALUES |
42 | 45 | ||
43 | EVP_SignInit() and EVP_SignUpdate() do not return values. | 46 | EVP_SignInit_ex(), EVP_SignUpdate() and EVP_SignFinal() return 1 |
44 | 47 | for success and 0 for failure. | |
45 | EVP_SignFinal() returns 1 for success and 0 for failure. | ||
46 | 48 | ||
47 | EVP_PKEY_size() returns the maximum size of a signature in bytes. | 49 | EVP_PKEY_size() returns the maximum size of a signature in bytes. |
48 | 50 | ||
@@ -63,11 +65,18 @@ When signing with DSA private keys the random number generator must be seeded | |||
63 | or the operation will fail. The random number generator does not need to be | 65 | or the operation will fail. The random number generator does not need to be |
64 | seeded for RSA signatures. | 66 | seeded for RSA signatures. |
65 | 67 | ||
68 | The call to EVP_SignFinal() internally finalizes a copy of the digest context. | ||
69 | This means that calls to EVP_SignUpdate() and EVP_SignFinal() can be called | ||
70 | later to digest and sign additional data. | ||
71 | |||
72 | Since only a copy of the digest context is ever finalized the context must | ||
73 | be cleaned up after use by calling EVP_MD_CTX_cleanup() or a memory leak | ||
74 | will occur. | ||
75 | |||
66 | =head1 BUGS | 76 | =head1 BUGS |
67 | 77 | ||
68 | Several of the functions do not return values: maybe they should. Although the | 78 | Older versions of this documentation wrongly stated that calls to |
69 | internal digest operations will never fail some future hardware based operations | 79 | EVP_SignUpdate() could not be made after calling EVP_SignFinal(). |
70 | might. | ||
71 | 80 | ||
72 | =head1 SEE ALSO | 81 | =head1 SEE ALSO |
73 | 82 | ||
@@ -82,4 +91,6 @@ L<SHA1(3)|SHA1(3)>, L<digest(1)|digest(1)> | |||
82 | EVP_SignInit(), EVP_SignUpdate() and EVP_SignFinal() are | 91 | EVP_SignInit(), EVP_SignUpdate() and EVP_SignFinal() are |
83 | available in all versions of SSLeay and OpenSSL. | 92 | available in all versions of SSLeay and OpenSSL. |
84 | 93 | ||
94 | EVP_SignInit_ex() was added in OpenSSL 0.9.7 | ||
95 | |||
85 | =cut | 96 | =cut |
diff --git a/src/lib/libssl/src/doc/crypto/EVP_VerifyInit.pod b/src/lib/libssl/src/doc/crypto/EVP_VerifyInit.pod index 736a0f4a82..80c656fde8 100644 --- a/src/lib/libssl/src/doc/crypto/EVP_VerifyInit.pod +++ b/src/lib/libssl/src/doc/crypto/EVP_VerifyInit.pod | |||
@@ -8,30 +8,35 @@ EVP_VerifyInit, EVP_VerifyUpdate, EVP_VerifyFinal - EVP signature verification f | |||
8 | 8 | ||
9 | #include <openssl/evp.h> | 9 | #include <openssl/evp.h> |
10 | 10 | ||
11 | void EVP_VerifyInit(EVP_MD_CTX *ctx, const EVP_MD *type); | 11 | int EVP_VerifyInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl); |
12 | void EVP_VerifyUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt); | 12 | int EVP_VerifyUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt); |
13 | int EVP_VerifyFinal(EVP_MD_CTX *ctx,unsigned char *sigbuf, unsigned int siglen,EVP_PKEY *pkey); | 13 | int EVP_VerifyFinal(EVP_MD_CTX *ctx,unsigned char *sigbuf, unsigned int siglen,EVP_PKEY *pkey); |
14 | 14 | ||
15 | int EVP_VerifyInit(EVP_MD_CTX *ctx, const EVP_MD *type); | ||
16 | |||
15 | =head1 DESCRIPTION | 17 | =head1 DESCRIPTION |
16 | 18 | ||
17 | The EVP signature verification routines are a high level interface to digital | 19 | The EVP signature verification routines are a high level interface to digital |
18 | signatures. | 20 | signatures. |
19 | 21 | ||
20 | EVP_VerifyInit() initializes a verification context B<ctx> to using digest | 22 | EVP_VerifyInit_ex() sets up verification context B<ctx> to use digest |
21 | B<type>: this will typically be supplied by a function such as EVP_sha1(). | 23 | B<type> from ENGINE B<impl>. B<ctx> must be initialized by calling |
24 | EVP_MD_CTX_init() before calling this function. | ||
22 | 25 | ||
23 | EVP_VerifyUpdate() hashes B<cnt> bytes of data at B<d> into the | 26 | EVP_VerifyUpdate() hashes B<cnt> bytes of data at B<d> into the |
24 | verification context B<ctx>. This function can be called several times on the | 27 | verification context B<ctx>. This function can be called several times on the |
25 | same B<ctx> to include additional data. | 28 | same B<ctx> to include additional data. |
26 | 29 | ||
27 | EVP_VerifyFinal() verifies the data in B<ctx> using the public key B<pkey> | 30 | EVP_VerifyFinal() verifies the data in B<ctx> using the public key B<pkey> |
28 | and against the B<siglen> bytes at B<sigbuf>. After calling EVP_VerifyFinal() | 31 | and against the B<siglen> bytes at B<sigbuf>. |
29 | no additional calls to EVP_VerifyUpdate() can be made, but EVP_VerifyInit() | 32 | |
30 | can be called to initialize a new verification operation. | 33 | EVP_VerifyInit() initializes verification context B<ctx> to use the default |
34 | implementation of digest B<type>. | ||
31 | 35 | ||
32 | =head1 RETURN VALUES | 36 | =head1 RETURN VALUES |
33 | 37 | ||
34 | EVP_VerifyInit() and EVP_VerifyUpdate() do not return values. | 38 | EVP_VerifyInit_ex() and EVP_VerifyUpdate() return 1 for success and 0 for |
39 | failure. | ||
35 | 40 | ||
36 | EVP_VerifyFinal() returns 1 for a correct signature, 0 for failure and -1 if some | 41 | EVP_VerifyFinal() returns 1 for a correct signature, 0 for failure and -1 if some |
37 | other error occurred. | 42 | other error occurred. |
@@ -49,11 +54,18 @@ digest algorithm must be used with the correct public key type. A list of | |||
49 | algorithms and associated public key algorithms appears in | 54 | algorithms and associated public key algorithms appears in |
50 | L<EVP_DigestInit(3)|EVP_DigestInit(3)>. | 55 | L<EVP_DigestInit(3)|EVP_DigestInit(3)>. |
51 | 56 | ||
57 | The call to EVP_VerifyFinal() internally finalizes a copy of the digest context. | ||
58 | This means that calls to EVP_VerifyUpdate() and EVP_VerifyFinal() can be called | ||
59 | later to digest and verify additional data. | ||
60 | |||
61 | Since only a copy of the digest context is ever finalized the context must | ||
62 | be cleaned up after use by calling EVP_MD_CTX_cleanup() or a memory leak | ||
63 | will occur. | ||
64 | |||
52 | =head1 BUGS | 65 | =head1 BUGS |
53 | 66 | ||
54 | Several of the functions do not return values: maybe they should. Although the | 67 | Older versions of this documentation wrongly stated that calls to |
55 | internal digest operations will never fail some future hardware based operations | 68 | EVP_VerifyUpdate() could not be made after calling EVP_VerifyFinal(). |
56 | might. | ||
57 | 69 | ||
58 | =head1 SEE ALSO | 70 | =head1 SEE ALSO |
59 | 71 | ||
@@ -69,4 +81,6 @@ L<sha(3)|sha(3)>, L<digest(1)|digest(1)> | |||
69 | EVP_VerifyInit(), EVP_VerifyUpdate() and EVP_VerifyFinal() are | 81 | EVP_VerifyInit(), EVP_VerifyUpdate() and EVP_VerifyFinal() are |
70 | available in all versions of SSLeay and OpenSSL. | 82 | available in all versions of SSLeay and OpenSSL. |
71 | 83 | ||
84 | EVP_VerifyInit_ex() was added in OpenSSL 0.9.7 | ||
85 | |||
72 | =cut | 86 | =cut |
diff --git a/src/lib/libssl/src/doc/crypto/OPENSSL_VERSION_NUMBER.pod b/src/lib/libssl/src/doc/crypto/OPENSSL_VERSION_NUMBER.pod index 68ea723259..c39ac35e78 100644 --- a/src/lib/libssl/src/doc/crypto/OPENSSL_VERSION_NUMBER.pod +++ b/src/lib/libssl/src/doc/crypto/OPENSSL_VERSION_NUMBER.pod | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | OPENSSL_VERSION_NUMBER, SSLeay SSLeay_version - get OpenSSL version number | 5 | OPENSSL_VERSION_NUMBER, SSLeay, SSLeay_version - get OpenSSL version number |
6 | 6 | ||
7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
8 | 8 | ||
@@ -11,7 +11,7 @@ OPENSSL_VERSION_NUMBER, SSLeay SSLeay_version - get OpenSSL version number | |||
11 | 11 | ||
12 | #include <openssl/crypto.h> | 12 | #include <openssl/crypto.h> |
13 | long SSLeay(void); | 13 | long SSLeay(void); |
14 | char *SSLeay_version(int t); | 14 | const char *SSLeay_version(int t); |
15 | 15 | ||
16 | =head1 DESCRIPTION | 16 | =head1 DESCRIPTION |
17 | 17 | ||
@@ -55,20 +55,32 @@ SSLeay_version() returns different strings depending on B<t>: | |||
55 | =over 4 | 55 | =over 4 |
56 | 56 | ||
57 | =item SSLEAY_VERSION | 57 | =item SSLEAY_VERSION |
58 | |||
58 | The text variant of the version number and the release date. For example, | 59 | The text variant of the version number and the release date. For example, |
59 | "OpenSSL 0.9.5a 1 Apr 2000". | 60 | "OpenSSL 0.9.5a 1 Apr 2000". |
60 | 61 | ||
61 | =item SSLEAY_CFLAGS | 62 | =item SSLEAY_CFLAGS |
62 | The flags given to the C compiler when compiling OpenSSL are returned in a | 63 | |
63 | string. | 64 | The compiler flags set for the compilation process in the form |
65 | "compiler: ..." if available or "compiler: information not available" | ||
66 | otherwise. | ||
67 | |||
68 | =item SSLEAY_BUILT_ON | ||
69 | |||
70 | The date of the build process in the form "built on: ..." if available | ||
71 | or "built on: date not available" otherwise. | ||
64 | 72 | ||
65 | =item SSLEAY_PLATFORM | 73 | =item SSLEAY_PLATFORM |
66 | The platform name used when OpenSSL was configured is returned. | ||
67 | 74 | ||
68 | =back | 75 | The "Configure" target of the library build in the form "platform: ..." |
76 | if available or "platform: information not available" otherwise. | ||
77 | |||
78 | =item SSLEAY_DIR | ||
69 | 79 | ||
70 | If the data request isn't available, a text saying that the information is | 80 | The "OPENSSLDIR" setting of the library build in the form "OPENSSLDIR: "..."" |
71 | not available is returned. | 81 | if available or "OPENSSLDIR: N/A" otherwise. |
82 | |||
83 | =back | ||
72 | 84 | ||
73 | For an unknown B<t>, the text "not available" is returned. | 85 | For an unknown B<t>, the text "not available" is returned. |
74 | 86 | ||
@@ -84,5 +96,6 @@ L<crypto(3)|crypto(3)> | |||
84 | 96 | ||
85 | SSLeay() and SSLEAY_VERSION_NUMBER are available in all versions of SSLeay and OpenSSL. | 97 | SSLeay() and SSLEAY_VERSION_NUMBER are available in all versions of SSLeay and OpenSSL. |
86 | OPENSSL_VERSION_NUMBER is available in all versions of OpenSSL. | 98 | OPENSSL_VERSION_NUMBER is available in all versions of OpenSSL. |
99 | B<SSLEAY_DIR> was added in OpenSSL 0.9.7. | ||
87 | 100 | ||
88 | =cut | 101 | =cut |
diff --git a/src/lib/libssl/src/doc/crypto/RAND_egd.pod b/src/lib/libssl/src/doc/crypto/RAND_egd.pod index 71cab3ca04..62adbe19b2 100644 --- a/src/lib/libssl/src/doc/crypto/RAND_egd.pod +++ b/src/lib/libssl/src/doc/crypto/RAND_egd.pod | |||
@@ -11,6 +11,8 @@ RAND_egd - query entropy gathering daemon | |||
11 | int RAND_egd(const char *path); | 11 | int RAND_egd(const char *path); |
12 | int RAND_egd_bytes(const char *path, int bytes); | 12 | int RAND_egd_bytes(const char *path, int bytes); |
13 | 13 | ||
14 | int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes); | ||
15 | |||
14 | =head1 DESCRIPTION | 16 | =head1 DESCRIPTION |
15 | 17 | ||
16 | RAND_egd() queries the entropy gathering daemon EGD on socket B<path>. | 18 | RAND_egd() queries the entropy gathering daemon EGD on socket B<path>. |
@@ -27,6 +29,11 @@ be generated, it is not necessary to request the full amount 255 bytes from | |||
27 | the EGD socket. This can be advantageous, since the amount of entropy | 29 | the EGD socket. This can be advantageous, since the amount of entropy |
28 | that can be retrieved from EGD over time is limited. | 30 | that can be retrieved from EGD over time is limited. |
29 | 31 | ||
32 | RAND_query_egd_bytes() performs the actual query of the EGD daemon on socket | ||
33 | B<path>. If B<buf> is given, B<bytes> bytes are queried and written into | ||
34 | B<buf>. If B<buf> is NULL, B<bytes> bytes are queried and used to seed the | ||
35 | OpenSSL built-in PRNG using L<RAND_add(3)|RAND_add(3)>. | ||
36 | |||
30 | =head1 NOTES | 37 | =head1 NOTES |
31 | 38 | ||
32 | On systems without /dev/*random devices providing entropy from the kernel, | 39 | On systems without /dev/*random devices providing entropy from the kernel, |
@@ -47,12 +54,19 @@ http://www.aet.tu-cottbus.de/personen/jaenicke/postfix_tls/prngd.html . | |||
47 | PRNGD does employ an internal PRNG itself and can therefore never run | 54 | PRNGD does employ an internal PRNG itself and can therefore never run |
48 | out of entropy. | 55 | out of entropy. |
49 | 56 | ||
57 | OpenSSL automatically queries EGD when entropy is requested via RAND_bytes() | ||
58 | or the status is checked via RAND_status() for the first time, if the socket | ||
59 | is located at /var/run/egd-pool, /dev/egd-pool or /etc/egd-pool. | ||
60 | |||
50 | =head1 RETURN VALUE | 61 | =head1 RETURN VALUE |
51 | 62 | ||
52 | RAND_egd() and RAND_egd_bytes() return the number of bytes read from the | 63 | RAND_egd() and RAND_egd_bytes() return the number of bytes read from the |
53 | daemon on success, and -1 if the connection failed or the daemon did not | 64 | daemon on success, and -1 if the connection failed or the daemon did not |
54 | return enough data to fully seed the PRNG. | 65 | return enough data to fully seed the PRNG. |
55 | 66 | ||
67 | RAND_query_egd_bytes() returns the number of bytes read from the daemon on | ||
68 | success, and -1 if the connection failed. The PRNG state is not considered. | ||
69 | |||
56 | =head1 SEE ALSO | 70 | =head1 SEE ALSO |
57 | 71 | ||
58 | L<rand(3)|rand(3)>, L<RAND_add(3)|RAND_add(3)>, | 72 | L<rand(3)|rand(3)>, L<RAND_add(3)|RAND_add(3)>, |
@@ -64,4 +78,8 @@ RAND_egd() is available since OpenSSL 0.9.5. | |||
64 | 78 | ||
65 | RAND_egd_bytes() is available since OpenSSL 0.9.6. | 79 | RAND_egd_bytes() is available since OpenSSL 0.9.6. |
66 | 80 | ||
81 | RAND_query_egd_bytes() is available since OpenSSL 0.9.7. | ||
82 | |||
83 | The automatic query of /var/run/egd-pool et al was added in OpenSSL 0.9.7. | ||
84 | |||
67 | =cut | 85 | =cut |
diff --git a/src/lib/libssl/src/doc/crypto/RSA_generate_key.pod b/src/lib/libssl/src/doc/crypto/RSA_generate_key.pod index 0e0f0a764c..11bc0b3459 100644 --- a/src/lib/libssl/src/doc/crypto/RSA_generate_key.pod +++ b/src/lib/libssl/src/doc/crypto/RSA_generate_key.pod | |||
@@ -19,7 +19,7 @@ be seeded prior to calling RSA_generate_key(). | |||
19 | 19 | ||
20 | The modulus size will be B<num> bits, and the public exponent will be | 20 | The modulus size will be B<num> bits, and the public exponent will be |
21 | B<e>. Key sizes with B<num> E<lt> 1024 should be considered insecure. | 21 | B<e>. Key sizes with B<num> E<lt> 1024 should be considered insecure. |
22 | The exponent is an odd number, typically 3 or 65535. | 22 | The exponent is an odd number, typically 3, 17 or 65537. |
23 | 23 | ||
24 | A callback function may be used to provide feedback about the | 24 | A callback function may be used to provide feedback about the |
25 | progress of the key generation. If B<callback> is not B<NULL>, it | 25 | progress of the key generation. If B<callback> is not B<NULL>, it |
diff --git a/src/lib/libssl/src/doc/crypto/RSA_public_encrypt.pod b/src/lib/libssl/src/doc/crypto/RSA_public_encrypt.pod index 23861c0004..8022a23f99 100644 --- a/src/lib/libssl/src/doc/crypto/RSA_public_encrypt.pod +++ b/src/lib/libssl/src/doc/crypto/RSA_public_encrypt.pod | |||
@@ -74,10 +74,6 @@ SSL, PKCS #1 v2.0 | |||
74 | 74 | ||
75 | L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>, L<rsa(3)|rsa(3)>, L<RSA_size(3)|RSA_size(3)> | 75 | L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>, L<rsa(3)|rsa(3)>, L<RSA_size(3)|RSA_size(3)> |
76 | 76 | ||
77 | =head1 NOTES | ||
78 | |||
79 | The L<RSA_PKCS1_RSAref(3)|RSA_PKCS1_RSAref(3)> method supports only the RSA_PKCS1_PADDING mode. | ||
80 | |||
81 | =head1 HISTORY | 77 | =head1 HISTORY |
82 | 78 | ||
83 | The B<padding> argument was added in SSLeay 0.8. RSA_NO_PADDING is | 79 | The B<padding> argument was added in SSLeay 0.8. RSA_NO_PADDING is |
diff --git a/src/lib/libssl/src/doc/crypto/RSA_set_method.pod b/src/lib/libssl/src/doc/crypto/RSA_set_method.pod index b672712292..14917dd35f 100644 --- a/src/lib/libssl/src/doc/crypto/RSA_set_method.pod +++ b/src/lib/libssl/src/doc/crypto/RSA_set_method.pod | |||
@@ -3,7 +3,7 @@ | |||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | RSA_set_default_method, RSA_get_default_method, RSA_set_method, | 5 | RSA_set_default_method, RSA_get_default_method, RSA_set_method, |
6 | RSA_get_method, RSA_PKCS1_SSLeay, RSA_PKCS1_RSAref, | 6 | RSA_get_method, RSA_PKCS1_SSLeay, |
7 | RSA_null_method, RSA_flags, RSA_new_method - select RSA method | 7 | RSA_null_method, RSA_flags, RSA_new_method - select RSA method |
8 | 8 | ||
9 | =head1 SYNOPSIS | 9 | =head1 SYNOPSIS |
@@ -15,14 +15,12 @@ RSA_null_method, RSA_flags, RSA_new_method - select RSA method | |||
15 | 15 | ||
16 | RSA_METHOD *RSA_get_default_openssl_method(void); | 16 | RSA_METHOD *RSA_get_default_openssl_method(void); |
17 | 17 | ||
18 | RSA_METHOD *RSA_set_method(RSA *rsa, ENGINE *engine); | 18 | int RSA_set_method(RSA *rsa, ENGINE *engine); |
19 | 19 | ||
20 | RSA_METHOD *RSA_get_method(RSA *rsa); | 20 | RSA_METHOD *RSA_get_method(RSA *rsa); |
21 | 21 | ||
22 | RSA_METHOD *RSA_PKCS1_SSLeay(void); | 22 | RSA_METHOD *RSA_PKCS1_SSLeay(void); |
23 | 23 | ||
24 | RSA_METHOD *RSA_PKCS1_RSAref(void); | ||
25 | |||
26 | RSA_METHOD *RSA_null_method(void); | 24 | RSA_METHOD *RSA_null_method(void); |
27 | 25 | ||
28 | int RSA_flags(RSA *rsa); | 26 | int RSA_flags(RSA *rsa); |
@@ -35,17 +33,8 @@ An B<RSA_METHOD> specifies the functions that OpenSSL uses for RSA | |||
35 | operations. By modifying the method, alternative implementations | 33 | operations. By modifying the method, alternative implementations |
36 | such as hardware accelerators may be used. | 34 | such as hardware accelerators may be used. |
37 | 35 | ||
38 | Initially, the default is to use the OpenSSL internal implementation, | 36 | Initially, the default is to use the OpenSSL internal implementation. |
39 | unless OpenSSL was configured with the C<rsaref> or C<-DRSA_NULL> | 37 | RSA_PKCS1_SSLeay() returns a pointer to that method. |
40 | options. RSA_PKCS1_SSLeay() returns a pointer to that method. | ||
41 | |||
42 | RSA_PKCS1_RSAref() returns a pointer to a method that uses the RSAref | ||
43 | library. This is the default method in the C<rsaref> configuration; | ||
44 | the function is not available in other configurations. | ||
45 | RSA_null_method() returns a pointer to a method that does not support | ||
46 | the RSA transformation. It is the default if OpenSSL is compiled with | ||
47 | C<-DRSA_NULL>. These methods may be useful in the USA because of a | ||
48 | patent on the RSA cryptosystem. | ||
49 | 38 | ||
50 | RSA_set_default_openssl_method() makes B<meth> the default method for all B<RSA> | 39 | RSA_set_default_openssl_method() makes B<meth> the default method for all B<RSA> |
51 | structures created later. B<NB:> This is true only whilst the default engine | 40 | structures created later. B<NB:> This is true only whilst the default engine |
@@ -132,9 +121,8 @@ the default engine for RSA operations is used. | |||
132 | 121 | ||
133 | =head1 RETURN VALUES | 122 | =head1 RETURN VALUES |
134 | 123 | ||
135 | RSA_PKCS1_SSLeay(), RSA_PKCS1_RSAref(), RSA_PKCS1_null_method(), | 124 | RSA_PKCS1_SSLeay(), RSA_PKCS1_null_method(), RSA_get_default_openssl_method() |
136 | RSA_get_default_openssl_method() and RSA_get_method() return pointers to | 125 | and RSA_get_method() return pointers to the respective RSA_METHODs. |
137 | the respective RSA_METHODs. | ||
138 | 126 | ||
139 | RSA_set_default_openssl_method() returns no value. | 127 | RSA_set_default_openssl_method() returns no value. |
140 | 128 | ||
@@ -163,6 +151,6 @@ added in OpenSSL 0.9.4. | |||
163 | RSA_set_default_openssl_method() and RSA_get_default_openssl_method() | 151 | RSA_set_default_openssl_method() and RSA_get_default_openssl_method() |
164 | replaced RSA_set_default_method() and RSA_get_default_method() respectively, | 152 | replaced RSA_set_default_method() and RSA_get_default_method() respectively, |
165 | and RSA_set_method() and RSA_new_method() were altered to use B<ENGINE>s | 153 | and RSA_set_method() and RSA_new_method() were altered to use B<ENGINE>s |
166 | rather than B<DH_METHOD>s during development of OpenSSL 0.9.6. | 154 | rather than B<RSA_METHOD>s during development of OpenSSL 0.9.6. |
167 | 155 | ||
168 | =cut | 156 | =cut |
diff --git a/src/lib/libssl/src/doc/crypto/blowfish.pod b/src/lib/libssl/src/doc/crypto/blowfish.pod index 65b8be388c..ed71334f56 100644 --- a/src/lib/libssl/src/doc/crypto/blowfish.pod +++ b/src/lib/libssl/src/doc/crypto/blowfish.pod | |||
@@ -27,7 +27,7 @@ BF_cfb64_encrypt, BF_ofb64_encrypt, BF_options - Blowfish encryption | |||
27 | 27 | ||
28 | =head1 DESCRIPTION | 28 | =head1 DESCRIPTION |
29 | 29 | ||
30 | This library implements the Blowfish cipher, which is invented and described | 30 | This library implements the Blowfish cipher, which was invented and described |
31 | by Counterpane (see http://www.counterpane.com/blowfish.html ). | 31 | by Counterpane (see http://www.counterpane.com/blowfish.html ). |
32 | 32 | ||
33 | Blowfish is a block cipher that operates on 64 bit (8 byte) blocks of data. | 33 | Blowfish is a block cipher that operates on 64 bit (8 byte) blocks of data. |
@@ -57,7 +57,7 @@ for the same message. B<ivec> may be initialized with anything, but the | |||
57 | recipient needs to know what it was initialized with, or it won't be able | 57 | recipient needs to know what it was initialized with, or it won't be able |
58 | to decrypt. Some programs and protocols simplify this, like SSH, where | 58 | to decrypt. Some programs and protocols simplify this, like SSH, where |
59 | B<ivec> is simply initialized to zero. | 59 | B<ivec> is simply initialized to zero. |
60 | BF_cbc_encrypt() operates of data that is a multiple of 8 bytes long, while | 60 | BF_cbc_encrypt() operates on data that is a multiple of 8 bytes long, while |
61 | BF_cfb64_encrypt() and BF_ofb64_encrypt() are used to encrypt an variable | 61 | BF_cfb64_encrypt() and BF_ofb64_encrypt() are used to encrypt an variable |
62 | number of bytes (the amount does not have to be an exact multiple of 8). The | 62 | number of bytes (the amount does not have to be an exact multiple of 8). The |
63 | purpose of the latter two is to simulate stream ciphers, and therefore, they | 63 | purpose of the latter two is to simulate stream ciphers, and therefore, they |
diff --git a/src/lib/libssl/src/doc/crypto/bn.pod b/src/lib/libssl/src/doc/crypto/bn.pod index d183028d61..210dfeac08 100644 --- a/src/lib/libssl/src/doc/crypto/bn.pod +++ b/src/lib/libssl/src/doc/crypto/bn.pod | |||
@@ -21,19 +21,27 @@ bn - multiprecision integer arithmetics | |||
21 | BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b); | 21 | BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b); |
22 | BIGNUM *BN_dup(const BIGNUM *a); | 22 | BIGNUM *BN_dup(const BIGNUM *a); |
23 | 23 | ||
24 | BIGNUM *BN_swap(BIGNUM *a, BIGNUM *b); | ||
25 | |||
24 | int BN_num_bytes(const BIGNUM *a); | 26 | int BN_num_bytes(const BIGNUM *a); |
25 | int BN_num_bits(const BIGNUM *a); | 27 | int BN_num_bits(const BIGNUM *a); |
26 | int BN_num_bits_word(BN_ULONG w); | 28 | int BN_num_bits_word(BN_ULONG w); |
27 | 29 | ||
28 | int BN_add(BIGNUM *r, BIGNUM *a, BIGNUM *b); | 30 | int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); |
29 | int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); | 31 | int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); |
30 | int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); | 32 | int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); |
33 | int BN_sqr(BIGNUM *r, BIGNUM *a, BN_CTX *ctx); | ||
31 | int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *a, const BIGNUM *d, | 34 | int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *a, const BIGNUM *d, |
32 | BN_CTX *ctx); | 35 | BN_CTX *ctx); |
33 | int BN_sqr(BIGNUM *r, BIGNUM *a, BN_CTX *ctx); | ||
34 | int BN_mod(BIGNUM *rem, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); | 36 | int BN_mod(BIGNUM *rem, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); |
37 | int BN_nnmod(BIGNUM *rem, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); | ||
38 | int BN_mod_add(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, | ||
39 | BN_CTX *ctx); | ||
40 | int BN_mod_sub(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, | ||
41 | BN_CTX *ctx); | ||
35 | int BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, | 42 | int BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, |
36 | BN_CTX *ctx); | 43 | BN_CTX *ctx); |
44 | int BN_mod_sqr(BIGNUM *ret, BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); | ||
37 | int BN_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BN_CTX *ctx); | 45 | int BN_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BN_CTX *ctx); |
38 | int BN_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p, | 46 | int BN_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p, |
39 | const BIGNUM *m, BN_CTX *ctx); | 47 | const BIGNUM *m, BN_CTX *ctx); |
@@ -54,13 +62,14 @@ bn - multiprecision integer arithmetics | |||
54 | 62 | ||
55 | int BN_zero(BIGNUM *a); | 63 | int BN_zero(BIGNUM *a); |
56 | int BN_one(BIGNUM *a); | 64 | int BN_one(BIGNUM *a); |
57 | BIGNUM *BN_value_one(void); | 65 | const BIGNUM *BN_value_one(void); |
58 | int BN_set_word(BIGNUM *a, unsigned long w); | 66 | int BN_set_word(BIGNUM *a, unsigned long w); |
59 | unsigned long BN_get_word(BIGNUM *a); | 67 | unsigned long BN_get_word(BIGNUM *a); |
60 | 68 | ||
61 | int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); | 69 | int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); |
62 | int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom); | 70 | int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom); |
63 | int BN_rand_range(BIGNUM *rnd, BIGNUM *range); | 71 | int BN_rand_range(BIGNUM *rnd, BIGNUM *range); |
72 | int BN_pseudo_rand_range(BIGNUM *rnd, BIGNUM *range); | ||
64 | 73 | ||
65 | BIGNUM *BN_generate_prime(BIGNUM *ret, int bits,int safe, BIGNUM *add, | 74 | BIGNUM *BN_generate_prime(BIGNUM *ret, int bits,int safe, BIGNUM *add, |
66 | BIGNUM *rem, void (*callback)(int, int, void *), void *cb_arg); | 75 | BIGNUM *rem, void (*callback)(int, int, void *), void *cb_arg); |
@@ -138,7 +147,7 @@ of B<BIGNUM>s to external formats is described in L<BN_bn2bin(3)|BN_bn2bin(3)>. | |||
138 | L<bn_internal(3)|bn_internal(3)>, | 147 | L<bn_internal(3)|bn_internal(3)>, |
139 | L<dh(3)|dh(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>, L<rsa(3)|rsa(3)>, | 148 | L<dh(3)|dh(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>, L<rsa(3)|rsa(3)>, |
140 | L<BN_new(3)|BN_new(3)>, L<BN_CTX_new(3)|BN_CTX_new(3)>, | 149 | L<BN_new(3)|BN_new(3)>, L<BN_CTX_new(3)|BN_CTX_new(3)>, |
141 | L<BN_copy(3)|BN_copy(3)>, L<BN_num_bytes(3)|BN_num_bytes(3)>, | 150 | L<BN_copy(3)|BN_copy(3)>, L<BN_swap(3)|BN_swap(3)>, L<BN_num_bytes(3)|BN_num_bytes(3)>, |
142 | L<BN_add(3)|BN_add(3)>, L<BN_add_word(3)|BN_add_word(3)>, | 151 | L<BN_add(3)|BN_add(3)>, L<BN_add_word(3)|BN_add_word(3)>, |
143 | L<BN_cmp(3)|BN_cmp(3)>, L<BN_zero(3)|BN_zero(3)>, L<BN_rand(3)|BN_rand(3)>, | 152 | L<BN_cmp(3)|BN_cmp(3)>, L<BN_zero(3)|BN_zero(3)>, L<BN_rand(3)|BN_rand(3)>, |
144 | L<BN_generate_prime(3)|BN_generate_prime(3)>, L<BN_set_bit(3)|BN_set_bit(3)>, | 153 | L<BN_generate_prime(3)|BN_generate_prime(3)>, L<BN_set_bit(3)|BN_set_bit(3)>, |
diff --git a/src/lib/libssl/src/doc/crypto/bn_internal.pod b/src/lib/libssl/src/doc/crypto/bn_internal.pod index 8da244aed4..d6f3cfe2ee 100644 --- a/src/lib/libssl/src/doc/crypto/bn_internal.pod +++ b/src/lib/libssl/src/doc/crypto/bn_internal.pod | |||
@@ -34,9 +34,9 @@ library internal functions | |||
34 | int nb); | 34 | int nb); |
35 | void bn_mul_low_normal(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n); | 35 | void bn_mul_low_normal(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n); |
36 | void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2, | 36 | void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2, |
37 | BN_ULONG *tmp); | 37 | int dna,int dnb,BN_ULONG *tmp); |
38 | void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, | 38 | void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, |
39 | int tn, int n, BN_ULONG *tmp); | 39 | int n, int tna,int tnb, BN_ULONG *tmp); |
40 | void bn_mul_low_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, | 40 | void bn_mul_low_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, |
41 | int n2, BN_ULONG *tmp); | 41 | int n2, BN_ULONG *tmp); |
42 | void bn_mul_high(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, BN_ULONG *l, | 42 | void bn_mul_high(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, BN_ULONG *l, |
@@ -152,14 +152,15 @@ bn_mul_low_normal(B<r>, B<a>, B<b>, B<n>) operates on the B<n> word | |||
152 | arrays B<r>, B<a> and B<b>. It computes the B<n> low words of | 152 | arrays B<r>, B<a> and B<b>. It computes the B<n> low words of |
153 | B<a>*B<b> and places the result in B<r>. | 153 | B<a>*B<b> and places the result in B<r>. |
154 | 154 | ||
155 | bn_mul_recursive(B<r>, B<a>, B<b>, B<n2>, B<t>) operates on the B<n2> | 155 | bn_mul_recursive(B<r>, B<a>, B<b>, B<n2>, B<dna>, B<dnb>, B<t>) operates |
156 | word arrays B<a> and B<b> and the 2*B<n2> word arrays B<r> and B<t>. | 156 | on the word arrays B<a> and B<b> of length B<n2>+B<dna> and B<n2>+B<dnb> |
157 | B<n2> must be a power of 2. It computes B<a>*B<b> and places the | 157 | (B<dna> and B<dnb> are currently allowed to be 0 or negative) and the 2*B<n2> |
158 | result in B<r>. | 158 | word arrays B<r> and B<t>. B<n2> must be a power of 2. It computes |
159 | B<a>*B<b> and places the result in B<r>. | ||
159 | 160 | ||
160 | bn_mul_part_recursive(B<r>, B<a>, B<b>, B<tn>, B<n>, B<tmp>) operates | 161 | bn_mul_part_recursive(B<r>, B<a>, B<b>, B<n>, B<tna>, B<tnb, B<tmp>) |
161 | on the B<n>+B<tn> word arrays B<a> and B<b> and the 4*B<n> word arrays | 162 | operates on the word arrays B<a> and B<b> of length B<n>+B<tna> and |
162 | B<r> and B<tmp>. | 163 | B<n>+B<tnb> and the 4*B<n> word arrays B<r> and B<tmp>. |
163 | 164 | ||
164 | bn_mul_low_recursive(B<r>, B<a>, B<b>, B<n2>, B<tmp>) operates on the | 165 | bn_mul_low_recursive(B<r>, B<a>, B<b>, B<n2>, B<tmp>) operates on the |
165 | B<n2> word arrays B<r> and B<tmp> and the B<n2>/2 word arrays B<a> | 166 | B<n2> word arrays B<r> and B<tmp> and the B<n2>/2 word arrays B<a> |
diff --git a/src/lib/libssl/src/doc/crypto/crypto.pod b/src/lib/libssl/src/doc/crypto/crypto.pod index 07ba7e5bc9..c12eec1409 100644 --- a/src/lib/libssl/src/doc/crypto/crypto.pod +++ b/src/lib/libssl/src/doc/crypto/crypto.pod | |||
@@ -46,7 +46,8 @@ L<sha(3)|sha(3)> | |||
46 | 46 | ||
47 | =item AUXILIARY FUNCTIONS | 47 | =item AUXILIARY FUNCTIONS |
48 | 48 | ||
49 | L<err(3)|err(3)>, L<threads(3)|threads(3)>, L<rand(3)|rand(3)> | 49 | L<err(3)|err(3)>, L<threads(3)|threads(3)>, L<rand(3)|rand(3)>, |
50 | L<OPENSSL_VERSION_NUMBER(3)|OPENSSL_VERSION_NUMBER(3)> | ||
50 | 51 | ||
51 | =item INPUT/OUTPUT, DATA ENCODING | 52 | =item INPUT/OUTPUT, DATA ENCODING |
52 | 53 | ||
diff --git a/src/lib/libssl/src/doc/crypto/des.pod b/src/lib/libssl/src/doc/crypto/des.pod index 99080391b1..528c73acac 100644 --- a/src/lib/libssl/src/doc/crypto/des.pod +++ b/src/lib/libssl/src/doc/crypto/des.pod | |||
@@ -2,113 +2,105 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | des_random_key, des_set_key, des_key_sched, des_set_key_checked, | 5 | DES_random_key, DES_set_key, DES_key_sched, DES_set_key_checked, |
6 | des_set_key_unchecked, des_set_odd_parity, des_is_weak_key, | 6 | DES_set_key_unchecked, DES_set_odd_parity, DES_is_weak_key, |
7 | des_ecb_encrypt, des_ecb2_encrypt, des_ecb3_encrypt, des_ncbc_encrypt, | 7 | DES_ecb_encrypt, DES_ecb2_encrypt, DES_ecb3_encrypt, DES_ncbc_encrypt, |
8 | des_cfb_encrypt, des_ofb_encrypt, des_pcbc_encrypt, des_cfb64_encrypt, | 8 | DES_cfb_encrypt, DES_ofb_encrypt, DES_pcbc_encrypt, DES_cfb64_encrypt, |
9 | des_ofb64_encrypt, des_xcbc_encrypt, des_ede2_cbc_encrypt, | 9 | DES_ofb64_encrypt, DES_xcbc_encrypt, DES_ede2_cbc_encrypt, |
10 | des_ede2_cfb64_encrypt, des_ede2_ofb64_encrypt, des_ede3_cbc_encrypt, | 10 | DES_ede2_cfb64_encrypt, DES_ede2_ofb64_encrypt, DES_ede3_cbc_encrypt, |
11 | des_ede3_cbcm_encrypt, des_ede3_cfb64_encrypt, des_ede3_ofb64_encrypt, | 11 | DES_ede3_cbcm_encrypt, DES_ede3_cfb64_encrypt, DES_ede3_ofb64_encrypt, |
12 | des_read_password, des_read_2passwords, des_read_pw_string, | 12 | DES_cbc_cksum, DES_quad_cksum, DES_string_to_key, DES_string_to_2keys, |
13 | des_cbc_cksum, des_quad_cksum, des_string_to_key, des_string_to_2keys, | 13 | DES_fcrypt, DES_crypt, DES_enc_read, DES_enc_write - DES encryption |
14 | des_fcrypt, des_crypt, des_enc_read, des_enc_write - DES encryption | ||
15 | 14 | ||
16 | =head1 SYNOPSIS | 15 | =head1 SYNOPSIS |
17 | 16 | ||
18 | #include <openssl/des.h> | 17 | #include <openssl/des.h> |
19 | 18 | ||
20 | void des_random_key(des_cblock *ret); | 19 | void DES_random_key(DES_cblock *ret); |
21 | 20 | ||
22 | int des_set_key(const_des_cblock *key, des_key_schedule schedule); | 21 | int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule); |
23 | int des_key_sched(const_des_cblock *key, des_key_schedule schedule); | 22 | int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule); |
24 | int des_set_key_checked(const_des_cblock *key, | 23 | int DES_set_key_checked(const_DES_cblock *key, |
25 | des_key_schedule schedule); | 24 | DES_key_schedule *schedule); |
26 | void des_set_key_unchecked(const_des_cblock *key, | 25 | void DES_set_key_unchecked(const_DES_cblock *key, |
27 | des_key_schedule schedule); | 26 | DES_key_schedule *schedule); |
28 | 27 | ||
29 | void des_set_odd_parity(des_cblock *key); | 28 | void DES_set_odd_parity(DES_cblock *key); |
30 | int des_is_weak_key(const_des_cblock *key); | 29 | int DES_is_weak_key(const_DES_cblock *key); |
31 | 30 | ||
32 | void des_ecb_encrypt(const_des_cblock *input, des_cblock *output, | 31 | void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output, |
33 | des_key_schedule ks, int enc); | 32 | DES_key_schedule *ks, int enc); |
34 | void des_ecb2_encrypt(const_des_cblock *input, des_cblock *output, | 33 | void DES_ecb2_encrypt(const_DES_cblock *input, DES_cblock *output, |
35 | des_key_schedule ks1, des_key_schedule ks2, int enc); | 34 | DES_key_schedule *ks1, DES_key_schedule *ks2, int enc); |
36 | void des_ecb3_encrypt(const_des_cblock *input, des_cblock *output, | 35 | void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output, |
37 | des_key_schedule ks1, des_key_schedule ks2, | 36 | DES_key_schedule *ks1, DES_key_schedule *ks2, |
38 | des_key_schedule ks3, int enc); | 37 | DES_key_schedule *ks3, int enc); |
39 | 38 | ||
40 | void des_ncbc_encrypt(const unsigned char *input, unsigned char *output, | 39 | void DES_ncbc_encrypt(const unsigned char *input, unsigned char *output, |
41 | long length, des_key_schedule schedule, des_cblock *ivec, | 40 | long length, DES_key_schedule *schedule, DES_cblock *ivec, |
42 | int enc); | 41 | int enc); |
43 | void des_cfb_encrypt(const unsigned char *in, unsigned char *out, | 42 | void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, |
44 | int numbits, long length, des_key_schedule schedule, | 43 | int numbits, long length, DES_key_schedule *schedule, |
45 | des_cblock *ivec, int enc); | 44 | DES_cblock *ivec, int enc); |
46 | void des_ofb_encrypt(const unsigned char *in, unsigned char *out, | 45 | void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, |
47 | int numbits, long length, des_key_schedule schedule, | 46 | int numbits, long length, DES_key_schedule *schedule, |
48 | des_cblock *ivec); | 47 | DES_cblock *ivec); |
49 | void des_pcbc_encrypt(const unsigned char *input, unsigned char *output, | 48 | void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output, |
50 | long length, des_key_schedule schedule, des_cblock *ivec, | 49 | long length, DES_key_schedule *schedule, DES_cblock *ivec, |
51 | int enc); | 50 | int enc); |
52 | void des_cfb64_encrypt(const unsigned char *in, unsigned char *out, | 51 | void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out, |
53 | long length, des_key_schedule schedule, des_cblock *ivec, | 52 | long length, DES_key_schedule *schedule, DES_cblock *ivec, |
54 | int *num, int enc); | 53 | int *num, int enc); |
55 | void des_ofb64_encrypt(const unsigned char *in, unsigned char *out, | 54 | void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out, |
56 | long length, des_key_schedule schedule, des_cblock *ivec, | 55 | long length, DES_key_schedule *schedule, DES_cblock *ivec, |
57 | int *num); | 56 | int *num); |
58 | 57 | ||
59 | void des_xcbc_encrypt(const unsigned char *input, unsigned char *output, | 58 | void DES_xcbc_encrypt(const unsigned char *input, unsigned char *output, |
60 | long length, des_key_schedule schedule, des_cblock *ivec, | 59 | long length, DES_key_schedule *schedule, DES_cblock *ivec, |
61 | const_des_cblock *inw, const_des_cblock *outw, int enc); | 60 | const_DES_cblock *inw, const_DES_cblock *outw, int enc); |
62 | 61 | ||
63 | void des_ede2_cbc_encrypt(const unsigned char *input, | 62 | void DES_ede2_cbc_encrypt(const unsigned char *input, |
64 | unsigned char *output, long length, des_key_schedule ks1, | 63 | unsigned char *output, long length, DES_key_schedule *ks1, |
65 | des_key_schedule ks2, des_cblock *ivec, int enc); | 64 | DES_key_schedule *ks2, DES_cblock *ivec, int enc); |
66 | void des_ede2_cfb64_encrypt(const unsigned char *in, | 65 | void DES_ede2_cfb64_encrypt(const unsigned char *in, |
67 | unsigned char *out, long length, des_key_schedule ks1, | 66 | unsigned char *out, long length, DES_key_schedule *ks1, |
68 | des_key_schedule ks2, des_cblock *ivec, int *num, int enc); | 67 | DES_key_schedule *ks2, DES_cblock *ivec, int *num, int enc); |
69 | void des_ede2_ofb64_encrypt(const unsigned char *in, | 68 | void DES_ede2_ofb64_encrypt(const unsigned char *in, |
70 | unsigned char *out, long length, des_key_schedule ks1, | 69 | unsigned char *out, long length, DES_key_schedule *ks1, |
71 | des_key_schedule ks2, des_cblock *ivec, int *num); | 70 | DES_key_schedule *ks2, DES_cblock *ivec, int *num); |
72 | 71 | ||
73 | void des_ede3_cbc_encrypt(const unsigned char *input, | 72 | void DES_ede3_cbc_encrypt(const unsigned char *input, |
74 | unsigned char *output, long length, des_key_schedule ks1, | 73 | unsigned char *output, long length, DES_key_schedule *ks1, |
75 | des_key_schedule ks2, des_key_schedule ks3, des_cblock *ivec, | 74 | DES_key_schedule *ks2, DES_key_schedule *ks3, DES_cblock *ivec, |
76 | int enc); | 75 | int enc); |
77 | void des_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out, | 76 | void DES_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out, |
78 | long length, des_key_schedule ks1, des_key_schedule ks2, | 77 | long length, DES_key_schedule *ks1, DES_key_schedule *ks2, |
79 | des_key_schedule ks3, des_cblock *ivec1, des_cblock *ivec2, | 78 | DES_key_schedule *ks3, DES_cblock *ivec1, DES_cblock *ivec2, |
80 | int enc); | 79 | int enc); |
81 | void des_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, | 80 | void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out, |
82 | long length, des_key_schedule ks1, des_key_schedule ks2, | 81 | long length, DES_key_schedule *ks1, DES_key_schedule *ks2, |
83 | des_key_schedule ks3, des_cblock *ivec, int *num, int enc); | 82 | DES_key_schedule *ks3, DES_cblock *ivec, int *num, int enc); |
84 | void des_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out, | 83 | void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out, |
85 | long length, des_key_schedule ks1, | 84 | long length, DES_key_schedule *ks1, |
86 | des_key_schedule ks2, des_key_schedule ks3, | 85 | DES_key_schedule *ks2, DES_key_schedule *ks3, |
87 | des_cblock *ivec, int *num); | 86 | DES_cblock *ivec, int *num); |
88 | 87 | ||
89 | int des_read_password(des_cblock *key, const char *prompt, int verify); | 88 | DES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output, |
90 | int des_read_2passwords(des_cblock *key1, des_cblock *key2, | 89 | long length, DES_key_schedule *schedule, |
91 | const char *prompt, int verify); | 90 | const_DES_cblock *ivec); |
92 | int des_read_pw_string(char *buf, int length, const char *prompt, | 91 | DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[], |
93 | int verify); | 92 | long length, int out_count, DES_cblock *seed); |
94 | 93 | void DES_string_to_key(const char *str, DES_cblock *key); | |
95 | DES_LONG des_cbc_cksum(const unsigned char *input, des_cblock *output, | 94 | void DES_string_to_2keys(const char *str, DES_cblock *key1, |
96 | long length, des_key_schedule schedule, | 95 | DES_cblock *key2); |
97 | const_des_cblock *ivec); | 96 | |
98 | DES_LONG des_quad_cksum(const unsigned char *input, des_cblock output[], | 97 | char *DES_fcrypt(const char *buf, const char *salt, char *ret); |
99 | long length, int out_count, des_cblock *seed); | 98 | char *DES_crypt(const char *buf, const char *salt); |
100 | void des_string_to_key(const char *str, des_cblock *key); | 99 | |
101 | void des_string_to_2keys(const char *str, des_cblock *key1, | 100 | int DES_enc_read(int fd, void *buf, int len, DES_key_schedule *sched, |
102 | des_cblock *key2); | 101 | DES_cblock *iv); |
103 | 102 | int DES_enc_write(int fd, const void *buf, int len, | |
104 | char *des_fcrypt(const char *buf, const char *salt, char *ret); | 103 | DES_key_schedule *sched, DES_cblock *iv); |
105 | char *des_crypt(const char *buf, const char *salt); | ||
106 | char *crypt(const char *buf, const char *salt); | ||
107 | |||
108 | int des_enc_read(int fd, void *buf, int len, des_key_schedule sched, | ||
109 | des_cblock *iv); | ||
110 | int des_enc_write(int fd, const void *buf, int len, | ||
111 | des_key_schedule sched, des_cblock *iv); | ||
112 | 104 | ||
113 | =head1 DESCRIPTION | 105 | =head1 DESCRIPTION |
114 | 106 | ||
@@ -116,56 +108,52 @@ This library contains a fast implementation of the DES encryption | |||
116 | algorithm. | 108 | algorithm. |
117 | 109 | ||
118 | There are two phases to the use of DES encryption. The first is the | 110 | There are two phases to the use of DES encryption. The first is the |
119 | generation of a I<des_key_schedule> from a key, the second is the | 111 | generation of a I<DES_key_schedule> from a key, the second is the |
120 | actual encryption. A DES key is of type I<des_cblock>. This type is | 112 | actual encryption. A DES key is of type I<DES_cblock>. This type is |
121 | consists of 8 bytes with odd parity. The least significant bit in | 113 | consists of 8 bytes with odd parity. The least significant bit in |
122 | each byte is the parity bit. The key schedule is an expanded form of | 114 | each byte is the parity bit. The key schedule is an expanded form of |
123 | the key; it is used to speed the encryption process. | 115 | the key; it is used to speed the encryption process. |
124 | 116 | ||
125 | des_random_key() generates a random key. The PRNG must be seeded | 117 | DES_random_key() generates a random key. The PRNG must be seeded |
126 | prior to using this function (see L<rand(3)|rand(3)>; for backward | 118 | prior to using this function (see L<rand(3)|rand(3)>). If the PRNG |
127 | compatibility the function des_random_seed() is available as well). | 119 | could not generate a secure key, 0 is returned. |
128 | If the PRNG could not generate a secure key, 0 is returned. In | ||
129 | earlier versions of the library, des_random_key() did not generate | ||
130 | secure keys. | ||
131 | 120 | ||
132 | Before a DES key can be used, it must be converted into the | 121 | Before a DES key can be used, it must be converted into the |
133 | architecture dependent I<des_key_schedule> via the | 122 | architecture dependent I<DES_key_schedule> via the |
134 | des_set_key_checked() or des_set_key_unchecked() function. | 123 | DES_set_key_checked() or DES_set_key_unchecked() function. |
135 | 124 | ||
136 | des_set_key_checked() will check that the key passed is of odd parity | 125 | DES_set_key_checked() will check that the key passed is of odd parity |
137 | and is not a week or semi-weak key. If the parity is wrong, then -1 | 126 | and is not a week or semi-weak key. If the parity is wrong, then -1 |
138 | is returned. If the key is a weak key, then -2 is returned. If an | 127 | is returned. If the key is a weak key, then -2 is returned. If an |
139 | error is returned, the key schedule is not generated. | 128 | error is returned, the key schedule is not generated. |
140 | 129 | ||
141 | des_set_key() (called des_key_sched() in the MIT library) works like | 130 | DES_set_key() works like |
142 | des_set_key_checked() if the I<des_check_key> flag is non-zero, | 131 | DES_set_key_checked() if the I<DES_check_key> flag is non-zero, |
143 | otherwise like des_set_key_unchecked(). These functions are available | 132 | otherwise like DES_set_key_unchecked(). These functions are available |
144 | for compatibility; it is recommended to use a function that does not | 133 | for compatibility; it is recommended to use a function that does not |
145 | depend on a global variable. | 134 | depend on a global variable. |
146 | 135 | ||
147 | des_set_odd_parity() (called des_fixup_key_parity() in the MIT | 136 | DES_set_odd_parity() sets the parity of the passed I<key> to odd. |
148 | library) sets the parity of the passed I<key> to odd. | ||
149 | 137 | ||
150 | des_is_weak_key() returns 1 is the passed key is a weak key, 0 if it | 138 | DES_is_weak_key() returns 1 is the passed key is a weak key, 0 if it |
151 | is ok. The probability that a randomly generated key is weak is | 139 | is ok. The probability that a randomly generated key is weak is |
152 | 1/2^52, so it is not really worth checking for them. | 140 | 1/2^52, so it is not really worth checking for them. |
153 | 141 | ||
154 | The following routines mostly operate on an input and output stream of | 142 | The following routines mostly operate on an input and output stream of |
155 | I<des_cblock>s. | 143 | I<DES_cblock>s. |
156 | 144 | ||
157 | des_ecb_encrypt() is the basic DES encryption routine that encrypts or | 145 | DES_ecb_encrypt() is the basic DES encryption routine that encrypts or |
158 | decrypts a single 8-byte I<des_cblock> in I<electronic code book> | 146 | decrypts a single 8-byte I<DES_cblock> in I<electronic code book> |
159 | (ECB) mode. It always transforms the input data, pointed to by | 147 | (ECB) mode. It always transforms the input data, pointed to by |
160 | I<input>, into the output data, pointed to by the I<output> argument. | 148 | I<input>, into the output data, pointed to by the I<output> argument. |
161 | If the I<encrypt> argument is non-zero (DES_ENCRYPT), the I<input> | 149 | If the I<encrypt> argument is non-zero (DES_ENCRYPT), the I<input> |
162 | (cleartext) is encrypted in to the I<output> (ciphertext) using the | 150 | (cleartext) is encrypted in to the I<output> (ciphertext) using the |
163 | key_schedule specified by the I<schedule> argument, previously set via | 151 | key_schedule specified by the I<schedule> argument, previously set via |
164 | I<des_set_key>. If I<encrypt> is zero (DES_DECRYPT), the I<input> (now | 152 | I<DES_set_key>. If I<encrypt> is zero (DES_DECRYPT), the I<input> (now |
165 | ciphertext) is decrypted into the I<output> (now cleartext). Input | 153 | ciphertext) is decrypted into the I<output> (now cleartext). Input |
166 | and output may overlap. des_ecb_encrypt() does not return a value. | 154 | and output may overlap. DES_ecb_encrypt() does not return a value. |
167 | 155 | ||
168 | des_ecb3_encrypt() encrypts/decrypts the I<input> block by using | 156 | DES_ecb3_encrypt() encrypts/decrypts the I<input> block by using |
169 | three-key Triple-DES encryption in ECB mode. This involves encrypting | 157 | three-key Triple-DES encryption in ECB mode. This involves encrypting |
170 | the input with I<ks1>, decrypting with the key schedule I<ks2>, and | 158 | the input with I<ks1>, decrypting with the key schedule I<ks2>, and |
171 | then encrypting with I<ks3>. This routine greatly reduces the chances | 159 | then encrypting with I<ks3>. This routine greatly reduces the chances |
@@ -173,10 +161,10 @@ of brute force breaking of DES and has the advantage of if I<ks1>, | |||
173 | I<ks2> and I<ks3> are the same, it is equivalent to just encryption | 161 | I<ks2> and I<ks3> are the same, it is equivalent to just encryption |
174 | using ECB mode and I<ks1> as the key. | 162 | using ECB mode and I<ks1> as the key. |
175 | 163 | ||
176 | The macro des_ecb2_encrypt() is provided to perform two-key Triple-DES | 164 | The macro DES_ecb2_encrypt() is provided to perform two-key Triple-DES |
177 | encryption by using I<ks1> for the final encryption. | 165 | encryption by using I<ks1> for the final encryption. |
178 | 166 | ||
179 | des_ncbc_encrypt() encrypts/decrypts using the I<cipher-block-chaining> | 167 | DES_ncbc_encrypt() encrypts/decrypts using the I<cipher-block-chaining> |
180 | (CBC) mode of DES. If the I<encrypt> argument is non-zero, the | 168 | (CBC) mode of DES. If the I<encrypt> argument is non-zero, the |
181 | routine cipher-block-chain encrypts the cleartext data pointed to by | 169 | routine cipher-block-chain encrypts the cleartext data pointed to by |
182 | the I<input> argument into the ciphertext pointed to by the I<output> | 170 | the I<input> argument into the ciphertext pointed to by the I<output> |
@@ -186,24 +174,24 @@ I<length> argument is not an integral multiple of eight bytes, the | |||
186 | last block is copied to a temporary area and zero filled. The output | 174 | last block is copied to a temporary area and zero filled. The output |
187 | is always an integral multiple of eight bytes. | 175 | is always an integral multiple of eight bytes. |
188 | 176 | ||
189 | des_xcbc_encrypt() is RSA's DESX mode of DES. It uses I<inw> and | 177 | DES_xcbc_encrypt() is RSA's DESX mode of DES. It uses I<inw> and |
190 | I<outw> to 'whiten' the encryption. I<inw> and I<outw> are secret | 178 | I<outw> to 'whiten' the encryption. I<inw> and I<outw> are secret |
191 | (unlike the iv) and are as such, part of the key. So the key is sort | 179 | (unlike the iv) and are as such, part of the key. So the key is sort |
192 | of 24 bytes. This is much better than CBC DES. | 180 | of 24 bytes. This is much better than CBC DES. |
193 | 181 | ||
194 | des_ede3_cbc_encrypt() implements outer triple CBC DES encryption with | 182 | DES_ede3_cbc_encrypt() implements outer triple CBC DES encryption with |
195 | three keys. This means that each DES operation inside the CBC mode is | 183 | three keys. This means that each DES operation inside the CBC mode is |
196 | really an C<C=E(ks3,D(ks2,E(ks1,M)))>. This mode is used by SSL. | 184 | really an C<C=E(ks3,D(ks2,E(ks1,M)))>. This mode is used by SSL. |
197 | 185 | ||
198 | The des_ede2_cbc_encrypt() macro implements two-key Triple-DES by | 186 | The DES_ede2_cbc_encrypt() macro implements two-key Triple-DES by |
199 | reusing I<ks1> for the final encryption. C<C=E(ks1,D(ks2,E(ks1,M)))>. | 187 | reusing I<ks1> for the final encryption. C<C=E(ks1,D(ks2,E(ks1,M)))>. |
200 | This form of Triple-DES is used by the RSAREF library. | 188 | This form of Triple-DES is used by the RSAREF library. |
201 | 189 | ||
202 | des_pcbc_encrypt() encrypt/decrypts using the propagating cipher block | 190 | DES_pcbc_encrypt() encrypt/decrypts using the propagating cipher block |
203 | chaining mode used by Kerberos v4. Its parameters are the same as | 191 | chaining mode used by Kerberos v4. Its parameters are the same as |
204 | des_ncbc_encrypt(). | 192 | DES_ncbc_encrypt(). |
205 | 193 | ||
206 | des_cfb_encrypt() encrypt/decrypts using cipher feedback mode. This | 194 | DES_cfb_encrypt() encrypt/decrypts using cipher feedback mode. This |
207 | method takes an array of characters as input and outputs and array of | 195 | method takes an array of characters as input and outputs and array of |
208 | characters. It does not require any padding to 8 character groups. | 196 | characters. It does not require any padding to 8 character groups. |
209 | Note: the I<ivec> variable is changed and the new changed value needs to | 197 | Note: the I<ivec> variable is changed and the new changed value needs to |
@@ -211,7 +199,7 @@ be passed to the next call to this function. Since this function runs | |||
211 | a complete DES ECB encryption per I<numbits>, this function is only | 199 | a complete DES ECB encryption per I<numbits>, this function is only |
212 | suggested for use when sending small numbers of characters. | 200 | suggested for use when sending small numbers of characters. |
213 | 201 | ||
214 | des_cfb64_encrypt() | 202 | DES_cfb64_encrypt() |
215 | implements CFB mode of DES with 64bit feedback. Why is this | 203 | implements CFB mode of DES with 64bit feedback. Why is this |
216 | useful you ask? Because this routine will allow you to encrypt an | 204 | useful you ask? Because this routine will allow you to encrypt an |
217 | arbitrary number of bytes, no 8 byte padding. Each call to this | 205 | arbitrary number of bytes, no 8 byte padding. Each call to this |
@@ -219,10 +207,10 @@ routine will encrypt the input bytes to output and then update ivec | |||
219 | and num. num contains 'how far' we are though ivec. If this does | 207 | and num. num contains 'how far' we are though ivec. If this does |
220 | not make much sense, read more about cfb mode of DES :-). | 208 | not make much sense, read more about cfb mode of DES :-). |
221 | 209 | ||
222 | des_ede3_cfb64_encrypt() and des_ede2_cfb64_encrypt() is the same as | 210 | DES_ede3_cfb64_encrypt() and DES_ede2_cfb64_encrypt() is the same as |
223 | des_cfb64_encrypt() except that Triple-DES is used. | 211 | DES_cfb64_encrypt() except that Triple-DES is used. |
224 | 212 | ||
225 | des_ofb_encrypt() encrypts using output feedback mode. This method | 213 | DES_ofb_encrypt() encrypts using output feedback mode. This method |
226 | takes an array of characters as input and outputs and array of | 214 | takes an array of characters as input and outputs and array of |
227 | characters. It does not require any padding to 8 character groups. | 215 | characters. It does not require any padding to 8 character groups. |
228 | Note: the I<ivec> variable is changed and the new changed value needs to | 216 | Note: the I<ivec> variable is changed and the new changed value needs to |
@@ -230,39 +218,22 @@ be passed to the next call to this function. Since this function runs | |||
230 | a complete DES ECB encryption per numbits, this function is only | 218 | a complete DES ECB encryption per numbits, this function is only |
231 | suggested for use when sending small numbers of characters. | 219 | suggested for use when sending small numbers of characters. |
232 | 220 | ||
233 | des_ofb64_encrypt() is the same as des_cfb64_encrypt() using Output | 221 | DES_ofb64_encrypt() is the same as DES_cfb64_encrypt() using Output |
234 | Feed Back mode. | 222 | Feed Back mode. |
235 | 223 | ||
236 | des_ede3_ofb64_encrypt() and des_ede2_ofb64_encrypt() is the same as | 224 | DES_ede3_ofb64_encrypt() and DES_ede2_ofb64_encrypt() is the same as |
237 | des_ofb64_encrypt(), using Triple-DES. | 225 | DES_ofb64_encrypt(), using Triple-DES. |
238 | 226 | ||
239 | The following functions are included in the DES library for | 227 | The following functions are included in the DES library for |
240 | compatibility with the MIT Kerberos library. des_read_pw_string() | 228 | compatibility with the MIT Kerberos library. |
241 | is also available under the name EVP_read_pw_string(). | 229 | |
242 | 230 | DES_cbc_cksum() produces an 8 byte checksum based on the input stream | |
243 | des_read_pw_string() writes the string specified by I<prompt> to | ||
244 | standard output, turns echo off and reads in input string from the | ||
245 | terminal. The string is returned in I<buf>, which must have space for | ||
246 | at least I<length> bytes. If I<verify> is set, the user is asked for | ||
247 | the password twice and unless the two copies match, an error is | ||
248 | returned. A return code of -1 indicates a system error, 1 failure due | ||
249 | to use interaction, and 0 is success. | ||
250 | |||
251 | des_read_password() does the same and converts the password to a DES | ||
252 | key by calling des_string_to_key(); des_read_2password() operates in | ||
253 | the same way as des_read_password() except that it generates two keys | ||
254 | by using the des_string_to_2key() function. des_string_to_key() is | ||
255 | available for backward compatibility with the MIT library. New | ||
256 | applications should use a cryptographic hash function. The same | ||
257 | applies for des_string_to_2key(). | ||
258 | |||
259 | des_cbc_cksum() produces an 8 byte checksum based on the input stream | ||
260 | (via CBC encryption). The last 4 bytes of the checksum are returned | 231 | (via CBC encryption). The last 4 bytes of the checksum are returned |
261 | and the complete 8 bytes are placed in I<output>. This function is | 232 | and the complete 8 bytes are placed in I<output>. This function is |
262 | used by Kerberos v4. Other applications should use | 233 | used by Kerberos v4. Other applications should use |
263 | L<EVP_DigestInit(3)|EVP_DigestInit(3)> etc. instead. | 234 | L<EVP_DigestInit(3)|EVP_DigestInit(3)> etc. instead. |
264 | 235 | ||
265 | des_quad_cksum() is a Kerberos v4 function. It returns a 4 byte | 236 | DES_quad_cksum() is a Kerberos v4 function. It returns a 4 byte |
266 | checksum from the input bytes. The algorithm can be iterated over the | 237 | checksum from the input bytes. The algorithm can be iterated over the |
267 | input, depending on I<out_count>, 1, 2, 3 or 4 times. If I<output> is | 238 | input, depending on I<out_count>, 1, 2, 3 or 4 times. If I<output> is |
268 | non-NULL, the 8 bytes generated by each pass are written into | 239 | non-NULL, the 8 bytes generated by each pass are written into |
@@ -270,19 +241,19 @@ I<output>. | |||
270 | 241 | ||
271 | The following are DES-based transformations: | 242 | The following are DES-based transformations: |
272 | 243 | ||
273 | des_fcrypt() is a fast version of the Unix crypt(3) function. This | 244 | DES_fcrypt() is a fast version of the Unix crypt(3) function. This |
274 | version takes only a small amount of space relative to other fast | 245 | version takes only a small amount of space relative to other fast |
275 | crypt() implementations. This is different to the normal crypt in | 246 | crypt() implementations. This is different to the normal crypt in |
276 | that the third parameter is the buffer that the return value is | 247 | that the third parameter is the buffer that the return value is |
277 | written into. It needs to be at least 14 bytes long. This function | 248 | written into. It needs to be at least 14 bytes long. This function |
278 | is thread safe, unlike the normal crypt. | 249 | is thread safe, unlike the normal crypt. |
279 | 250 | ||
280 | des_crypt() is a faster replacement for the normal system crypt(). | 251 | DES_crypt() is a faster replacement for the normal system crypt(). |
281 | This function calls des_fcrypt() with a static array passed as the | 252 | This function calls DES_fcrypt() with a static array passed as the |
282 | third parameter. This emulates the normal non-thread safe semantics | 253 | third parameter. This emulates the normal non-thread safe semantics |
283 | of crypt(3). | 254 | of crypt(3). |
284 | 255 | ||
285 | des_enc_write() writes I<len> bytes to file descriptor I<fd> from | 256 | DES_enc_write() writes I<len> bytes to file descriptor I<fd> from |
286 | buffer I<buf>. The data is encrypted via I<pcbc_encrypt> (default) | 257 | buffer I<buf>. The data is encrypted via I<pcbc_encrypt> (default) |
287 | using I<sched> for the key and I<iv> as a starting vector. The actual | 258 | using I<sched> for the key and I<iv> as a starting vector. The actual |
288 | data send down I<fd> consists of 4 bytes (in network byte order) | 259 | data send down I<fd> consists of 4 bytes (in network byte order) |
@@ -290,40 +261,40 @@ containing the length of the following encrypted data. The encrypted | |||
290 | data then follows, padded with random data out to a multiple of 8 | 261 | data then follows, padded with random data out to a multiple of 8 |
291 | bytes. | 262 | bytes. |
292 | 263 | ||
293 | des_enc_read() is used to read I<len> bytes from file descriptor | 264 | DES_enc_read() is used to read I<len> bytes from file descriptor |
294 | I<fd> into buffer I<buf>. The data being read from I<fd> is assumed to | 265 | I<fd> into buffer I<buf>. The data being read from I<fd> is assumed to |
295 | have come from des_enc_write() and is decrypted using I<sched> for | 266 | have come from DES_enc_write() and is decrypted using I<sched> for |
296 | the key schedule and I<iv> for the initial vector. | 267 | the key schedule and I<iv> for the initial vector. |
297 | 268 | ||
298 | B<Warning:> The data format used by des_enc_write() and des_enc_read() | 269 | B<Warning:> The data format used by DES_enc_write() and DES_enc_read() |
299 | has a cryptographic weakness: When asked to write more than MAXWRITE | 270 | has a cryptographic weakness: When asked to write more than MAXWRITE |
300 | bytes, des_enc_write() will split the data into several chunks that | 271 | bytes, DES_enc_write() will split the data into several chunks that |
301 | are all encrypted using the same IV. So don't use these functions | 272 | are all encrypted using the same IV. So don't use these functions |
302 | unless you are sure you know what you do (in which case you might not | 273 | unless you are sure you know what you do (in which case you might not |
303 | want to use them anyway). They cannot handle non-blocking sockets. | 274 | want to use them anyway). They cannot handle non-blocking sockets. |
304 | des_enc_read() uses an internal state and thus cannot be used on | 275 | DES_enc_read() uses an internal state and thus cannot be used on |
305 | multiple files. | 276 | multiple files. |
306 | 277 | ||
307 | I<des_rw_mode> is used to specify the encryption mode to use with | 278 | I<DES_rw_mode> is used to specify the encryption mode to use with |
308 | des_enc_read() and des_end_write(). If set to I<DES_PCBC_MODE> (the | 279 | DES_enc_read() and DES_end_write(). If set to I<DES_PCBC_MODE> (the |
309 | default), des_pcbc_encrypt is used. If set to I<DES_CBC_MODE> | 280 | default), DES_pcbc_encrypt is used. If set to I<DES_CBC_MODE> |
310 | des_cbc_encrypt is used. | 281 | DES_cbc_encrypt is used. |
311 | 282 | ||
312 | =head1 NOTES | 283 | =head1 NOTES |
313 | 284 | ||
314 | Single-key DES is insecure due to its short key size. ECB mode is | 285 | Single-key DES is insecure due to its short key size. ECB mode is |
315 | not suitable for most applications; see L<des_modes(7)|des_modes(7)>. | 286 | not suitable for most applications; see L<DES_modes(7)|DES_modes(7)>. |
316 | 287 | ||
317 | The L<evp(3)|evp(3)> library provides higher-level encryption functions. | 288 | The L<evp(3)|evp(3)> library provides higher-level encryption functions. |
318 | 289 | ||
319 | =head1 BUGS | 290 | =head1 BUGS |
320 | 291 | ||
321 | des_3cbc_encrypt() is flawed and must not be used in applications. | 292 | DES_3cbc_encrypt() is flawed and must not be used in applications. |
322 | 293 | ||
323 | des_cbc_encrypt() does not modify B<ivec>; use des_ncbc_encrypt() | 294 | DES_cbc_encrypt() does not modify B<ivec>; use DES_ncbc_encrypt() |
324 | instead. | 295 | instead. |
325 | 296 | ||
326 | des_cfb_encrypt() and des_ofb_encrypt() operates on input of 8 bits. | 297 | DES_cfb_encrypt() and DES_ofb_encrypt() operates on input of 8 bits. |
327 | What this means is that if you set numbits to 12, and length to 2, the | 298 | What this means is that if you set numbits to 12, and length to 2, the |
328 | first 12 bits will come from the 1st input byte and the low half of | 299 | first 12 bits will come from the 1st input byte and the low half of |
329 | the second input byte. The second 12 bits will have the low 8 bits | 300 | the second input byte. The second 12 bits will have the low 8 bits |
@@ -333,8 +304,9 @@ implemented this way because most people will be using a multiple of 8 | |||
333 | and because once you get into pulling bytes input bytes apart things | 304 | and because once you get into pulling bytes input bytes apart things |
334 | get ugly! | 305 | get ugly! |
335 | 306 | ||
336 | des_read_pw_string() is the most machine/OS dependent function and | 307 | DES_string_to_key() is available for backward compatibility with the |
337 | normally generates the most problems when porting this code. | 308 | MIT library. New applications should use a cryptographic hash function. |
309 | The same applies for DES_string_to_2key(). | ||
338 | 310 | ||
339 | =head1 CONFORMING TO | 311 | =head1 CONFORMING TO |
340 | 312 | ||
@@ -349,10 +321,20 @@ crypt(3), L<des_modes(7)|des_modes(7)>, L<evp(3)|evp(3)>, L<rand(3)|rand(3)> | |||
349 | 321 | ||
350 | =head1 HISTORY | 322 | =head1 HISTORY |
351 | 323 | ||
324 | In OpenSSL 0.9.7, all des_ functions were renamed to DES_ to avoid | ||
325 | clashes with older versions of libdes. Compatibility des_ functions | ||
326 | are provided for a short while, as well as crypt(). | ||
327 | Declarations for these are in <openssl/des_old.h>. There is no DES_ | ||
328 | variant for des_random_seed(). | ||
329 | This will happen to other functions | ||
330 | as well if they are deemed redundant (des_random_seed() just calls | ||
331 | RAND_seed() and is present for backward compatibility only), buggy or | ||
332 | already scheduled for removal. | ||
333 | |||
352 | des_cbc_cksum(), des_cbc_encrypt(), des_ecb_encrypt(), | 334 | des_cbc_cksum(), des_cbc_encrypt(), des_ecb_encrypt(), |
353 | des_is_weak_key(), des_key_sched(), des_pcbc_encrypt(), | 335 | des_is_weak_key(), des_key_sched(), des_pcbc_encrypt(), |
354 | des_quad_cksum(), des_random_key(), des_read_password() and | 336 | des_quad_cksum(), des_random_key() and des_string_to_key() |
355 | des_string_to_key() are available in the MIT Kerberos library; | 337 | are available in the MIT Kerberos library; |
356 | des_check_key_parity(), des_fixup_key_parity() and des_is_weak_key() | 338 | des_check_key_parity(), des_fixup_key_parity() and des_is_weak_key() |
357 | are available in newer versions of that library. | 339 | are available in newer versions of that library. |
358 | 340 | ||
diff --git a/src/lib/libssl/src/doc/crypto/hmac.pod b/src/lib/libssl/src/doc/crypto/hmac.pod index 631f40377e..3cc29dfc83 100644 --- a/src/lib/libssl/src/doc/crypto/hmac.pod +++ b/src/lib/libssl/src/doc/crypto/hmac.pod | |||
@@ -13,11 +13,16 @@ authentication code | |||
13 | int key_len, const unsigned char *d, int n, | 13 | int key_len, const unsigned char *d, int n, |
14 | unsigned char *md, unsigned int *md_len); | 14 | unsigned char *md, unsigned int *md_len); |
15 | 15 | ||
16 | void HMAC_CTX_init(HMAC_CTX *ctx); | ||
17 | |||
16 | void HMAC_Init(HMAC_CTX *ctx, const void *key, int key_len, | 18 | void HMAC_Init(HMAC_CTX *ctx, const void *key, int key_len, |
17 | const EVP_MD *md); | 19 | const EVP_MD *md); |
20 | void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int key_len, | ||
21 | const EVP_MD *md); | ||
18 | void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len); | 22 | void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len); |
19 | void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); | 23 | void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); |
20 | 24 | ||
25 | void HMAC_CTX_cleanup(HMAC_CTX *ctx); | ||
21 | void HMAC_cleanup(HMAC_CTX *ctx); | 26 | void HMAC_cleanup(HMAC_CTX *ctx); |
22 | 27 | ||
23 | =head1 DESCRIPTION | 28 | =head1 DESCRIPTION |
@@ -39,13 +44,31 @@ B<evp_md> can be EVP_sha1(), EVP_ripemd160() etc. | |||
39 | B<key> and B<evp_md> may be B<NULL> if a key and hash function have | 44 | B<key> and B<evp_md> may be B<NULL> if a key and hash function have |
40 | been set in a previous call to HMAC_Init() for that B<HMAC_CTX>. | 45 | been set in a previous call to HMAC_Init() for that B<HMAC_CTX>. |
41 | 46 | ||
42 | HMAC_cleanup() erases the key and other data from the B<HMAC_CTX>. | 47 | HMAC_CTX_init() initialises a B<HMAC_CTX> before first use. It must be |
48 | called. | ||
49 | |||
50 | HMAC_CTX_cleanup() erases the key and other data from the B<HMAC_CTX> | ||
51 | and releases any associated resources. It must be called when an | ||
52 | B<HMAC_CTX> is no longer required. | ||
53 | |||
54 | HMAC_cleanup() is an alias for HMAC_CTX_cleanup() included for back | ||
55 | compatibility with 0.9.6b, it is deprecated. | ||
43 | 56 | ||
44 | The following functions may be used if the message is not completely | 57 | The following functions may be used if the message is not completely |
45 | stored in memory: | 58 | stored in memory: |
46 | 59 | ||
47 | HMAC_Init() initializes a B<HMAC_CTX> structure to use the hash | 60 | HMAC_Init() initializes a B<HMAC_CTX> structure to use the hash |
48 | function B<evp_md> and the key B<key> which is B<key_len> bytes long. | 61 | function B<evp_md> and the key B<key> which is B<key_len> bytes |
62 | long. It is deprecated and only included for backward compatibility | ||
63 | with OpenSSL 0.9.6b. | ||
64 | |||
65 | HMAC_Init_ex() initializes or reuses a B<HMAC_CTX> structure to use | ||
66 | the function B<evp_md> and key B<key>. Either can be NULL, in which | ||
67 | case the existing one will be reused. HMAC_CTX_init() must have been | ||
68 | called before the first use of an B<HMAC_CTX> in this | ||
69 | function. B<N.B. HMAC_Init() had this undocumented behaviour in | ||
70 | previous versions of OpenSSL - failure to switch to HMAC_Init_ex() in | ||
71 | programs that expect it will cause them to stop working>. | ||
49 | 72 | ||
50 | HMAC_Update() can be called repeatedly with chunks of the message to | 73 | HMAC_Update() can be called repeatedly with chunks of the message to |
51 | be authenticated (B<len> bytes at B<data>). | 74 | be authenticated (B<len> bytes at B<data>). |
@@ -57,8 +80,8 @@ must have space for the hash function output. | |||
57 | 80 | ||
58 | HMAC() returns a pointer to the message authentication code. | 81 | HMAC() returns a pointer to the message authentication code. |
59 | 82 | ||
60 | HMAC_Init(), HMAC_Update(), HMAC_Final() and HMAC_cleanup() do not | 83 | HMAC_CTX_init(), HMAC_Init_ex(), HMAC_Update(), HMAC_Final() and |
61 | return values. | 84 | HMAC_CTX_cleanup() do not return values. |
62 | 85 | ||
63 | =head1 CONFORMING TO | 86 | =head1 CONFORMING TO |
64 | 87 | ||
diff --git a/src/lib/libssl/src/doc/crypto/lhash.pod b/src/lib/libssl/src/doc/crypto/lhash.pod index 4e87aee824..0bac11421e 100644 --- a/src/lib/libssl/src/doc/crypto/lhash.pod +++ b/src/lib/libssl/src/doc/crypto/lhash.pod | |||
@@ -2,43 +2,108 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | lh_new, lh_free, lh_insert, lh_delete, lh_retrieve, lh_doall, | 5 | lh_new, lh_free, lh_insert, lh_delete, lh_retrieve, lh_doall, lh_doall_arg, lh_error - dynamic hash table |
6 | lh_doall_arg, lh_error - dynamic hash table | ||
7 | 6 | ||
8 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
9 | 8 | ||
10 | #include <openssl/lhash.h> | 9 | #include <openssl/lhash.h> |
11 | 10 | ||
12 | LHASH *lh_new(unsigned long (*hash)(/*void *a*/), | 11 | LHASH *lh_new(LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE compare); |
13 | int (*compare)(/*void *a,void *b*/)); | ||
14 | void lh_free(LHASH *table); | 12 | void lh_free(LHASH *table); |
15 | 13 | ||
16 | void *lh_insert(LHASH *table, void *data); | 14 | void *lh_insert(LHASH *table, void *data); |
17 | void *lh_delete(LHASH *table, void *data); | 15 | void *lh_delete(LHASH *table, void *data); |
18 | void *lh_retrieve(LHASH *table, void *data); | 16 | void *lh_retrieve(LHASH *table, void *data); |
19 | 17 | ||
20 | void lh_doall(LHASH *table, void (*func)(/*void *b*/)); | 18 | void lh_doall(LHASH *table, LHASH_DOALL_FN_TYPE func); |
21 | void lh_doall_arg(LHASH *table, void (*func)(/*void *a,void *b*/), | 19 | void lh_doall_arg(LHASH *table, LHASH_DOALL_ARG_FN_TYPE func, |
22 | void *arg); | 20 | void *arg); |
23 | 21 | ||
24 | int lh_error(LHASH *table); | 22 | int lh_error(LHASH *table); |
25 | 23 | ||
24 | typedef int (*LHASH_COMP_FN_TYPE)(const void *, const void *); | ||
25 | typedef unsigned long (*LHASH_HASH_FN_TYPE)(const void *); | ||
26 | typedef void (*LHASH_DOALL_FN_TYPE)(const void *); | ||
27 | typedef void (*LHASH_DOALL_ARG_FN_TYPE)(const void *, const void *); | ||
28 | |||
26 | =head1 DESCRIPTION | 29 | =head1 DESCRIPTION |
27 | 30 | ||
28 | This library implements dynamic hash tables. The hash table entries | 31 | This library implements dynamic hash tables. The hash table entries |
29 | can be arbitrary structures. Usually they consist of key and value | 32 | can be arbitrary structures. Usually they consist of key and value |
30 | fields. | 33 | fields. |
31 | 34 | ||
32 | lh_new() creates a new B<LHASH> structure. B<hash> takes a pointer to | 35 | lh_new() creates a new B<LHASH> structure to store arbitrary data |
33 | the structure and returns an unsigned long hash value of its key | 36 | entries, and provides the 'hash' and 'compare' callbacks to be used in |
34 | field. The hash value is normally truncated to a power of 2, so make | 37 | organising the table's entries. The B<hash> callback takes a pointer |
35 | sure that your hash function returns well mixed low order | 38 | to a table entry as its argument and returns an unsigned long hash |
36 | bits. B<compare> takes two arguments, and returns 0 if their keys are | 39 | value for its key field. The hash value is normally truncated to a |
37 | equal, non-zero otherwise. | 40 | power of 2, so make sure that your hash function returns well mixed |
41 | low order bits. The B<compare> callback takes two arguments (pointers | ||
42 | to two hash table entries), and returns 0 if their keys are equal, | ||
43 | non-zero otherwise. If your hash table will contain items of some | ||
44 | particular type and the B<hash> and B<compare> callbacks hash/compare | ||
45 | these types, then the B<DECLARE_LHASH_HASH_FN> and | ||
46 | B<IMPLEMENT_LHASH_COMP_FN> macros can be used to create callback | ||
47 | wrappers of the prototypes required by lh_new(). These provide | ||
48 | per-variable casts before calling the type-specific callbacks written | ||
49 | by the application author. These macros, as well as those used for | ||
50 | the "doall" callbacks, are defined as; | ||
51 | |||
52 | #define DECLARE_LHASH_HASH_FN(f_name,o_type) \ | ||
53 | unsigned long f_name##_LHASH_HASH(const void *); | ||
54 | #define IMPLEMENT_LHASH_HASH_FN(f_name,o_type) \ | ||
55 | unsigned long f_name##_LHASH_HASH(const void *arg) { \ | ||
56 | o_type a = (o_type)arg; \ | ||
57 | return f_name(a); } | ||
58 | #define LHASH_HASH_FN(f_name) f_name##_LHASH_HASH | ||
59 | |||
60 | #define DECLARE_LHASH_COMP_FN(f_name,o_type) \ | ||
61 | int f_name##_LHASH_COMP(const void *, const void *); | ||
62 | #define IMPLEMENT_LHASH_COMP_FN(f_name,o_type) \ | ||
63 | int f_name##_LHASH_COMP(const void *arg1, const void *arg2) { \ | ||
64 | o_type a = (o_type)arg1; \ | ||
65 | o_type b = (o_type)arg2; \ | ||
66 | return f_name(a,b); } | ||
67 | #define LHASH_COMP_FN(f_name) f_name##_LHASH_COMP | ||
68 | |||
69 | #define DECLARE_LHASH_DOALL_FN(f_name,o_type) \ | ||
70 | void f_name##_LHASH_DOALL(const void *); | ||
71 | #define IMPLEMENT_LHASH_DOALL_FN(f_name,o_type) \ | ||
72 | void f_name##_LHASH_DOALL(const void *arg) { \ | ||
73 | o_type a = (o_type)arg; \ | ||
74 | f_name(a); } | ||
75 | #define LHASH_DOALL_FN(f_name) f_name##_LHASH_DOALL | ||
76 | |||
77 | #define DECLARE_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \ | ||
78 | void f_name##_LHASH_DOALL_ARG(const void *, const void *); | ||
79 | #define IMPLEMENT_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \ | ||
80 | void f_name##_LHASH_DOALL_ARG(const void *arg1, const void *arg2) { \ | ||
81 | o_type a = (o_type)arg1; \ | ||
82 | a_type b = (a_type)arg2; \ | ||
83 | f_name(a,b); } | ||
84 | #define LHASH_DOALL_ARG_FN(f_name) f_name##_LHASH_DOALL_ARG | ||
85 | |||
86 | An example of a hash table storing (pointers to) structures of type 'STUFF' | ||
87 | could be defined as follows; | ||
88 | |||
89 | /* Calculates the hash value of 'tohash' (implemented elsewhere) */ | ||
90 | unsigned long STUFF_hash(const STUFF *tohash); | ||
91 | /* Orders 'arg1' and 'arg2' (implemented elsewhere) */ | ||
92 | int STUFF_cmp(const STUFF *arg1, const STUFF *arg2); | ||
93 | /* Create the type-safe wrapper functions for use in the LHASH internals */ | ||
94 | static IMPLEMENT_LHASH_HASH_FN(STUFF_hash, const STUFF *) | ||
95 | static IMPLEMENT_LHASH_COMP_FN(STUFF_cmp, const STUFF *); | ||
96 | /* ... */ | ||
97 | int main(int argc, char *argv[]) { | ||
98 | /* Create the new hash table using the hash/compare wrappers */ | ||
99 | LHASH *hashtable = lh_new(LHASH_HASH_FN(STUFF_hash), | ||
100 | LHASH_COMP_FN(STUFF_cmp)); | ||
101 | /* ... */ | ||
102 | } | ||
38 | 103 | ||
39 | lh_free() frees the B<LHASH> structure B<table>. Allocated hash table | 104 | lh_free() frees the B<LHASH> structure B<table>. Allocated hash table |
40 | entries will not be freed; consider using lh_doall() to deallocate any | 105 | entries will not be freed; consider using lh_doall() to deallocate any |
41 | remaining entries in the hash table. | 106 | remaining entries in the hash table (see below). |
42 | 107 | ||
43 | lh_insert() inserts the structure pointed to by B<data> into B<table>. | 108 | lh_insert() inserts the structure pointed to by B<data> into B<table>. |
44 | If there already is an entry with the same key, the old value is | 109 | If there already is an entry with the same key, the old value is |
@@ -52,23 +117,53 @@ a structure with the key field(s) set; the function will return a | |||
52 | pointer to a fully populated structure. | 117 | pointer to a fully populated structure. |
53 | 118 | ||
54 | lh_doall() will, for every entry in the hash table, call B<func> with | 119 | lh_doall() will, for every entry in the hash table, call B<func> with |
55 | the data item as parameters. | 120 | the data item as its parameter. For lh_doall() and lh_doall_arg(), |
56 | This function can be quite useful when used as follows: | 121 | function pointer casting should be avoided in the callbacks (see |
57 | void cleanup(STUFF *a) | 122 | B<NOTE>) - instead, either declare the callbacks to match the |
58 | { STUFF_free(a); } | 123 | prototype required in lh_new() or use the declare/implement macros to |
59 | lh_doall(hash,cleanup); | 124 | create type-safe wrappers that cast variables prior to calling your |
60 | lh_free(hash); | 125 | type-specific callbacks. An example of this is illustrated here where |
61 | This can be used to free all the entries. lh_free() then cleans up the | 126 | the callback is used to cleanup resources for items in the hash table |
62 | 'buckets' that point to nothing. When doing this, be careful if you | 127 | prior to the hashtable itself being deallocated: |
63 | delete entries from the hash table in B<func>: the table may decrease | 128 | |
64 | in size, moving item that you are currently on down lower in the hash | 129 | /* Cleans up resources belonging to 'a' (this is implemented elsewhere) */ |
65 | table. This could cause some entries to be skipped. The best | 130 | void STUFF_cleanup(STUFF *a); |
66 | solution to this problem is to set hash-E<gt>down_load=0 before you | 131 | /* Implement a prototype-compatible wrapper for "STUFF_cleanup" */ |
67 | start. This will stop the hash table ever being decreased in size. | 132 | IMPLEMENT_LHASH_DOALL_FN(STUFF_cleanup, STUFF *) |
68 | 133 | /* ... then later in the code ... */ | |
69 | lh_doall_arg() is the same as lh_doall() except that B<func> will | 134 | /* So to run "STUFF_cleanup" against all items in a hash table ... */ |
70 | be called with B<arg> as the second argument. | 135 | lh_doall(hashtable, LHASH_DOALL_FN(STUFF_cleanup)); |
71 | 136 | /* Then the hash table itself can be deallocated */ | |
137 | lh_free(hashtable); | ||
138 | |||
139 | When doing this, be careful if you delete entries from the hash table | ||
140 | in your callbacks: the table may decrease in size, moving the item | ||
141 | that you are currently on down lower in the hash table - this could | ||
142 | cause some entries to be skipped during the iteration. The second | ||
143 | best solution to this problem is to set hash-E<gt>down_load=0 before | ||
144 | you start (which will stop the hash table ever decreasing in size). | ||
145 | The best solution is probably to avoid deleting items from the hash | ||
146 | table inside a "doall" callback! | ||
147 | |||
148 | lh_doall_arg() is the same as lh_doall() except that B<func> will be | ||
149 | called with B<arg> as the second argument and B<func> should be of | ||
150 | type B<LHASH_DOALL_ARG_FN_TYPE> (a callback prototype that is passed | ||
151 | both the table entry and an extra argument). As with lh_doall(), you | ||
152 | can instead choose to declare your callback with a prototype matching | ||
153 | the types you are dealing with and use the declare/implement macros to | ||
154 | create compatible wrappers that cast variables before calling your | ||
155 | type-specific callbacks. An example of this is demonstrated here | ||
156 | (printing all hash table entries to a BIO that is provided by the | ||
157 | caller): | ||
158 | |||
159 | /* Prints item 'a' to 'output_bio' (this is implemented elsewhere) */ | ||
160 | void STUFF_print(const STUFF *a, BIO *output_bio); | ||
161 | /* Implement a prototype-compatible wrapper for "STUFF_print" */ | ||
162 | static IMPLEMENT_LHASH_DOALL_ARG_FN(STUFF_print, const STUFF *, BIO *) | ||
163 | /* ... then later in the code ... */ | ||
164 | /* Print out the entire hashtable to a particular BIO */ | ||
165 | lh_doall_arg(hashtable, LHASH_DOALL_ARG_FN(STUFF_print), logging_bio); | ||
166 | |||
72 | lh_error() can be used to determine if an error occurred in the last | 167 | lh_error() can be used to determine if an error occurred in the last |
73 | operation. lh_error() is a macro. | 168 | operation. lh_error() is a macro. |
74 | 169 | ||
@@ -91,6 +186,45 @@ otherwise. | |||
91 | 186 | ||
92 | lh_free(), lh_doall() and lh_doall_arg() return no values. | 187 | lh_free(), lh_doall() and lh_doall_arg() return no values. |
93 | 188 | ||
189 | =head1 NOTE | ||
190 | |||
191 | The various LHASH macros and callback types exist to make it possible | ||
192 | to write type-safe code without resorting to function-prototype | ||
193 | casting - an evil that makes application code much harder to | ||
194 | audit/verify and also opens the window of opportunity for stack | ||
195 | corruption and other hard-to-find bugs. It also, apparently, violates | ||
196 | ANSI-C. | ||
197 | |||
198 | The LHASH code regards table entries as constant data. As such, it | ||
199 | internally represents lh_insert()'d items with a "const void *" | ||
200 | pointer type. This is why callbacks such as those used by lh_doall() | ||
201 | and lh_doall_arg() declare their prototypes with "const", even for the | ||
202 | parameters that pass back the table items' data pointers - for | ||
203 | consistency, user-provided data is "const" at all times as far as the | ||
204 | LHASH code is concerned. However, as callers are themselves providing | ||
205 | these pointers, they can choose whether they too should be treating | ||
206 | all such parameters as constant. | ||
207 | |||
208 | As an example, a hash table may be maintained by code that, for | ||
209 | reasons of encapsulation, has only "const" access to the data being | ||
210 | indexed in the hash table (ie. it is returned as "const" from | ||
211 | elsewhere in their code) - in this case the LHASH prototypes are | ||
212 | appropriate as-is. Conversely, if the caller is responsible for the | ||
213 | life-time of the data in question, then they may well wish to make | ||
214 | modifications to table item passed back in the lh_doall() or | ||
215 | lh_doall_arg() callbacks (see the "STUFF_cleanup" example above). If | ||
216 | so, the caller can either cast the "const" away (if they're providing | ||
217 | the raw callbacks themselves) or use the macros to declare/implement | ||
218 | the wrapper functions without "const" types. | ||
219 | |||
220 | Callers that only have "const" access to data they're indexing in a | ||
221 | table, yet declare callbacks without constant types (or cast the | ||
222 | "const" away themselves), are therefore creating their own risks/bugs | ||
223 | without being encouraged to do so by the API. On a related note, | ||
224 | those auditing code should pay special attention to any instances of | ||
225 | DECLARE/IMPLEMENT_LHASH_DOALL_[ARG_]_FN macros that provide types | ||
226 | without any "const" qualifiers. | ||
227 | |||
94 | =head1 BUGS | 228 | =head1 BUGS |
95 | 229 | ||
96 | lh_insert() returns B<NULL> both for success and error. | 230 | lh_insert() returns B<NULL> both for success and error. |
@@ -131,7 +265,7 @@ generating hashes that are the same for different values. It is | |||
131 | probably worth changing your hash function if this is the case because | 265 | probably worth changing your hash function if this is the case because |
132 | even if your hash table has 10 items in a 'bucket', it can be searched | 266 | even if your hash table has 10 items in a 'bucket', it can be searched |
133 | with 10 B<unsigned long> compares and 10 linked list traverses. This | 267 | with 10 B<unsigned long> compares and 10 linked list traverses. This |
134 | will be much less expensive that 10 calls to you compare function. | 268 | will be much less expensive that 10 calls to your compare function. |
135 | 269 | ||
136 | lh_strhash() is a demo string hashing function: | 270 | lh_strhash() is a demo string hashing function: |
137 | 271 | ||
diff --git a/src/lib/libssl/src/doc/crypto/pem.pod b/src/lib/libssl/src/doc/crypto/pem.pod new file mode 100644 index 0000000000..a4f8cc3337 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/pem.pod | |||
@@ -0,0 +1,476 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | PEM - PEM routines | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/pem.h> | ||
10 | |||
11 | EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, | ||
12 | pem_password_cb *cb, void *u); | ||
13 | |||
14 | EVP_PKEY *PEM_read_PrivateKey(FILE *fp, EVP_PKEY **x, | ||
15 | pem_password_cb *cb, void *u); | ||
16 | |||
17 | int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, | ||
18 | unsigned char *kstr, int klen, | ||
19 | pem_password_cb *cb, void *u); | ||
20 | |||
21 | int PEM_write_PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, | ||
22 | unsigned char *kstr, int klen, | ||
23 | pem_password_cb *cb, void *u); | ||
24 | |||
25 | int PEM_write_bio_PKCS8PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, | ||
26 | char *kstr, int klen, | ||
27 | pem_password_cb *cb, void *u); | ||
28 | |||
29 | int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, | ||
30 | char *kstr, int klen, | ||
31 | pem_password_cb *cb, void *u); | ||
32 | |||
33 | int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid, | ||
34 | char *kstr, int klen, | ||
35 | pem_password_cb *cb, void *u); | ||
36 | |||
37 | int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, | ||
38 | char *kstr, int klen, | ||
39 | pem_password_cb *cb, void *u); | ||
40 | |||
41 | EVP_PKEY *PEM_read_bio_PUBKEY(BIO *bp, EVP_PKEY **x, | ||
42 | pem_password_cb *cb, void *u); | ||
43 | |||
44 | EVP_PKEY *PEM_read_PUBKEY(FILE *fp, EVP_PKEY **x, | ||
45 | pem_password_cb *cb, void *u); | ||
46 | |||
47 | int PEM_write_bio_PUBKEY(BIO *bp, EVP_PKEY *x); | ||
48 | int PEM_write_PUBKEY(FILE *fp, EVP_PKEY *x); | ||
49 | |||
50 | RSA *PEM_read_bio_RSAPrivateKey(BIO *bp, RSA **x, | ||
51 | pem_password_cb *cb, void *u); | ||
52 | |||
53 | RSA *PEM_read_RSAPrivateKey(FILE *fp, RSA **x, | ||
54 | pem_password_cb *cb, void *u); | ||
55 | |||
56 | int PEM_write_bio_RSAPrivateKey(BIO *bp, RSA *x, const EVP_CIPHER *enc, | ||
57 | unsigned char *kstr, int klen, | ||
58 | pem_password_cb *cb, void *u); | ||
59 | |||
60 | int PEM_write_RSAPrivateKey(FILE *fp, RSA *x, const EVP_CIPHER *enc, | ||
61 | unsigned char *kstr, int klen, | ||
62 | pem_password_cb *cb, void *u); | ||
63 | |||
64 | RSA *PEM_read_bio_RSAPublicKey(BIO *bp, RSA **x, | ||
65 | pem_password_cb *cb, void *u); | ||
66 | |||
67 | RSA *PEM_read_RSAPublicKey(FILE *fp, RSA **x, | ||
68 | pem_password_cb *cb, void *u); | ||
69 | |||
70 | int PEM_write_bio_RSAPublicKey(BIO *bp, RSA *x); | ||
71 | |||
72 | int PEM_write_RSAPublicKey(FILE *fp, RSA *x); | ||
73 | |||
74 | RSA *PEM_read_bio_RSA_PUBKEY(BIO *bp, RSA **x, | ||
75 | pem_password_cb *cb, void *u); | ||
76 | |||
77 | RSA *PEM_read_RSA_PUBKEY(FILE *fp, RSA **x, | ||
78 | pem_password_cb *cb, void *u); | ||
79 | |||
80 | int PEM_write_bio_RSA_PUBKEY(BIO *bp, RSA *x); | ||
81 | |||
82 | int PEM_write_RSA_PUBKEY(FILE *fp, RSA *x); | ||
83 | |||
84 | DSA *PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **x, | ||
85 | pem_password_cb *cb, void *u); | ||
86 | |||
87 | DSA *PEM_read_DSAPrivateKey(FILE *fp, DSA **x, | ||
88 | pem_password_cb *cb, void *u); | ||
89 | |||
90 | int PEM_write_bio_DSAPrivateKey(BIO *bp, DSA *x, const EVP_CIPHER *enc, | ||
91 | unsigned char *kstr, int klen, | ||
92 | pem_password_cb *cb, void *u); | ||
93 | |||
94 | int PEM_write_DSAPrivateKey(FILE *fp, DSA *x, const EVP_CIPHER *enc, | ||
95 | unsigned char *kstr, int klen, | ||
96 | pem_password_cb *cb, void *u); | ||
97 | |||
98 | DSA *PEM_read_bio_DSA_PUBKEY(BIO *bp, DSA **x, | ||
99 | pem_password_cb *cb, void *u); | ||
100 | |||
101 | DSA *PEM_read_DSA_PUBKEY(FILE *fp, DSA **x, | ||
102 | pem_password_cb *cb, void *u); | ||
103 | |||
104 | int PEM_write_bio_DSA_PUBKEY(BIO *bp, DSA *x); | ||
105 | |||
106 | int PEM_write_DSA_PUBKEY(FILE *fp, DSA *x); | ||
107 | |||
108 | DSA *PEM_read_bio_DSAparams(BIO *bp, DSA **x, pem_password_cb *cb, void *u); | ||
109 | |||
110 | DSA *PEM_read_DSAparams(FILE *fp, DSA **x, pem_password_cb *cb, void *u); | ||
111 | |||
112 | int PEM_write_bio_DSAparams(BIO *bp, DSA *x); | ||
113 | |||
114 | int PEM_write_DSAparams(FILE *fp, DSA *x); | ||
115 | |||
116 | DH *PEM_read_bio_DHparams(BIO *bp, DH **x, pem_password_cb *cb, void *u); | ||
117 | |||
118 | DH *PEM_read_DHparams(FILE *fp, DH **x, pem_password_cb *cb, void *u); | ||
119 | |||
120 | int PEM_write_bio_DHparams(BIO *bp, DH *x); | ||
121 | |||
122 | int PEM_write_DHparams(FILE *fp, DH *x); | ||
123 | |||
124 | X509 *PEM_read_bio_X509(BIO *bp, X509 **x, pem_password_cb *cb, void *u); | ||
125 | |||
126 | X509 *PEM_read_X509(FILE *fp, X509 **x, pem_password_cb *cb, void *u); | ||
127 | |||
128 | int PEM_write_bio_X509(BIO *bp, X509 *x); | ||
129 | |||
130 | int PEM_write_X509(FILE *fp, X509 *x); | ||
131 | |||
132 | X509 *PEM_read_bio_X509_AUX(BIO *bp, X509 **x, pem_password_cb *cb, void *u); | ||
133 | |||
134 | X509 *PEM_read_X509_AUX(FILE *fp, X509 **x, pem_password_cb *cb, void *u); | ||
135 | |||
136 | int PEM_write_bio_X509_AUX(BIO *bp, X509 *x); | ||
137 | |||
138 | int PEM_write_X509_AUX(FILE *fp, X509 *x); | ||
139 | |||
140 | X509_REQ *PEM_read_bio_X509_REQ(BIO *bp, X509_REQ **x, | ||
141 | pem_password_cb *cb, void *u); | ||
142 | |||
143 | X509_REQ *PEM_read_X509_REQ(FILE *fp, X509_REQ **x, | ||
144 | pem_password_cb *cb, void *u); | ||
145 | |||
146 | int PEM_write_bio_X509_REQ(BIO *bp, X509_REQ *x); | ||
147 | |||
148 | int PEM_write_X509_REQ(FILE *fp, X509_REQ *x); | ||
149 | |||
150 | int PEM_write_bio_X509_REQ_NEW(BIO *bp, X509_REQ *x); | ||
151 | |||
152 | int PEM_write_X509_REQ_NEW(FILE *fp, X509_REQ *x); | ||
153 | |||
154 | X509_CRL *PEM_read_bio_X509_CRL(BIO *bp, X509_CRL **x, | ||
155 | pem_password_cb *cb, void *u); | ||
156 | X509_CRL *PEM_read_X509_CRL(FILE *fp, X509_CRL **x, | ||
157 | pem_password_cb *cb, void *u); | ||
158 | int PEM_write_bio_X509_CRL(BIO *bp, X509_CRL *x); | ||
159 | int PEM_write_X509_CRL(FILE *fp, X509_CRL *x); | ||
160 | |||
161 | PKCS7 *PEM_read_bio_PKCS7(BIO *bp, PKCS7 **x, pem_password_cb *cb, void *u); | ||
162 | |||
163 | PKCS7 *PEM_read_PKCS7(FILE *fp, PKCS7 **x, pem_password_cb *cb, void *u); | ||
164 | |||
165 | int PEM_write_bio_PKCS7(BIO *bp, PKCS7 *x); | ||
166 | |||
167 | int PEM_write_PKCS7(FILE *fp, PKCS7 *x); | ||
168 | |||
169 | NETSCAPE_CERT_SEQUENCE *PEM_read_bio_NETSCAPE_CERT_SEQUENCE(BIO *bp, | ||
170 | NETSCAPE_CERT_SEQUENCE **x, | ||
171 | pem_password_cb *cb, void *u); | ||
172 | |||
173 | NETSCAPE_CERT_SEQUENCE *PEM_read_NETSCAPE_CERT_SEQUENCE(FILE *fp, | ||
174 | NETSCAPE_CERT_SEQUENCE **x, | ||
175 | pem_password_cb *cb, void *u); | ||
176 | |||
177 | int PEM_write_bio_NETSCAPE_CERT_SEQUENCE(BIO *bp, NETSCAPE_CERT_SEQUENCE *x); | ||
178 | |||
179 | int PEM_write_NETSCAPE_CERT_SEQUENCE(FILE *fp, NETSCAPE_CERT_SEQUENCE *x); | ||
180 | |||
181 | =head1 DESCRIPTION | ||
182 | |||
183 | The PEM functions read or write structures in PEM format. In | ||
184 | this sense PEM format is simply base64 encoded data surrounded | ||
185 | by header lines. | ||
186 | |||
187 | For more details about the meaning of arguments see the | ||
188 | B<PEM FUNCTION ARGUMENTS> section. | ||
189 | |||
190 | Each operation has four functions associated with it. For | ||
191 | clarity the term "B<foobar> functions" will be used to collectively | ||
192 | refer to the PEM_read_bio_foobar(), PEM_read_foobar(), | ||
193 | PEM_write_bio_foobar() and PEM_write_foobar() functions. | ||
194 | |||
195 | The B<PrivateKey> functions read or write a private key in | ||
196 | PEM format using an EVP_PKEY structure. The write routines use | ||
197 | "traditional" private key format and can handle both RSA and DSA | ||
198 | private keys. The read functions can additionally transparently | ||
199 | handle PKCS#8 format encrypted and unencrypted keys too. | ||
200 | |||
201 | PEM_write_bio_PKCS8PrivateKey() and PEM_write_PKCS8PrivateKey() | ||
202 | write a private key in an EVP_PKEY structure in PKCS#8 | ||
203 | EncryptedPrivateKeyInfo format using PKCS#5 v2.0 password based encryption | ||
204 | algorithms. The B<cipher> argument specifies the encryption algoritm to | ||
205 | use: unlike all other PEM routines the encryption is applied at the | ||
206 | PKCS#8 level and not in the PEM headers. If B<cipher> is NULL then no | ||
207 | encryption is used and a PKCS#8 PrivateKeyInfo structure is used instead. | ||
208 | |||
209 | PEM_write_bio_PKCS8PrivateKey_nid() and PEM_write_PKCS8PrivateKey_nid() | ||
210 | also write out a private key as a PKCS#8 EncryptedPrivateKeyInfo however | ||
211 | it uses PKCS#5 v1.5 or PKCS#12 encryption algorithms instead. The algorithm | ||
212 | to use is specified in the B<nid> parameter and should be the NID of the | ||
213 | corresponding OBJECT IDENTIFIER (see NOTES section). | ||
214 | |||
215 | The B<PUBKEY> functions process a public key using an EVP_PKEY | ||
216 | structure. The public key is encoded as a SubjectPublicKeyInfo | ||
217 | structure. | ||
218 | |||
219 | The B<RSAPrivateKey> functions process an RSA private key using an | ||
220 | RSA structure. It handles the same formats as the B<PrivateKey> | ||
221 | functions but an error occurs if the private key is not RSA. | ||
222 | |||
223 | The B<RSAPublicKey> functions process an RSA public key using an | ||
224 | RSA structure. The public key is encoded using a PKCS#1 RSAPublicKey | ||
225 | structure. | ||
226 | |||
227 | The B<RSA_PUBKEY> functions also process an RSA public key using | ||
228 | an RSA structure. However the public key is encoded using a | ||
229 | SubjectPublicKeyInfo structure and an error occurs if the public | ||
230 | key is not RSA. | ||
231 | |||
232 | The B<DSAPrivateKey> functions process a DSA private key using a | ||
233 | DSA structure. It handles the same formats as the B<PrivateKey> | ||
234 | functions but an error occurs if the private key is not DSA. | ||
235 | |||
236 | The B<DSA_PUBKEY> functions process a DSA public key using | ||
237 | a DSA structure. The public key is encoded using a | ||
238 | SubjectPublicKeyInfo structure and an error occurs if the public | ||
239 | key is not DSA. | ||
240 | |||
241 | The B<DSAparams> functions process DSA parameters using a DSA | ||
242 | structure. The parameters are encoded using a foobar structure. | ||
243 | |||
244 | The B<DHparams> functions process DH parameters using a DH | ||
245 | structure. The parameters are encoded using a PKCS#3 DHparameter | ||
246 | structure. | ||
247 | |||
248 | The B<X509> functions process an X509 certificate using an X509 | ||
249 | structure. They will also process a trusted X509 certificate but | ||
250 | any trust settings are discarded. | ||
251 | |||
252 | The B<X509_AUX> functions process a trusted X509 certificate using | ||
253 | an X509 structure. | ||
254 | |||
255 | The B<X509_REQ> and B<X509_REQ_NEW> functions process a PKCS#10 | ||
256 | certificate request using an X509_REQ structure. The B<X509_REQ> | ||
257 | write functions use B<CERTIFICATE REQUEST> in the header whereas | ||
258 | the B<X509_REQ_NEW> functions use B<NEW CERTIFICATE REQUEST> | ||
259 | (as required by some CAs). The B<X509_REQ> read functions will | ||
260 | handle either form so there are no B<X509_REQ_NEW> read functions. | ||
261 | |||
262 | The B<X509_CRL> functions process an X509 CRL using an X509_CRL | ||
263 | structure. | ||
264 | |||
265 | The B<PKCS7> functions process a PKCS#7 ContentInfo using a PKCS7 | ||
266 | structure. | ||
267 | |||
268 | The B<NETSCAPE_CERT_SEQUENCE> functions process a Netscape Certificate | ||
269 | Sequence using a NETSCAPE_CERT_SEQUENCE structure. | ||
270 | |||
271 | =head1 PEM FUNCTION ARGUMENTS | ||
272 | |||
273 | The PEM functions have many common arguments. | ||
274 | |||
275 | The B<bp> BIO parameter (if present) specifies the BIO to read from | ||
276 | or write to. | ||
277 | |||
278 | The B<fp> FILE parameter (if present) specifies the FILE pointer to | ||
279 | read from or write to. | ||
280 | |||
281 | The PEM read functions all take an argument B<TYPE **x> and return | ||
282 | a B<TYPE *> pointer. Where B<TYPE> is whatever structure the function | ||
283 | uses. If B<x> is NULL then the parameter is ignored. If B<x> is not | ||
284 | NULL but B<*x> is NULL then the structure returned will be written | ||
285 | to B<*x>. If neither B<x> nor B<*x> is NULL then an attempt is made | ||
286 | to reuse the structure at B<*x> (but see BUGS and EXAMPLES sections). | ||
287 | Irrespective of the value of B<x> a pointer to the structure is always | ||
288 | returned (or NULL if an error occurred). | ||
289 | |||
290 | The PEM functions which write private keys take an B<enc> parameter | ||
291 | which specifies the encryption algorithm to use, encryption is done | ||
292 | at the PEM level. If this parameter is set to NULL then the private | ||
293 | key is written in unencrypted form. | ||
294 | |||
295 | The B<cb> argument is the callback to use when querying for the pass | ||
296 | phrase used for encrypted PEM structures (normally only private keys). | ||
297 | |||
298 | For the PEM write routines if the B<kstr> parameter is not NULL then | ||
299 | B<klen> bytes at B<kstr> are used as the passphrase and B<cb> is | ||
300 | ignored. | ||
301 | |||
302 | If the B<cb> parameters is set to NULL and the B<u> parameter is not | ||
303 | NULL then the B<u> parameter is interpreted as a null terminated string | ||
304 | to use as the passphrase. If both B<cb> and B<u> are NULL then the | ||
305 | default callback routine is used which will typically prompt for the | ||
306 | passphrase on the current terminal with echoing turned off. | ||
307 | |||
308 | The default passphrase callback is sometimes inappropriate (for example | ||
309 | in a GUI application) so an alternative can be supplied. The callback | ||
310 | routine has the following form: | ||
311 | |||
312 | int cb(char *buf, int size, int rwflag, void *u); | ||
313 | |||
314 | B<buf> is the buffer to write the passphrase to. B<size> is the maximum | ||
315 | length of the passphrase (i.e. the size of buf). B<rwflag> is a flag | ||
316 | which is set to 0 when reading and 1 when writing. A typical routine | ||
317 | will ask the user to verify the passphrase (for example by prompting | ||
318 | for it twice) if B<rwflag> is 1. The B<u> parameter has the same | ||
319 | value as the B<u> parameter passed to the PEM routine. It allows | ||
320 | arbitrary data to be passed to the callback by the application | ||
321 | (for example a window handle in a GUI application). The callback | ||
322 | B<must> return the number of characters in the passphrase or 0 if | ||
323 | an error occurred. | ||
324 | |||
325 | =head1 EXAMPLES | ||
326 | |||
327 | Although the PEM routines take several arguments in almost all applications | ||
328 | most of them are set to 0 or NULL. | ||
329 | |||
330 | Read a certificate in PEM format from a BIO: | ||
331 | |||
332 | X509 *x; | ||
333 | x = PEM_read_bio(bp, NULL, 0, NULL); | ||
334 | if (x == NULL) | ||
335 | { | ||
336 | /* Error */ | ||
337 | } | ||
338 | |||
339 | Alternative method: | ||
340 | |||
341 | X509 *x = NULL; | ||
342 | if (!PEM_read_bio_X509(bp, &x, 0, NULL)) | ||
343 | { | ||
344 | /* Error */ | ||
345 | } | ||
346 | |||
347 | Write a certificate to a BIO: | ||
348 | |||
349 | if (!PEM_write_bio_X509(bp, x)) | ||
350 | { | ||
351 | /* Error */ | ||
352 | } | ||
353 | |||
354 | Write an unencrypted private key to a FILE pointer: | ||
355 | |||
356 | if (!PEM_write_PrivateKey(fp, key, NULL, NULL, 0, 0, NULL)) | ||
357 | { | ||
358 | /* Error */ | ||
359 | } | ||
360 | |||
361 | Write a private key (using traditional format) to a BIO using | ||
362 | triple DES encryption, the pass phrase is prompted for: | ||
363 | |||
364 | if (!PEM_write_bio_PrivateKey(bp, key, EVP_des_ede3_cbc(), NULL, 0, 0, NULL)) | ||
365 | { | ||
366 | /* Error */ | ||
367 | } | ||
368 | |||
369 | Write a private key (using PKCS#8 format) to a BIO using triple | ||
370 | DES encryption, using the pass phrase "hello": | ||
371 | |||
372 | if (!PEM_write_bio_PKCS8PrivateKey(bp, key, EVP_des_ede3_cbc(), NULL, 0, 0, "hello")) | ||
373 | { | ||
374 | /* Error */ | ||
375 | } | ||
376 | |||
377 | Read a private key from a BIO using the pass phrase "hello": | ||
378 | |||
379 | key = PEM_read_bio_PrivateKey(bp, NULL, 0, "hello"); | ||
380 | if (key == NULL) | ||
381 | { | ||
382 | /* Error */ | ||
383 | } | ||
384 | |||
385 | Read a private key from a BIO using a pass phrase callback: | ||
386 | |||
387 | key = PEM_read_bio_PrivateKey(bp, NULL, pass_cb, "My Private Key"); | ||
388 | if (key == NULL) | ||
389 | { | ||
390 | /* Error */ | ||
391 | } | ||
392 | |||
393 | Skeleton pass phrase callback: | ||
394 | |||
395 | int pass_cb(char *buf, int size, int rwflag, void *u); | ||
396 | { | ||
397 | int len; | ||
398 | char *tmp; | ||
399 | /* We'd probably do something else if 'rwflag' is 1 */ | ||
400 | printf("Enter pass phrase for \"%s\"\n", u); | ||
401 | |||
402 | /* get pass phrase, length 'len' into 'tmp' */ | ||
403 | tmp = "hello"; | ||
404 | len = strlen(tmp); | ||
405 | |||
406 | if (len <= 0) return 0; | ||
407 | /* if too long, truncate */ | ||
408 | if (len > size) len = size; | ||
409 | memcpy(buf, tmp, len); | ||
410 | return len; | ||
411 | } | ||
412 | |||
413 | =head1 NOTES | ||
414 | |||
415 | The old B<PrivateKey> write routines are retained for compatibility. | ||
416 | New applications should write private keys using the | ||
417 | PEM_write_bio_PKCS8PrivateKey() or PEM_write_PKCS8PrivateKey() routines | ||
418 | because they are more secure (they use an iteration count of 2048 whereas | ||
419 | the traditional routines use a count of 1) unless compatibility with older | ||
420 | versions of OpenSSL is important. | ||
421 | |||
422 | The B<PrivateKey> read routines can be used in all applications because | ||
423 | they handle all formats transparently. | ||
424 | |||
425 | A frequent cause of problems is attempting to use the PEM routines like | ||
426 | this: | ||
427 | |||
428 | X509 *x; | ||
429 | PEM_read_bio_X509(bp, &x, 0, NULL); | ||
430 | |||
431 | this is a bug because an attempt will be made to reuse the data at B<x> | ||
432 | which is an uninitialised pointer. | ||
433 | |||
434 | =head1 PEM ENCRYPTION FORMAT | ||
435 | |||
436 | This old B<PrivateKey> routines use a non standard technique for encryption. | ||
437 | |||
438 | The private key (or other data) takes the following form: | ||
439 | |||
440 | -----BEGIN RSA PRIVATE KEY----- | ||
441 | Proc-Type: 4,ENCRYPTED | ||
442 | DEK-Info: DES-EDE3-CBC,3F17F5316E2BAC89 | ||
443 | |||
444 | ...base64 encoded data... | ||
445 | -----END RSA PRIVATE KEY----- | ||
446 | |||
447 | The line beginning DEK-Info contains two comma separated pieces of information: | ||
448 | the encryption algorithm name as used by EVP_get_cipherbyname() and an 8 | ||
449 | byte B<salt> encoded as a set of hexadecimal digits. | ||
450 | |||
451 | After this is the base64 encoded encrypted data. | ||
452 | |||
453 | The encryption key is determined using EVP_bytestokey(), using B<salt> and an | ||
454 | iteration count of 1. The IV used is the value of B<salt> and *not* the IV | ||
455 | returned by EVP_bytestokey(). | ||
456 | |||
457 | =head1 BUGS | ||
458 | |||
459 | The PEM read routines in some versions of OpenSSL will not correctly reuse | ||
460 | an existing structure. Therefore the following: | ||
461 | |||
462 | PEM_read_bio(bp, &x, 0, NULL); | ||
463 | |||
464 | where B<x> already contains a valid certificate, may not work, whereas: | ||
465 | |||
466 | X509_free(x); | ||
467 | x = PEM_read_bio(bp, NULL, 0, NULL); | ||
468 | |||
469 | is guaranteed to work. | ||
470 | |||
471 | =head1 RETURN CODES | ||
472 | |||
473 | The read routines return either a pointer to the structure read or NULL | ||
474 | is an error occurred. | ||
475 | |||
476 | The write routines return 1 for success or 0 for failure. | ||
diff --git a/src/lib/libssl/src/doc/crypto/rsa.pod b/src/lib/libssl/src/doc/crypto/rsa.pod index ef0d4df205..09ad30cab1 100644 --- a/src/lib/libssl/src/doc/crypto/rsa.pod +++ b/src/lib/libssl/src/doc/crypto/rsa.pod | |||
@@ -37,7 +37,6 @@ rsa - RSA public key cryptosystem | |||
37 | int RSA_set_method(RSA *rsa, ENGINE *engine); | 37 | int RSA_set_method(RSA *rsa, ENGINE *engine); |
38 | RSA_METHOD *RSA_get_method(RSA *rsa); | 38 | RSA_METHOD *RSA_get_method(RSA *rsa); |
39 | RSA_METHOD *RSA_PKCS1_SSLeay(void); | 39 | RSA_METHOD *RSA_PKCS1_SSLeay(void); |
40 | RSA_METHOD *RSA_PKCS1_RSAref(void); | ||
41 | RSA_METHOD *RSA_null_method(void); | 40 | RSA_METHOD *RSA_null_method(void); |
42 | int RSA_flags(RSA *rsa); | 41 | int RSA_flags(RSA *rsa); |
43 | RSA *RSA_new_method(ENGINE *engine); | 42 | RSA *RSA_new_method(ENGINE *engine); |
diff --git a/src/lib/libssl/src/doc/crypto/threads.pod b/src/lib/libssl/src/doc/crypto/threads.pod index bc7ff9b705..afa45cd76c 100644 --- a/src/lib/libssl/src/doc/crypto/threads.pod +++ b/src/lib/libssl/src/doc/crypto/threads.pod | |||
@@ -53,8 +53,10 @@ OpenSSL can safely be used in multi-threaded applications provided | |||
53 | that at least two callback functions are set. | 53 | that at least two callback functions are set. |
54 | 54 | ||
55 | locking_function(int mode, int n, const char *file, int line) is | 55 | locking_function(int mode, int n, const char *file, int line) is |
56 | needed to perform locking on shared data structures. Multi-threaded | 56 | needed to perform locking on shared data structures. |
57 | applications will crash at random if it is not set. | 57 | (Note that OpenSSL uses a number of global data structures that |
58 | will be implicitly shared whenever multiple threads use OpenSSL.) | ||
59 | Multi-threaded applications will crash at random if it is not set. | ||
58 | 60 | ||
59 | locking_function() must be able to handle up to CRYPTO_num_locks() | 61 | locking_function() must be able to handle up to CRYPTO_num_locks() |
60 | different mutex locks. It sets the B<n>-th lock if B<mode> & | 62 | different mutex locks. It sets the B<n>-th lock if B<mode> & |
diff --git a/src/lib/libssl/src/doc/crypto/ui.pod b/src/lib/libssl/src/doc/crypto/ui.pod new file mode 100644 index 0000000000..2b3535a746 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/ui.pod | |||
@@ -0,0 +1,194 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | UI_new, UI_new_method, UI_free, UI_add_input_string, UI_dup_input_string, | ||
6 | UI_add_verify_string, UI_dup_verify_string, UI_add_input_boolean, | ||
7 | UI_dup_input_boolean, UI_add_info_string, UI_dup_info_string, | ||
8 | UI_add_error_string, UI_dup_error_string, UI_construct_prompt | ||
9 | UI_add_user_data, UI_get0_user_data, UI_get0_result, UI_process, | ||
10 | UI_ctrl, UI_set_default_method, UI_get_default_method, UI_get_method, | ||
11 | UI_set_method, UI_OpenSSL, ERR_load_UI_strings - New User Interface | ||
12 | |||
13 | =head1 SYNOPSIS | ||
14 | |||
15 | #include <openssl/ui.h> | ||
16 | |||
17 | typedef struct ui_st UI; | ||
18 | typedef struct ui_method_st UI_METHOD; | ||
19 | |||
20 | UI *UI_new(void); | ||
21 | UI *UI_new_method(const UI_METHOD *method); | ||
22 | void UI_free(UI *ui); | ||
23 | |||
24 | int UI_add_input_string(UI *ui, const char *prompt, int flags, | ||
25 | char *result_buf, int minsize, int maxsize); | ||
26 | int UI_dup_input_string(UI *ui, const char *prompt, int flags, | ||
27 | char *result_buf, int minsize, int maxsize); | ||
28 | int UI_add_verify_string(UI *ui, const char *prompt, int flags, | ||
29 | char *result_buf, int minsize, int maxsize, const char *test_buf); | ||
30 | int UI_dup_verify_string(UI *ui, const char *prompt, int flags, | ||
31 | char *result_buf, int minsize, int maxsize, const char *test_buf); | ||
32 | int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc, | ||
33 | const char *ok_chars, const char *cancel_chars, | ||
34 | int flags, char *result_buf); | ||
35 | int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc, | ||
36 | const char *ok_chars, const char *cancel_chars, | ||
37 | int flags, char *result_buf); | ||
38 | int UI_add_info_string(UI *ui, const char *text); | ||
39 | int UI_dup_info_string(UI *ui, const char *text); | ||
40 | int UI_add_error_string(UI *ui, const char *text); | ||
41 | int UI_dup_error_string(UI *ui, const char *text); | ||
42 | |||
43 | /* These are the possible flags. They can be or'ed together. */ | ||
44 | #define UI_INPUT_FLAG_ECHO 0x01 | ||
45 | #define UI_INPUT_FLAG_DEFAULT_PWD 0x02 | ||
46 | |||
47 | char *UI_construct_prompt(UI *ui_method, | ||
48 | const char *object_desc, const char *object_name); | ||
49 | |||
50 | void *UI_add_user_data(UI *ui, void *user_data); | ||
51 | void *UI_get0_user_data(UI *ui); | ||
52 | |||
53 | const char *UI_get0_result(UI *ui, int i); | ||
54 | |||
55 | int UI_process(UI *ui); | ||
56 | |||
57 | int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)()); | ||
58 | #define UI_CTRL_PRINT_ERRORS 1 | ||
59 | #define UI_CTRL_IS_REDOABLE 2 | ||
60 | |||
61 | void UI_set_default_method(const UI_METHOD *meth); | ||
62 | const UI_METHOD *UI_get_default_method(void); | ||
63 | const UI_METHOD *UI_get_method(UI *ui); | ||
64 | const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth); | ||
65 | |||
66 | UI_METHOD *UI_OpenSSL(void); | ||
67 | |||
68 | =head1 DESCRIPTION | ||
69 | |||
70 | UI stands for User Interface, and is general purpose set of routines to | ||
71 | prompt the user for text-based information. Through user-written methods | ||
72 | (see L<ui_create(3)|ui_create(3)>), prompting can be done in any way | ||
73 | imaginable, be it plain text prompting, through dialog boxes or from a | ||
74 | cell phone. | ||
75 | |||
76 | All the functions work through a context of the type UI. This context | ||
77 | contains all the information needed to prompt correctly as well as a | ||
78 | reference to a UI_METHOD, which is an ordered vector of functions that | ||
79 | carry out the actual prompting. | ||
80 | |||
81 | The first thing to do is to create a UI with UI_new() or UI_new_method(), | ||
82 | then add information to it with the UI_add or UI_dup functions. Also, | ||
83 | user-defined random data can be passed down to the underlying method | ||
84 | through calls to UI_add_user_data. The default UI method doesn't care | ||
85 | about these data, but other methods might. Finally, use UI_process() | ||
86 | to actually perform the prompting and UI_get0_result() to find the result | ||
87 | to the prompt. | ||
88 | |||
89 | A UI can contain more than one prompt, which are performed in the given | ||
90 | sequence. Each prompt gets an index number which is returned by the | ||
91 | UI_add and UI_dup functions, and has to be used to get the corresponding | ||
92 | result with UI_get0_result(). | ||
93 | |||
94 | The functions are as follows: | ||
95 | |||
96 | UI_new() creates a new UI using the default UI method. When done with | ||
97 | this UI, it should be freed using UI_free(). | ||
98 | |||
99 | UI_new_method() creates a new UI using the given UI method. When done with | ||
100 | this UI, it should be freed using UI_free(). | ||
101 | |||
102 | UI_OpenSSL() returns the built-in UI method (note: not the default one, | ||
103 | since the default can be changed. See further on). This method is the | ||
104 | most machine/OS dependent part of OpenSSL and normally generates the | ||
105 | most problems when porting. | ||
106 | |||
107 | UI_free() removes a UI from memory, along with all other pieces of memory | ||
108 | that's connected to it, like duplicated input strings, results and others. | ||
109 | |||
110 | UI_add_input_string() and UI_add_verify_string() add a prompt to the UI, | ||
111 | as well as flags and a result buffer and the desired minimum and maximum | ||
112 | sizes of the result. The given information is used to prompt for | ||
113 | information, for example a password, and to verify a password (i.e. having | ||
114 | the user enter it twice and check that the same string was entered twice). | ||
115 | UI_add_verify_string() takes and extra argument that should be a pointer | ||
116 | to the result buffer of the input string that it's supposed to verify, or | ||
117 | verification will fail. | ||
118 | |||
119 | UI_add_input_boolean() adds a prompt to the UI that's supposed to be answered | ||
120 | in a boolean way, with a single character for yes and a different character | ||
121 | for no. A set of characters that can be used to cancel the prompt is given | ||
122 | as well. The prompt itself is really divided in two, one part being the | ||
123 | descriptive text (given through the I<prompt> argument) and one describing | ||
124 | the possible answers (given through the I<action_desc> argument). | ||
125 | |||
126 | UI_add_info_string() and UI_add_error_string() add strings that are shown at | ||
127 | the same time as the prompt for extra information or to show an error string. | ||
128 | The difference between the two is only conceptual. With the builtin method, | ||
129 | there's no technical difference between them. Other methods may make a | ||
130 | difference between them, however. | ||
131 | |||
132 | The flags currently supported are UI_INPUT_FLAG_ECHO, which is relevant for | ||
133 | UI_add_input_string() and will have the users response be echoed (when | ||
134 | prompting for a password, this flag should obviously not be used, and | ||
135 | UI_INPUT_FLAG_DEFAULT_PWD, which means that a default password of some | ||
136 | sort will be used (completely depending on the application and the UI | ||
137 | method). | ||
138 | |||
139 | UI_dup_input_string(), UI_dup_verify_string(), UI_dup_input_boolean(), | ||
140 | UI_dup_info_string() and UI_dup_error_string() are basically the same | ||
141 | as their UI_add counterparts, except that they make their own copies | ||
142 | of all strings. | ||
143 | |||
144 | UI_construct_prompt() is a helper function that can be used to create | ||
145 | a prompt from two pieces of information: an description and a name. | ||
146 | The default constructor (if there is none provided by the method used) | ||
147 | creates a string "Enter I<description> for I<name>:". With the | ||
148 | description "pass phrase" and the file name "foo.key", that becomes | ||
149 | "Enter pass phrase for foo.key:". Other methods may create whatever | ||
150 | string and may include encodings that will be processed by the other | ||
151 | method functions. | ||
152 | |||
153 | UI_add_user_data() adds a piece of memory for the method to use at any | ||
154 | time. The builtin UI method doesn't care about this info. Note that several | ||
155 | calls to this function doesn't add data, it replaces the previous blob | ||
156 | with the one given as argument. | ||
157 | |||
158 | UI_get0_user_data() retrieves the data that has last been given to the | ||
159 | UI with UI_add_user_data(). | ||
160 | |||
161 | UI_get0_result() returns a pointer to the result buffer associated with | ||
162 | the information indexed by I<i>. | ||
163 | |||
164 | UI_process() goes through the information given so far, does all the printing | ||
165 | and prompting and returns. | ||
166 | |||
167 | UI_ctrl() adds extra control for the application author. For now, it | ||
168 | understands two commands: UI_CTRL_PRINT_ERRORS, which makes UI_process() | ||
169 | print the OpenSSL error stack as part of processing the UI, and | ||
170 | UI_CTRL_IS_REDOABLE, which returns a flag saying if the used UI can | ||
171 | be used again or not. | ||
172 | |||
173 | UI_set_default_method() changes the default UI method to the one given. | ||
174 | |||
175 | UI_get_default_method() returns a pointer to the current default UI method. | ||
176 | |||
177 | UI_get_method() returns the UI method associated with a given UI. | ||
178 | |||
179 | UI_set_method() changes the UI method associated with a given UI. | ||
180 | |||
181 | =head1 SEE ALSO | ||
182 | |||
183 | L<ui_create(3)|ui_create(3)>, L<ui_compat(3)|ui_compat(3)> | ||
184 | |||
185 | =head1 HISTORY | ||
186 | |||
187 | The UI section was first introduced in OpenSSL 0.9.7. | ||
188 | |||
189 | =head1 AUTHOR | ||
190 | |||
191 | Richard Levitte (richard@levitte.org) for the OpenSSL project | ||
192 | (http://www.openssl.org). | ||
193 | |||
194 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/ui_compat.pod b/src/lib/libssl/src/doc/crypto/ui_compat.pod new file mode 100644 index 0000000000..9ab3c69bf2 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/ui_compat.pod | |||
@@ -0,0 +1,55 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | des_read_password, des_read_2passwords, des_read_pw_string, des_read_pw - | ||
6 | Compatibility user interface functions | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | int des_read_password(DES_cblock *key,const char *prompt,int verify); | ||
11 | int des_read_2passwords(DES_cblock *key1,DES_cblock *key2, | ||
12 | const char *prompt,int verify); | ||
13 | |||
14 | int des_read_pw_string(char *buf,int length,const char *prompt,int verify); | ||
15 | int des_read_pw(char *buf,char *buff,int size,const char *prompt,int verify); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | The DES library contained a few routines to prompt for passwords. These | ||
20 | aren't necessarely dependent on DES, and have therefore become part of the | ||
21 | UI compatibility library. | ||
22 | |||
23 | des_read_pw() writes the string specified by I<prompt> to standard output | ||
24 | turns echo off and reads an input string from the terminal. The string is | ||
25 | returned in I<buf>, which must have spac for at least I<size> bytes. | ||
26 | If I<verify> is set, the user is asked for the password twice and unless | ||
27 | the two copies match, an error is returned. The second password is stored | ||
28 | in I<buff>, which must therefore also be at least I<size> bytes. A return | ||
29 | code of -1 indicates a system error, 1 failure due to use interaction, and | ||
30 | 0 is success. All other functions described here use des_read_pw() to do | ||
31 | the work. | ||
32 | |||
33 | des_read_pw_string() is a variant of des_read_pw() that provides a buffer | ||
34 | for you if I<verify> is set. | ||
35 | |||
36 | des_read_password() calls des_read_pw() and converts the password to a | ||
37 | DES key by calling DES_string_to_key(); des_read_2password() operates in | ||
38 | the same way as des_read_password() except that it generates two keys | ||
39 | by using the DES_string_to_2key() function. | ||
40 | |||
41 | =head1 NOTES | ||
42 | |||
43 | des_read_pw_string() is available in the MIT Kerberos library as well, and | ||
44 | is also available under the name EVP_read_pw_string(). | ||
45 | |||
46 | =head1 SEE ALSO | ||
47 | |||
48 | L<ui(3)|ui(3)>, L<ui_create(3)|ui_create(3)> | ||
49 | |||
50 | =head1 AUTHOR | ||
51 | |||
52 | Richard Levitte (richard@levitte.org) for the OpenSSL project | ||
53 | (http://www.openssl.org). | ||
54 | |||
55 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_COMP_add_compression_method.pod b/src/lib/libssl/src/doc/ssl/SSL_COMP_add_compression_method.pod new file mode 100644 index 0000000000..2a98739114 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_COMP_add_compression_method.pod | |||
@@ -0,0 +1,70 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_COMP_add_compression_method - handle SSL/TLS integrated compression methods | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_COMP_add_compression_method() adds the compression method B<cm> with | ||
16 | the identifier B<id> to the list of available compression methods. This | ||
17 | list is globally maintained for all SSL operations within this application. | ||
18 | It cannot be set for specific SSL_CTX or SSL objects. | ||
19 | |||
20 | =head1 NOTES | ||
21 | |||
22 | The TLS standard (or SSLv3) allows the integration of compression methods | ||
23 | into the communication. The TLS RFC does however not specify compression | ||
24 | methods or their corresponding identifiers, so there is currently no compatible | ||
25 | way to integrate compression with unknown peers. It is therefore currently not | ||
26 | recommended to integrate compression into applications. Applications for | ||
27 | non-public use may agree on certain compression methods. Using different | ||
28 | compression methods with the same identifier will lead to connection failure. | ||
29 | |||
30 | An OpenSSL client speaking a protocol that allows compression (SSLv3, TLSv1) | ||
31 | will unconditionally send the list of all compression methods enabled with | ||
32 | SSL_COMP_add_compression_method() to the server during the handshake. | ||
33 | Unlike the mechanisms to set a cipher list, there is no method available to | ||
34 | restrict the list of compression method on a per connection basis. | ||
35 | |||
36 | An OpenSSL server will match the identifiers listed by a client against | ||
37 | its own compression methods and will unconditionally activate compression | ||
38 | when a matching identifier is found. There is no way to restrict the list | ||
39 | of compression methods supported on a per connection basis. | ||
40 | |||
41 | The OpenSSL library has the compression methods B<COMP_rle()> and (when | ||
42 | especially enabled during compilation) B<COMP_zlib()> available. | ||
43 | |||
44 | =head1 WARNINGS | ||
45 | |||
46 | Once the identities of the compression methods for the TLS protocol have | ||
47 | been standardized, the compression API will most likely be changed. Using | ||
48 | it in the current state is not recommended. | ||
49 | |||
50 | =head1 RETURN VALUES | ||
51 | |||
52 | SSL_COMP_add_compression_method() may return the following values: | ||
53 | |||
54 | =over 4 | ||
55 | |||
56 | =item 1 | ||
57 | |||
58 | The operation succeeded. | ||
59 | |||
60 | =item 0 | ||
61 | |||
62 | The operation failed. Check the error queue to find out the reason. | ||
63 | |||
64 | =back | ||
65 | |||
66 | =head1 SEE ALSO | ||
67 | |||
68 | L<ssl(3)|ssl(3)> | ||
69 | |||
70 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_add_extra_chain_cert.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_add_extra_chain_cert.pod index 21a9db0e2a..ee28f5ccc3 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_add_extra_chain_cert.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_add_extra_chain_cert.pod | |||
@@ -33,6 +33,7 @@ error stack to find out the reason for failure otherwise. | |||
33 | 33 | ||
34 | L<ssl(3)|ssl(3)>, | 34 | L<ssl(3)|ssl(3)>, |
35 | L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)>, | 35 | L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)>, |
36 | L<SSL_CTX_set_client_cert_cb(3)|SSL_CTX_set_client_cert_cb(3)>, | ||
36 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)> | 37 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)> |
37 | 38 | ||
38 | =cut | 39 | =cut |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_ctrl.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_ctrl.pod new file mode 100644 index 0000000000..fb6adcf50c --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_ctrl.pod | |||
@@ -0,0 +1,34 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_ctrl, SSL_CTX_callback_ctrl, SSL_ctrl, SSL_callback_ctrl - internal handling functions for SSL_CTX and SSL objects | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg); | ||
12 | long SSL_CTX_callback_ctrl(SSL_CTX *, int cmd, void (*fp)()); | ||
13 | |||
14 | long SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg); | ||
15 | long SSL_callback_ctrl(SSL *, int cmd, void (*fp)()); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | The SSL_*_ctrl() family of functions is used to manipulate settings of | ||
20 | the SSL_CTX and SSL objects. Depending on the command B<cmd> the arguments | ||
21 | B<larg>, B<parg>, or B<fp> are evaluated. These functions should never | ||
22 | be called directly. All functionalities needed are made available via | ||
23 | other functions or macros. | ||
24 | |||
25 | =head1 RETURN VALUES | ||
26 | |||
27 | The return values of the SSL*_ctrl() functions depend on the command | ||
28 | supplied via the B<cmd> parameter. | ||
29 | |||
30 | =head1 SEE ALSO | ||
31 | |||
32 | L<ssl(3)|ssl(3)> | ||
33 | |||
34 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_free.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_free.pod index c716cde164..55e592f5f8 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_free.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_free.pod | |||
@@ -24,6 +24,8 @@ the certificates and keys. | |||
24 | 24 | ||
25 | SSL_CTX_free() does not provide diagnostic information. | 25 | SSL_CTX_free() does not provide diagnostic information. |
26 | 26 | ||
27 | =head1 SEE ALSO | ||
28 | |||
27 | L<SSL_CTX_new(3)|SSL_CTX_new(3)>, L<ssl(3)|ssl(3)> | 29 | L<SSL_CTX_new(3)|SSL_CTX_new(3)>, L<ssl(3)|ssl(3)> |
28 | 30 | ||
29 | =cut | 31 | =cut |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_load_verify_locations.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_load_verify_locations.pod index 0f63537e78..84a799fc71 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_load_verify_locations.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_load_verify_locations.pod | |||
@@ -58,7 +58,7 @@ failure. | |||
58 | In server mode, when requesting a client certificate, the server must send | 58 | In server mode, when requesting a client certificate, the server must send |
59 | the list of CAs of which it will accept client certificates. This list | 59 | the list of CAs of which it will accept client certificates. This list |
60 | is not influenced by the contents of B<CAfile> or B<CApath> and must | 60 | is not influenced by the contents of B<CAfile> or B<CApath> and must |
61 | explicitely be set using the | 61 | explicitly be set using the |
62 | L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)> | 62 | L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)> |
63 | family of functions. | 63 | family of functions. |
64 | 64 | ||
@@ -118,7 +118,7 @@ L<ssl(3)|ssl(3)>, | |||
118 | L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)>, | 118 | L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)>, |
119 | L<SSL_get_client_CA_list(3)|SSL_get_client_CA_list(3)>, | 119 | L<SSL_get_client_CA_list(3)|SSL_get_client_CA_list(3)>, |
120 | L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)>, | 120 | L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)>, |
121 | L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)> | 121 | L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)>, |
122 | 122 | L<SSL_CTX_set_cert_store(3)|SSL_CTX_set_cert_store(3)> | |
123 | 123 | ||
124 | =cut | 124 | =cut |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_new.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_new.pod index 1dae8b0bdd..465220a75c 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_new.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_new.pod | |||
@@ -59,10 +59,6 @@ choice when compatibility is a concern. | |||
59 | 59 | ||
60 | =back | 60 | =back |
61 | 61 | ||
62 | If a generic method is used, it is necessary to explicitly set client or | ||
63 | server mode with L<SSL_set_connect_state(3)|SSL_set_connect_state(3)> | ||
64 | or SSL_set_accept_state(). | ||
65 | |||
66 | The list of protocols available can later be limited using the SSL_OP_NO_SSLv2, | 62 | The list of protocols available can later be limited using the SSL_OP_NO_SSLv2, |
67 | SSL_OP_NO_SSLv3, SSL_OP_NO_TLSv1 options of the B<SSL_CTX_set_options()> or | 63 | SSL_OP_NO_SSLv3, SSL_OP_NO_TLSv1 options of the B<SSL_CTX_set_options()> or |
68 | B<SSL_set_options()> functions. Using these options it is possible to choose | 64 | B<SSL_set_options()> functions. Using these options it is possible to choose |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_set_get_cb.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_set_get_cb.pod index b6f15b4404..6e0ef00632 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_set_get_cb.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_set_get_cb.pod | |||
@@ -70,12 +70,16 @@ proposed by the client. The get_session_cb() is always called, also when | |||
70 | session caching was disabled. The get_session_cb() is passed the | 70 | session caching was disabled. The get_session_cb() is passed the |
71 | B<ssl> connection, the session id of length B<length> at the memory location | 71 | B<ssl> connection, the session id of length B<length> at the memory location |
72 | B<data>. With the parameter B<copy> the callback can require the | 72 | B<data>. With the parameter B<copy> the callback can require the |
73 | SSL engine to increment the reference count of the SSL_SESSION object. | 73 | SSL engine to increment the reference count of the SSL_SESSION object, |
74 | Normally the reference count is not incremented and therefore the | ||
75 | session must not be explicitly freed with | ||
76 | L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>. | ||
74 | 77 | ||
75 | =head1 SEE ALSO | 78 | =head1 SEE ALSO |
76 | 79 | ||
77 | L<ssl(3)|ssl(3)>, L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)>, | 80 | L<ssl(3)|ssl(3)>, L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)>, |
78 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, | 81 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, |
79 | L<SSL_CTX_flush_sessions(3)|<SSL_CTX_flush_sessions(3)> | 82 | L<SSL_CTX_flush_sessions(3)|<SSL_CTX_flush_sessions(3)>, |
83 | L<SSL_SESSION_free(3)|SSL_SESSION_free(3)> | ||
80 | 84 | ||
81 | =cut | 85 | =cut |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_store.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_store.pod new file mode 100644 index 0000000000..81286ee650 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_store.pod | |||
@@ -0,0 +1,57 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_cert_store, SSL_CTX_get_cert_store - manipulate X509 certificate verification storage | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | void SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *store); | ||
12 | X509_STORE *SSL_CTX_get_cert_store(SSL_CTX *ctx); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | SSL_CTX_set_cert_store() sets/replaces the certificate verification storage | ||
17 | of B<ctx> to/with B<store>. If another X505_STORE object is currently | ||
18 | set in B<ctx>, it will be X509_STORE_free()ed. | ||
19 | |||
20 | SSL_CTX_get_cert_store() returns a pointer to the current certificate | ||
21 | verification storage. | ||
22 | |||
23 | =head1 NOTES | ||
24 | |||
25 | In order to verify the certificates presented by the peer, trusted CA | ||
26 | certificates must be accessed. These CA certificates are made available | ||
27 | via lookup methods, handled inside the X509_STORE. From the X509_STORE | ||
28 | the X509_STORE_CTX used when verifying certificates is created. | ||
29 | |||
30 | Typically the trusted certificate store is handled indirectly via using | ||
31 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)>. | ||
32 | Using the SSL_CTX_set_cert_store() and SSL_CTX_get_cert_store() functions | ||
33 | it is possible to manipulate the X509_STORE object beyond the | ||
34 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)> | ||
35 | call. | ||
36 | |||
37 | Currently no detailed documentation on how to use the X509_STORE | ||
38 | object is available. Not all members of the X509_STORE are used when | ||
39 | the verification takes place. So will e.g. the verify_callback() be | ||
40 | overridden with the verify_callback() set via the | ||
41 | L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)> family of functions. | ||
42 | This document must therefore be updated when documentation about the | ||
43 | X509_STORE object and its handling becomes available. | ||
44 | |||
45 | =head1 RETURN VALUES | ||
46 | |||
47 | SSL_CTX_set_cert_store() does not return diagnostic output. | ||
48 | |||
49 | SSL_CTX_get_cert_store() returns the current setting. | ||
50 | |||
51 | =head1 SEE ALSO | ||
52 | |||
53 | L<ssl(3)|ssl(3)>, | ||
54 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)>, | ||
55 | L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)> | ||
56 | |||
57 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_verify_callback.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_verify_callback.pod new file mode 100644 index 0000000000..c0f4f85708 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_verify_callback.pod | |||
@@ -0,0 +1,75 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_cert_verify_callback - set peer certificate verification procedure | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, int (*callback)(X509_STORE_CTX *,void *), void *arg); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_CTX_set_cert_verify_callback() sets the verification callback function for | ||
16 | I<ctx>. SSL objects that are created from I<ctx> inherit the setting valid at | ||
17 | the time when L<SSL_new(3)|SSL_new(3)> is called. | ||
18 | |||
19 | =head1 NOTES | ||
20 | |||
21 | Whenever a certificate is verified during a SSL/TLS handshake, a verification | ||
22 | function is called. If the application does not explicitly specify a | ||
23 | verification callback function, the built-in verification function is used. | ||
24 | If a verification callback I<callback> is specified via | ||
25 | SSL_CTX_set_cert_verify_callback(), the supplied callback function is called | ||
26 | instead. By setting I<callback> to NULL, the default behaviour is restored. | ||
27 | |||
28 | When the verification must be performed, I<callback> will be called with | ||
29 | the arguments callback(X509_STORE_CTX *x509_store_ctx, void *arg). The | ||
30 | argument I<arg> is specified by the application when setting I<callback>. | ||
31 | |||
32 | I<callback> should return 1 to indicate verification success and 0 to | ||
33 | indicate verification failure. If SSL_VERIFY_PEER is set and I<callback> | ||
34 | returns 0, the handshake will fail. As the verification procedure may | ||
35 | allow to continue the connection in case of failure (by always returning 1) | ||
36 | the verification result must be set in any case using the B<error> | ||
37 | member of I<x509_store_ctx> so that the calling application will be informed | ||
38 | about the detailed result of the verification procedure! | ||
39 | |||
40 | Within I<x509_store_ctx>, I<callback> has access to the I<verify_callback> | ||
41 | function set using L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>. | ||
42 | |||
43 | =head1 WARNINGS | ||
44 | |||
45 | Do not mix the verification callback described in this function with the | ||
46 | B<verify_callback> function called during the verification process. The | ||
47 | latter is set using the L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)> | ||
48 | family of functions. | ||
49 | |||
50 | Providing a complete verification procedure including certificate purpose | ||
51 | settings etc is a complex task. The built-in procedure is quite powerful | ||
52 | and in most cases it should be sufficient to modify its behaviour using | ||
53 | the B<verify_callback> function. | ||
54 | |||
55 | =head1 BUGS | ||
56 | |||
57 | =head1 RETURN VALUES | ||
58 | |||
59 | SSL_CTX_set_cert_verify_callback() does not provide diagnostic information. | ||
60 | |||
61 | =head1 SEE ALSO | ||
62 | |||
63 | L<ssl(3)|ssl(3)>, L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>, | ||
64 | L<SSL_get_verify_result(3)|SSL_get_verify_result(3)>, | ||
65 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)> | ||
66 | |||
67 | =head1 HISTORY | ||
68 | |||
69 | Previous to OpenSSL 0.9.7, the I<arg> argument to B<SSL_CTX_set_cert_verify_callback> | ||
70 | was ignored, and I<callback> was called simply as | ||
71 | int (*callback)(X509_STORE_CTX *) | ||
72 | To compile software written for previous versions of OpenSSL, a dummy | ||
73 | argument will have to be added to I<callback>. | ||
74 | |||
75 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cipher_list.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cipher_list.pod index 9a29eeeb95..ed64f64157 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cipher_list.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cipher_list.pod | |||
@@ -34,9 +34,25 @@ a necessary condition. On the client side, the inclusion into the list is | |||
34 | also sufficient. On the server side, additional restrictions apply. All ciphers | 34 | also sufficient. On the server side, additional restrictions apply. All ciphers |
35 | have additional requirements. ADH ciphers don't need a certificate, but | 35 | have additional requirements. ADH ciphers don't need a certificate, but |
36 | DH-parameters must have been set. All other ciphers need a corresponding | 36 | DH-parameters must have been set. All other ciphers need a corresponding |
37 | certificate and key. A RSA cipher can only be chosen, when a RSA certificate is | 37 | certificate and key. |
38 | available, the respective is valid for DSA ciphers. Ciphers using EDH need | 38 | |
39 | a certificate and key and DH-parameters. | 39 | A RSA cipher can only be chosen, when a RSA certificate is available. |
40 | RSA export ciphers with a keylength of 512 bits for the RSA key require | ||
41 | a temporary 512 bit RSA key, as typically the supplied key has a length | ||
42 | of 1024 bit (see | ||
43 | L<SSL_CTX_set_tmp_rsa_callback(3)|SSL_CTX_set_tmp_rsa_callback(3)>). | ||
44 | RSA ciphers using EDH need a certificate and key and additional DH-parameters | ||
45 | (see L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>). | ||
46 | |||
47 | A DSA cipher can only be chosen, when a DSA certificate is available. | ||
48 | DSA ciphers always use DH key exchange and therefore need DH-parameters | ||
49 | (see L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>). | ||
50 | |||
51 | When these conditions are not met for any cipher in the list (e.g. a | ||
52 | client only supports export RSA ciphers with a asymmetric key length | ||
53 | of 512 bits and the server is not configured to use temporary RSA | ||
54 | keys), the "no shared cipher" (SSL_R_NO_SHARED_CIPHER) error is generated | ||
55 | and the handshake will fail. | ||
40 | 56 | ||
41 | =head1 RETURN VALUES | 57 | =head1 RETURN VALUES |
42 | 58 | ||
@@ -47,6 +63,8 @@ could be selected and 0 on complete failure. | |||
47 | 63 | ||
48 | L<ssl(3)|ssl(3)>, L<SSL_get_ciphers(3)|SSL_get_ciphers(3)>, | 64 | L<ssl(3)|ssl(3)>, L<SSL_get_ciphers(3)|SSL_get_ciphers(3)>, |
49 | L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)>, | 65 | L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)>, |
66 | L<SSL_CTX_set_tmp_rsa_callback(3)|SSL_CTX_set_tmp_rsa_callback(3)>, | ||
67 | L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>, | ||
50 | L<ciphers(1)|ciphers(1)> | 68 | L<ciphers(1)|ciphers(1)> |
51 | 69 | ||
52 | =cut | 70 | =cut |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_client_cert_cb.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_client_cert_cb.pod new file mode 100644 index 0000000000..53e1827713 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_client_cert_cb.pod | |||
@@ -0,0 +1,90 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_client_cert_cb, SSL_CTX_get_client_cert_cb - handle client certificate callback function | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)); | ||
12 | int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey); | ||
13 | int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | SSL_CTX_set_client_cert_cb() sets the B<client_cert_cb()> callback, that is | ||
18 | called when a client certificate is requested by a server. | ||
19 | When B<client_cert_cb()> is NULL, not callback function is used. | ||
20 | |||
21 | SSL_CTX_get_client_cert_cb() returns a pointer to the currently set callback | ||
22 | function. | ||
23 | |||
24 | client_cert_cb() is the application defined callback. If it wants to | ||
25 | set a certificate, a certificate/private key combination must be set | ||
26 | using the B<x509> and B<pkey> arguments and "1" must be returned. The | ||
27 | certificate will be installed into B<ssl>, see the NOTES and BUGS sections. | ||
28 | If no certificate should be set, "0" has to be returned and the default | ||
29 | certificate will be sent. A fatal error can be indicated by returning | ||
30 | a negative value, in which case the handshake will be canceled. | ||
31 | |||
32 | =head1 NOTES | ||
33 | |||
34 | During a handshake (or renegotiation) a server may request a certificate | ||
35 | from the client. A client certificate must only be sent, when the server | ||
36 | did send the request. | ||
37 | |||
38 | When no callback function is set, an OpenSSL client will send the certificate | ||
39 | that was set using the | ||
40 | L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)> family of functions. | ||
41 | The TLS standard requires that only a certificate is sent, if it matches | ||
42 | the list of acceptable CAs sent by the server. This constraint is | ||
43 | violated by the default behavior of the OpenSSL library. Using the | ||
44 | callback function it is possible to implement a proper selection routine | ||
45 | or to allow a user interaction to choose the certificate to be sent. | ||
46 | The callback function can obtain the list of acceptable CAs using the | ||
47 | L<SSL_get_client_CA_list(3)|SSL_get_client_CA_list(3)> function. | ||
48 | |||
49 | If a callback function is defined, the callback function will be called. | ||
50 | If the callback function returns a certificate, the OpenSSL library | ||
51 | will try to load the private key and certificate data into the SSL | ||
52 | object using SSL_use_certificate() and SSL_use_private_key() functions. | ||
53 | Thus it will permanently override the certificate and key previously | ||
54 | installed and will not be reset by calling L<SSL_clear(3)|SSL_clear(3)>. | ||
55 | If the callback returns no certificate, the OpenSSL library will send | ||
56 | the certificate previously installed for the SSL_CTX object or the specific | ||
57 | certificate of the SSL object, if available. | ||
58 | |||
59 | =head1 BUGS | ||
60 | |||
61 | The client_cert_cb() cannot return a complete certificate chain, it can | ||
62 | only return one client certificate. If the chain only has a length of 2, | ||
63 | the root CA certificate may be omitted according to the TLS standard and | ||
64 | thus a standard conforming answer can be sent to the server. For a | ||
65 | longer chain, the client must send the complete chain (with the option | ||
66 | to leave out the root CA certificate). This can only be accomplished by | ||
67 | either adding the intermediate CA certificates into the trusted | ||
68 | certificate store for the SSL_CTX object (resulting in having to add | ||
69 | CA certificates that otherwise maybe would not be trusted), or by adding | ||
70 | the chain certificates using the | ||
71 | L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)> | ||
72 | function, which is only available for the SSL_CTX object as a whole and that | ||
73 | therefore probably can only apply for one client certificate, making | ||
74 | the concept of the callback function (to allow the choice from several | ||
75 | certificates) questionable. | ||
76 | |||
77 | Once the SSL object has been used in conjunction with the callback function, | ||
78 | the certificate will be set for the SSL object and will not be cleared | ||
79 | even when L<SSL_clear(3)|SSL_clear(3)> is being called. It is therefore | ||
80 | mandatory to destroy the SSL object using L<SSL_free(3)|SSL_free(3)> | ||
81 | and create a new one to return to the previous state. | ||
82 | |||
83 | =head1 SEE ALSO | ||
84 | |||
85 | L<ssl(3)|ssl(3)>, L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)>, | ||
86 | L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)>, | ||
87 | L<SSL_get_client_CA_list(3)|SSL_get_client_CA_list(3)>, | ||
88 | L<SSL_clear(3)|SSL_clear(3)>, L<SSL_free(3)|SSL_free(3)> | ||
89 | |||
90 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_default_passwd_cb.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_default_passwd_cb.pod index a5343a1cf3..2b87f01ca1 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_default_passwd_cb.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_default_passwd_cb.pod | |||
@@ -40,6 +40,12 @@ then keep it in memory and use it several times. In the last case, the | |||
40 | password could be stored into the B<userdata> storage and the | 40 | password could be stored into the B<userdata> storage and the |
41 | pem_passwd_cb() only returns the password already stored. | 41 | pem_passwd_cb() only returns the password already stored. |
42 | 42 | ||
43 | When asking for the password interactively, pem_passwd_cb() can use | ||
44 | B<rwflag> to check, whether an item shall be encrypted (rwflag=1). | ||
45 | In this case the password dialog may ask for the same password twice | ||
46 | for comparison in order to catch typos, that would make decryption | ||
47 | impossible. | ||
48 | |||
43 | Other items in PEM formatting (certificates) can also be encrypted, it is | 49 | Other items in PEM formatting (certificates) can also be encrypted, it is |
44 | however not usual, as certificate information is considered public. | 50 | however not usual, as certificate information is considered public. |
45 | 51 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_generate_session_id.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_generate_session_id.pod new file mode 100644 index 0000000000..798e8443a7 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_generate_session_id.pod | |||
@@ -0,0 +1,150 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_generate_session_id, SSL_set_generate_session_id, SSL_has_matching_session_id - manipulate generation of SSL session IDs (server only) | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | typedef int (*GEN_SESSION_CB)(const SSL *ssl, unsigned char *id, | ||
12 | unsigned int *id_len); | ||
13 | |||
14 | int SSL_CTX_set_generate_session_id(SSL_CTX *ctx, GEN_SESSION_CB cb); | ||
15 | int SSL_set_generate_session_id(SSL *ssl, GEN_SESSION_CB, cb); | ||
16 | int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id, | ||
17 | unsigned int id_len); | ||
18 | |||
19 | =head1 DESCRIPTION | ||
20 | |||
21 | SSL_CTX_set_generate_session_id() sets the callback function for generating | ||
22 | new session ids for SSL/TLS sessions for B<ctx> to be B<cb>. | ||
23 | |||
24 | SSL_set_generate_session_id() sets the callback function for generating | ||
25 | new session ids for SSL/TLS sessions for B<ssl> to be B<cb>. | ||
26 | |||
27 | SSL_has_matching_session_id() checks, whether a session with id B<id> | ||
28 | (of length B<id_len>) is already contained in the internal session cache | ||
29 | of the parent context of B<ssl>. | ||
30 | |||
31 | =head1 NOTES | ||
32 | |||
33 | When a new session is established between client and server, the server | ||
34 | generates a session id. The session id is an arbitrary sequence of bytes. | ||
35 | The length of the session id is 16 bytes for SSLv2 sessions and between | ||
36 | 1 and 32 bytes for SSLv3/TLSv1. The session id is not security critical | ||
37 | but must be unique for the server. Additionally, the session id is | ||
38 | transmitted in the clear when reusing the session so it must not contain | ||
39 | sensitive information. | ||
40 | |||
41 | Without a callback being set, an OpenSSL server will generate a unique | ||
42 | session id from pseudo random numbers of the maximum possible length. | ||
43 | Using the callback function, the session id can be changed to contain | ||
44 | additional information like e.g. a host id in order to improve load balancing | ||
45 | or external caching techniques. | ||
46 | |||
47 | The callback function receives a pointer to the memory location to put | ||
48 | B<id> into and a pointer to the maximum allowed length B<id_len>. The | ||
49 | buffer at location B<id> is only guaranteed to have the size B<id_len>. | ||
50 | The callback is only allowed to generate a shorter id and reduce B<id_len>; | ||
51 | the callback B<must never> increase B<id_len> or write to the location | ||
52 | B<id> exceeding the given limit. | ||
53 | |||
54 | If a SSLv2 session id is generated and B<id_len> is reduced, it will be | ||
55 | restored after the callback has finished and the session id will be padded | ||
56 | with 0x00. It is not recommended to change the B<id_len> for SSLv2 sessions. | ||
57 | The callback can use the L<SSL_get_version(3)|SSL_get_version(3)> function | ||
58 | to check, whether the session is of type SSLv2. | ||
59 | |||
60 | The location B<id> is filled with 0x00 before the callback is called, so the | ||
61 | callback may only fill part of the possible length and leave B<id_len> | ||
62 | untouched while maintaining reproducibility. | ||
63 | |||
64 | Since the sessions must be distinguished, session ids must be unique. | ||
65 | Without the callback a random number is used, so that the probability | ||
66 | of generating the same session id is extremely small (2^128 possible ids | ||
67 | for an SSLv2 session, 2^256 for SSLv3/TLSv1). In order to assure the | ||
68 | uniqueness of the generated session id, the callback must call | ||
69 | SSL_has_matching_session_id() and generate another id if a conflict occurs. | ||
70 | If an id conflict is not resolved, the handshake will fail. | ||
71 | If the application codes e.g. a unique host id, a unique process number, and | ||
72 | a unique sequence number into the session id, uniqueness could easily be | ||
73 | achieved without randomness added (it should however be taken care that | ||
74 | no confidential information is leaked this way). If the application can not | ||
75 | guarantee uniqueness, it is recommended to use the maximum B<id_len> and | ||
76 | fill in the bytes not used to code special information with random data | ||
77 | to avoid collisions. | ||
78 | |||
79 | SSL_has_matching_session_id() will only query the internal session cache, | ||
80 | not the external one. Since the session id is generated before the | ||
81 | handshake is completed, it is not immediately added to the cache. If | ||
82 | another thread is using the same internal session cache, a race condition | ||
83 | can occur in that another thread generates the same session id. | ||
84 | Collisions can also occur when using an external session cache, since | ||
85 | the external cache is not tested with SSL_has_matching_session_id() | ||
86 | and the same race condition applies. | ||
87 | |||
88 | When calling SSL_has_matching_session_id() for an SSLv2 session with | ||
89 | reduced B<id_len>, the match operation will be performed using the | ||
90 | fixed length required and with a 0x00 padded id. | ||
91 | |||
92 | The callback must return 0 if it cannot generate a session id for whatever | ||
93 | reason and return 1 on success. | ||
94 | |||
95 | =head1 EXAMPLES | ||
96 | |||
97 | The callback function listed will generate a session id with the | ||
98 | server id given, and will fill the rest with pseudo random bytes: | ||
99 | |||
100 | const char session_id_prefix = "www-18"; | ||
101 | |||
102 | #define MAX_SESSION_ID_ATTEMPTS 10 | ||
103 | static int generate_session_id(const SSL *ssl, unsigned char *id, | ||
104 | unsigned int *id_len) | ||
105 | { | ||
106 | unsigned int count = 0; | ||
107 | const char *version; | ||
108 | |||
109 | version = SSL_get_version(ssl); | ||
110 | if (!strcmp(version, "SSLv2")) | ||
111 | /* we must not change id_len */; | ||
112 | |||
113 | do { | ||
114 | RAND_pseudo_bytes(id, *id_len); | ||
115 | /* Prefix the session_id with the required prefix. NB: If our | ||
116 | * prefix is too long, clip it - but there will be worse effects | ||
117 | * anyway, eg. the server could only possibly create 1 session | ||
118 | * ID (ie. the prefix!) so all future session negotiations will | ||
119 | * fail due to conflicts. */ | ||
120 | memcpy(id, session_id_prefix, | ||
121 | (strlen(session_id_prefix) < *id_len) ? | ||
122 | strlen(session_id_prefix) : *id_len); | ||
123 | } | ||
124 | while(SSL_has_matching_session_id(ssl, id, *id_len) && | ||
125 | (++count < MAX_SESSION_ID_ATTEMPTS)); | ||
126 | if(count >= MAX_SESSION_ID_ATTEMPTS) | ||
127 | return 0; | ||
128 | return 1; | ||
129 | } | ||
130 | |||
131 | |||
132 | =head1 RETURN VALUES | ||
133 | |||
134 | SSL_CTX_set_generate_session_id() and SSL_set_generate_session_id() | ||
135 | always return 1. | ||
136 | |||
137 | SSL_has_matching_session_id() returns 1 if another session with the | ||
138 | same id is already in the cache. | ||
139 | |||
140 | =head1 SEE ALSO | ||
141 | |||
142 | L<ssl(3)|ssl(3)>, L<SSL_get_version(3)|SSL_get_version(3)> | ||
143 | |||
144 | =head1 HISTORY | ||
145 | |||
146 | SSL_CTX_set_generate_session_id(), SSL_set_generate_session_id() | ||
147 | and SSL_has_matching_session_id() have been introduced in | ||
148 | OpenSSL 0.9.7. | ||
149 | |||
150 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_info_callback.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_info_callback.pod new file mode 100644 index 0000000000..63d0b8d33f --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_info_callback.pod | |||
@@ -0,0 +1,153 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_info_callback, SSL_CTX_get_info_callback, SSL_set_info_callback, SSL_get_info_callback - handle information callback for SSL connections | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | void SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*callback)()); | ||
12 | void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(); | ||
13 | |||
14 | void SSL_set_info_callback(SSL *ssl, void (*callback)()); | ||
15 | void (*SSL_get_info_callback(SSL *ssl))(); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | SSL_CTX_set_info_callback() sets the B<callback> function, that can be used to | ||
20 | obtain state information for SSL objects created from B<ctx> during connection | ||
21 | setup and use. The setting for B<ctx> is overridden from the setting for | ||
22 | a specific SSL object, if specified. | ||
23 | When B<callback> is NULL, not callback function is used. | ||
24 | |||
25 | SSL_set_info_callback() sets the B<callback> function, that can be used to | ||
26 | obtain state information for B<ssl> during connection setup and use. | ||
27 | When B<callback> is NULL, the callback setting currently valid for | ||
28 | B<ctx> is used. | ||
29 | |||
30 | SSL_CTX_get_info_callback() returns a pointer to the currently set information | ||
31 | callback function for B<ctx>. | ||
32 | |||
33 | SSL_get_info_callback() returns a pointer to the currently set information | ||
34 | callback function for B<ssl>. | ||
35 | |||
36 | =head1 NOTES | ||
37 | |||
38 | When setting up a connection and during use, it is possible to obtain state | ||
39 | information from the SSL/TLS engine. When set, an information callback function | ||
40 | is called whenever the state changes, an alert appears, or an error occurs. | ||
41 | |||
42 | The callback function is called as B<callback(SSL *ssl, int where, int ret)>. | ||
43 | The B<where> argument specifies information about where (in which context) | ||
44 | the callback function was called. If B<ret> is 0, an error condition occurred. | ||
45 | If an alert is handled, SSL_CB_ALERT is set and B<ret> specifies the alert | ||
46 | information. | ||
47 | |||
48 | B<where> is a bitmask made up of the following bits: | ||
49 | |||
50 | =over 4 | ||
51 | |||
52 | =item SSL_CB_LOOP | ||
53 | |||
54 | Callback has been called to indicate state change inside a loop. | ||
55 | |||
56 | =item SSL_CB_EXIT | ||
57 | |||
58 | Callback has been called to indicate error exit of a handshake function. | ||
59 | (May be soft error with retry option for non-blocking setups.) | ||
60 | |||
61 | =item SSL_CB_READ | ||
62 | |||
63 | Callback has been called during read operation. | ||
64 | |||
65 | =item SSL_CB_WRITE | ||
66 | |||
67 | Callback has been called during write operation. | ||
68 | |||
69 | =item SSL_CB_ALERT | ||
70 | |||
71 | Callback has been called due to an alert being sent or received. | ||
72 | |||
73 | =item SSL_CB_READ_ALERT (SSL_CB_ALERT|SSL_CB_READ) | ||
74 | |||
75 | =item SSL_CB_WRITE_ALERT (SSL_CB_ALERT|SSL_CB_WRITE) | ||
76 | |||
77 | =item SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT|SSL_CB_LOOP) | ||
78 | |||
79 | =item SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT|SSL_CB_EXIT) | ||
80 | |||
81 | =item SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT|SSL_CB_LOOP) | ||
82 | |||
83 | =item SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT|SSL_CB_EXIT) | ||
84 | |||
85 | =item SSL_CB_HANDSHAKE_START | ||
86 | |||
87 | Callback has been called because a new handshake is started. | ||
88 | |||
89 | =item SSL_CB_HANDSHAKE_DONE 0x20 | ||
90 | |||
91 | Callback has been called because a handshake is finished. | ||
92 | |||
93 | =back | ||
94 | |||
95 | The current state information can be obtained using the | ||
96 | L<SSL_state_string(3)|SSL_state_string(3)> family of functions. | ||
97 | |||
98 | The B<ret> information can be evaluated using the | ||
99 | L<SSL_alert_type_string(3)|SSL_alert_type_string(3)> family of functions. | ||
100 | |||
101 | =head1 RETURN VALUES | ||
102 | |||
103 | SSL_set_info_callback() does not provide diagnostic information. | ||
104 | |||
105 | SSL_get_info_callback() returns the current setting. | ||
106 | |||
107 | =head1 EXAMPLES | ||
108 | |||
109 | The following example callback function prints state strings, information | ||
110 | about alerts being handled and error messages to the B<bio_err> BIO. | ||
111 | |||
112 | void apps_ssl_info_callback(SSL *s, int where, int ret) | ||
113 | { | ||
114 | const char *str; | ||
115 | int w; | ||
116 | |||
117 | w=where& ~SSL_ST_MASK; | ||
118 | |||
119 | if (w & SSL_ST_CONNECT) str="SSL_connect"; | ||
120 | else if (w & SSL_ST_ACCEPT) str="SSL_accept"; | ||
121 | else str="undefined"; | ||
122 | |||
123 | if (where & SSL_CB_LOOP) | ||
124 | { | ||
125 | BIO_printf(bio_err,"%s:%s\n",str,SSL_state_string_long(s)); | ||
126 | } | ||
127 | else if (where & SSL_CB_ALERT) | ||
128 | { | ||
129 | str=(where & SSL_CB_READ)?"read":"write"; | ||
130 | BIO_printf(bio_err,"SSL3 alert %s:%s:%s\n", | ||
131 | str, | ||
132 | SSL_alert_type_string_long(ret), | ||
133 | SSL_alert_desc_string_long(ret)); | ||
134 | } | ||
135 | else if (where & SSL_CB_EXIT) | ||
136 | { | ||
137 | if (ret == 0) | ||
138 | BIO_printf(bio_err,"%s:failed in %s\n", | ||
139 | str,SSL_state_string_long(s)); | ||
140 | else if (ret < 0) | ||
141 | { | ||
142 | BIO_printf(bio_err,"%s:error in %s\n", | ||
143 | str,SSL_state_string_long(s)); | ||
144 | } | ||
145 | } | ||
146 | } | ||
147 | |||
148 | =head1 SEE ALSO | ||
149 | |||
150 | L<ssl(3)|ssl(3)>, L<SSL_state_string(3)|SSL_state_string(3)>, | ||
151 | L<SSL_alert_type_string(3)|SSL_alert_type_string(3)> | ||
152 | |||
153 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_max_cert_list.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_max_cert_list.pod new file mode 100644 index 0000000000..da68cb9fc2 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_max_cert_list.pod | |||
@@ -0,0 +1,77 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_max_cert_list, SSL_CTX_get_max_cert_list, SSL_set_max_cert_list, SSL_get_max_cert_list, - manipulate allowed for the peer's certificate chain | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | long SSL_CTX_set_max_cert_list(SSL_CTX *ctx, long size); | ||
12 | long SSL_CTX_get_max_cert_list(SSL_CTX *ctx); | ||
13 | |||
14 | long SSL_set_max_cert_list(SSL *ssl, long size); | ||
15 | long SSL_get_max_cert_list(SSL *ctx); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | SSL_CTX_set_max_cert_list() sets the maximum size allowed for the peer's | ||
20 | certificate chain for all SSL objects created from B<ctx> to be <size> bytes. | ||
21 | The SSL objects inherit the setting valid for B<ctx> at the time | ||
22 | L<SSL_new(3)|SSL_new(3)> is being called. | ||
23 | |||
24 | SSL_CTX_get_max_cert_list() returns the currently set maximum size for B<ctx>. | ||
25 | |||
26 | SSL_set_max_cert_list() sets the maximum size allowed for the peer's | ||
27 | certificate chain for B<ssl> to be <size> bytes. This setting stays valid | ||
28 | until a new value is set. | ||
29 | |||
30 | SSL_get_max_cert_list() returns the currently set maximum size for B<ssl>. | ||
31 | |||
32 | =head1 NOTES | ||
33 | |||
34 | During the handshake process, the peer may send a certificate chain. | ||
35 | The TLS/SSL standard does not give any maximum size of the certificate chain. | ||
36 | The OpenSSL library handles incoming data by a dynamically allocated buffer. | ||
37 | In order to prevent this buffer from growing without bounds due to data | ||
38 | received from a faulty or malicious peer, a maximum size for the certificate | ||
39 | chain is set. | ||
40 | |||
41 | The default value for the maximum certificate chain size is 100kB (30kB | ||
42 | on the 16bit DOS platform). This should be sufficient for usual certificate | ||
43 | chains (OpenSSL's default maximum chain length is 10, see | ||
44 | L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>, and certificates | ||
45 | without special extensions have a typical size of 1-2kB). | ||
46 | |||
47 | For special applications it can be necessary to extend the maximum certificate | ||
48 | chain size allowed to be sent by the peer, see e.g. the work on | ||
49 | "Internet X.509 Public Key Infrastructure Proxy Certificate Profile" | ||
50 | and "TLS Delegation Protocol" at http://www.ietf.org/ and | ||
51 | http://www.globus.org/ . | ||
52 | |||
53 | Under normal conditions it should never be necessary to set a value smaller | ||
54 | than the default, as the buffer is handled dynamically and only uses the | ||
55 | memory actually required by the data sent by the peer. | ||
56 | |||
57 | If the maximum certificate chain size allowed is exceeded, the handshake will | ||
58 | fail with a SSL_R_EXCESSIVE_MESSAGE_SIZE error. | ||
59 | |||
60 | =head1 RETURN VALUES | ||
61 | |||
62 | SSL_CTX_set_max_cert_list() and SSL_set_max_cert_list() return the previously | ||
63 | set value. | ||
64 | |||
65 | SSL_CTX_get_max_cert_list() and SSL_get_max_cert_list() return the currently | ||
66 | set value. | ||
67 | |||
68 | =head1 SEE ALSO | ||
69 | |||
70 | L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)>, | ||
71 | L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)> | ||
72 | |||
73 | =head1 HISTORY | ||
74 | |||
75 | SSL*_set/get_max_cert_list() have been introduced in OpenSSL 0.9.7. | ||
76 | |||
77 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_mode.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_mode.pod index 9a035bb4d1..9822544e5e 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_mode.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_mode.pod | |||
@@ -37,6 +37,9 @@ The following mode changes are available: | |||
37 | Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success | 37 | Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success |
38 | when just a single record has been written). When not set (the default), | 38 | when just a single record has been written). When not set (the default), |
39 | SSL_write() will only report success once the complete chunk was written. | 39 | SSL_write() will only report success once the complete chunk was written. |
40 | Once SSL_write() returns with r, r bytes have been successfully written | ||
41 | and the next call to SSL_write() must only send the n-r bytes left, | ||
42 | imitating the behaviour of write(). | ||
40 | 43 | ||
41 | =item SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER | 44 | =item SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER |
42 | 45 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_msg_callback.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_msg_callback.pod new file mode 100644 index 0000000000..a423932d0a --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_msg_callback.pod | |||
@@ -0,0 +1,97 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_msg_callback, SSL_CTX_set_msg_callback_arg, SSL_set_msg_callback, SSL_get_msg_callback_arg - install callback for observing protocol messages | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); | ||
12 | void SSL_CTX_set_msg_callback_arg(SSL_CTX *ctx, void *arg); | ||
13 | |||
14 | void SSL_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); | ||
15 | void SSL_set_msg_callback_arg(SSL_CTX *ctx, void *arg); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | SSL_CTX_set_msg_callback() or SSL_set_msg_callback() can be used to | ||
20 | define a message callback function I<cb> for observing all SSL/TLS | ||
21 | protocol messages (such as handshake messages) that are received or | ||
22 | sent. SSL_CTX_set_msg_callback_arg() and SSL_set_msg_callback_arg() | ||
23 | can be used to set argument I<arg> to the callback function, which is | ||
24 | available for arbitrary application use. | ||
25 | |||
26 | SSL_CTX_set_msg_callback() and SSL_CTX_set_msg_callback_arg() specify | ||
27 | default settings that will be copied to new B<SSL> objects by | ||
28 | L<SSL_new(3)|SSL_new(3)>. SSL_set_msg_callback() and | ||
29 | SSL_set_msg_callback_arg() modify the actual settings of an B<SSL> | ||
30 | object. Using a B<0> pointer for I<cb> disables the message callback. | ||
31 | |||
32 | When I<cb> is called by the SSL/TLS library for a protocol message, | ||
33 | the function arguments have the following meaning: | ||
34 | |||
35 | =over 4 | ||
36 | |||
37 | =item I<write_p> | ||
38 | |||
39 | This flag is B<0> when a protocol message has been received and B<1> | ||
40 | when a protocol message has been sent. | ||
41 | |||
42 | =item I<version> | ||
43 | |||
44 | The protocol version according to which the protocol message is | ||
45 | interpreted by the library. Currently, this is one of | ||
46 | B<SSL2_VERSION>, B<SSL3_VERSION> and B<TLS1_VERSION> (for SSL 2.0, SSL | ||
47 | 3.0 and TLS 1.0, respectively). | ||
48 | |||
49 | =item I<content_type> | ||
50 | |||
51 | In the case of SSL 2.0, this is always B<0>. In the case of SSL 3.0 | ||
52 | or TLS 1.0, this is one of the B<ContentType> values defined in the | ||
53 | protocol specification (B<change_cipher_spec(20)>, B<alert(21)>, | ||
54 | B<handshake(22)>; but never B<application_data(23)> because the | ||
55 | callback will only be called for protocol messages). | ||
56 | |||
57 | =item I<buf>, I<len> | ||
58 | |||
59 | I<buf> points to a buffer containing the protocol message, which | ||
60 | consists of I<len> bytes. The buffer is no longer valid after the | ||
61 | callback function has returned. | ||
62 | |||
63 | =item I<ssl> | ||
64 | |||
65 | The B<SSL> object that received or sent the message. | ||
66 | |||
67 | =item I<arg> | ||
68 | |||
69 | The user-defined argument optionally defined by | ||
70 | SSL_CTX_set_msg_callback_arg() or SSL_set_msg_callback_arg(). | ||
71 | |||
72 | =head1 NOTES | ||
73 | |||
74 | Protocol messages are passed to the callback function after decryption | ||
75 | and fragment collection where applicable. (Thus record boundaries are | ||
76 | not visible.) | ||
77 | |||
78 | If processing a received protocol message results in an error, | ||
79 | the callback function may not be called. For example, the callback | ||
80 | function will never see messages that are considered too large to be | ||
81 | processed. | ||
82 | |||
83 | Due to automatic protocol version negotiation, I<version> is not | ||
84 | necessarily the protocol version used by the sender of the message: If | ||
85 | a TLS 1.0 ClientHello message is received by an SSL 3.0-only server, | ||
86 | I<version> will be B<SSL3_VERSION>. | ||
87 | |||
88 | =head1 SEE ALSO | ||
89 | |||
90 | L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)> | ||
91 | |||
92 | =head1 HISTORY | ||
93 | |||
94 | SSL_CTX_set_msg_callback(), SSL_CTX_set_msg_callback_arg(), | ||
95 | SSL_set_msg_callback() and SSL_get_msg_callback_arg() were added in OpenSSL 0.9.7. | ||
96 | |||
97 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_options.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_options.pod index 3dc7cc74ad..c10055c6e7 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_options.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_options.pod | |||
@@ -17,10 +17,10 @@ SSL_CTX_set_options, SSL_set_options, SSL_CTX_get_options, SSL_get_options - man | |||
17 | =head1 DESCRIPTION | 17 | =head1 DESCRIPTION |
18 | 18 | ||
19 | SSL_CTX_set_options() adds the options set via bitmask in B<options> to B<ctx>. | 19 | SSL_CTX_set_options() adds the options set via bitmask in B<options> to B<ctx>. |
20 | Options already set before are not cleared. | 20 | Options already set before are not cleared! |
21 | 21 | ||
22 | SSL_set_options() adds the options set via bitmask in B<options> to B<ssl>. | 22 | SSL_set_options() adds the options set via bitmask in B<options> to B<ssl>. |
23 | Options already set before are not cleared. | 23 | Options already set before are not cleared! |
24 | 24 | ||
25 | SSL_CTX_get_options() returns the options set for B<ctx>. | 25 | SSL_CTX_get_options() returns the options set for B<ctx>. |
26 | 26 | ||
@@ -32,7 +32,12 @@ The behaviour of the SSL library can be changed by setting several options. | |||
32 | The options are coded as bitmasks and can be combined by a logical B<or> | 32 | The options are coded as bitmasks and can be combined by a logical B<or> |
33 | operation (|). Options can only be added but can never be reset. | 33 | operation (|). Options can only be added but can never be reset. |
34 | 34 | ||
35 | During a handshake, the option settings of the SSL object used. When | 35 | SSL_CTX_set_options() and SSL_set_options() affect the (external) |
36 | protocol behaviour of the SSL library. The (internal) behaviour of | ||
37 | the API can be changed by using the similar | ||
38 | L<SSL_CTX_set_modes(3)|SSL_CTX_set_modes(3)> and SSL_set_modes() functions. | ||
39 | |||
40 | During a handshake, the option settings of the SSL object are used. When | ||
36 | a new SSL object is created from a context using SSL_new(), the current | 41 | a new SSL object is created from a context using SSL_new(), the current |
37 | option setting is copied. Changes to B<ctx> do not affect already created | 42 | option setting is copied. Changes to B<ctx> do not affect already created |
38 | SSL objects. SSL_clear() does not affect the settings. | 43 | SSL objects. SSL_clear() does not affect the settings. |
@@ -95,38 +100,62 @@ doing a re-connect, always takes the first cipher in the cipher list. | |||
95 | 100 | ||
96 | ... | 101 | ... |
97 | 102 | ||
98 | =item SSL_OP_TLS_ROLLBACK_BUG | ||
99 | |||
100 | Disable version rollback attack detection. | ||
101 | |||
102 | During the client key exchange, the client must send the same information | ||
103 | about acceptable SSL/TLS protocol levels as during the first hello. Some | ||
104 | clients violate this rule by adapting to the server's answer. (Example: | ||
105 | the client sends a SSLv2 hello and accepts up to SSLv3.1=TLSv1, the server | ||
106 | only understands up to SSLv3. In this case the client must still use the | ||
107 | same SSLv3.1=TLSv1 announcement. Some clients step down to SSLv3 with respect | ||
108 | to the server's answer and violate the version rollback protection.) | ||
109 | |||
110 | =item SSL_OP_ALL | 103 | =item SSL_OP_ALL |
111 | 104 | ||
112 | All of the above bug workarounds. | 105 | All of the above bug workarounds. |
113 | 106 | ||
114 | =back | 107 | =back |
115 | 108 | ||
116 | It is save and recommended to use SSL_OP_ALL to enable the bug workaround | 109 | It is safe and recommended to use B<SSL_OP_ALL> to enable the bug workaround |
117 | options. | 110 | options. |
118 | 111 | ||
119 | The following B<modifying> options are available: | 112 | The following B<modifying> options are available: |
120 | 113 | ||
121 | =over 4 | 114 | =over 4 |
122 | 115 | ||
116 | =item SSL_OP_TLS_ROLLBACK_BUG | ||
117 | |||
118 | Disable version rollback attack detection. | ||
119 | |||
120 | During the client key exchange, the client must send the same information | ||
121 | about acceptable SSL/TLS protocol levels as during the first hello. Some | ||
122 | clients violate this rule by adapting to the server's answer. (Example: | ||
123 | the client sends a SSLv2 hello and accepts up to SSLv3.1=TLSv1, the server | ||
124 | only understands up to SSLv3. In this case the client must still use the | ||
125 | same SSLv3.1=TLSv1 announcement. Some clients step down to SSLv3 with respect | ||
126 | to the server's answer and violate the version rollback protection.) | ||
127 | |||
123 | =item SSL_OP_SINGLE_DH_USE | 128 | =item SSL_OP_SINGLE_DH_USE |
124 | 129 | ||
125 | Always create a new key when using temporary DH parameters. | 130 | Always create a new key when using temporary/ephemeral DH parameters |
131 | (see L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>). | ||
132 | This option must be used to prevent small subgroup attacks, when | ||
133 | the DH parameters were not generated using "strong" primes | ||
134 | (e.g. when using DSA-parameters, see L<dhparam(1)|dhparam(1)>). | ||
135 | If "strong" primes were used, it is not strictly necessary to generate | ||
136 | a new DH key during each handshake but it is also recommended. | ||
137 | B<SSL_OP_SINGLE_DH_USE> should therefore be enabled whenever | ||
138 | temporary/ephemeral DH parameters are used. | ||
126 | 139 | ||
127 | =item SSL_OP_EPHEMERAL_RSA | 140 | =item SSL_OP_EPHEMERAL_RSA |
128 | 141 | ||
129 | Also use the temporary RSA key when doing RSA operations. | 142 | Always use ephemeral (temporary) RSA key when doing RSA operations |
143 | (see L<SSL_CTX_set_tmp_rsa_callback(3)|SSL_CTX_set_tmp_rsa_callback(3)>). | ||
144 | According to the specifications this is only done, when a RSA key | ||
145 | can only be used for signature operations (namely under export ciphers | ||
146 | with restricted RSA keylength). By setting this option, ephemeral | ||
147 | RSA keys are always used. This option breaks compatibility with the | ||
148 | SSL/TLS specifications and may lead to interoperability problems with | ||
149 | clients and should therefore never be used. Ciphers with EDH (ephemeral | ||
150 | Diffie-Hellman) key exchange should be used instead. | ||
151 | |||
152 | =item SSL_OP_CIPHER_SERVER_PREFERENCE | ||
153 | |||
154 | When choosing a cipher, use the server's preferences instead of the client | ||
155 | preferences. When not set, the SSL server will always follow the clients | ||
156 | preferences. When set, the SSLv3/TLSv1 server will choose following its | ||
157 | own preferences. Because of the different protocol, for SSLv2 the server | ||
158 | will send his list of preferences to the client and the client chooses. | ||
130 | 159 | ||
131 | =item SSL_OP_PKCS1_CHECK_1 | 160 | =item SSL_OP_PKCS1_CHECK_1 |
132 | 161 | ||
@@ -142,11 +171,6 @@ If we accept a netscape connection, demand a client cert, have a | |||
142 | non-self-sighed CA which does not have it's CA in netscape, and the | 171 | non-self-sighed CA which does not have it's CA in netscape, and the |
143 | browser has a cert, it will crash/hang. Works for 3.x and 4.xbeta | 172 | browser has a cert, it will crash/hang. Works for 3.x and 4.xbeta |
144 | 173 | ||
145 | =item SSL_OP_NON_EXPORT_FIRST | ||
146 | |||
147 | On servers try to use non-export (stronger) ciphers first. This option does | ||
148 | not work under all circumstances (in the code it is declared "broken"). | ||
149 | |||
150 | =item SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG | 174 | =item SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG |
151 | 175 | ||
152 | ... | 176 | ... |
@@ -163,6 +187,12 @@ Do not use the SSLv3 protocol. | |||
163 | 187 | ||
164 | Do not use the TLSv1 protocol. | 188 | Do not use the TLSv1 protocol. |
165 | 189 | ||
190 | =item SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION | ||
191 | |||
192 | When performing renegotiation as a server, always start a new session | ||
193 | (i.e., session resumption requests are only accepted in the initial | ||
194 | handshake). This option is not needed for clients. | ||
195 | |||
166 | =back | 196 | =back |
167 | 197 | ||
168 | =head1 RETURN VALUES | 198 | =head1 RETURN VALUES |
@@ -174,10 +204,19 @@ SSL_CTX_get_options() and SSL_get_options() return the current bitmask. | |||
174 | 204 | ||
175 | =head1 SEE ALSO | 205 | =head1 SEE ALSO |
176 | 206 | ||
177 | L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)>, L<SSL_clear(3)|SSL_clear(3)> | 207 | L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)>, L<SSL_clear(3)|SSL_clear(3)>, |
208 | L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>, | ||
209 | L<SSL_CTX_set_tmp_rsa_callback(3)|SSL_CTX_set_tmp_rsa_callback(3)>, | ||
210 | L<dhparam(1)|dhparam(1)> | ||
178 | 211 | ||
179 | =head1 HISTORY | 212 | =head1 HISTORY |
180 | 213 | ||
181 | SSL_OP_TLS_ROLLBACK_BUG has been added in OpenSSL 0.9.6. | 214 | B<SSL_OP_CIPHER_SERVER_PREFERENCE> and |
215 | B<SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION> have been added in | ||
216 | OpenSSL 0.9.7. | ||
217 | |||
218 | B<SSL_OP_TLS_ROLLBACK_BUG> has been added in OpenSSL 0.9.6 and was automatically | ||
219 | enabled with B<SSL_OP_ALL>. As of 0.9.7, it is no longer included in B<SSL_OP_ALL> | ||
220 | and must be explicitly set. | ||
182 | 221 | ||
183 | =cut | 222 | =cut |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_quiet_shutdown.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_quiet_shutdown.pod new file mode 100644 index 0000000000..1d0526d59a --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_quiet_shutdown.pod | |||
@@ -0,0 +1,63 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_quiet_shutdown, SSL_CTX_get_quiet_shutdown, SSL_set_quiet_shutdown, SSL_get_quiet_shutdown - manipulate shutdown behaviour | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode); | ||
12 | int SSL_CTX_get_quiet_shutdown(SSL_CTX *ctx); | ||
13 | |||
14 | void SSL_set_quiet_shutdown(SSL *ssl, int mode); | ||
15 | int SSL_get_quiet_shutdown(SSL *ssl); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | SSL_CTX_set_quiet_shutdown() sets the "quiet shutdown" flag for B<ctx> to be | ||
20 | B<mode>. SSL objects created from B<ctx> inherit the B<mode> valid at the time | ||
21 | L<SSL_new(3)|SSL_new(3)> is called. B<mode> may be 0 or 1. | ||
22 | |||
23 | SSL_CTX_get_quiet_shutdown() returns the "quiet shutdown" setting of B<ctx>. | ||
24 | |||
25 | SSL_set_quiet_shutdown() sets the "quiet shutdown" flag for B<ssl> to be | ||
26 | B<mode>. The setting stays valid until B<ssl> is removed with | ||
27 | L<SSL_free(3)|SSL_free(3)> or SSL_set_quiet_shutdown() is called again. | ||
28 | It is not changed when L<SSL_clear(3)|SSL_clear(3)> is called. | ||
29 | B<mode> may be 0 or 1. | ||
30 | |||
31 | SSL_get_quiet_shutdown() returns the "quiet shutdown" setting of B<ssl>. | ||
32 | |||
33 | =head1 NOTES | ||
34 | |||
35 | Normally when a SSL connection is finished, the parties must send out | ||
36 | "close notify" alert messages using L<SSL_shutdown(3)|SSL_shutdown(3)> | ||
37 | for a clean shutdown. | ||
38 | |||
39 | When setting the "quiet shutdown" flag to 1, L<SSL_shutdown(3)|SSL_shutdown(3)> | ||
40 | will set the internal flags to SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN. | ||
41 | (L<SSL_shutdown(3)|SSL_shutdown(3)> then behaves like | ||
42 | L<SSL_set_shutdown(3)|SSL_set_shutdown(3)> called with | ||
43 | SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN.) | ||
44 | The session is thus considered to be shutdown, but no "close notify" alert | ||
45 | is sent to the peer. This behaviour violates the TLS standard. | ||
46 | |||
47 | The default is normal shutdown behaviour as described by the TLS standard. | ||
48 | |||
49 | =head1 RETURN VALUES | ||
50 | |||
51 | SSL_CTX_set_quiet_shutdown() and SSL_set_quiet_shutdown() do not return | ||
52 | diagnostic information. | ||
53 | |||
54 | SSL_CTX_get_quiet_shutdown() and SSL_get_quiet_shutdown return the current | ||
55 | setting. | ||
56 | |||
57 | =head1 SEE ALSO | ||
58 | |||
59 | L<ssl(3)|ssl(3)>, L<SSL_shutdown(3)|SSL_shutdown(3)>, | ||
60 | L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>, L<SSL_new(3)|SSL_new(3)>, | ||
61 | L<SSL_clear(3)|SSL_clear(3)>, L<SSL_free(3)|SSL_free(3)> | ||
62 | |||
63 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_session_cache_mode.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_session_cache_mode.pod index 8bbfc78720..9aa6c6b2e3 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_session_cache_mode.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_session_cache_mode.pod | |||
@@ -97,6 +97,7 @@ SSL_CTX_get_session_cache_mode() returns the currently set cache mode. | |||
97 | =head1 SEE ALSO | 97 | =head1 SEE ALSO |
98 | 98 | ||
99 | L<ssl(3)|ssl(3)>, L<SSL_set_session(3)|SSL_set_session(3)>, | 99 | L<ssl(3)|ssl(3)>, L<SSL_set_session(3)|SSL_set_session(3)>, |
100 | L<SSL_session_reused(3)|SSL_session_reused(3)>, | ||
100 | L<SSL_CTX_sess_number(3)|SSL_CTX_sess_number(3)>, | 101 | L<SSL_CTX_sess_number(3)|SSL_CTX_sess_number(3)>, |
101 | L<SSL_CTX_sess_set_cache_size(3)|SSL_CTX_sess_set_cache_size(3)>, | 102 | L<SSL_CTX_sess_set_cache_size(3)|SSL_CTX_sess_set_cache_size(3)>, |
102 | L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)>, | 103 | L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)>, |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_timeout.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_timeout.pod index 21faed12d4..e3de27c473 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_timeout.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_timeout.pod | |||
@@ -37,7 +37,10 @@ L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)> is called, either | |||
37 | directly by the application or automatically (see | 37 | directly by the application or automatically (see |
38 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>) | 38 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>) |
39 | 39 | ||
40 | The default value for session timeout is 300 seconds. | 40 | The default value for session timeout is decided on a per protocol |
41 | basis, see L<SSL_get_default_timeout(3)|SSL_get_default_timeout(3)>. | ||
42 | All currently supported protocols have the same default timeout value | ||
43 | of 300 seconds. | ||
41 | 44 | ||
42 | =head1 RETURN VALUES | 45 | =head1 RETURN VALUES |
43 | 46 | ||
@@ -50,6 +53,7 @@ SSL_CTX_get_timeout() returns the currently set timeout value. | |||
50 | L<ssl(3)|ssl(3)>, | 53 | L<ssl(3)|ssl(3)>, |
51 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, | 54 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, |
52 | L<SSL_SESSION_get_time(3)|SSL_SESSION_get_time(3)>, | 55 | L<SSL_SESSION_get_time(3)|SSL_SESSION_get_time(3)>, |
53 | L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)> | 56 | L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>, |
57 | L<SSL_get_default_timeout(3)|SSL_get_default_timeout(3)> | ||
54 | 58 | ||
55 | =cut | 59 | =cut |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_tmp_dh_callback.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_tmp_dh_callback.pod new file mode 100644 index 0000000000..29d1f8a6fb --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_tmp_dh_callback.pod | |||
@@ -0,0 +1,170 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_tmp_dh_callback, SSL_CTX_set_tmp_dh, SSL_set_tmp_dh_callback, SSL_set_tmp_dh - handle DH keys for ephemeral key exchange | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, | ||
12 | DH *(*tmp_dh_callback)(SSL *ssl, int is_export, int keylength)); | ||
13 | long SSL_CTX_set_tmp_dh(SSL_CTX *ctx, DH *dh); | ||
14 | |||
15 | void SSL_set_tmp_dh_callback(SSL_CTX *ctx, | ||
16 | DH *(*tmp_dh_callback)(SSL *ssl, int is_export, int keylength)); | ||
17 | long SSL_set_tmp_dh(SSL *ssl, DH *dh) | ||
18 | |||
19 | DH *(*tmp_dh_callback)(SSL *ssl, int is_export, int keylength)); | ||
20 | |||
21 | =head1 DESCRIPTION | ||
22 | |||
23 | SSL_CTX_set_tmp_dh_callback() sets the callback function for B<ctx> to be | ||
24 | used when a DH parameters are required to B<tmp_dh_callback>. | ||
25 | The callback is inherited by all B<ssl> objects created from B<ctx>. | ||
26 | |||
27 | SSL_CTX_set_tmp_dh() sets DH parameters to be used to be B<dh>. | ||
28 | The key is inherited by all B<ssl> objects created from B<ctx>. | ||
29 | |||
30 | SSL_set_tmp_dh_callback() sets the callback only for B<ssl>. | ||
31 | |||
32 | SSL_set_tmp_dh() sets the parameters only for B<ssl>. | ||
33 | |||
34 | These functions apply to SSL/TLS servers only. | ||
35 | |||
36 | =head1 NOTES | ||
37 | |||
38 | When using a cipher with RSA authentication, an ephemeral DH key exchange | ||
39 | can take place. Ciphers with DSA keys always use ephemeral DH keys as well. | ||
40 | In these cases, the session data are negotiated using the | ||
41 | ephemeral/temporary DH key and the key supplied and certified | ||
42 | by the certificate chain is only used for signing. | ||
43 | Anonymous ciphers (without a permanent server key) also use ephemeral DH keys. | ||
44 | |||
45 | Using ephemeral DH key exchange yields forward secrecy, as the connection | ||
46 | can only be decrypted, when the DH key is known. By generating a temporary | ||
47 | DH key inside the server application that is lost when the application | ||
48 | is left, it becomes impossible for an attacker to decrypt past sessions, | ||
49 | even if he gets hold of the normal (certified) key, as this key was | ||
50 | only used for signing. | ||
51 | |||
52 | In order to perform a DH key exchange the server must use a DH group | ||
53 | (DH parameters) and generate a DH key. The server will always generate a new | ||
54 | DH key during the negotiation, when the DH parameters are supplied via | ||
55 | callback and/or when the SSL_OP_SINGLE_DH_USE option of | ||
56 | L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)> is set. It will | ||
57 | immediately create a DH key, when DH parameters are supplied via | ||
58 | SSL_CTX_set_tmp_dh() and SSL_OP_SINGLE_DH_USE is not set. In this case, | ||
59 | it may happen that a key is generated on initialization without later | ||
60 | being needed, while on the other hand the computer time during the | ||
61 | negotiation is being saved. | ||
62 | |||
63 | If "strong" primes were used to generate the DH parameters, it is not strictly | ||
64 | necessary to generate a new key for each handshake but it does improve forward | ||
65 | secrecy. If it is not assured, that "strong" primes were used (see especially | ||
66 | the section about DSA parameters below), SSL_OP_SINGLE_DH_USE must be used | ||
67 | in order to prevent small subgroup attacks. Always using SSL_OP_SINGLE_DH_USE | ||
68 | has an impact on the computer time needed during negotiation, but it is not | ||
69 | very large, so application authors/users should consider to always enable | ||
70 | this option. | ||
71 | |||
72 | As generating DH parameters is extremely time consuming, an application | ||
73 | should not generate the parameters on the fly but supply the parameters. | ||
74 | DH parameters can be reused, as the actual key is newly generated during | ||
75 | the negotiation. The risk in reusing DH parameters is that an attacker | ||
76 | may specialize on a very often used DH group. Applications should therefore | ||
77 | generate their own DH parameters during the installation process using the | ||
78 | openssl L<dhparam(1)|dhparam(1)> application. In order to reduce the computer | ||
79 | time needed for this generation, it is possible to use DSA parameters | ||
80 | instead (see L<dhparam(1)|dhparam(1)>), but in this case SSL_OP_SINGLE_DH_USE | ||
81 | is mandatory. | ||
82 | |||
83 | Application authors may compile in DH parameters. Files dh512.pem, | ||
84 | dh1024.pem, dh2048.pem, and dh4096 in the 'apps' directory of current | ||
85 | version of the OpenSSL distribution contain the 'SKIP' DH parameters, | ||
86 | which use safe primes and were generated verifiably pseudo-randomly. | ||
87 | These files can be converted into C code using the B<-C> option of the | ||
88 | L<dhparam(1)|dhparam(1)> application. | ||
89 | Authors may also generate their own set of parameters using | ||
90 | L<dhparam(1)|dhparam(1)>, but a user may not be sure how the parameters were | ||
91 | generated. The generation of DH parameters during installation is therefore | ||
92 | recommended. | ||
93 | |||
94 | An application may either directly specify the DH parameters or | ||
95 | can supply the DH parameters via a callback function. The callback approach | ||
96 | has the advantage, that the callback may supply DH parameters for different | ||
97 | key lengths. | ||
98 | |||
99 | The B<tmp_dh_callback> is called with the B<keylength> needed and | ||
100 | the B<is_export> information. The B<is_export> flag is set, when the | ||
101 | ephemeral DH key exchange is performed with an export cipher. | ||
102 | |||
103 | =head1 EXAMPLES | ||
104 | |||
105 | Handle DH parameters for key lengths of 512 and 1024 bits. (Error handling | ||
106 | partly left out.) | ||
107 | |||
108 | ... | ||
109 | /* Set up ephemeral DH stuff */ | ||
110 | DH *dh_512 = NULL; | ||
111 | DH *dh_1024 = NULL; | ||
112 | FILE *paramfile; | ||
113 | |||
114 | ... | ||
115 | /* "openssl dhparam -out dh_param_512.pem -2 512" */ | ||
116 | paramfile = fopen("dh_param_512.pem", "r"); | ||
117 | if (paramfile) { | ||
118 | dh_512 = PEM_read_DHparams(paramfile, NULL, NULL, NULL); | ||
119 | fclose(paramfile); | ||
120 | } | ||
121 | /* "openssl dhparam -out dh_param_1024.pem -2 1024" */ | ||
122 | paramfile = fopen("dh_param_1024.pem", "r"); | ||
123 | if (paramfile) { | ||
124 | dh_1024 = PEM_read_DHparams(paramfile, NULL, NULL, NULL); | ||
125 | fclose(paramfile); | ||
126 | } | ||
127 | ... | ||
128 | |||
129 | /* "openssl dhparam -C -2 512" etc... */ | ||
130 | DH *get_dh512() { ... } | ||
131 | DH *get_dh1024() { ... } | ||
132 | |||
133 | DH *tmp_dh_callback(SSL *s, int is_export, int keylength) | ||
134 | { | ||
135 | DH *dh_tmp=NULL; | ||
136 | |||
137 | switch (keylength) { | ||
138 | case 512: | ||
139 | if (!dh_512) | ||
140 | dh_512 = get_dh512(); | ||
141 | dh_tmp = dh_512; | ||
142 | break; | ||
143 | case 1024: | ||
144 | if (!dh_1024) | ||
145 | dh_1024 = get_dh1024(); | ||
146 | dh_tmp = dh_1024; | ||
147 | break; | ||
148 | default: | ||
149 | /* Generating a key on the fly is very costly, so use what is there */ | ||
150 | setup_dh_parameters_like_above(); | ||
151 | } | ||
152 | return(dh_tmp); | ||
153 | } | ||
154 | |||
155 | =head1 RETURN VALUES | ||
156 | |||
157 | SSL_CTX_set_tmp_dh_callback() and SSL_set_tmp_dh_callback() do not return | ||
158 | diagnostic output. | ||
159 | |||
160 | SSL_CTX_set_tmp_dh() and SSL_set_tmp_dh() do return 1 on success and 0 | ||
161 | on failure. Check the error queue to find out the reason of failure. | ||
162 | |||
163 | =head1 SEE ALSO | ||
164 | |||
165 | L<ssl(3)|ssl(3)>, L<SSL_CTX_set_cipher_list(3)|SSL_CTX_set_cipher_list(3)>, | ||
166 | L<SSL_CTX_set_tmp_rsa_callback(3)|SSL_CTX_set_tmp_rsa_callback(3)>, | ||
167 | L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, | ||
168 | L<ciphers(1)|ciphers(1)>, L<dhparam(1)|dhparam(1)> | ||
169 | |||
170 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_tmp_rsa_callback.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_tmp_rsa_callback.pod new file mode 100644 index 0000000000..f85775927d --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_tmp_rsa_callback.pod | |||
@@ -0,0 +1,166 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_tmp_rsa_callback, SSL_CTX_set_tmp_rsa, SSL_CTX_need_tmp_rsa, SSL_set_tmp_rsa_callback, SSL_set_tmp_rsa, SSL_need_tmp_rsa - handle RSA keys for ephemeral key exchange | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx, | ||
12 | RSA *(*tmp_rsa_callback)(SSL *ssl, int is_export, int keylength)); | ||
13 | long SSL_CTX_set_tmp_rsa(SSL_CTX *ctx, RSA *rsa); | ||
14 | long SSL_CTX_need_tmp_rsa(SSL_CTX *ctx); | ||
15 | |||
16 | void SSL_set_tmp_rsa_callback(SSL_CTX *ctx, | ||
17 | RSA *(*tmp_rsa_callback)(SSL *ssl, int is_export, int keylength)); | ||
18 | long SSL_set_tmp_rsa(SSL *ssl, RSA *rsa) | ||
19 | long SSL_need_tmp_rsa(SSL *ssl) | ||
20 | |||
21 | RSA *(*tmp_rsa_callback)(SSL *ssl, int is_export, int keylength)); | ||
22 | |||
23 | =head1 DESCRIPTION | ||
24 | |||
25 | SSL_CTX_set_tmp_rsa_callback() sets the callback function for B<ctx> to be | ||
26 | used when a temporary/ephemeral RSA key is required to B<tmp_rsa_callback>. | ||
27 | The callback is inherited by all SSL objects newly created from B<ctx> | ||
28 | with <SSL_new(3)|SSL_new(3)>. Already created SSL objects are not affected. | ||
29 | |||
30 | SSL_CTX_set_tmp_rsa() sets the temporary/ephemeral RSA key to be used to be | ||
31 | B<rsa>. The key is inherited by all SSL objects newly created from B<ctx> | ||
32 | with <SSL_new(3)|SSL_new(3)>. Already created SSL objects are not affected. | ||
33 | |||
34 | SSL_CTX_need_tmp_rsa() returns 1, if a temporary/ephemeral RSA key is needed | ||
35 | for RSA-based strength-limited 'exportable' ciphersuites because a RSA key | ||
36 | with a keysize larger than 512 bits is installed. | ||
37 | |||
38 | SSL_set_tmp_rsa_callback() sets the callback only for B<ssl>. | ||
39 | |||
40 | SSL_set_tmp_rsa() sets the key only for B<ssl>. | ||
41 | |||
42 | SSL_need_tmp_rsa() returns 1, if a temporary/ephemeral RSA key is needed, | ||
43 | for RSA-based strength-limited 'exportable' ciphersuites because a RSA key | ||
44 | with a keysize larger than 512 bits is installed. | ||
45 | |||
46 | These functions apply to SSL/TLS servers only. | ||
47 | |||
48 | =head1 NOTES | ||
49 | |||
50 | When using a cipher with RSA authentication, an ephemeral RSA key exchange | ||
51 | can take place. In this case the session data are negotiated using the | ||
52 | ephemeral/temporary RSA key and the RSA key supplied and certified | ||
53 | by the certificate chain is only used for signing. | ||
54 | |||
55 | Under previous export restrictions, ciphers with RSA keys shorter (512 bits) | ||
56 | than the usual key length of 1024 bits were created. To use these ciphers | ||
57 | with RSA keys of usual length, an ephemeral key exchange must be performed, | ||
58 | as the normal (certified) key cannot be directly used. | ||
59 | |||
60 | Using ephemeral RSA key exchange yields forward secrecy, as the connection | ||
61 | can only be decrypted, when the RSA key is known. By generating a temporary | ||
62 | RSA key inside the server application that is lost when the application | ||
63 | is left, it becomes impossible for an attacker to decrypt past sessions, | ||
64 | even if he gets hold of the normal (certified) RSA key, as this key was | ||
65 | used for signing only. The downside is that creating a RSA key is | ||
66 | computationally expensive. | ||
67 | |||
68 | Additionally, the use of ephemeral RSA key exchange is only allowed in | ||
69 | the TLS standard, when the RSA key can be used for signing only, that is | ||
70 | for export ciphers. Using ephemeral RSA key exchange for other purposes | ||
71 | violates the standard and can break interoperability with clients. | ||
72 | It is therefore strongly recommended to not use ephemeral RSA key | ||
73 | exchange and use EDH (Ephemeral Diffie-Hellman) key exchange instead | ||
74 | in order to achieve forward secrecy (see | ||
75 | L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>). | ||
76 | |||
77 | On OpenSSL servers ephemeral RSA key exchange is therefore disabled by default | ||
78 | and must be explicitly enabled using the SSL_OP_EPHEMERAL_RSA option of | ||
79 | L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, violating the TLS/SSL | ||
80 | standard. When ephemeral RSA key exchange is required for export ciphers, | ||
81 | it will automatically be used without this option! | ||
82 | |||
83 | An application may either directly specify the key or can supply the key via | ||
84 | a callback function. The callback approach has the advantage, that the | ||
85 | callback may generate the key only in case it is actually needed. As the | ||
86 | generation of a RSA key is however costly, it will lead to a significant | ||
87 | delay in the handshake procedure. Another advantage of the callback function | ||
88 | is that it can supply keys of different size (e.g. for SSL_OP_EPHEMERAL_RSA | ||
89 | usage) while the explicit setting of the key is only useful for key size of | ||
90 | 512 bits to satisfy the export restricted ciphers and does give away key length | ||
91 | if a longer key would be allowed. | ||
92 | |||
93 | The B<tmp_rsa_callback> is called with the B<keylength> needed and | ||
94 | the B<is_export> information. The B<is_export> flag is set, when the | ||
95 | ephemeral RSA key exchange is performed with an export cipher. | ||
96 | |||
97 | =head1 EXAMPLES | ||
98 | |||
99 | Generate temporary RSA keys to prepare ephemeral RSA key exchange. As the | ||
100 | generation of a RSA key costs a lot of computer time, they saved for later | ||
101 | reuse. For demonstration purposes, two keys for 512 bits and 1024 bits | ||
102 | respectively are generated. | ||
103 | |||
104 | ... | ||
105 | /* Set up ephemeral RSA stuff */ | ||
106 | RSA *rsa_512 = NULL; | ||
107 | RSA *rsa_1024 = NULL; | ||
108 | |||
109 | rsa_512 = RSA_generate_key(512,RSA_F4,NULL,NULL); | ||
110 | if (rsa_512 == NULL) | ||
111 | evaluate_error_queue(); | ||
112 | |||
113 | rsa_1024 = RSA_generate_key(1024,RSA_F4,NULL,NULL); | ||
114 | if (rsa_1024 == NULL) | ||
115 | evaluate_error_queue(); | ||
116 | |||
117 | ... | ||
118 | |||
119 | RSA *tmp_rsa_callback(SSL *s, int is_export, int keylength) | ||
120 | { | ||
121 | RSA *rsa_tmp=NULL; | ||
122 | |||
123 | switch (keylength) { | ||
124 | case 512: | ||
125 | if (rsa_512) | ||
126 | rsa_tmp = rsa_512; | ||
127 | else { /* generate on the fly, should not happen in this example */ | ||
128 | rsa_tmp = RSA_generate_key(keylength,RSA_F4,NULL,NULL); | ||
129 | rsa_512 = rsa_tmp; /* Remember for later reuse */ | ||
130 | } | ||
131 | break; | ||
132 | case 1024: | ||
133 | if (rsa_1024) | ||
134 | rsa_tmp=rsa_1024; | ||
135 | else | ||
136 | should_not_happen_in_this_example(); | ||
137 | break; | ||
138 | default: | ||
139 | /* Generating a key on the fly is very costly, so use what is there */ | ||
140 | if (rsa_1024) | ||
141 | rsa_tmp=rsa_1024; | ||
142 | else | ||
143 | rsa_tmp=rsa_512; /* Use at least a shorter key */ | ||
144 | } | ||
145 | return(rsa_tmp); | ||
146 | } | ||
147 | |||
148 | =head1 RETURN VALUES | ||
149 | |||
150 | SSL_CTX_set_tmp_rsa_callback() and SSL_set_tmp_rsa_callback() do not return | ||
151 | diagnostic output. | ||
152 | |||
153 | SSL_CTX_set_tmp_rsa() and SSL_set_tmp_rsa() do return 1 on success and 0 | ||
154 | on failure. Check the error queue to find out the reason of failure. | ||
155 | |||
156 | SSL_CTX_need_tmp_rsa() and SSL_need_tmp_rsa() return 1 if a temporary | ||
157 | RSA key is needed and 0 otherwise. | ||
158 | |||
159 | =head1 SEE ALSO | ||
160 | |||
161 | L<ssl(3)|ssl(3)>, L<SSL_CTX_set_cipher_list(3)|SSL_CTX_set_cipher_list(3)>, | ||
162 | L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, | ||
163 | L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>, | ||
164 | L<SSL_new(3)|SSL_new(3)>, L<ciphers(1)|ciphers(1)> | ||
165 | |||
166 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_verify.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_verify.pod index fc0b76118f..5bb21ca535 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_verify.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_verify.pod | |||
@@ -59,14 +59,14 @@ The handshake will be continued regardless of the verification result. | |||
59 | 59 | ||
60 | B<Server mode:> the server sends a client certificate request to the client. | 60 | B<Server mode:> the server sends a client certificate request to the client. |
61 | The certificate returned (if any) is checked. If the verification process | 61 | The certificate returned (if any) is checked. If the verification process |
62 | fails as indicated by B<verify_callback>, the TLS/SSL handshake is | 62 | fails, the TLS/SSL handshake is |
63 | immediately terminated with an alert message containing the reason for | 63 | immediately terminated with an alert message containing the reason for |
64 | the verification failure. | 64 | the verification failure. |
65 | The behaviour can be controlled by the additional | 65 | The behaviour can be controlled by the additional |
66 | SSL_VERIFY_FAIL_IF_NO_PEER_CERT and SSL_VERIFY_CLIENT_ONCE flags. | 66 | SSL_VERIFY_FAIL_IF_NO_PEER_CERT and SSL_VERIFY_CLIENT_ONCE flags. |
67 | 67 | ||
68 | B<Client mode:> the server certificate is verified. If the verification process | 68 | B<Client mode:> the server certificate is verified. If the verification process |
69 | fails as indicated by B<verify_callback>, the TLS/SSL handshake is | 69 | fails, the TLS/SSL handshake is |
70 | immediately terminated with an alert message containing the reason for | 70 | immediately terminated with an alert message containing the reason for |
71 | the verification failure. If no server certificate is sent, because an | 71 | the verification failure. If no server certificate is sent, because an |
72 | anonymous cipher is used, SSL_VERIFY_PEER is ignored. | 72 | anonymous cipher is used, SSL_VERIFY_PEER is ignored. |
@@ -92,6 +92,15 @@ B<Client mode:> ignored | |||
92 | Exactly one of the B<mode> flags SSL_VERIFY_NONE and SSL_VERIFY_PEER must be | 92 | Exactly one of the B<mode> flags SSL_VERIFY_NONE and SSL_VERIFY_PEER must be |
93 | set at any time. | 93 | set at any time. |
94 | 94 | ||
95 | The actual verification procedure is performed either using the built-in | ||
96 | verification procedure or using another application provided verification | ||
97 | function set with | ||
98 | L<SSL_CTX_set_cert_verify_callback(3)|SSL_CTX_set_cert_verify_callback(3)>. | ||
99 | The following descriptions apply in the case of the built-in procedure. An | ||
100 | application provided procedure also has access to the verify depth information | ||
101 | and the verify_callback() function, but the way this information is used | ||
102 | may be different. | ||
103 | |||
95 | SSL_CTX_set_verify_depth() and SSL_set_verify_depth() set the limit up | 104 | SSL_CTX_set_verify_depth() and SSL_set_verify_depth() set the limit up |
96 | to which depth certificates in a chain are used during the verification | 105 | to which depth certificates in a chain are used during the verification |
97 | procedure. If the certificate chain is longer than allowed, the certificates | 106 | procedure. If the certificate chain is longer than allowed, the certificates |
@@ -278,6 +287,7 @@ L<SSL_CTX_get_verify_mode(3)|SSL_CTX_get_verify_mode(3)>, | |||
278 | L<SSL_get_verify_result(3)|SSL_get_verify_result(3)>, | 287 | L<SSL_get_verify_result(3)|SSL_get_verify_result(3)>, |
279 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)>, | 288 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)>, |
280 | L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)>, | 289 | L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)>, |
290 | L<SSL_CTX_set_cert_verify_callback(3)|SSL_CTX_set_cert_verify_callback(3)>, | ||
281 | L<SSL_get_ex_data_X509_STORE_CTX_idx(3)|SSL_get_ex_data_X509_STORE_CTX_idx(3)>, | 291 | L<SSL_get_ex_data_X509_STORE_CTX_idx(3)|SSL_get_ex_data_X509_STORE_CTX_idx(3)>, |
282 | L<SSL_get_ex_new_index(3)|SSL_get_ex_new_index(3)> | 292 | L<SSL_get_ex_new_index(3)|SSL_get_ex_new_index(3)> |
283 | 293 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_use_certificate.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_use_certificate.pod index 3b2fe6fc50..b8868f18bf 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_use_certificate.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_use_certificate.pod | |||
@@ -149,6 +149,7 @@ L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)>, L<SSL_clear(3)|SSL_clear(3)>, | |||
149 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)>, | 149 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)>, |
150 | L<SSL_CTX_set_default_passwd_cb(3)|SSL_CTX_set_default_passwd_cb(3)>, | 150 | L<SSL_CTX_set_default_passwd_cb(3)|SSL_CTX_set_default_passwd_cb(3)>, |
151 | L<SSL_CTX_set_cipher_list(3)|SSL_CTX_set_cipher_list(3)>, | 151 | L<SSL_CTX_set_cipher_list(3)|SSL_CTX_set_cipher_list(3)>, |
152 | L<SSL_CTX_set_client_cert_cb(3)|SSL_CTX_set_client_cert_cb(3)>, | ||
152 | L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)> | 153 | L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)> |
153 | 154 | ||
154 | =cut | 155 | =cut |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_SESSION_free.pod b/src/lib/libssl/src/doc/ssl/SSL_SESSION_free.pod index df30ccbb32..558de01df9 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_SESSION_free.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_SESSION_free.pod | |||
@@ -16,10 +16,40 @@ SSL_SESSION_free() decrements the reference count of B<session> and removes | |||
16 | the B<SSL_SESSION> structure pointed to by B<session> and frees up the allocated | 16 | the B<SSL_SESSION> structure pointed to by B<session> and frees up the allocated |
17 | memory, if the the reference count has reached 0. | 17 | memory, if the the reference count has reached 0. |
18 | 18 | ||
19 | =head1 NOTES | ||
20 | |||
21 | SSL_SESSION objects are allocated, when a TLS/SSL handshake operation | ||
22 | is successfully completed. Depending on the settings, see | ||
23 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, | ||
24 | the SSL_SESSION objects are internally referenced by the SSL_CTX and | ||
25 | linked into its session cache. SSL objects may be using the SSL_SESSION object; | ||
26 | as a session may be reused, several SSL objects may be using one SSL_SESSION | ||
27 | object at the same time. It is therefore crucial to keep the reference | ||
28 | count (usage information) correct and not delete a SSL_SESSION object | ||
29 | that is still used, as this may lead to program failures due to | ||
30 | dangling pointers. These failures may also appear delayed, e.g. | ||
31 | when an SSL_SESSION object was completely freed as the reference count | ||
32 | incorrectly became 0, but it is still referenced in the internal | ||
33 | session cache and the cache list is processed during a | ||
34 | L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)> operation. | ||
35 | |||
36 | SSL_SESSION_free() must only be called for SSL_SESSION objects, for | ||
37 | which the reference count was explicitly incremented (e.g. | ||
38 | by calling SSL_get1_session(), see L<SSL_get_session(3)|SSL_get_session(3)>) | ||
39 | or when the SSL_SESSION object was generated outside a TLS handshake | ||
40 | operation, e.g. by using L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)>. | ||
41 | It must not be called on other SSL_SESSION objects, as this would cause | ||
42 | incorrect reference counts and therefore program failures. | ||
43 | |||
19 | =head1 RETURN VALUES | 44 | =head1 RETURN VALUES |
20 | 45 | ||
21 | SSL_SESSION_free() does not provide diagnostic information. | 46 | SSL_SESSION_free() does not provide diagnostic information. |
22 | 47 | ||
23 | L<ssl(3)|ssl(3)>, L<SSL_get_session(3)|SSL_get_session(3)> | 48 | =head1 SEE ALSO |
49 | |||
50 | L<ssl(3)|ssl(3)>, L<SSL_get_session(3)|SSL_get_session(3)>, | ||
51 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, | ||
52 | L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>, | ||
53 | L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)> | ||
24 | 54 | ||
25 | =cut | 55 | =cut |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_time.pod b/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_time.pod index cd33b73aa3..ea3c2bcfe6 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_time.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_time.pod | |||
@@ -58,6 +58,7 @@ If any of the function is passed the NULL pointer for the session B<s>, | |||
58 | =head1 SEE ALSO | 58 | =head1 SEE ALSO |
59 | 59 | ||
60 | L<ssl(3)|ssl(3)>, | 60 | L<ssl(3)|ssl(3)>, |
61 | L<SSL_CTX_set_timeout(3)|SSL_CTX_set_timeout(3)> | 61 | L<SSL_CTX_set_timeout(3)|SSL_CTX_set_timeout(3)>, |
62 | L<SSL_get_default_timeout(3)|SSL_get_default_timeout(3)> | ||
62 | 63 | ||
63 | =cut | 64 | =cut |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_accept.pod b/src/lib/libssl/src/doc/ssl/SSL_accept.pod index 86f980de41..ac6caf9baa 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_accept.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_accept.pod | |||
@@ -37,11 +37,6 @@ nothing is to be done, but select() can be used to check for the required | |||
37 | condition. When using a buffering BIO, like a BIO pair, data must be written | 37 | condition. When using a buffering BIO, like a BIO pair, data must be written |
38 | into or retrieved out of the BIO before being able to continue. | 38 | into or retrieved out of the BIO before being able to continue. |
39 | 39 | ||
40 | When using a generic method (see L<SSL_CTX_new(3)|SSL_CTX_new(3)>), it | ||
41 | is necessary to call SSL_set_accept_state() | ||
42 | before calling SSL_accept() to explicitly switch the B<ssl> to server | ||
43 | mode. | ||
44 | |||
45 | =head1 RETURN VALUES | 40 | =head1 RETURN VALUES |
46 | 41 | ||
47 | The following return values can occur: | 42 | The following return values can occur: |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_alert_type_string.pod b/src/lib/libssl/src/doc/ssl/SSL_alert_type_string.pod new file mode 100644 index 0000000000..94e28cc307 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_alert_type_string.pod | |||
@@ -0,0 +1,228 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_alert_type_string, SSL_alert_type_string_long, SSL_alert_desc_string, SSL_alert_desc_string_long - get textual description of alert information | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | const char *SSL_alert_type_string(int value); | ||
12 | const char *SSL_alert_type_string_long(int value); | ||
13 | |||
14 | const char *SSL_alert_desc_string(int value); | ||
15 | const char *SSL_alert_desc_string_long(int value); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | SSL_alert_type_string() returns a one letter string indicating the | ||
20 | type of the alert specified by B<value>. | ||
21 | |||
22 | SSL_alert_type_string_long() returns a string indicating the type of the alert | ||
23 | specified by B<value>. | ||
24 | |||
25 | SSL_alert_desc_string() returns a two letter string as a short form | ||
26 | describing the reason of the alert specified by B<value>. | ||
27 | |||
28 | SSL_alert_desc_string_long() returns a string describing the reason | ||
29 | of the alert specified by B<value>. | ||
30 | |||
31 | =head1 NOTES | ||
32 | |||
33 | When one side of an SSL/TLS communication wants to inform the peer about | ||
34 | a special situation, it sends an alert. The alert is sent as a special message | ||
35 | and does not influence the normal data stream (unless its contents results | ||
36 | in the communication being canceled). | ||
37 | |||
38 | A warning alert is sent, when a non-fatal error condition occurs. The | ||
39 | "close notify" alert is sent as a warning alert. Other examples for | ||
40 | non-fatal errors are certificate errors ("certificate expired", | ||
41 | "unsupported certificate"), for which a warning alert may be sent. | ||
42 | (The sending party may however decide to send a fatal error.) The | ||
43 | receiving side may cancel the connection on reception of a warning | ||
44 | alert on it discretion. | ||
45 | |||
46 | Several alert messages must be sent as fatal alert messages as specified | ||
47 | by the TLS RFC. A fatal alert always leads to a connection abort. | ||
48 | |||
49 | =head1 RETURN VALUES | ||
50 | |||
51 | The following strings can occur for SSL_alert_type_string() or | ||
52 | SSL_alert_type_string_long(): | ||
53 | |||
54 | =over 4 | ||
55 | |||
56 | =item "W"/"warning" | ||
57 | |||
58 | =item "F"/"fatal" | ||
59 | |||
60 | =item "U"/"unknown" | ||
61 | |||
62 | This indicates that no support is available for this alert type. | ||
63 | Probably B<value> does not contain a correct alert message. | ||
64 | |||
65 | =back | ||
66 | |||
67 | The following strings can occur for SSL_alert_desc_string() or | ||
68 | SSL_alert_desc_string_long(): | ||
69 | |||
70 | =over 4 | ||
71 | |||
72 | =item "CN"/"close notify" | ||
73 | |||
74 | The connection shall be closed. This is a warning alert. | ||
75 | |||
76 | =item "UM"/"unexpected message" | ||
77 | |||
78 | An inappropriate message was received. This alert is always fatal | ||
79 | and should never be observed in communication between proper | ||
80 | implementations. | ||
81 | |||
82 | =item "BM"/"bad record mac" | ||
83 | |||
84 | This alert is returned if a record is received with an incorrect | ||
85 | MAC. This message is always fatal. | ||
86 | |||
87 | =item "DF"/"decompression failure" | ||
88 | |||
89 | The decompression function received improper input (e.g. data | ||
90 | that would expand to excessive length). This message is always | ||
91 | fatal. | ||
92 | |||
93 | =item "HF"/"handshake failure" | ||
94 | |||
95 | Reception of a handshake_failure alert message indicates that the | ||
96 | sender was unable to negotiate an acceptable set of security | ||
97 | parameters given the options available. This is a fatal error. | ||
98 | |||
99 | =item "NC"/"no certificate" | ||
100 | |||
101 | A client, that was asked to send a certificate, does not send a certificate | ||
102 | (SSLv3 only). | ||
103 | |||
104 | =item "BC"/"bad certificate" | ||
105 | |||
106 | A certificate was corrupt, contained signatures that did not | ||
107 | verify correctly, etc | ||
108 | |||
109 | =item "UC"/"unsupported certificate" | ||
110 | |||
111 | A certificate was of an unsupported type. | ||
112 | |||
113 | =item "CR"/"certificate revoked" | ||
114 | |||
115 | A certificate was revoked by its signer. | ||
116 | |||
117 | =item "CE"/"certificate expired" | ||
118 | |||
119 | A certificate has expired or is not currently valid. | ||
120 | |||
121 | =item "CU"/"certificate unknown" | ||
122 | |||
123 | Some other (unspecified) issue arose in processing the | ||
124 | certificate, rendering it unacceptable. | ||
125 | |||
126 | =item "IP"/"illegal parameter" | ||
127 | |||
128 | A field in the handshake was out of range or inconsistent with | ||
129 | other fields. This is always fatal. | ||
130 | |||
131 | =item "DC"/"decryption failed" | ||
132 | |||
133 | A TLSCiphertext decrypted in an invalid way: either it wasn't an | ||
134 | even multiple of the block length or its padding values, when | ||
135 | checked, weren't correct. This message is always fatal. | ||
136 | |||
137 | =item "RO"/"record overflow" | ||
138 | |||
139 | A TLSCiphertext record was received which had a length more than | ||
140 | 2^14+2048 bytes, or a record decrypted to a TLSCompressed record | ||
141 | with more than 2^14+1024 bytes. This message is always fatal. | ||
142 | |||
143 | =item "CA"/"unknown CA" | ||
144 | |||
145 | A valid certificate chain or partial chain was received, but the | ||
146 | certificate was not accepted because the CA certificate could not | ||
147 | be located or couldn't be matched with a known, trusted CA. This | ||
148 | message is always fatal. | ||
149 | |||
150 | =item "AD"/"access denied" | ||
151 | |||
152 | A valid certificate was received, but when access control was | ||
153 | applied, the sender decided not to proceed with negotiation. | ||
154 | This message is always fatal. | ||
155 | |||
156 | =item "DE"/"decode error" | ||
157 | |||
158 | A message could not be decoded because some field was out of the | ||
159 | specified range or the length of the message was incorrect. This | ||
160 | message is always fatal. | ||
161 | |||
162 | =item "CY"/"decrypt error" | ||
163 | |||
164 | A handshake cryptographic operation failed, including being | ||
165 | unable to correctly verify a signature, decrypt a key exchange, | ||
166 | or validate a finished message. | ||
167 | |||
168 | =item "ER"/"export restriction" | ||
169 | |||
170 | A negotiation not in compliance with export restrictions was | ||
171 | detected; for example, attempting to transfer a 1024 bit | ||
172 | ephemeral RSA key for the RSA_EXPORT handshake method. This | ||
173 | message is always fatal. | ||
174 | |||
175 | =item "PV"/"protocol version" | ||
176 | |||
177 | The protocol version the client has attempted to negotiate is | ||
178 | recognized, but not supported. (For example, old protocol | ||
179 | versions might be avoided for security reasons). This message is | ||
180 | always fatal. | ||
181 | |||
182 | =item "IS"/"insufficient security" | ||
183 | |||
184 | Returned instead of handshake_failure when a negotiation has | ||
185 | failed specifically because the server requires ciphers more | ||
186 | secure than those supported by the client. This message is always | ||
187 | fatal. | ||
188 | |||
189 | =item "IE"/"internal error" | ||
190 | |||
191 | An internal error unrelated to the peer or the correctness of the | ||
192 | protocol makes it impossible to continue (such as a memory | ||
193 | allocation failure). This message is always fatal. | ||
194 | |||
195 | =item "US"/"user canceled" | ||
196 | |||
197 | This handshake is being canceled for some reason unrelated to a | ||
198 | protocol failure. If the user cancels an operation after the | ||
199 | handshake is complete, just closing the connection by sending a | ||
200 | close_notify is more appropriate. This alert should be followed | ||
201 | by a close_notify. This message is generally a warning. | ||
202 | |||
203 | =item "NR"/"no renegotiation" | ||
204 | |||
205 | Sent by the client in response to a hello request or by the | ||
206 | server in response to a client hello after initial handshaking. | ||
207 | Either of these would normally lead to renegotiation; when that | ||
208 | is not appropriate, the recipient should respond with this alert; | ||
209 | at that point, the original requester can decide whether to | ||
210 | proceed with the connection. One case where this would be | ||
211 | appropriate would be where a server has spawned a process to | ||
212 | satisfy a request; the process might receive security parameters | ||
213 | (key length, authentication, etc.) at startup and it might be | ||
214 | difficult to communicate changes to these parameters after that | ||
215 | point. This message is always a warning. | ||
216 | |||
217 | =item "UK"/"unknown" | ||
218 | |||
219 | This indicates that no description is available for this alert type. | ||
220 | Probably B<value> does not contain a correct alert message. | ||
221 | |||
222 | =back | ||
223 | |||
224 | =head1 SEE ALSO | ||
225 | |||
226 | L<ssl(3)|ssl(3)>, L<SSL_CTX_set_info_callback(3)|SSL_CTX_set_info_callback(3)> | ||
227 | |||
228 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_clear.pod b/src/lib/libssl/src/doc/ssl/SSL_clear.pod index 8b735d81dc..8e077e31c9 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_clear.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_clear.pod | |||
@@ -25,6 +25,25 @@ if L<SSL_shutdown(3)|SSL_shutdown(3)> was not called for the connection | |||
25 | or at least L<SSL_set_shutdown(3)|SSL_set_shutdown(3)> was used to | 25 | or at least L<SSL_set_shutdown(3)|SSL_set_shutdown(3)> was used to |
26 | set the SSL_SENT_SHUTDOWN state. | 26 | set the SSL_SENT_SHUTDOWN state. |
27 | 27 | ||
28 | If a session was closed cleanly, the session object will be kept and all | ||
29 | settings corresponding. This explicitly means, that e.g. the special method | ||
30 | used during the session will be kept for the next handshake. So if the | ||
31 | session was a TLSv1 session, a SSL client object will use a TLSv1 client | ||
32 | method for the next handshake and a SSL server object will use a TLSv1 | ||
33 | server method, even if SSLv23_*_methods were chosen on startup. This | ||
34 | will might lead to connection failures (see L<SSL_new(3)|SSL_new(3)>) | ||
35 | for a description of the method's properties. | ||
36 | |||
37 | =head1 WARNINGS | ||
38 | |||
39 | SSL_clear() resets the SSL object to allow for another connection. The | ||
40 | reset operation however keeps several settings of the last sessions | ||
41 | (some of these settings were made automatically during the last | ||
42 | handshake). It only makes sense when opening a new session (or reusing | ||
43 | an old one) with the same peer that shares these settings. | ||
44 | SSL_clear() is not a short form for the sequence | ||
45 | L<SSL_free(3)|SSL_free(3)>; L<SSL_new(3)|SSL_new(3)>; . | ||
46 | |||
28 | =head1 RETURN VALUES | 47 | =head1 RETURN VALUES |
29 | 48 | ||
30 | The following return values can occur: | 49 | The following return values can occur: |
@@ -44,6 +63,7 @@ The SSL_clear() operation was successful. | |||
44 | 63 | ||
45 | L<SSL_new(3)|SSL_new(3)>, L<SSL_free(3)|SSL_free(3)>, | 64 | L<SSL_new(3)|SSL_new(3)>, L<SSL_free(3)|SSL_free(3)>, |
46 | L<SSL_shutdown(3)|SSL_shutdown(3)>, L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>, | 65 | L<SSL_shutdown(3)|SSL_shutdown(3)>, L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>, |
47 | L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, L<ssl(3)|ssl(3)> | 66 | L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, L<ssl(3)|ssl(3)>, |
67 | L<SSL_CTX_set_client_cert_cb(3)|SSL_CTX_set_client_cert_cb(3)> | ||
48 | 68 | ||
49 | =cut | 69 | =cut |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_connect.pod b/src/lib/libssl/src/doc/ssl/SSL_connect.pod index bcc167745b..766f1876aa 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_connect.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_connect.pod | |||
@@ -34,11 +34,6 @@ nothing is to be done, but select() can be used to check for the required | |||
34 | condition. When using a buffering BIO, like a BIO pair, data must be written | 34 | condition. When using a buffering BIO, like a BIO pair, data must be written |
35 | into or retrieved out of the BIO before being able to continue. | 35 | into or retrieved out of the BIO before being able to continue. |
36 | 36 | ||
37 | When using a generic method (see L<SSL_CTX_new(3)|SSL_CTX_new(3)>), it | ||
38 | is necessary to call L<SSL_set_connect_state(3)|SSL_set_connect_state(3)> | ||
39 | before calling SSL_connect() to explicitly switch the B<ssl> to client | ||
40 | mode. | ||
41 | |||
42 | =head1 RETURN VALUES | 37 | =head1 RETURN VALUES |
43 | 38 | ||
44 | The following return values can occur: | 39 | The following return values can occur: |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_SSL_CTX.pod b/src/lib/libssl/src/doc/ssl/SSL_get_SSL_CTX.pod new file mode 100644 index 0000000000..52d0227b19 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_SSL_CTX.pod | |||
@@ -0,0 +1,26 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_SSL_CTX - get the SSL_CTX from which an SSL is created | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | SSL_CTX *SSL_get_SSL_CTX(SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_get_SSL_CTX() returns a pointer to the SSL_CTX object, from which | ||
16 | B<ssl> was created with L<SSL_new(3)|SSL_new(3)>. | ||
17 | |||
18 | =head1 RETURN VALUES | ||
19 | |||
20 | The pointer to the SSL_CTX object is returned. | ||
21 | |||
22 | =head1 SEE ALSO | ||
23 | |||
24 | L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)> | ||
25 | |||
26 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_client_CA_list.pod b/src/lib/libssl/src/doc/ssl/SSL_get_client_CA_list.pod index 40e01cf9c8..5693fdebb2 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_get_client_CA_list.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_get_client_CA_list.pod | |||
@@ -47,6 +47,7 @@ the server did not send a list of CAs (client mode). | |||
47 | =head1 SEE ALSO | 47 | =head1 SEE ALSO |
48 | 48 | ||
49 | L<ssl(3)|ssl(3)>, | 49 | L<ssl(3)|ssl(3)>, |
50 | L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)> | 50 | L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)>, |
51 | L<SSL_CTX_set_client_cert_cb(3)|SSL_CTX_set_client_cert_cb(3)> | ||
51 | 52 | ||
52 | =cut | 53 | =cut |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_default_timeout.pod b/src/lib/libssl/src/doc/ssl/SSL_get_default_timeout.pod new file mode 100644 index 0000000000..8d43b31345 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_default_timeout.pod | |||
@@ -0,0 +1,41 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_default_timeout - get default session timeout value | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | long SSL_get_default_timeout(SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_get_default_timeout() returns the default timeout value assigned to | ||
16 | SSL_SESSION objects negotiated for the protocol valid for B<ssl>. | ||
17 | |||
18 | =head1 NOTES | ||
19 | |||
20 | Whenever a new session is negotiated, it is assigned a timeout value, | ||
21 | after which it will not be accepted for session reuse. If the timeout | ||
22 | value was not explicitly set using | ||
23 | L<SSL_CTX_set_timeout(3)|SSL_CTX_set_timeout(3)>, the hardcoded default | ||
24 | timeout for the protocol will be used. | ||
25 | |||
26 | SSL_get_default_timeout() return this hardcoded value, which is 300 seconds | ||
27 | for all currently supported protocols (SSLv2, SSLv3, and TLSv1). | ||
28 | |||
29 | =head1 RETURN VALUES | ||
30 | |||
31 | See description. | ||
32 | |||
33 | =head1 SEE ALSO | ||
34 | |||
35 | L<ssl(3)|ssl(3)>, | ||
36 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, | ||
37 | L<SSL_SESSION_get_time(3)|SSL_SESSION_get_time(3)>, | ||
38 | L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>, | ||
39 | L<SSL_get_default_timeout(3)|SSL_get_default_timeout(3)> | ||
40 | |||
41 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_error.pod b/src/lib/libssl/src/doc/ssl/SSL_get_error.pod index d95eec78aa..f700bf0ace 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_get_error.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_get_error.pod | |||
@@ -69,13 +69,13 @@ to read data. This is mainly because TLS/SSL handshakes may occur at any | |||
69 | time during the protocol (initiated by either the client or the server); | 69 | time during the protocol (initiated by either the client or the server); |
70 | SSL_read(), SSL_peek(), and SSL_write() will handle any pending handshakes. | 70 | SSL_read(), SSL_peek(), and SSL_write() will handle any pending handshakes. |
71 | 71 | ||
72 | =item SSL_ERROR_WANT_CONNECT | 72 | =item SSL_ERROR_WANT_CONNECT, SSL_ERROR_WANT_ACCEPT |
73 | 73 | ||
74 | The operation did not complete; the same TLS/SSL I/O function should be | 74 | The operation did not complete; the same TLS/SSL I/O function should be |
75 | called again later. The underlying BIO was not connected yet to the peer | 75 | called again later. The underlying BIO was not connected yet to the peer |
76 | and the call would block in connect(). The SSL function should be | 76 | and the call would block in connect()/accept(). The SSL function should be |
77 | called again when the connection is established. This messages can only | 77 | called again when the connection is established. These messages can only |
78 | appear with a BIO_s_connect() BIO. | 78 | appear with a BIO_s_connect() or BIO_s_accept() BIO, respectively. |
79 | In order to find out, when the connection has been successfully established, | 79 | In order to find out, when the connection has been successfully established, |
80 | on many platforms select() or poll() for writing on the socket file descriptor | 80 | on many platforms select() or poll() for writing on the socket file descriptor |
81 | can be used. | 81 | can be used. |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_peer_certificate.pod b/src/lib/libssl/src/doc/ssl/SSL_get_peer_certificate.pod index 18d1db5183..60635a9660 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_get_peer_certificate.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_get_peer_certificate.pod | |||
@@ -19,7 +19,7 @@ peer presented. If the peer did not present a certificate, NULL is returned. | |||
19 | 19 | ||
20 | Due to the protocol definition, a TLS/SSL server will always send a | 20 | Due to the protocol definition, a TLS/SSL server will always send a |
21 | certificate, if present. A client will only send a certificate when | 21 | certificate, if present. A client will only send a certificate when |
22 | explicitely requested to do so by the server (see | 22 | explicitly requested to do so by the server (see |
23 | L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>). If an anonymous cipher | 23 | L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>). If an anonymous cipher |
24 | is used, no certificates are sent. | 24 | is used, no certificates are sent. |
25 | 25 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_session.pod b/src/lib/libssl/src/doc/ssl/SSL_get_session.pod index a0266e2ac6..dd9aba40b6 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_get_session.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_get_session.pod | |||
@@ -37,8 +37,16 @@ if the session is valid, it can be removed at any time due to timeout | |||
37 | during L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>. | 37 | during L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>. |
38 | 38 | ||
39 | If the data is to be kept, SSL_get1_session() will increment the reference | 39 | If the data is to be kept, SSL_get1_session() will increment the reference |
40 | count and the session will stay in memory until explicitly freed with | 40 | count, so that the session will not be implicitly removed by other operations |
41 | L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>, regardless of its state. | 41 | but stays in memory. In order to remove the session |
42 | L<SSL_SESSION_free(3)|SSL_SESSION_free(3)> must be explicitly called once | ||
43 | to decrement the reference count again. | ||
44 | |||
45 | SSL_SESSION objects keep internal link information about the session cache | ||
46 | list, when being inserted into one SSL_CTX object's session cache. | ||
47 | One SSL_SESSION object, regardless of its reference count, must therefore | ||
48 | only be used with one SSL_CTX object (and the SSL objects created | ||
49 | from this SSL_CTX object). | ||
42 | 50 | ||
43 | =head1 RETURN VALUES | 51 | =head1 RETURN VALUES |
44 | 52 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_new.pod b/src/lib/libssl/src/doc/ssl/SSL_new.pod index 3b084e867d..25300e978f 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_new.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_new.pod | |||
@@ -38,6 +38,7 @@ The return value points to an allocated SSL structure. | |||
38 | 38 | ||
39 | L<SSL_free(3)|SSL_free(3)>, L<SSL_clear(3)|SSL_clear(3)>, | 39 | L<SSL_free(3)|SSL_free(3)>, L<SSL_clear(3)|SSL_clear(3)>, |
40 | L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, | 40 | L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, |
41 | L<SSL_get_SSL_CTX(3)|SSL_get_SSL_CTX(3)>, | ||
41 | L<ssl(3)|ssl(3)> | 42 | L<ssl(3)|ssl(3)> |
42 | 43 | ||
43 | =cut | 44 | =cut |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_read.pod b/src/lib/libssl/src/doc/ssl/SSL_read.pod index cc7aa1a547..f6c37f77e4 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_read.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_read.pod | |||
@@ -25,11 +25,10 @@ the SSL_read() operation. The behaviour of SSL_read() depends on the | |||
25 | underlying BIO. | 25 | underlying BIO. |
26 | 26 | ||
27 | For the transparent negotiation to succeed, the B<ssl> must have been | 27 | For the transparent negotiation to succeed, the B<ssl> must have been |
28 | initialized to client or server mode. This is not the case if a generic | 28 | initialized to client or server mode. This is being done by calling |
29 | method is being used (see L<SSL_CTX_new(3)|SSL_CTX_new(3)>, so that | ||
30 | L<SSL_set_connect_state(3)|SSL_set_connect_state(3)> or SSL_set_accept_state() | 29 | L<SSL_set_connect_state(3)|SSL_set_connect_state(3)> or SSL_set_accept_state() |
31 | must be used before the first call to an SSL_read() or | 30 | before the first call to an SSL_read() or L<SSL_write(3)|SSL_write(3)> |
32 | L<SSL_write(3)|SSL_write(3)> function). | 31 | function. |
33 | 32 | ||
34 | SSL_read() works based on the SSL/TLS records. The data are received in | 33 | SSL_read() works based on the SSL/TLS records. The data are received in |
35 | records (with a maximum record size of 16kB for SSLv3/TLSv1). Only when a | 34 | records (with a maximum record size of 16kB for SSLv3/TLSv1). Only when a |
@@ -84,9 +83,20 @@ bytes actually read from the TLS/SSL connection. | |||
84 | 83 | ||
85 | =item 0 | 84 | =item 0 |
86 | 85 | ||
87 | The read operation was not successful, probably because no data was | 86 | The read operation was not successful. The reason may either be a clean |
88 | available. Call SSL_get_error() with the return value B<ret> to find out, | 87 | shutdown due to a "close notify" alert sent by the peer (in which case |
89 | whether an error occurred. | 88 | the SSL_RECEIVED_SHUTDOWN flag in the ssl shutdown state is set |
89 | (see L<SSL_shutdown(3)|SSL_shutdown(3)>, | ||
90 | L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>). It is also possible, that | ||
91 | the peer simply shut down the underlying transport and the shutdown is | ||
92 | incomplete. Call SSL_get_error() with the return value B<ret> to find out, | ||
93 | whether an error occurred or the connection was shut down cleanly | ||
94 | (SSL_ERROR_ZERO_RETURN). | ||
95 | |||
96 | SSLv2 (deprecated) does not support a shutdown alert protocol, so it can | ||
97 | only be detected, whether the underlying connection was closed. It cannot | ||
98 | be checked, whether the closure was initiated by the peer or by something | ||
99 | else. | ||
90 | 100 | ||
91 | =item E<lt>0 | 101 | =item E<lt>0 |
92 | 102 | ||
@@ -102,6 +112,7 @@ L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_write(3)|SSL_write(3)>, | |||
102 | L<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)>, L<SSL_CTX_new(3)|SSL_CTX_new(3)>, | 112 | L<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)>, L<SSL_CTX_new(3)|SSL_CTX_new(3)>, |
103 | L<SSL_connect(3)|SSL_connect(3)>, L<SSL_accept(3)|SSL_accept(3)> | 113 | L<SSL_connect(3)|SSL_connect(3)>, L<SSL_accept(3)|SSL_accept(3)> |
104 | L<SSL_set_connect_state(3)|SSL_set_connect_state(3)>, | 114 | L<SSL_set_connect_state(3)|SSL_set_connect_state(3)>, |
115 | L<SSL_shutdown(3)|SSL_shutdown(3)>, L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>, | ||
105 | L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> | 116 | L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> |
106 | 117 | ||
107 | =cut | 118 | =cut |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_rstate_string.pod b/src/lib/libssl/src/doc/ssl/SSL_rstate_string.pod new file mode 100644 index 0000000000..bdb8a1fcd5 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_rstate_string.pod | |||
@@ -0,0 +1,59 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_rstate_string, SSL_rstate_string_long - get textual description of state of an SSL object during read operation | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | const char *SSL_rstate_string(SSL *ssl); | ||
12 | const char *SSL_rstate_string_long(SSL *ssl); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | SSL_rstate_string() returns a 2 letter string indicating the current read state | ||
17 | of the SSL object B<ssl>. | ||
18 | |||
19 | SSL_rstate_string_long() returns a string indicating the current read state of | ||
20 | the SSL object B<ssl>. | ||
21 | |||
22 | =head1 NOTES | ||
23 | |||
24 | When performing a read operation, the SSL/TLS engine must parse the record, | ||
25 | consisting of header and body. When working in a blocking environment, | ||
26 | SSL_rstate_string[_long]() should always return "RD"/"read done". | ||
27 | |||
28 | This function should only seldom be needed in applications. | ||
29 | |||
30 | =head1 RETURN VALUES | ||
31 | |||
32 | SSL_rstate_string() and SSL_rstate_string_long() can return the following | ||
33 | values: | ||
34 | |||
35 | =over 4 | ||
36 | |||
37 | =item "RH"/"read header" | ||
38 | |||
39 | The header of the record is being evaluated. | ||
40 | |||
41 | =item "RB"/"read body" | ||
42 | |||
43 | The body of the record is being evaluated. | ||
44 | |||
45 | =item "RD"/"read done" | ||
46 | |||
47 | The record has been completely processed. | ||
48 | |||
49 | =item "unknown"/"unknown" | ||
50 | |||
51 | The read state is unknown. This should never happen. | ||
52 | |||
53 | =back | ||
54 | |||
55 | =head1 SEE ALSO | ||
56 | |||
57 | L<ssl(3)|ssl(3)> | ||
58 | |||
59 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_session_reused.pod b/src/lib/libssl/src/doc/ssl/SSL_session_reused.pod new file mode 100644 index 0000000000..da7d06264d --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_session_reused.pod | |||
@@ -0,0 +1,45 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_session_reused - query whether a reused session was negotiated during handshake | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_session_reused(SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | Query, whether a reused session was negotiated during the handshake. | ||
16 | |||
17 | =head1 NOTES | ||
18 | |||
19 | During the negotiation, a client can propose to reuse a session. The server | ||
20 | then looks up the session in its cache. If both client and server agree | ||
21 | on the session, it will be reused and a flag is being set that can be | ||
22 | queried by the application. | ||
23 | |||
24 | =head1 RETURN VALUES | ||
25 | |||
26 | The following return values can occur: | ||
27 | |||
28 | =over 4 | ||
29 | |||
30 | =item 0 | ||
31 | |||
32 | A new session was negotiated. | ||
33 | |||
34 | =item 1 | ||
35 | |||
36 | A session was reused. | ||
37 | |||
38 | =back | ||
39 | |||
40 | =head1 SEE ALSO | ||
41 | |||
42 | L<ssl(3)|ssl(3)>, L<SSL_set_session(3)|SSL_set_session(3)>, | ||
43 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)> | ||
44 | |||
45 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_set_connect_state.pod b/src/lib/libssl/src/doc/ssl/SSL_set_connect_state.pod index a8c4463c64..7adf8adfed 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_set_connect_state.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_set_connect_state.pod | |||
@@ -14,9 +14,9 @@ SSL_set_connect_state, SSL_get_accept_state - prepare SSL object to work in clie | |||
14 | 14 | ||
15 | =head1 DESCRIPTION | 15 | =head1 DESCRIPTION |
16 | 16 | ||
17 | SSL_set_connect_state() B<ssl> to work in client mode. | 17 | SSL_set_connect_state() sets B<ssl> to work in client mode. |
18 | 18 | ||
19 | SSL_set_accept_state() B<ssl> to work in server mode. | 19 | SSL_set_accept_state() sets B<ssl> to work in server mode. |
20 | 20 | ||
21 | =head1 NOTES | 21 | =head1 NOTES |
22 | 22 | ||
@@ -27,12 +27,17 @@ server connections. (The method might have been changed with | |||
27 | L<SSL_CTX_set_ssl_version(3)|SSL_CTX_set_ssl_version(3)> or | 27 | L<SSL_CTX_set_ssl_version(3)|SSL_CTX_set_ssl_version(3)> or |
28 | SSL_set_ssl_method().) | 28 | SSL_set_ssl_method().) |
29 | 29 | ||
30 | In order to successfully accomplish the handshake, the SSL routines need | 30 | When beginning a new handshake, the SSL engine must know whether it must |
31 | to know whether they should act in server or client mode. If the generic | 31 | call the connect (client) or accept (server) routines. Even though it may |
32 | method was used, this is not clear from the method itself and must be set | 32 | be clear from the method chosen, whether client or server mode was |
33 | with either SSL_set_connect_state() or SSL_set_accept_state(). If these | 33 | requested, the handshake routines must be explicitly set. |
34 | routines are not called, the default value set when L<SSL_new(3)|SSL_new(3)> | 34 | |
35 | is called is server mode. | 35 | When using the L<SSL_connect(3)|SSL_connect(3)> or |
36 | L<SSL_accept(3)|SSL_accept(3)> routines, the correct handshake | ||
37 | routines are automatically set. When performing a transparent negotiation | ||
38 | using L<SSL_write(3)|SSL_write(3)> or L<SSL_read(3)|SSL_read(3)>, the | ||
39 | handshake routines must be explicitly set in advance using either | ||
40 | SSL_set_connect_state() or SSL_set_accept_state(). | ||
36 | 41 | ||
37 | =head1 RETURN VALUES | 42 | =head1 RETURN VALUES |
38 | 43 | ||
@@ -42,6 +47,8 @@ information. | |||
42 | =head1 SEE ALSO | 47 | =head1 SEE ALSO |
43 | 48 | ||
44 | L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)>, L<SSL_CTX_new(3)|SSL_CTX_new(3)>, | 49 | L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)>, L<SSL_CTX_new(3)|SSL_CTX_new(3)>, |
50 | L<SSL_connect(3)|SSL_connect(3)>, L<SSL_accept(3)|SSL_accept(3)>, | ||
51 | L<SSL_write(3)|SSL_write(3)>, L<SSL_read(3)|SSL_read(3)>, | ||
45 | L<SSL_CTX_set_ssl_version(3)|SSL_CTX_set_ssl_version(3)> | 52 | L<SSL_CTX_set_ssl_version(3)|SSL_CTX_set_ssl_version(3)> |
46 | 53 | ||
47 | =cut | 54 | =cut |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_set_session.pod b/src/lib/libssl/src/doc/ssl/SSL_set_session.pod index c4f7878579..5f54714ad8 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_set_session.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_set_session.pod | |||
@@ -16,12 +16,21 @@ SSL_set_session() sets B<session> to be used when the TLS/SSL connection | |||
16 | is to be established. SSL_set_session() is only useful for TLS/SSL clients. | 16 | is to be established. SSL_set_session() is only useful for TLS/SSL clients. |
17 | When the session is set, the reference count of B<session> is incremented | 17 | When the session is set, the reference count of B<session> is incremented |
18 | by 1. If the session is not reused, the reference count is decremented | 18 | by 1. If the session is not reused, the reference count is decremented |
19 | again during SSL_connect(). | 19 | again during SSL_connect(). Whether the session was reused can be queried |
20 | with the L<SSL_session_reused(3)|SSL_session_reused(3)> call. | ||
20 | 21 | ||
21 | If there is already a session set inside B<ssl> (because it was set with | 22 | If there is already a session set inside B<ssl> (because it was set with |
22 | SSL_set_session() before or because the same B<ssl> was already used for | 23 | SSL_set_session() before or because the same B<ssl> was already used for |
23 | a connection), SSL_SESSION_free() will be called for that session. | 24 | a connection), SSL_SESSION_free() will be called for that session. |
24 | 25 | ||
26 | =head1 NOTES | ||
27 | |||
28 | SSL_SESSION objects keep internal link information about the session cache | ||
29 | list, when being inserted into one SSL_CTX object's session cache. | ||
30 | One SSL_SESSION object, regardless of its reference count, must therefore | ||
31 | only be used with one SSL_CTX object (and the SSL objects created | ||
32 | from this SSL_CTX object). | ||
33 | |||
25 | =head1 RETURN VALUES | 34 | =head1 RETURN VALUES |
26 | 35 | ||
27 | The following return values can occur: | 36 | The following return values can occur: |
@@ -41,6 +50,8 @@ The operation succeeded. | |||
41 | =head1 SEE ALSO | 50 | =head1 SEE ALSO |
42 | 51 | ||
43 | L<ssl(3)|ssl(3)>, L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>, | 52 | L<ssl(3)|ssl(3)>, L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>, |
53 | L<SSL_get_session(3)|SSL_get_session(3)>, | ||
54 | L<SSL_session_reused(3)|SSL_session_reused(3)>, | ||
44 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)> | 55 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)> |
45 | 56 | ||
46 | =cut | 57 | =cut |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_set_shutdown.pod b/src/lib/libssl/src/doc/ssl/SSL_set_shutdown.pod index 6b196c1f15..6289e635d9 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_set_shutdown.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_set_shutdown.pod | |||
@@ -46,7 +46,10 @@ The shutdown state of the connection is used to determine the state of | |||
46 | the ssl session. If the session is still open, when | 46 | the ssl session. If the session is still open, when |
47 | L<SSL_clear(3)|SSL_clear(3)> or L<SSL_free(3)|SSL_free(3)> is called, | 47 | L<SSL_clear(3)|SSL_clear(3)> or L<SSL_free(3)|SSL_free(3)> is called, |
48 | it is considered bad and removed according to RFC2246. | 48 | it is considered bad and removed according to RFC2246. |
49 | The actual condition for a correctly closed session is SSL_SENT_SHUTDOWN. | 49 | The actual condition for a correctly closed session is SSL_SENT_SHUTDOWN |
50 | (according to the TLS RFC, it is acceptable to only send the "close notify" | ||
51 | alert but to not wait for the peer's answer, when the underlying connection | ||
52 | is closed). | ||
50 | SSL_set_shutdown() can be used to set this state without sending a | 53 | SSL_set_shutdown() can be used to set this state without sending a |
51 | close alert to the peer (see L<SSL_shutdown(3)|SSL_shutdown(3)>). | 54 | close alert to the peer (see L<SSL_shutdown(3)|SSL_shutdown(3)>). |
52 | 55 | ||
@@ -63,6 +66,7 @@ SSL_get_shutdown() returns the current setting. | |||
63 | =head1 SEE ALSO | 66 | =head1 SEE ALSO |
64 | 67 | ||
65 | L<ssl(3)|ssl(3)>, L<SSL_shutdown(3)|SSL_shutdown(3)>, | 68 | L<ssl(3)|ssl(3)>, L<SSL_shutdown(3)|SSL_shutdown(3)>, |
69 | L<SSL_CTX_set_quiet_shutdown(3)|SSL_CTX_set_quiet_shutdown(3)>, | ||
66 | L<SSL_clear(3)|SSL_clear(3)>, L<SSL_free(3)|SSL_free(3)> | 70 | L<SSL_clear(3)|SSL_clear(3)>, L<SSL_free(3)|SSL_free(3)> |
67 | 71 | ||
68 | =cut | 72 | =cut |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_shutdown.pod b/src/lib/libssl/src/doc/ssl/SSL_shutdown.pod index c4ae6704e7..6b5012be7a 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_shutdown.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_shutdown.pod | |||
@@ -22,10 +22,52 @@ Whether the operation succeeds or not, the SSL_SENT_SHUTDOWN flag is set and | |||
22 | a currently open session is considered closed and good and will be kept in the | 22 | a currently open session is considered closed and good and will be kept in the |
23 | session cache for further reuse. | 23 | session cache for further reuse. |
24 | 24 | ||
25 | The behaviour of SSL_shutdown() depends on the underlying BIO. | 25 | The shutdown procedure consists of 2 steps: the sending of the "close notify" |
26 | shutdown alert and the reception of the peer's "close notify" shutdown | ||
27 | alert. According to the TLS standard, it is acceptable for an application | ||
28 | to only send its shutdown alert and then close the underlying connection | ||
29 | without waiting for the peer's response (this way resources can be saved, | ||
30 | as the process can already terminate or serve another connection). | ||
31 | When the underlying connection shall be used for more communications, the | ||
32 | complete shutdown procedure (bidirectional "close notify" alerts) must be | ||
33 | performed, so that the peers stay synchronized. | ||
34 | |||
35 | SSL_shutdown() supports both uni- and bidirectional shutdown by its 2 step | ||
36 | behaviour. | ||
37 | |||
38 | =over 4 | ||
39 | |||
40 | =item When the application is the first party to send the "close notify" | ||
41 | alert, SSL_shutdown() will only send the alert and the set the | ||
42 | SSL_SENT_SHUTDOWN flag (so that the session is considered good and will | ||
43 | be kept in cache). SSL_shutdown() will then return with 0. If a unidirectional | ||
44 | shutdown is enough (the underlying connection shall be closed anyway), this | ||
45 | first call to SSL_shutdown() is sufficient. In order to complete the | ||
46 | bidirectional shutdown handshake, SSL_shutdown() must be called again. | ||
47 | The second call will make SSL_shutdown() wait for the peer's "close notify" | ||
48 | shutdown alert. On success, the second call to SSL_shutdown() will return | ||
49 | with 1. | ||
50 | |||
51 | =item If the peer already sent the "close notify" alert B<and> it was | ||
52 | already processed implicitly inside another function | ||
53 | (L<SSL_read(3)|SSL_read(3)>), the SSL_RECEIVED_SHUTDOWN flag is set. | ||
54 | SSL_shutdown() will send the "close notify" alert, set the SSL_SENT_SHUTDOWN | ||
55 | flag and will immediately return with 1. | ||
56 | Whether SSL_RECEIVED_SHUTDOWN is already set can be checked using the | ||
57 | SSL_get_shutdown() (see also L<SSL_set_shutdown(3)|SSL_set_shutdown(3)> call. | ||
58 | |||
59 | =back | ||
60 | |||
61 | It is therefore recommended, to check the return value of SSL_shutdown() | ||
62 | and call SSL_shutdown() again, if the bidirectional shutdown is not yet | ||
63 | complete (return value of the first call is 0). As the shutdown is not | ||
64 | specially handled in the SSLv2 protocol, SSL_shutdown() will succeed on | ||
65 | the first call. | ||
66 | |||
67 | The behaviour of SSL_shutdown() additionally depends on the underlying BIO. | ||
26 | 68 | ||
27 | If the underlying BIO is B<blocking>, SSL_shutdown() will only return once the | 69 | If the underlying BIO is B<blocking>, SSL_shutdown() will only return once the |
28 | handshake has been finished or an error occurred. | 70 | handshake step has been finished or an error occurred. |
29 | 71 | ||
30 | If the underlying BIO is B<non-blocking>, SSL_shutdown() will also return | 72 | If the underlying BIO is B<non-blocking>, SSL_shutdown() will also return |
31 | when the underlying BIO could not satisfy the needs of SSL_shutdown() | 73 | when the underlying BIO could not satisfy the needs of SSL_shutdown() |
@@ -38,6 +80,12 @@ nothing is to be done, but select() can be used to check for the required | |||
38 | condition. When using a buffering BIO, like a BIO pair, data must be written | 80 | condition. When using a buffering BIO, like a BIO pair, data must be written |
39 | into or retrieved out of the BIO before being able to continue. | 81 | into or retrieved out of the BIO before being able to continue. |
40 | 82 | ||
83 | SSL_shutdown() can be modified to only set the connection to "shutdown" | ||
84 | state but not actually send the "close notify" alert messages, | ||
85 | see L<SSL_CTX_set_quiet_shutdown(3)|SSL_CTX_set_quiet_shutdown(3)>. | ||
86 | When "quiet shutdown" is enabled, SSL_shutdown() will always succeed | ||
87 | and return 1. | ||
88 | |||
41 | =head1 RETURN VALUES | 89 | =head1 RETURN VALUES |
42 | 90 | ||
43 | The following return values can occur: | 91 | The following return values can occur: |
@@ -46,19 +94,23 @@ The following return values can occur: | |||
46 | 94 | ||
47 | =item 1 | 95 | =item 1 |
48 | 96 | ||
49 | The shutdown was successfully completed. | 97 | The shutdown was successfully completed. The "close notify" alert was sent |
98 | and the peer's "close notify" alert was received. | ||
50 | 99 | ||
51 | =item 0 | 100 | =item 0 |
52 | 101 | ||
53 | The shutdown was not successful. Call SSL_get_error() with the return | 102 | The shutdown is not yet finished. Call SSL_shutdown() for a second time, |
54 | value B<ret> to find out the reason. | 103 | if a bidirectional shutdown shall be performed. |
104 | The output of L<SSL_get_error(3)|SSL_get_error(3)> may be misleading, as an | ||
105 | erroneous SSL_ERROR_SYSCALL may be flagged even though no error occurred. | ||
55 | 106 | ||
56 | =item -1 | 107 | =item -1 |
57 | 108 | ||
58 | The shutdown was not successful because a fatal error occurred either | 109 | The shutdown was not successful because a fatal error occurred either |
59 | at the protocol level or a connection failure occurred. It can also occur of | 110 | at the protocol level or a connection failure occurred. It can also occur if |
60 | action is need to continue the operation for non-blocking BIOs. | 111 | action is need to continue the operation for non-blocking BIOs. |
61 | Call SSL_get_error() with the return value B<ret> to find out the reason. | 112 | Call L<SSL_get_error(3)|SSL_get_error(3)> with the return value B<ret> |
113 | to find out the reason. | ||
62 | 114 | ||
63 | =back | 115 | =back |
64 | 116 | ||
@@ -66,6 +118,7 @@ Call SSL_get_error() with the return value B<ret> to find out the reason. | |||
66 | 118 | ||
67 | L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_connect(3)|SSL_connect(3)>, | 119 | L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_connect(3)|SSL_connect(3)>, |
68 | L<SSL_accept(3)|SSL_accept(3)>, L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>, | 120 | L<SSL_accept(3)|SSL_accept(3)>, L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>, |
121 | L<SSL_CTX_set_quiet_shutdown(3)|SSL_CTX_set_quiet_shutdown(3)>, | ||
69 | L<SSL_clear(3)|SSL_clear(3)>, L<SSL_free(3)|SSL_free(3)>, | 122 | L<SSL_clear(3)|SSL_clear(3)>, L<SSL_free(3)|SSL_free(3)>, |
70 | L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> | 123 | L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> |
71 | 124 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_state_string.pod b/src/lib/libssl/src/doc/ssl/SSL_state_string.pod new file mode 100644 index 0000000000..b4be1aaa48 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_state_string.pod | |||
@@ -0,0 +1,45 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_state_string, SSL_state_string_long - get textual description of state of an SSL object | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | const char *SSL_state_string(SSL *ssl); | ||
12 | const char *SSL_state_string_long(SSL *ssl); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | SSL_state_string() returns a 6 letter string indicating the current state | ||
17 | of the SSL object B<ssl>. | ||
18 | |||
19 | SSL_state_string_long() returns a string indicating the current state of | ||
20 | the SSL object B<ssl>. | ||
21 | |||
22 | =head1 NOTES | ||
23 | |||
24 | During its use, an SSL objects passes several states. The state is internally | ||
25 | maintained. Querying the state information is not very informative before | ||
26 | or when a connection has been established. It however can be of significant | ||
27 | interest during the handshake. | ||
28 | |||
29 | When using non-blocking sockets, the function call performing the handshake | ||
30 | may return with SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE condition, | ||
31 | so that SSL_state_string[_long]() may be called. | ||
32 | |||
33 | For both blocking or non-blocking sockets, the details state information | ||
34 | can be used within the info_callback function set with the | ||
35 | SSL_set_info_callback() call. | ||
36 | |||
37 | =head1 RETURN VALUES | ||
38 | |||
39 | Detailed description of possible states to be included later. | ||
40 | |||
41 | =head1 SEE ALSO | ||
42 | |||
43 | L<ssl(3)|ssl(3)>, L<SSL_CTX_set_info_callback(3)|SSL_CTX_set_info_callback(3)> | ||
44 | |||
45 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_want.pod b/src/lib/libssl/src/doc/ssl/SSL_want.pod new file mode 100644 index 0000000000..50cc89db80 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_want.pod | |||
@@ -0,0 +1,77 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_want, SSL_want_nothing, SSL_want_read, SSL_want_write, SSL_want_x509_lookup - obtain state information TLS/SSL I/O operation | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_want(SSL *ssl); | ||
12 | int SSL_want_nothing(SSL *ssl); | ||
13 | int SSL_want_read(SSL *ssl); | ||
14 | int SSL_want_write(SSL *ssl); | ||
15 | int SSL_want_x509_lookup(SSL *ssl); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | SSL_want() returns state information for the SSL object B<ssl>. | ||
20 | |||
21 | The other SSL_want_*() calls are shortcuts for the possible states returned | ||
22 | by SSL_want(). | ||
23 | |||
24 | =head1 NOTES | ||
25 | |||
26 | SSL_want() examines the internal state information of the SSL object. Its | ||
27 | return values are similar to that of L<SSL_get_error(3)|SSL_get_error(3)>. | ||
28 | Unlike L<SSL_get_error(3)|SSL_get_error(3)>, which also evaluates the | ||
29 | error queue, the results are obtained by examining an internal state flag | ||
30 | only. The information must therefore only be used for normal operation under | ||
31 | non-blocking I/O. Error conditions are not handled and must be treated | ||
32 | using L<SSL_get_error(3)|SSL_get_error(3)>. | ||
33 | |||
34 | The result returned by SSL_want() should always be consistent with | ||
35 | the result of L<SSL_get_error(3)|SSL_get_error(3)>. | ||
36 | |||
37 | =head1 RETURN VALUES | ||
38 | |||
39 | The following return values can currently occur for SSL_want(): | ||
40 | |||
41 | =over 4 | ||
42 | |||
43 | =item SSL_NOTHING | ||
44 | |||
45 | There is no data to be written or to be read. | ||
46 | |||
47 | =item SSL_WRITING | ||
48 | |||
49 | There are data in the SSL buffer that must be written to the underlying | ||
50 | B<BIO> layer in order to complete the actual SSL_*() operation. | ||
51 | A call to L<SSL_get_error(3)|SSL_get_error(3)> should return | ||
52 | SSL_ERROR_WANT_WRITE. | ||
53 | |||
54 | =item SSL_READING | ||
55 | |||
56 | More data must be read from the underlying B<BIO> layer in order to | ||
57 | complete the actual SSL_*() operation. | ||
58 | A call to L<SSL_get_error(3)|SSL_get_error(3)> should return | ||
59 | SSL_ERROR_WANT_READ. | ||
60 | |||
61 | =item SSL_X509_LOOKUP | ||
62 | |||
63 | The operation did not complete because an application callback set by | ||
64 | SSL_CTX_set_client_cert_cb() has asked to be called again. | ||
65 | A call to L<SSL_get_error(3)|SSL_get_error(3)> should return | ||
66 | SSL_ERROR_WANT_X509_LOOKUP. | ||
67 | |||
68 | =back | ||
69 | |||
70 | SSL_want_nothing(), SSL_want_read(), SSL_want_write(), SSL_want_x509_lookup() | ||
71 | return 1, when the corresponding condition is true or 0 otherwise. | ||
72 | |||
73 | =head1 SEE ALSO | ||
74 | |||
75 | L<ssl(3)|ssl(3)>, L<err(3)|err(3)>, L<SSL_get_error(3)|SSL_get_error(3)> | ||
76 | |||
77 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_write.pod b/src/lib/libssl/src/doc/ssl/SSL_write.pod index b0dfefae20..dfa42e9aee 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_write.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_write.pod | |||
@@ -25,11 +25,9 @@ the SSL_write() operation. The behaviour of SSL_write() depends on the | |||
25 | underlying BIO. | 25 | underlying BIO. |
26 | 26 | ||
27 | For the transparent negotiation to succeed, the B<ssl> must have been | 27 | For the transparent negotiation to succeed, the B<ssl> must have been |
28 | initialized to client or server mode. This is not the case if a generic | 28 | initialized to client or server mode. This is being done by calling |
29 | method is being used (see L<SSL_CTX_new(3)|SSL_CTX_new(3)>, so that | ||
30 | L<SSL_set_connect_state(3)|SSL_set_connect_state(3)> or SSL_set_accept_state() | 29 | L<SSL_set_connect_state(3)|SSL_set_connect_state(3)> or SSL_set_accept_state() |
31 | must be used before the first call to an L<SSL_read(3)|SSL_read(3)> | 30 | before the first call to an L<SSL_read(3)|SSL_read(3)> or SSL_write() function. |
32 | or SSL_write() function. | ||
33 | 31 | ||
34 | If the underlying BIO is B<blocking>, SSL_write() will only return, once the | 32 | If the underlying BIO is B<blocking>, SSL_write() will only return, once the |
35 | write operation has been finished or an error occurred, except when a | 33 | write operation has been finished or an error occurred, except when a |
@@ -80,8 +78,14 @@ bytes actually written to the TLS/SSL connection. | |||
80 | 78 | ||
81 | =item 0 | 79 | =item 0 |
82 | 80 | ||
83 | The write operation was not successful. Call SSL_get_error() with the return | 81 | The write operation was not successful. Probably the underlying connection |
84 | value B<ret> to find out, whether an error occurred. | 82 | was closed. Call SSL_get_error() with the return value B<ret> to find out, |
83 | whether an error occurred or the connection was shut down cleanly | ||
84 | (SSL_ERROR_ZERO_RETURN). | ||
85 | |||
86 | SSLv2 (deprecated) does not support a shutdown alert protocol, so it can | ||
87 | only be detected, whether the underlying connection was closed. It cannot | ||
88 | be checked, why the closure happened. | ||
85 | 89 | ||
86 | =item E<lt>0 | 90 | =item E<lt>0 |
87 | 91 | ||
diff --git a/src/lib/libssl/src/doc/ssl/d2i_SSL_SESSION.pod b/src/lib/libssl/src/doc/ssl/d2i_SSL_SESSION.pod index 9a1ba6c47b..0321a5a36f 100644 --- a/src/lib/libssl/src/doc/ssl/d2i_SSL_SESSION.pod +++ b/src/lib/libssl/src/doc/ssl/d2i_SSL_SESSION.pod | |||
@@ -30,7 +30,17 @@ session data on disk or into a database, it must be transformed into | |||
30 | a binary ASN1 representation. | 30 | a binary ASN1 representation. |
31 | 31 | ||
32 | When using d2i_SSL_SESSION(), the SSL_SESSION object is automatically | 32 | When using d2i_SSL_SESSION(), the SSL_SESSION object is automatically |
33 | allocated. | 33 | allocated. The reference count is 1, so that the session must be |
34 | explicitly removed using L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>, | ||
35 | unless the SSL_SESSION object is completely taken over, when being called | ||
36 | inside the get_session_cb() (see | ||
37 | L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)>). | ||
38 | |||
39 | SSL_SESSION objects keep internal link information about the session cache | ||
40 | list, when being inserted into one SSL_CTX object's session cache. | ||
41 | One SSL_SESSION object, regardless of its reference count, must therefore | ||
42 | only be used with one SSL_CTX object (and the SSL objects created | ||
43 | from this SSL_CTX object). | ||
34 | 44 | ||
35 | When using i2d_SSL_SESSION(), the memory location pointed to by B<pp> must be | 45 | When using i2d_SSL_SESSION(), the memory location pointed to by B<pp> must be |
36 | large enough to hold the binary representation of the session. There is no | 46 | large enough to hold the binary representation of the session. There is no |
@@ -50,7 +60,7 @@ When the session is not valid, B<0> is returned and no operation is performed. | |||
50 | 60 | ||
51 | =head1 SEE ALSO | 61 | =head1 SEE ALSO |
52 | 62 | ||
53 | L<ssl(3)|ssl(3)>, | 63 | L<ssl(3)|ssl(3)>, L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>, |
54 | L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)> | 64 | L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)> |
55 | 65 | ||
56 | =cut | 66 | =cut |
diff --git a/src/lib/libssl/src/doc/ssl/ssl.pod b/src/lib/libssl/src/doc/ssl/ssl.pod index 16292a05f2..ce41b3e17d 100644 --- a/src/lib/libssl/src/doc/ssl/ssl.pod +++ b/src/lib/libssl/src/doc/ssl/ssl.pod | |||
@@ -299,7 +299,7 @@ protocol context defined in the B<SSL_CTX> structure. | |||
299 | 299 | ||
300 | =item void B<SSL_CTX_set_cert_store>(SSL_CTX *ctx, X509_STORE *cs); | 300 | =item void B<SSL_CTX_set_cert_store>(SSL_CTX *ctx, X509_STORE *cs); |
301 | 301 | ||
302 | =item void B<SSL_CTX_set_cert_verify_cb>(SSL_CTX *ctx, int (*cb)(SSL_CTX *), char *arg) | 302 | =item void B<SSL_CTX_set_cert_verify_cb>(SSL_CTX *ctx, int (*cb)(), char *arg) |
303 | 303 | ||
304 | =item int B<SSL_CTX_set_cipher_list>(SSL_CTX *ctx, char *str); | 304 | =item int B<SSL_CTX_set_cipher_list>(SSL_CTX *ctx, char *str); |
305 | 305 | ||
@@ -317,6 +317,10 @@ protocol context defined in the B<SSL_CTX> structure. | |||
317 | 317 | ||
318 | =item void B<SSL_CTX_set_info_callback>(SSL_CTX *ctx, void (*cb)(SSL *ssl, int cb, int ret)); | 318 | =item void B<SSL_CTX_set_info_callback>(SSL_CTX *ctx, void (*cb)(SSL *ssl, int cb, int ret)); |
319 | 319 | ||
320 | =item void B<SSL_CTX_set_msg_callback>(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); | ||
321 | |||
322 | =item void B<SSL_CTX_set_msg_callback_arg>(SSL_CTX *ctx, void *arg); | ||
323 | |||
320 | =item void B<SSL_CTX_set_options>(SSL_CTX *ctx, unsigned long op); | 324 | =item void B<SSL_CTX_set_options>(SSL_CTX *ctx, unsigned long op); |
321 | 325 | ||
322 | =item void B<SSL_CTX_set_quiet_shutdown>(SSL_CTX *ctx, int mode); | 326 | =item void B<SSL_CTX_set_quiet_shutdown>(SSL_CTX *ctx, int mode); |
@@ -576,6 +580,10 @@ connection defined in the B<SSL> structure. | |||
576 | 580 | ||
577 | =item void B<SSL_set_info_callback>(SSL *ssl, void (*cb);(void)) | 581 | =item void B<SSL_set_info_callback>(SSL *ssl, void (*cb);(void)) |
578 | 582 | ||
583 | =item void B<SSL_set_msg_callback>(SSL *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); | ||
584 | |||
585 | =item void B<SSL_set_msg_callback_arg>(SSL *ctx, void *arg); | ||
586 | |||
579 | =item void B<SSL_set_options>(SSL *ssl, unsigned long op); | 587 | =item void B<SSL_set_options>(SSL *ssl, unsigned long op); |
580 | 588 | ||
581 | =item void B<SSL_set_quiet_shutdown>(SSL *ssl, int mode); | 589 | =item void B<SSL_set_quiet_shutdown>(SSL *ssl, int mode); |
@@ -650,8 +658,10 @@ L<openssl(1)|openssl(1)>, L<crypto(3)|crypto(3)>, | |||
650 | L<SSL_accept(3)|SSL_accept(3)>, L<SSL_clear(3)|SSL_clear(3)>, | 658 | L<SSL_accept(3)|SSL_accept(3)>, L<SSL_clear(3)|SSL_clear(3)>, |
651 | L<SSL_connect(3)|SSL_connect(3)>, | 659 | L<SSL_connect(3)|SSL_connect(3)>, |
652 | L<SSL_CIPHER_get_name(3)|SSL_CIPHER_get_name(3)>, | 660 | L<SSL_CIPHER_get_name(3)|SSL_CIPHER_get_name(3)>, |
661 | L<SSL_COMP_add_compression_method(3)|SSL_COMP_add_compression_method(3)>, | ||
653 | L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)>, | 662 | L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)>, |
654 | L<SSL_CTX_add_session(3)|SSL_CTX_add_session(3)>, | 663 | L<SSL_CTX_add_session(3)|SSL_CTX_add_session(3)>, |
664 | L<SSL_CTX_ctrl(3)|SSL_CTX_ctrl(3)>, | ||
655 | L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>, | 665 | L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>, |
656 | L<SSL_CTX_get_ex_new_index(3)|SSL_CTX_get_ex_new_index(3)>, | 666 | L<SSL_CTX_get_ex_new_index(3)|SSL_CTX_get_ex_new_index(3)>, |
657 | L<SSL_CTX_get_verify_mode(3)|SSL_CTX_get_verify_mode(3)>, | 667 | L<SSL_CTX_get_verify_mode(3)|SSL_CTX_get_verify_mode(3)>, |
@@ -661,18 +671,32 @@ L<SSL_CTX_sess_number(3)|SSL_CTX_sess_number(3)>, | |||
661 | L<SSL_CTX_sess_set_cache_size(3)|SSL_CTX_sess_set_cache_size(3)>, | 671 | L<SSL_CTX_sess_set_cache_size(3)|SSL_CTX_sess_set_cache_size(3)>, |
662 | L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)>, | 672 | L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)>, |
663 | L<SSL_CTX_sessions(3)|SSL_CTX_sessions(3)>, | 673 | L<SSL_CTX_sessions(3)|SSL_CTX_sessions(3)>, |
674 | L<SSL_CTX_set_cert_store(3)|SSL_CTX_set_cert_store(3)>, | ||
675 | L<SSL_CTX_set_cert_verify_callback(3)|SSL_CTX_set_cert_verify_callback(3)>, | ||
676 | L<SSL_CTX_set_cipher_list(3)|SSL_CTX_set_cipher_list(3)>, | ||
664 | L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)>, | 677 | L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)>, |
678 | L<SSL_CTX_set_client_cert_cb(3)|SSL_CTX_set_client_cert_cb(3)>, | ||
665 | L<SSL_CTX_set_default_passwd_cb(3)|SSL_CTX_set_default_passwd_cb(3)>, | 679 | L<SSL_CTX_set_default_passwd_cb(3)|SSL_CTX_set_default_passwd_cb(3)>, |
680 | L<SSL_CTX_set_generate_session_id(3)|SSL_CTX_set_generate_session_id(3)>, | ||
681 | L<SSL_CTX_set_info_callback(3)|SSL_CTX_set_info_callback(3)>, | ||
682 | L<SSL_CTX_set_max_cert_list(3)|SSL_CTX_set_max_cert_list(3)>, | ||
666 | L<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)>, | 683 | L<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)>, |
684 | L<SSL_CTX_set_msg_callback(3)|SSL_CTX_set_msg_callback(3)>, | ||
667 | L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, | 685 | L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, |
686 | L<SSL_CTX_set_quiet_shutdown(3)|SSL_CTX_set_quiet_shutdown(3)>, | ||
668 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, | 687 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, |
669 | L<SSL_CTX_set_session_id_context(3)|SSL_CTX_set_session_id_context(3)>, | 688 | L<SSL_CTX_set_session_id_context(3)|SSL_CTX_set_session_id_context(3)>, |
670 | L<SSL_CTX_set_ssl_version(3)|SSL_CTX_set_ssl_version(3)>, | 689 | L<SSL_CTX_set_ssl_version(3)|SSL_CTX_set_ssl_version(3)>, |
671 | L<SSL_CTX_set_timeout(3)|SSL_CTX_set_timeout(3)>, | 690 | L<SSL_CTX_set_timeout(3)|SSL_CTX_set_timeout(3)>, |
691 | L<SSL_CTX_set_tmp_rsa_callback(3)|SSL_CTX_set_tmp_rsa_callback(3)>, | ||
692 | L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>, | ||
672 | L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>, | 693 | L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>, |
673 | L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)>, | 694 | L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)>, |
695 | L<SSL_alert_type_string(3)|SSL_alert_type_string(3)>, | ||
696 | L<SSL_get_SSL_CTX(3)|SSL_get_SSL_CTX(3)>, | ||
674 | L<SSL_get_ciphers(3)|SSL_get_ciphers(3)>, | 697 | L<SSL_get_ciphers(3)|SSL_get_ciphers(3)>, |
675 | L<SSL_get_client_CA_list(3)|SSL_get_client_CA_list(3)>, | 698 | L<SSL_get_client_CA_list(3)|SSL_get_client_CA_list(3)>, |
699 | L<SSL_get_default_timeout(3)|SSL_get_default_timeout(3)>, | ||
676 | L<SSL_get_error(3)|SSL_get_error(3)>, | 700 | L<SSL_get_error(3)|SSL_get_error(3)>, |
677 | L<SSL_get_ex_data_X509_STORE_CTX_idx(3)|SSL_get_ex_data_X509_STORE_CTX_idx(3)>, | 701 | L<SSL_get_ex_data_X509_STORE_CTX_idx(3)|SSL_get_ex_data_X509_STORE_CTX_idx(3)>, |
678 | L<SSL_get_ex_new_index(3)|SSL_get_ex_new_index(3)>, | 702 | L<SSL_get_ex_new_index(3)|SSL_get_ex_new_index(3)>, |
@@ -685,12 +709,19 @@ L<SSL_get_version(3)|SSL_get_version(3)>, | |||
685 | L<SSL_library_init(3)|SSL_library_init(3)>, | 709 | L<SSL_library_init(3)|SSL_library_init(3)>, |
686 | L<SSL_load_client_CA_file(3)|SSL_load_client_CA_file(3)>, | 710 | L<SSL_load_client_CA_file(3)|SSL_load_client_CA_file(3)>, |
687 | L<SSL_new(3)|SSL_new(3)>, | 711 | L<SSL_new(3)|SSL_new(3)>, |
688 | L<SSL_read(3)|SSL_read(3)>, L<SSL_set_bio(3)|SSL_set_bio(3)>, | 712 | L<SSL_pending(3)|SSL_pending(3)>, |
713 | L<SSL_read(3)|SSL_read(3)>, | ||
714 | L<SSL_rstate_string(3)|SSL_rstate_string(3)>, | ||
715 | L<SSL_session_reused(3)|SSL_session_reused(3)>, | ||
716 | L<SSL_set_bio(3)|SSL_set_bio(3)>, | ||
689 | L<SSL_set_connect_state(3)|SSL_set_connect_state(3)>, | 717 | L<SSL_set_connect_state(3)|SSL_set_connect_state(3)>, |
690 | L<SSL_set_fd(3)|SSL_set_fd(3)>, L<SSL_pending(3)|SSL_pending(3)>, | 718 | L<SSL_set_fd(3)|SSL_set_fd(3)>, |
691 | L<SSL_set_session(3)|SSL_set_session(3)>, | 719 | L<SSL_set_session(3)|SSL_set_session(3)>, |
692 | L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>, | 720 | L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>, |
693 | L<SSL_shutdown(3)|SSL_shutdown(3)>, L<SSL_write(3)|SSL_write(3)>, | 721 | L<SSL_shutdown(3)|SSL_shutdown(3)>, |
722 | L<SSL_state_string(3)|SSL_state_string(3)>, | ||
723 | L<SSL_want(3)|SSL_want(3)>, | ||
724 | L<SSL_write(3)|SSL_write(3)>, | ||
694 | L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>, | 725 | L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>, |
695 | L<SSL_SESSION_get_ex_new_index(3)|SSL_SESSION_get_ex_new_index(3)>, | 726 | L<SSL_SESSION_get_ex_new_index(3)|SSL_SESSION_get_ex_new_index(3)>, |
696 | L<SSL_SESSION_get_time(3)|SSL_SESSION_get_time(3)>, | 727 | L<SSL_SESSION_get_time(3)|SSL_SESSION_get_time(3)>, |
diff --git a/src/lib/libssl/src/doc/ssleay.txt b/src/lib/libssl/src/doc/ssleay.txt index fab8d42c42..c6049d5e53 100644 --- a/src/lib/libssl/src/doc/ssleay.txt +++ b/src/lib/libssl/src/doc/ssleay.txt | |||
@@ -1,6 +1,22 @@ | |||
1 | 1 | ||
2 | Bundle of old SSLeay documentation files [OBSOLETE!] | 2 | Bundle of old SSLeay documentation files [OBSOLETE!] |
3 | 3 | ||
4 | *** WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! *** | ||
5 | |||
6 | OBSOLETE means that nothing in this document should be trusted. This | ||
7 | document is provided mostly for historical purposes (it wasn't even up | ||
8 | to date at the time SSLeay 0.8.1 was released) and as inspiration. If | ||
9 | you copy some snippet of code from this document, please _check_ that | ||
10 | it really is correct from all points of view. For example, you can | ||
11 | check with the other documents in this directory tree, or by comparing | ||
12 | with relevant parts of the include files. | ||
13 | |||
14 | People have done the mistake of trusting what's written here. Please | ||
15 | don't do that. | ||
16 | |||
17 | *** WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! *** | ||
18 | |||
19 | |||
4 | ==== readme ======================================================== | 20 | ==== readme ======================================================== |
5 | 21 | ||
6 | This is the old 0.6.6 docuementation. Most of the cipher stuff is still | 22 | This is the old 0.6.6 docuementation. Most of the cipher stuff is still |
diff --git a/src/lib/libssl/src/doc/standards.txt b/src/lib/libssl/src/doc/standards.txt index 61ccc5d7e0..596d9001e6 100644 --- a/src/lib/libssl/src/doc/standards.txt +++ b/src/lib/libssl/src/doc/standards.txt | |||
@@ -24,7 +24,8 @@ http://www.rsasecurity.com/rsalabs/pkcs/. | |||
24 | Implemented: | 24 | Implemented: |
25 | ------------ | 25 | ------------ |
26 | 26 | ||
27 | These are documents that describe things that are implemented in OpenSSL. | 27 | These are documents that describe things that are implemented (in |
28 | whole or at least great parts) in OpenSSL. | ||
28 | 29 | ||
29 | 1319 The MD2 Message-Digest Algorithm. B. Kaliski. April 1992. | 30 | 1319 The MD2 Message-Digest Algorithm. B. Kaliski. April 1992. |
30 | (Format: TXT=25661 bytes) (Status: INFORMATIONAL) | 31 | (Format: TXT=25661 bytes) (Status: INFORMATIONAL) |
@@ -59,6 +60,11 @@ PKCS#8: Private-Key Information Syntax Standard | |||
59 | 60 | ||
60 | PKCS#12: Personal Information Exchange Syntax Standard, version 1.0. | 61 | PKCS#12: Personal Information Exchange Syntax Standard, version 1.0. |
61 | 62 | ||
63 | 2560 X.509 Internet Public Key Infrastructure Online Certificate | ||
64 | Status Protocol - OCSP. M. Myers, R. Ankney, A. Malpani, S. Galperin, | ||
65 | C. Adams. June 1999. (Format: TXT=43243 bytes) (Status: PROPOSED | ||
66 | STANDARD) | ||
67 | |||
62 | 68 | ||
63 | Related: | 69 | Related: |
64 | -------- | 70 | -------- |
@@ -84,6 +90,10 @@ STARTTLS documents. | |||
84 | Certification and Related Services. B. Kaliski. February 1993. | 90 | Certification and Related Services. B. Kaliski. February 1993. |
85 | (Format: TXT=17537 bytes) (Status: PROPOSED STANDARD) | 91 | (Format: TXT=17537 bytes) (Status: PROPOSED STANDARD) |
86 | 92 | ||
93 | 2256 A Summary of the X.500(96) User Schema for use with LDAPv3. M. | ||
94 | Wahl. December 1997. (Format: TXT=32377 bytes) (Status: PROPOSED | ||
95 | STANDARD) | ||
96 | |||
87 | 2487 SMTP Service Extension for Secure SMTP over TLS. P. Hoffman. | 97 | 2487 SMTP Service Extension for Secure SMTP over TLS. P. Hoffman. |
88 | January 1999. (Format: TXT=15120 bytes) (Status: PROPOSED STANDARD) | 98 | January 1999. (Format: TXT=15120 bytes) (Status: PROPOSED STANDARD) |
89 | 99 | ||
@@ -114,8 +124,7 @@ To be implemented: | |||
114 | These are documents that describe things that are planed to be | 124 | These are documents that describe things that are planed to be |
115 | implemented in the hopefully short future. | 125 | implemented in the hopefully short future. |
116 | 126 | ||
117 | 2560 X.509 Internet Public Key Infrastructure Online Certificate | 127 | 2712 Addition of Kerberos Cipher Suites to Transport Layer Security |
118 | Status Protocol - OCSP. M. Myers, R. Ankney, A. Malpani, S. Galperin, | 128 | (TLS). A. Medvinsky, M. Hur. October 1999. (Format: TXT=13763 bytes) |
119 | C. Adams. June 1999. (Format: TXT=43243 bytes) (Status: PROPOSED | 129 | (Status: PROPOSED STANDARD) |
120 | STANDARD) | ||
121 | 130 | ||