diff options
Diffstat (limited to 'src/lib/libssl/src/doc')
116 files changed, 5362 insertions, 293 deletions
diff --git a/src/lib/libssl/src/doc/README b/src/lib/libssl/src/doc/README index 14469a82e3..6ecc14d994 100644 --- a/src/lib/libssl/src/doc/README +++ b/src/lib/libssl/src/doc/README | |||
@@ -4,6 +4,8 @@ | |||
4 | ssl/ssl.pod ......... Documentation of OpenSSL ssl.h+libssl.a | 4 | ssl/ssl.pod ......... Documentation of OpenSSL ssl.h+libssl.a |
5 | openssl.txt ......... Assembled documentation files for OpenSSL [not final] | 5 | openssl.txt ......... Assembled documentation files for OpenSSL [not final] |
6 | ssleay.txt .......... Assembled documentation of ancestor SSLeay [obsolete] | 6 | ssleay.txt .......... Assembled documentation of ancestor SSLeay [obsolete] |
7 | standards.txt ....... Assembled pointers to standards, RFCs or internet drafts | ||
8 | that are related to OpenSSL. | ||
7 | 9 | ||
8 | An archive of HTML documents for the SSLeay library is available from | 10 | An archive of HTML documents for the SSLeay library is available from |
9 | http://www.columbia.edu/~ariel/ssleay/ | 11 | http://www.columbia.edu/~ariel/ssleay/ |
diff --git a/src/lib/libssl/src/doc/apps/CA.pl.pod b/src/lib/libssl/src/doc/apps/CA.pl.pod index 9d287f0c4d..63cd1320cc 100644 --- a/src/lib/libssl/src/doc/apps/CA.pl.pod +++ b/src/lib/libssl/src/doc/apps/CA.pl.pod | |||
@@ -69,9 +69,16 @@ list box), otherwise the name "My Certificate" is used. | |||
69 | 69 | ||
70 | calls the B<ca> program to sign a certificate request. It expects the request | 70 | calls the B<ca> program to sign a certificate request. It expects the request |
71 | to be in the file "newreq.pem". The new certificate is written to the file | 71 | to be in the file "newreq.pem". The new certificate is written to the file |
72 | "newcert.pem" except in the case of the B<-xcert> option when it is written | 72 | "newcert.pem" except in the case of the B<-xsign> option when it is written |
73 | to standard output. | 73 | to standard output. |
74 | 74 | ||
75 | |||
76 | =item B<-signCA> | ||
77 | |||
78 | this option is the same as the B<-signreq> option except it uses the configuration | ||
79 | file section B<v3_ca> and so makes the signed request a valid CA certificate. This | ||
80 | is useful when creating intermediate CA from a root CA. | ||
81 | |||
75 | =item B<-signcert> | 82 | =item B<-signcert> |
76 | 83 | ||
77 | this option is the same as B<-sign> except it expects a self signed certificate | 84 | this option is the same as B<-sign> except it expects a self signed certificate |
@@ -122,7 +129,7 @@ Create the CA directories and files: | |||
122 | 129 | ||
123 | enter cacert.pem when prompted for the CA file name. | 130 | enter cacert.pem when prompted for the CA file name. |
124 | 131 | ||
125 | Create a DSA certificate request and privat key (a different set of parameters | 132 | Create a DSA certificate request and private key (a different set of parameters |
126 | can optionally be created first): | 133 | can optionally be created first): |
127 | 134 | ||
128 | openssl req -out newreq.pem -newkey dsa:dsap.pem | 135 | openssl req -out newreq.pem -newkey dsa:dsap.pem |
diff --git a/src/lib/libssl/src/doc/apps/ca.pod b/src/lib/libssl/src/doc/apps/ca.pod index 03209aa6b1..d352925864 100644 --- a/src/lib/libssl/src/doc/apps/ca.pod +++ b/src/lib/libssl/src/doc/apps/ca.pod | |||
@@ -23,6 +23,7 @@ B<openssl> B<ca> | |||
23 | [B<-policy arg>] | 23 | [B<-policy arg>] |
24 | [B<-keyfile arg>] | 24 | [B<-keyfile arg>] |
25 | [B<-key arg>] | 25 | [B<-key arg>] |
26 | [B<-passin arg>] | ||
26 | [B<-cert file>] | 27 | [B<-cert file>] |
27 | [B<-in file>] | 28 | [B<-in file>] |
28 | [B<-out file>] | 29 | [B<-out file>] |
@@ -99,6 +100,10 @@ the password used to encrypt the private key. Since on some | |||
99 | systems the command line arguments are visible (e.g. Unix with | 100 | systems the command line arguments are visible (e.g. Unix with |
100 | the 'ps' utility) this option should be used with caution. | 101 | the 'ps' utility) this option should be used with caution. |
101 | 102 | ||
103 | =item B<-passin arg> | ||
104 | |||
105 | 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)>. | ||
102 | =item B<-verbose> | 107 | =item B<-verbose> |
103 | 108 | ||
104 | this prints extra details about the operations being performed. | 109 | this prints extra details about the operations being performed. |
@@ -342,6 +347,10 @@ Sign a certificate request: | |||
342 | 347 | ||
343 | openssl ca -in req.pem -out newcert.pem | 348 | openssl ca -in req.pem -out newcert.pem |
344 | 349 | ||
350 | Sign a certificate request, using CA extensions: | ||
351 | |||
352 | openssl ca -in req.pem -extensions v3_ca -out newcert.pem | ||
353 | |||
345 | Generate a CRL | 354 | Generate a CRL |
346 | 355 | ||
347 | openssl ca -gencrl -out crl.pem | 356 | openssl ca -gencrl -out crl.pem |
diff --git a/src/lib/libssl/src/doc/apps/ciphers.pod b/src/lib/libssl/src/doc/apps/ciphers.pod index 2301e28251..21077614a7 100644 --- a/src/lib/libssl/src/doc/apps/ciphers.pod +++ b/src/lib/libssl/src/doc/apps/ciphers.pod | |||
@@ -25,9 +25,13 @@ the appropriate cipherlist. | |||
25 | 25 | ||
26 | =item B<-v> | 26 | =item B<-v> |
27 | 27 | ||
28 | verbose option. List ciphers with a complete description of the authentication, | 28 | verbose option. List ciphers with a complete description of |
29 | key exchange, encryption and mac algorithms used along with any key size | 29 | protocol version (SSLv2 or SSLv3; the latter includes TLS), key exchange, |
30 | authentication, encryption and mac algorithms used along with any key size | ||
30 | restrictions and whether the algorithm is classed as an "export" cipher. | 31 | restrictions and whether the algorithm is classed as an "export" cipher. |
32 | Note that without the B<-v> option, ciphers may seem to appear twice | ||
33 | in a cipher list; this is when similar ciphers are available for | ||
34 | SSL v2 and for SSL v3/TLS v1. | ||
31 | 35 | ||
32 | =item B<-ssl3> | 36 | =item B<-ssl3> |
33 | 37 | ||
diff --git a/src/lib/libssl/src/doc/apps/dgst.pod b/src/lib/libssl/src/doc/apps/dgst.pod index fcfd3ecf23..1648742bcf 100644 --- a/src/lib/libssl/src/doc/apps/dgst.pod +++ b/src/lib/libssl/src/doc/apps/dgst.pod | |||
@@ -2,25 +2,32 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | dgst, md5, md2, sha1, sha, mdc2, ripemd160 - message digests | 5 | dgst, md5, md4, md2, sha1, sha, mdc2, ripemd160 - message digests |
6 | 6 | ||
7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
8 | 8 | ||
9 | B<openssl> B<dgst> | 9 | B<openssl> B<dgst> |
10 | [B<-md5|-md2|-sha1|-sha|mdc2|-ripemd160>] | 10 | [B<-md5|-md4|-md2|-sha1|-sha|-mdc2|-ripemd160|-dss1>] |
11 | [B<-c>] | 11 | [B<-c>] |
12 | [B<-d>] | 12 | [B<-d>] |
13 | [B<-hex>] | ||
14 | [B<-binary>] | ||
15 | [B<-out filename>] | ||
16 | [B<-sign filename>] | ||
17 | [B<-verify filename>] | ||
18 | [B<-prverify filename>] | ||
19 | [B<-signature filename>] | ||
13 | [B<file...>] | 20 | [B<file...>] |
14 | 21 | ||
15 | [B<md5|md2|sha1|sha|mdc2|ripemd160>] | 22 | [B<md5|md4|md2|sha1|sha|mdc2|ripemd160>] |
16 | [B<-c>] | 23 | [B<-c>] |
17 | [B<-d>] | 24 | [B<-d>] |
18 | [B<file...>] | 25 | [B<file...>] |
19 | 26 | ||
20 | =head1 DESCRIPTION | 27 | =head1 DESCRIPTION |
21 | 28 | ||
22 | The digest functions print out the message digest of a supplied file or files | 29 | The digest functions output the message digest of a supplied file or files |
23 | in hexadecimal form. | 30 | in hexadecimal form. They can also be used for digital signing and verification. |
24 | 31 | ||
25 | =head1 OPTIONS | 32 | =head1 OPTIONS |
26 | 33 | ||
@@ -28,12 +35,51 @@ in hexadecimal form. | |||
28 | 35 | ||
29 | =item B<-c> | 36 | =item B<-c> |
30 | 37 | ||
31 | print out the digest in two digit groups separated by colons. | 38 | print out the digest in two digit groups separated by colons, only relevant if |
39 | B<hex> format output is used. | ||
32 | 40 | ||
33 | =item B<-d> | 41 | =item B<-d> |
34 | 42 | ||
35 | print out BIO debugging information. | 43 | print out BIO debugging information. |
36 | 44 | ||
45 | =item B<-hex> | ||
46 | |||
47 | digest is to be output as a hex dump. This is the default case for a "normal" | ||
48 | digest as opposed to a digital signature. | ||
49 | |||
50 | =item B<-binary> | ||
51 | |||
52 | output the digest or signature in binary form. | ||
53 | |||
54 | =item B<-out filename> | ||
55 | |||
56 | filename to output to, or standard output by default. | ||
57 | |||
58 | =item B<-sign filename> | ||
59 | |||
60 | digitally sign the digest using the private key in "filename". | ||
61 | |||
62 | =item B<-verify filename> | ||
63 | |||
64 | verify the signature using the the public key in "filename". | ||
65 | The output is either "Verification OK" or "Verification Failure". | ||
66 | |||
67 | =item B<-prverify filename> | ||
68 | |||
69 | verify the signature using the the private key in "filename". | ||
70 | |||
71 | =item B<-signature filename> | ||
72 | |||
73 | the actual signature to verify. | ||
74 | |||
75 | =item B<-rand file(s)> | ||
76 | |||
77 | a file or files containing random data used to seed the random number | ||
78 | generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). | ||
79 | Multiple files can be specified separated by a OS-dependent character. | ||
80 | The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for | ||
81 | all others. | ||
82 | |||
37 | =item B<file...> | 83 | =item B<file...> |
38 | 84 | ||
39 | file or files to digest. If no files are specified then standard input is | 85 | file or files to digest. If no files are specified then standard input is |
@@ -46,4 +92,13 @@ used. | |||
46 | The digest of choice for all new applications is SHA1. Other digests are | 92 | The digest of choice for all new applications is SHA1. Other digests are |
47 | however still widely used. | 93 | however still widely used. |
48 | 94 | ||
95 | If you wish to sign or verify data using the DSA algorithm then the dss1 | ||
96 | digest must be used. | ||
97 | |||
98 | A source of random numbers is required for certain signing algorithms, in | ||
99 | particular DSA. | ||
100 | |||
101 | The signing and verify options should only be used if a single file is | ||
102 | being signed or verified. | ||
103 | |||
49 | =cut | 104 | =cut |
diff --git a/src/lib/libssl/src/doc/apps/dhparam.pod b/src/lib/libssl/src/doc/apps/dhparam.pod index 15aabf4ac8..ff8a6e5e5b 100644 --- a/src/lib/libssl/src/doc/apps/dhparam.pod +++ b/src/lib/libssl/src/doc/apps/dhparam.pod | |||
@@ -73,7 +73,7 @@ input file is ignored and parameters are generated instead. | |||
73 | a file or files containing random data used to seed the random number | 73 | a file or files containing random data used to seed the random number |
74 | generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). | 74 | generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). |
75 | Multiple files can be specified separated by a OS-dependent character. | 75 | Multiple files can be specified separated by a OS-dependent character. |
76 | The separator is B<;> for MS-Windows, B<,> for OpenVSM, and B<:> for | 76 | The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for |
77 | all others. | 77 | all others. |
78 | 78 | ||
79 | =item I<numbits> | 79 | =item I<numbits> |
diff --git a/src/lib/libssl/src/doc/apps/dsaparam.pod b/src/lib/libssl/src/doc/apps/dsaparam.pod index 8647f34698..50c2f61242 100644 --- a/src/lib/libssl/src/doc/apps/dsaparam.pod +++ b/src/lib/libssl/src/doc/apps/dsaparam.pod | |||
@@ -73,7 +73,7 @@ parameters. | |||
73 | a file or files containing random data used to seed the random number | 73 | a file or files containing random data used to seed the random number |
74 | generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). | 74 | generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). |
75 | Multiple files can be specified separated by a OS-dependent character. | 75 | Multiple files can be specified separated by a OS-dependent character. |
76 | The separator is B<;> for MS-Windows, B<,> for OpenVSM, and B<:> for | 76 | The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for |
77 | all others. | 77 | all others. |
78 | 78 | ||
79 | =item B<numbits> | 79 | =item B<numbits> |
diff --git a/src/lib/libssl/src/doc/apps/gendsa.pod b/src/lib/libssl/src/doc/apps/gendsa.pod index 3314ace517..74318fe7fb 100644 --- a/src/lib/libssl/src/doc/apps/gendsa.pod +++ b/src/lib/libssl/src/doc/apps/gendsa.pod | |||
@@ -34,7 +34,7 @@ If none of these options is specified no encryption is used. | |||
34 | a file or files containing random data used to seed the random number | 34 | a file or files containing random data used to seed the random number |
35 | generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). | 35 | generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). |
36 | Multiple files can be specified separated by a OS-dependent character. | 36 | Multiple files can be specified separated by a OS-dependent character. |
37 | The separator is B<;> for MS-Windows, B<,> for OpenVSM, and B<:> for | 37 | The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for |
38 | all others. | 38 | all others. |
39 | 39 | ||
40 | =item B<paramfile> | 40 | =item B<paramfile> |
diff --git a/src/lib/libssl/src/doc/apps/genrsa.pod b/src/lib/libssl/src/doc/apps/genrsa.pod index 70d35fef0a..cdcc03c123 100644 --- a/src/lib/libssl/src/doc/apps/genrsa.pod +++ b/src/lib/libssl/src/doc/apps/genrsa.pod | |||
@@ -51,7 +51,7 @@ the public exponent to use, either 65537 or 3. The default is 65537. | |||
51 | a file or files containing random data used to seed the random number | 51 | a file or files containing random data used to seed the random number |
52 | generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). | 52 | generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). |
53 | Multiple files can be specified separated by a OS-dependent character. | 53 | Multiple files can be specified separated by a OS-dependent character. |
54 | The separator is B<;> for MS-Windows, B<,> for OpenVSM, and B<:> for | 54 | The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for |
55 | all others. | 55 | all others. |
56 | 56 | ||
57 | =item B<numbits> | 57 | =item B<numbits> |
diff --git a/src/lib/libssl/src/doc/apps/openssl.pod b/src/lib/libssl/src/doc/apps/openssl.pod index 2fc61b6c21..0cbd199d79 100644 --- a/src/lib/libssl/src/doc/apps/openssl.pod +++ b/src/lib/libssl/src/doc/apps/openssl.pod | |||
@@ -83,9 +83,10 @@ CRL to PKCS#7 Conversion. | |||
83 | 83 | ||
84 | Message Digest Calculation. | 84 | Message Digest Calculation. |
85 | 85 | ||
86 | =item L<B<dh>|dh(1)> | 86 | =item B<dh> |
87 | 87 | ||
88 | Diffie-Hellman Data Management. | 88 | Diffie-Hellman Parameter Management. |
89 | Obsoleted by L<B<dhparam>|dhparam(1)>. | ||
89 | 90 | ||
90 | =item L<B<dsa>|dsa(1)> | 91 | =item L<B<dsa>|dsa(1)> |
91 | 92 | ||
@@ -103,9 +104,14 @@ Encoding with Ciphers. | |||
103 | 104 | ||
104 | Error Number to Error String Conversion. | 105 | Error Number to Error String Conversion. |
105 | 106 | ||
106 | =item L<B<gendh>|gendh(1)> | 107 | =item L<B<dhparam>|dhparam(1)> |
108 | |||
109 | Generation and Management of Diffie-Hellman Parameters. | ||
110 | |||
111 | =item B<gendh> | ||
107 | 112 | ||
108 | Generation of Diffie-Hellman Parameters. | 113 | Generation of Diffie-Hellman Parameters. |
114 | Obsoleted by L<B<dhparam>|dhparam(1)>. | ||
109 | 115 | ||
110 | =item L<B<gendsa>|gendsa(1)> | 116 | =item L<B<gendsa>|gendsa(1)> |
111 | 117 | ||
@@ -135,6 +141,10 @@ X.509 Certificate Signing Request (CSR) Management. | |||
135 | 141 | ||
136 | RSA Data Management. | 142 | RSA Data Management. |
137 | 143 | ||
144 | =item L<B<rsautl>|rsautl(1)> | ||
145 | |||
146 | RSA utility for signing, verification, encryption, and decryption. | ||
147 | |||
138 | =item L<B<s_client>|s_client(1)> | 148 | =item L<B<s_client>|s_client(1)> |
139 | 149 | ||
140 | This implements a generic SSL/TLS client which can establish a transparent | 150 | This implements a generic SSL/TLS client which can establish a transparent |
@@ -309,7 +319,8 @@ L<enc(1)|enc(1)>, L<gendsa(1)|gendsa(1)>, | |||
309 | L<genrsa(1)|genrsa(1)>, L<nseq(1)|nseq(1)>, L<openssl(1)|openssl(1)>, | 319 | L<genrsa(1)|genrsa(1)>, L<nseq(1)|nseq(1)>, L<openssl(1)|openssl(1)>, |
310 | L<passwd(1)|passwd(1)>, | 320 | L<passwd(1)|passwd(1)>, |
311 | L<pkcs12(1)|pkcs12(1)>, L<pkcs7(1)|pkcs7(1)>, L<pkcs8(1)|pkcs8(1)>, | 321 | L<pkcs12(1)|pkcs12(1)>, L<pkcs7(1)|pkcs7(1)>, L<pkcs8(1)|pkcs8(1)>, |
312 | L<rand(1)|rand(1)>, L<req(1)|req(1)>, L<rsa(1)|rsa(1)>, L<s_client(1)|s_client(1)>, | 322 | L<rand(1)|rand(1)>, L<req(1)|req(1)>, L<rsa(1)|rsa(1)>, |
323 | L<rsautl(1)|rsautl(1)>, L<s_client(1)|s_client(1)>, | ||
313 | L<s_server(1)|s_server(1)>, L<smime(1)|smime(1)>, L<spkac(1)|spkac(1)>, | 324 | L<s_server(1)|s_server(1)>, L<smime(1)|smime(1)>, L<spkac(1)|spkac(1)>, |
314 | L<verify(1)|verify(1)>, L<version(1)|version(1)>, L<x509(1)|x509(1)>, | 325 | L<verify(1)|verify(1)>, L<version(1)|version(1)>, L<x509(1)|x509(1)>, |
315 | L<crypto(3)|crypto(3)>, L<ssl(3)|ssl(3)> | 326 | L<crypto(3)|crypto(3)>, L<ssl(3)|ssl(3)> |
diff --git a/src/lib/libssl/src/doc/apps/passwd.pod b/src/lib/libssl/src/doc/apps/passwd.pod index cee6a2f172..6e098940c7 100644 --- a/src/lib/libssl/src/doc/apps/passwd.pod +++ b/src/lib/libssl/src/doc/apps/passwd.pod | |||
@@ -8,6 +8,7 @@ passwd - compute password hashes | |||
8 | 8 | ||
9 | B<openssl passwd> | 9 | B<openssl passwd> |
10 | [B<-crypt>] | 10 | [B<-crypt>] |
11 | [B<-1>] | ||
11 | [B<-apr1>] | 12 | [B<-apr1>] |
12 | [B<-salt> I<string>] | 13 | [B<-salt> I<string>] |
13 | [B<-in> I<file>] | 14 | [B<-in> I<file>] |
@@ -22,8 +23,8 @@ The B<passwd> command computes the hash of a password typed at | |||
22 | run-time or the hash of each password in a list. The password list is | 23 | run-time or the hash of each password in a list. The password list is |
23 | taken from the named file for option B<-in file>, from stdin for | 24 | taken from the named file for option B<-in file>, from stdin for |
24 | option B<-stdin>, and from the command line otherwise. | 25 | option B<-stdin>, and from the command line otherwise. |
25 | The Unix standard algorithm B<crypt> and the MD5-based B<apr1> algorithm | 26 | The Unix standard algorithm B<crypt> and the MD5-based BSD password |
26 | are available. | 27 | algorithm B<1> and its Apache variant B<apr1> are available. |
27 | 28 | ||
28 | =head1 OPTIONS | 29 | =head1 OPTIONS |
29 | 30 | ||
@@ -33,9 +34,13 @@ are available. | |||
33 | 34 | ||
34 | Use the B<crypt> algorithm (default). | 35 | Use the B<crypt> algorithm (default). |
35 | 36 | ||
37 | =item B<-1> | ||
38 | |||
39 | Use the MD5 based BSD password algorithm B<1>. | ||
40 | |||
36 | =item B<-apr1> | 41 | =item B<-apr1> |
37 | 42 | ||
38 | Use the B<apr1> algorithm. | 43 | Use the B<apr1> algorithm (Apache variant of the BSD algorithm). |
39 | 44 | ||
40 | =item B<-salt> I<string> | 45 | =item B<-salt> I<string> |
41 | 46 | ||
@@ -64,6 +69,8 @@ to each password hash. | |||
64 | 69 | ||
65 | B<openssl passwd -crypt -salt xx password> prints B<xxj31ZMTZzkVA>. | 70 | B<openssl passwd -crypt -salt xx password> prints B<xxj31ZMTZzkVA>. |
66 | 71 | ||
72 | B<openssl passwd -1 -salt xxxxxxxx password> prints B<$1$xxxxxxxx$8XJIcl6ZXqBMCK0qFevqT1>. | ||
73 | |||
67 | B<openssl passwd -apr1 -salt xxxxxxxx password> prints B<$apr1$xxxxxxxx$dxHfLAsjHkDRmG83UXe8K0>. | 74 | B<openssl passwd -apr1 -salt xxxxxxxx password> prints B<$apr1$xxxxxxxx$dxHfLAsjHkDRmG83UXe8K0>. |
68 | 75 | ||
69 | =cut | 76 | =cut |
diff --git a/src/lib/libssl/src/doc/apps/pkcs12.pod b/src/lib/libssl/src/doc/apps/pkcs12.pod index 241f9c4a8b..c4009998b8 100644 --- a/src/lib/libssl/src/doc/apps/pkcs12.pod +++ b/src/lib/libssl/src/doc/apps/pkcs12.pod | |||
@@ -244,7 +244,7 @@ to be needed to use MAC iterations counts but they are now used by default. | |||
244 | a file or files containing random data used to seed the random number | 244 | a file or files containing random data used to seed the random number |
245 | generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). | 245 | generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). |
246 | Multiple files can be specified separated by a OS-dependent character. | 246 | Multiple files can be specified separated by a OS-dependent character. |
247 | The separator is B<;> for MS-Windows, B<,> for OpenVSM, and B<:> for | 247 | The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for |
248 | all others. | 248 | all others. |
249 | 249 | ||
250 | =back | 250 | =back |
diff --git a/src/lib/libssl/src/doc/apps/rand.pod b/src/lib/libssl/src/doc/apps/rand.pod index f81eab0457..cbf8768801 100644 --- a/src/lib/libssl/src/doc/apps/rand.pod +++ b/src/lib/libssl/src/doc/apps/rand.pod | |||
@@ -34,7 +34,7 @@ Write to I<file> instead of standard output. | |||
34 | Use specified file or files or EGD socket (see L<RAND_egd(3)|RAND_egd(3)>) | 34 | Use specified file or files or EGD socket (see L<RAND_egd(3)|RAND_egd(3)>) |
35 | for seeding the random number generator. | 35 | for seeding the random number generator. |
36 | Multiple files can be specified separated by a OS-dependent character. | 36 | Multiple files can be specified separated by a OS-dependent character. |
37 | The separator is B<;> for MS-Windows, B<,> for OpenVSM, and B<:> for | 37 | The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for |
38 | all others. | 38 | all others. |
39 | 39 | ||
40 | =item B<-base64> | 40 | =item B<-base64> |
diff --git a/src/lib/libssl/src/doc/apps/req.pod b/src/lib/libssl/src/doc/apps/req.pod index fde6ff2e9f..a3f54f45a3 100644 --- a/src/lib/libssl/src/doc/apps/req.pod +++ b/src/lib/libssl/src/doc/apps/req.pod | |||
@@ -19,6 +19,7 @@ B<openssl> B<req> | |||
19 | [B<-verify>] | 19 | [B<-verify>] |
20 | [B<-modulus>] | 20 | [B<-modulus>] |
21 | [B<-new>] | 21 | [B<-new>] |
22 | [B<-rand file(s)>] | ||
22 | [B<-newkey rsa:bits>] | 23 | [B<-newkey rsa:bits>] |
23 | [B<-newkey dsa:file>] | 24 | [B<-newkey dsa:file>] |
24 | [B<-nodes>] | 25 | [B<-nodes>] |
@@ -104,6 +105,14 @@ in the configuration file and any requested extensions. | |||
104 | If the B<-key> option is not used it will generate a new RSA private | 105 | If the B<-key> option is not used it will generate a new RSA private |
105 | key using information specified in the configuration file. | 106 | key using information specified in the configuration file. |
106 | 107 | ||
108 | =item B<-rand file(s)> | ||
109 | |||
110 | a file or files containing random data used to seed the random number | ||
111 | generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). | ||
112 | Multiple files can be specified separated by a OS-dependent character. | ||
113 | The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for | ||
114 | all others. | ||
115 | |||
107 | =item B<-newkey arg> | 116 | =item B<-newkey arg> |
108 | 117 | ||
109 | this option creates a new certificate request and a new private | 118 | this option creates a new certificate request and a new private |
@@ -158,6 +167,7 @@ when the B<-x509> option is being used this specifies the number of | |||
158 | days to certify the certificate for. The default is 30 days. | 167 | days to certify the certificate for. The default is 30 days. |
159 | 168 | ||
160 | =item B<-extensions section> | 169 | =item B<-extensions section> |
170 | |||
161 | =item B<-reqexts section> | 171 | =item B<-reqexts section> |
162 | 172 | ||
163 | these options specify alternative sections to include certificate | 173 | these options specify alternative sections to include certificate |
diff --git a/src/lib/libssl/src/doc/apps/rsa.pod b/src/lib/libssl/src/doc/apps/rsa.pod index 62ad62e23d..f0e613ed05 100644 --- a/src/lib/libssl/src/doc/apps/rsa.pod +++ b/src/lib/libssl/src/doc/apps/rsa.pod | |||
@@ -14,6 +14,7 @@ B<openssl> B<rsa> | |||
14 | [B<-passin arg>] | 14 | [B<-passin arg>] |
15 | [B<-out filename>] | 15 | [B<-out filename>] |
16 | [B<-passout arg>] | 16 | [B<-passout arg>] |
17 | [B<-sgckey>] | ||
17 | [B<-des>] | 18 | [B<-des>] |
18 | [B<-des3>] | 19 | [B<-des3>] |
19 | [B<-idea>] | 20 | [B<-idea>] |
@@ -42,9 +43,8 @@ This specifies the input format. The B<DER> option uses an ASN1 DER encoded | |||
42 | form compatible with the PKCS#1 RSAPrivateKey or SubjectPublicKeyInfo format. | 43 | form compatible with the PKCS#1 RSAPrivateKey or SubjectPublicKeyInfo format. |
43 | The B<PEM> form is the default format: it consists of the B<DER> format base64 | 44 | The B<PEM> form is the default format: it consists of the B<DER> format base64 |
44 | encoded with additional header and footer lines. On input PKCS#8 format private | 45 | encoded with additional header and footer lines. On input PKCS#8 format private |
45 | keys are also accepted. The B<NET> form is a format compatible with older Netscape | 46 | keys are also accepted. The B<NET> form is a format is described in the B<NOTES> |
46 | servers and MS IIS, this uses unsalted RC4 for its encryption. It is not very | 47 | section. |
47 | secure and so should only be used when necessary. | ||
48 | 48 | ||
49 | =item B<-outform DER|NET|PEM> | 49 | =item B<-outform DER|NET|PEM> |
50 | 50 | ||
@@ -74,6 +74,11 @@ filename. | |||
74 | the output file password source. For more information about the format of B<arg> | 74 | the output file password source. For more information about the format of B<arg> |
75 | see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. | 75 | see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. |
76 | 76 | ||
77 | =item B<-sgckey> | ||
78 | |||
79 | use the modified NET algorithm used with some versions of Microsoft IIS and SGC | ||
80 | keys. | ||
81 | |||
77 | =item B<-des|-des3|-idea> | 82 | =item B<-des|-des3|-idea> |
78 | 83 | ||
79 | These options encrypt the private key with the DES, triple DES, or the | 84 | These options encrypt the private key with the DES, triple DES, or the |
@@ -126,6 +131,18 @@ The PEM public key format uses the header and footer lines: | |||
126 | -----BEGIN PUBLIC KEY----- | 131 | -----BEGIN PUBLIC KEY----- |
127 | -----END PUBLIC KEY----- | 132 | -----END PUBLIC KEY----- |
128 | 133 | ||
134 | The B<NET> form is a format compatible with older Netscape servers | ||
135 | 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. | ||
137 | |||
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 | ||
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 | ||
142 | from this point onwards to another file and use that as the input | ||
143 | to the B<rsa> utility with the B<-inform NET> option. If you get | ||
144 | an error after entering the password try the B<-sgckey> option. | ||
145 | |||
129 | =head1 EXAMPLES | 146 | =head1 EXAMPLES |
130 | 147 | ||
131 | To remove the pass phrase on an RSA private key: | 148 | To remove the pass phrase on an RSA private key: |
@@ -148,6 +165,14 @@ To just output the public part of a private key: | |||
148 | 165 | ||
149 | openssl rsa -in key.pem -pubout -out pubkey.pem | 166 | openssl rsa -in key.pem -pubout -out pubkey.pem |
150 | 167 | ||
168 | =head1 BUGS | ||
169 | |||
170 | The command line password arguments don't currently work with | ||
171 | B<NET> format. | ||
172 | |||
173 | There should be an option that automatically handles .key files, | ||
174 | without having to manually edit them. | ||
175 | |||
151 | =head1 SEE ALSO | 176 | =head1 SEE ALSO |
152 | 177 | ||
153 | L<pkcs8(1)|pkcs8(1)>, L<dsa(1)|dsa(1)>, L<genrsa(1)|genrsa(1)>, | 178 | L<pkcs8(1)|pkcs8(1)>, L<dsa(1)|dsa(1)>, L<genrsa(1)|genrsa(1)>, |
diff --git a/src/lib/libssl/src/doc/apps/rsautl.pod b/src/lib/libssl/src/doc/apps/rsautl.pod new file mode 100644 index 0000000000..7a334bc8d6 --- /dev/null +++ b/src/lib/libssl/src/doc/apps/rsautl.pod | |||
@@ -0,0 +1,183 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | rsautl - RSA utility | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<openssl> B<rsautl> | ||
10 | [B<-in file>] | ||
11 | [B<-out file>] | ||
12 | [B<-inkey file>] | ||
13 | [B<-pubin>] | ||
14 | [B<-certin>] | ||
15 | [B<-sign>] | ||
16 | [B<-verify>] | ||
17 | [B<-encrypt>] | ||
18 | [B<-decrypt>] | ||
19 | [B<-pkcs>] | ||
20 | [B<-ssl>] | ||
21 | [B<-raw>] | ||
22 | [B<-hexdump>] | ||
23 | [B<-asn1parse>] | ||
24 | |||
25 | =head1 DESCRIPTION | ||
26 | |||
27 | The B<rsautl> command can be used to sign, verify, encrypt and decrypt | ||
28 | data using the RSA algorithm. | ||
29 | |||
30 | =head1 COMMAND OPTIONS | ||
31 | |||
32 | =over 4 | ||
33 | |||
34 | =item B<-in filename> | ||
35 | |||
36 | This specifies the input filename to read data from or standard input | ||
37 | if this option is not specified. | ||
38 | |||
39 | =item B<-out filename> | ||
40 | |||
41 | specifies the output filename to write to or standard output by | ||
42 | default. | ||
43 | |||
44 | =item B<-inkey file> | ||
45 | |||
46 | the input key file, by default it should be an RSA private key. | ||
47 | |||
48 | =item B<-pubin> | ||
49 | |||
50 | the input file is an RSA public key. | ||
51 | |||
52 | =item B<-certin> | ||
53 | |||
54 | the input is a certificate containing an RSA public key. | ||
55 | |||
56 | =item B<-sign> | ||
57 | |||
58 | sign the input data and output the signed result. This requires | ||
59 | and RSA private key. | ||
60 | |||
61 | =item B<-verify> | ||
62 | |||
63 | verify the input data and output the recovered data. | ||
64 | |||
65 | =item B<-encrypt> | ||
66 | |||
67 | encrypt the input data using an RSA public key. | ||
68 | |||
69 | =item B<-decrypt> | ||
70 | |||
71 | decrypt the input data using an RSA private key. | ||
72 | |||
73 | =item B<-pkcs, -oaep, -ssl, -raw> | ||
74 | |||
75 | the padding to use: PKCS#1 v1.5 (the default), PKCS#1 OAEP, | ||
76 | special padding used in SSL v2 backwards compatible handshakes, | ||
77 | or no padding, respectively. | ||
78 | For signatures, only B<-pkcs> and B<-raw> can be used. | ||
79 | |||
80 | =item B<-hexdump> | ||
81 | |||
82 | hex dump the output data. | ||
83 | |||
84 | =item B<-asn1parse> | ||
85 | |||
86 | asn1parse the output data, this is useful when combined with the | ||
87 | B<-verify> option. | ||
88 | |||
89 | =back | ||
90 | |||
91 | =head1 NOTES | ||
92 | |||
93 | B<rsautl> because it uses the RSA algorithm directly can only be | ||
94 | used to sign or verify small pieces of data. | ||
95 | |||
96 | =head1 EXAMPLES | ||
97 | |||
98 | Sign some data using a private key: | ||
99 | |||
100 | openssl rsautl -sign -in file -inkey key.pem -out sig | ||
101 | |||
102 | Recover the signed data | ||
103 | |||
104 | openssl rsautl -sign -in sig -inkey key.pem | ||
105 | |||
106 | Examine the raw signed data: | ||
107 | |||
108 | openssl rsautl -sign -in file -inkey key.pem -raw -hexdump | ||
109 | |||
110 | 0000 - 00 01 ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ | ||
111 | 0010 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ | ||
112 | 0020 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ | ||
113 | 0030 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ | ||
114 | 0040 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ | ||
115 | 0050 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ | ||
116 | 0060 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ | ||
117 | 0070 - ff ff ff ff 00 68 65 6c-6c 6f 20 77 6f 72 6c 64 .....hello world | ||
118 | |||
119 | The PKCS#1 block formatting is evident from this. If this was done using | ||
120 | encrypt and decrypt the block would have been of type 2 (the second byte) | ||
121 | and random padding data visible instead of the 0xff bytes. | ||
122 | |||
123 | It is possible to analyse the signature of certificates using this | ||
124 | utility in conjunction with B<asn1parse>. Consider the self signed | ||
125 | example in certs/pca-cert.pem . Running B<asn1parse> as follows yields: | ||
126 | |||
127 | openssl asn1parse -in pca-cert.pem | ||
128 | |||
129 | 0:d=0 hl=4 l= 742 cons: SEQUENCE | ||
130 | 4:d=1 hl=4 l= 591 cons: SEQUENCE | ||
131 | 8:d=2 hl=2 l= 3 cons: cont [ 0 ] | ||
132 | 10:d=3 hl=2 l= 1 prim: INTEGER :02 | ||
133 | 13:d=2 hl=2 l= 1 prim: INTEGER :00 | ||
134 | 16:d=2 hl=2 l= 13 cons: SEQUENCE | ||
135 | 18:d=3 hl=2 l= 9 prim: OBJECT :md5WithRSAEncryption | ||
136 | 29:d=3 hl=2 l= 0 prim: NULL | ||
137 | 31:d=2 hl=2 l= 92 cons: SEQUENCE | ||
138 | 33:d=3 hl=2 l= 11 cons: SET | ||
139 | 35:d=4 hl=2 l= 9 cons: SEQUENCE | ||
140 | 37:d=5 hl=2 l= 3 prim: OBJECT :countryName | ||
141 | 42:d=5 hl=2 l= 2 prim: PRINTABLESTRING :AU | ||
142 | .... | ||
143 | 599:d=1 hl=2 l= 13 cons: SEQUENCE | ||
144 | 601:d=2 hl=2 l= 9 prim: OBJECT :md5WithRSAEncryption | ||
145 | 612:d=2 hl=2 l= 0 prim: NULL | ||
146 | 614:d=1 hl=3 l= 129 prim: BIT STRING | ||
147 | |||
148 | |||
149 | The final BIT STRING contains the actual signature. It can be extracted with: | ||
150 | |||
151 | openssl asn1parse -in pca-cert.pem -out sig -noout -strparse 614 | ||
152 | |||
153 | The certificate public key can be extracted with: | ||
154 | |||
155 | openssl x509 -in test/testx509.pem -pubout -noout >pubkey.pem | ||
156 | |||
157 | The signature can be analysed with: | ||
158 | |||
159 | openssl rsautl -in sig -verify -asn1parse -inkey pubkey.pem -pubin | ||
160 | |||
161 | 0:d=0 hl=2 l= 32 cons: SEQUENCE | ||
162 | 2:d=1 hl=2 l= 12 cons: SEQUENCE | ||
163 | 4:d=2 hl=2 l= 8 prim: OBJECT :md5 | ||
164 | 14:d=2 hl=2 l= 0 prim: NULL | ||
165 | 16:d=1 hl=2 l= 16 prim: OCTET STRING | ||
166 | 0000 - f3 46 9e aa 1a 4a 73 c9-37 ea 93 00 48 25 08 b5 .F...Js.7...H%.. | ||
167 | |||
168 | This is the parsed version of an ASN1 DigestInfo structure. It can be seen that | ||
169 | the digest used was md5. The actual part of the certificate that was signed can | ||
170 | be extracted with: | ||
171 | |||
172 | openssl asn1parse -in pca-cert.pem -out tbs -noout -strparse 4 | ||
173 | |||
174 | and its digest computed with: | ||
175 | |||
176 | openssl md5 -c tbs | ||
177 | MD5(tbs)= f3:46:9e:aa:1a:4a:73:c9:37:ea:93:00:48:25:08:b5 | ||
178 | |||
179 | which it can be seen agrees with the recovered value above. | ||
180 | |||
181 | =head1 SEE ALSO | ||
182 | |||
183 | L<dgst(1)|dgst(1)>, L<rsa(1)|rsa(1)>, L<genrsa(1)|genrsa(1)> | ||
diff --git a/src/lib/libssl/src/doc/apps/s_client.pod b/src/lib/libssl/src/doc/apps/s_client.pod index 2f80375319..9df1c07fb7 100644 --- a/src/lib/libssl/src/doc/apps/s_client.pod +++ b/src/lib/libssl/src/doc/apps/s_client.pod | |||
@@ -32,6 +32,7 @@ B<openssl> B<s_client> | |||
32 | [B<-no_tls1>] | 32 | [B<-no_tls1>] |
33 | [B<-bugs>] | 33 | [B<-bugs>] |
34 | [B<-cipher cipherlist>] | 34 | [B<-cipher cipherlist>] |
35 | [B<-engine id>] | ||
35 | 36 | ||
36 | =head1 DESCRIPTION | 37 | =head1 DESCRIPTION |
37 | 38 | ||
@@ -156,6 +157,13 @@ the server determines which cipher suite is used it should take the first | |||
156 | supported cipher in the list sent by the client. See the B<ciphers> | 157 | supported cipher in the list sent by the client. See the B<ciphers> |
157 | command for more information. | 158 | command for more information. |
158 | 159 | ||
160 | =item B<-engine id> | ||
161 | |||
162 | specifying an engine (by it's unique B<id> string) will cause B<s_client> | ||
163 | to attempt to obtain a functional reference to the specified engine, | ||
164 | thus initialising it if needed. The engine will then be set as the default | ||
165 | for all available algorithms. | ||
166 | |||
159 | =back | 167 | =back |
160 | 168 | ||
161 | =head1 CONNECTED COMMANDS | 169 | =head1 CONNECTED COMMANDS |
diff --git a/src/lib/libssl/src/doc/apps/s_server.pod b/src/lib/libssl/src/doc/apps/s_server.pod index 0f29c361d9..3a5bf46e28 100644 --- a/src/lib/libssl/src/doc/apps/s_server.pod +++ b/src/lib/libssl/src/doc/apps/s_server.pod | |||
@@ -39,6 +39,7 @@ B<openssl> B<s_client> | |||
39 | [B<-hack>] | 39 | [B<-hack>] |
40 | [B<-www>] | 40 | [B<-www>] |
41 | [B<-WWW>] | 41 | [B<-WWW>] |
42 | [B<-engine id>] | ||
42 | 43 | ||
43 | =head1 DESCRIPTION | 44 | =head1 DESCRIPTION |
44 | 45 | ||
@@ -186,6 +187,13 @@ emulates a simple web server. Pages will be resolved relative to the | |||
186 | current directory, for example if the URL https://myhost/page.html is | 187 | current directory, for example if the URL https://myhost/page.html is |
187 | requested the file ./page.html will be loaded. | 188 | requested the file ./page.html will be loaded. |
188 | 189 | ||
190 | =item B<-engine id> | ||
191 | |||
192 | specifying an engine (by it's unique B<id> string) will cause B<s_server> | ||
193 | to attempt to obtain a functional reference to the specified engine, | ||
194 | thus initialising it if needed. The engine will then be set as the default | ||
195 | for all available algorithms. | ||
196 | |||
189 | =back | 197 | =back |
190 | 198 | ||
191 | =head1 CONNECTED COMMANDS | 199 | =head1 CONNECTED COMMANDS |
diff --git a/src/lib/libssl/src/doc/apps/smime.pod b/src/lib/libssl/src/doc/apps/smime.pod index 631ecdc241..ce99b5c345 100644 --- a/src/lib/libssl/src/doc/apps/smime.pod +++ b/src/lib/libssl/src/doc/apps/smime.pod | |||
@@ -22,8 +22,12 @@ B<openssl> B<smime> | |||
22 | [B<-signer file>] | 22 | [B<-signer file>] |
23 | [B<-recip file>] | 23 | [B<-recip file>] |
24 | [B<-in file>] | 24 | [B<-in file>] |
25 | [B<-inform SMIME|PEM|DER>] | ||
26 | [B<-passin arg>] | ||
25 | [B<-inkey file>] | 27 | [B<-inkey file>] |
26 | [B<-out file>] | 28 | [B<-out file>] |
29 | [B<-outform SMIME|PEM|DER>] | ||
30 | [B<-content file>] | ||
27 | [B<-to addr>] | 31 | [B<-to addr>] |
28 | [B<-from ad>] | 32 | [B<-from ad>] |
29 | [B<-subject s>] | 33 | [B<-subject s>] |
@@ -74,11 +78,37 @@ takes an input message and writes out a PEM encoded PKCS#7 structure. | |||
74 | the input message to be encrypted or signed or the MIME message to | 78 | the input message to be encrypted or signed or the MIME message to |
75 | be decrypted or verified. | 79 | be decrypted or verified. |
76 | 80 | ||
81 | =item B<-inform SMIME|PEM|DER> | ||
82 | |||
83 | this specifies the input format for the PKCS#7 structure. The default | ||
84 | is B<SMIME> which reads an S/MIME format message. B<PEM> and B<DER> | ||
85 | format change this to expect PEM and DER format PKCS#7 structures | ||
86 | instead. This currently only affects the input format of the PKCS#7 | ||
87 | structure, if no PKCS#7 structure is being input (for example with | ||
88 | B<-encrypt> or B<-sign>) this option has no effect. | ||
89 | |||
77 | =item B<-out filename> | 90 | =item B<-out filename> |
78 | 91 | ||
79 | the message text that has been decrypted or verified or the output MIME | 92 | the message text that has been decrypted or verified or the output MIME |
80 | format message that has been signed or verified. | 93 | format message that has been signed or verified. |
81 | 94 | ||
95 | =item B<-outform SMIME|PEM|DER> | ||
96 | |||
97 | this specifies the output format for the PKCS#7 structure. The default | ||
98 | is B<SMIME> which write an S/MIME format message. B<PEM> and B<DER> | ||
99 | format change this to write PEM and DER format PKCS#7 structures | ||
100 | instead. This currently only affects the output format of the PKCS#7 | ||
101 | structure, if no PKCS#7 structure is being output (for example with | ||
102 | B<-verify> or B<-decrypt>) this option has no effect. | ||
103 | |||
104 | =item B<-content filename> | ||
105 | |||
106 | This specifies a file containing the detached content, this is only | ||
107 | useful with the B<-verify> command. This is only usable if the PKCS#7 | ||
108 | structure is using the detached signature form where the content is | ||
109 | not included. This option will override any content if the input format | ||
110 | is S/MIME and it uses the multipart/signed MIME content type. | ||
111 | |||
82 | =item B<-text> | 112 | =item B<-text> |
83 | 113 | ||
84 | this option adds plain text (text/plain) MIME headers to the supplied | 114 | this option adds plain text (text/plain) MIME headers to the supplied |
@@ -174,12 +204,17 @@ corresponding certificate. If this option is not specified then the | |||
174 | private key must be included in the certificate file specified with | 204 | private key must be included in the certificate file specified with |
175 | the B<-recip> or B<-signer> file. | 205 | the B<-recip> or B<-signer> file. |
176 | 206 | ||
207 | =item B<-passin arg> | ||
208 | |||
209 | the private key password source. For more information about the format of B<arg> | ||
210 | see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. | ||
211 | |||
177 | =item B<-rand file(s)> | 212 | =item B<-rand file(s)> |
178 | 213 | ||
179 | a file or files containing random data used to seed the random number | 214 | a file or files containing random data used to seed the random number |
180 | generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). | 215 | generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). |
181 | Multiple files can be specified separated by a OS-dependent character. | 216 | Multiple files can be specified separated by a OS-dependent character. |
182 | The separator is B<;> for MS-Windows, B<,> for OpenVSM, and B<:> for | 217 | The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for |
183 | all others. | 218 | all others. |
184 | 219 | ||
185 | =item B<cert.pem...> | 220 | =item B<cert.pem...> |
@@ -204,7 +239,7 @@ a blank line. Piping the mail directly to sendmail is one way to | |||
204 | achieve the correct format. | 239 | achieve the correct format. |
205 | 240 | ||
206 | The supplied message to be signed or encrypted must include the | 241 | The supplied message to be signed or encrypted must include the |
207 | necessary MIME headers: or many S/MIME clients wont display it | 242 | necessary MIME headers or many S/MIME clients wont display it |
208 | properly (if at all). You can use the B<-text> option to automatically | 243 | properly (if at all). You can use the B<-text> option to automatically |
209 | add plain text headers. | 244 | add plain text headers. |
210 | 245 | ||
@@ -290,7 +325,7 @@ Send encrypted mail using triple DES: | |||
290 | Sign and encrypt mail: | 325 | Sign and encrypt mail: |
291 | 326 | ||
292 | openssl smime -sign -in ml.txt -signer my.pem -text \ | 327 | openssl smime -sign -in ml.txt -signer my.pem -text \ |
293 | | openssl -encrypt -out mail.msg \ | 328 | | openssl smime -encrypt -out mail.msg \ |
294 | -from steve@openssl.org -to someone@somewhere \ | 329 | -from steve@openssl.org -to someone@somewhere \ |
295 | -subject "Signed and Encrypted message" -des3 user.pem | 330 | -subject "Signed and Encrypted message" -des3 user.pem |
296 | 331 | ||
@@ -301,6 +336,22 @@ Decrypt mail: | |||
301 | 336 | ||
302 | openssl smime -decrypt -in mail.msg -recip mycert.pem -inkey key.pem | 337 | openssl smime -decrypt -in mail.msg -recip mycert.pem -inkey key.pem |
303 | 338 | ||
339 | The output from Netscape form signing is a PKCS#7 structure with the | ||
340 | detached signature format. You can use this program to verify the | ||
341 | signature by line wrapping the base64 encoded structure and surrounding | ||
342 | it with: | ||
343 | |||
344 | -----BEGIN PKCS7---- | ||
345 | -----END PKCS7---- | ||
346 | |||
347 | and using the command, | ||
348 | |||
349 | openssl smime -verify -inform PEM -in signature.pem -content content.txt | ||
350 | |||
351 | alternatively you can base64 decode the signature and use | ||
352 | |||
353 | openssl smime -verify -inform DER -in signature.der -content content.txt | ||
354 | |||
304 | =head1 BUGS | 355 | =head1 BUGS |
305 | 356 | ||
306 | The MIME parser isn't very clever: it seems to handle most messages that I've thrown | 357 | The MIME parser isn't very clever: it seems to handle most messages that I've thrown |
diff --git a/src/lib/libssl/src/doc/apps/speed.pod b/src/lib/libssl/src/doc/apps/speed.pod index fecd9a994d..8101851ec6 100644 --- a/src/lib/libssl/src/doc/apps/speed.pod +++ b/src/lib/libssl/src/doc/apps/speed.pod | |||
@@ -7,6 +7,7 @@ speed - test library performance | |||
7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
8 | 8 | ||
9 | B<openssl speed> | 9 | B<openssl speed> |
10 | [B<-engine id>] | ||
10 | [B<md2>] | 11 | [B<md2>] |
11 | [B<mdc2>] | 12 | [B<mdc2>] |
12 | [B<md5>] | 13 | [B<md5>] |
@@ -39,7 +40,18 @@ This command is used to test the performance of cryptographic algorithms. | |||
39 | 40 | ||
40 | =head1 OPTIONS | 41 | =head1 OPTIONS |
41 | 42 | ||
42 | If an option is given, B<speed> test that algorithm, otherwise all of | 43 | =over 4 |
44 | |||
45 | =item B<-engine id> | ||
46 | |||
47 | specifying an engine (by it's unique B<id> string) will cause B<speed> | ||
48 | to attempt to obtain a functional reference to the specified engine, | ||
49 | thus initialising it if needed. The engine will then be set as the default | ||
50 | for all available algorithms. | ||
51 | |||
52 | =item B<[zero or more test algorithms]> | ||
53 | |||
54 | If any options are given, B<speed> tests those algorithms, otherwise all of | ||
43 | the above are tested. | 55 | the above are tested. |
44 | 56 | ||
45 | =cut | 57 | =cut |
diff --git a/src/lib/libssl/src/doc/apps/verify.pod b/src/lib/libssl/src/doc/apps/verify.pod index 4a6572d3b8..90455525d1 100644 --- a/src/lib/libssl/src/doc/apps/verify.pod +++ b/src/lib/libssl/src/doc/apps/verify.pod | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | pkcs7 - PKCS#7 utility | 5 | verify - Utility to verify certificates. |
6 | 6 | ||
7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
8 | 8 | ||
@@ -12,6 +12,7 @@ B<openssl> B<verify> | |||
12 | [B<-purpose purpose>] | 12 | [B<-purpose purpose>] |
13 | [B<-untrusted file>] | 13 | [B<-untrusted file>] |
14 | [B<-help>] | 14 | [B<-help>] |
15 | [B<-issuer_checks>] | ||
15 | [B<-verbose>] | 16 | [B<-verbose>] |
16 | [B<->] | 17 | [B<->] |
17 | [certificates] | 18 | [certificates] |
@@ -57,6 +58,14 @@ prints out a usage message. | |||
57 | 58 | ||
58 | print extra information about the operations being performed. | 59 | print extra information about the operations being performed. |
59 | 60 | ||
61 | =item B<-issuer_checks> | ||
62 | |||
63 | print out diagnostics relating to searches for the issuer certificate | ||
64 | of the current certificate. This shows why each candidate issuer | ||
65 | certificate was rejected. However the presence of rejection messages | ||
66 | does not itself imply that anything is wrong: during the normal | ||
67 | verify process several rejections may take place. | ||
68 | |||
60 | =item B<-> | 69 | =item B<-> |
61 | 70 | ||
62 | marks the last option. All arguments following this are assumed to be | 71 | marks the last option. All arguments following this are assumed to be |
@@ -88,9 +97,21 @@ The verify operation consists of a number of separate steps. | |||
88 | 97 | ||
89 | Firstly a certificate chain is built up starting from the supplied certificate | 98 | Firstly a certificate chain is built up starting from the supplied certificate |
90 | and ending in the root CA. It is an error if the whole chain cannot be built | 99 | and ending in the root CA. It is an error if the whole chain cannot be built |
91 | up. The chain is built up by looking up a certificate whose subject name | 100 | up. The chain is built up by looking up the issuers certificate of the current |
92 | matches the issuer name of the current certificate. If a certificate is found | 101 | certificate. If a certificate is found which is its own issuer it is assumed |
93 | whose subject and issuer names are identical it is assumed to be the root CA. | 102 | to be the root CA. |
103 | |||
104 | The process of 'looking up the issuers certificate' itself involves a number | ||
105 | of steps. In versions of OpenSSL before 0.9.5a the first certificate whose | ||
106 | subject name matched the issuer of the current certificate was assumed to be | ||
107 | the issuers certificate. In OpenSSL 0.9.6 and later all certificates | ||
108 | whose subject name matches the issuer name of the current certificate are | ||
109 | subject to further tests. The relevant authority key identifier components | ||
110 | of the current certificate (if present) must match the subject key identifier | ||
111 | (if present) and issuer and serial number of the candidate issuer, in addition | ||
112 | the keyUsage extension of the candidate issuer (if present) must permit | ||
113 | certificate signing. | ||
114 | |||
94 | The lookup first looks in the list of untrusted certificates and if no match | 115 | The lookup first looks in the list of untrusted certificates and if no match |
95 | is found the remaining lookups are from the trusted certificates. The root CA | 116 | is found the remaining lookups are from the trusted certificates. The root CA |
96 | is always looked up in the trusted certificate list: if the certificate to | 117 | is always looked up in the trusted certificate list: if the certificate to |
@@ -260,12 +281,46 @@ the root CA is not marked as trusted for the specified purpose. | |||
260 | 281 | ||
261 | the root CA is marked to reject the specified purpose. | 282 | the root CA is marked to reject the specified purpose. |
262 | 283 | ||
284 | =item B<29 X509_V_ERR_SUBJECT_ISSUER_MISMATCH: subject issuer mismatch> | ||
285 | |||
286 | the current candidate issuer certificate was rejected because its subject name | ||
287 | did not match the issuer name of the current certificate. Only displayed when | ||
288 | the B<-issuer_checks> option is set. | ||
289 | |||
290 | =item B<30 X509_V_ERR_AKID_SKID_MISMATCH: authority and subject key identifier mismatch> | ||
291 | |||
292 | the current candidate issuer certificate was rejected because its subject key | ||
293 | identifier was present and did not match the authority key identifier current | ||
294 | certificate. Only displayed when the B<-issuer_checks> option is set. | ||
295 | |||
296 | =item B<31 X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH: authority and issuer serial number mismatch> | ||
297 | |||
298 | the current candidate issuer certificate was rejected because its issuer name | ||
299 | and serial number was present and did not match the authority key identifier | ||
300 | of the current certificate. Only displayed when the B<-issuer_checks> option is set. | ||
301 | |||
302 | =item B<32 X509_V_ERR_KEYUSAGE_NO_CERTSIGN:key usage does not include certificate signing> | ||
303 | |||
304 | the current candidate issuer certificate was rejected because its keyUsage extension | ||
305 | does not permit certificate signing. | ||
306 | |||
263 | =item B<50 X509_V_ERR_APPLICATION_VERIFICATION: application verification failure> | 307 | =item B<50 X509_V_ERR_APPLICATION_VERIFICATION: application verification failure> |
264 | 308 | ||
265 | an application specific error. Unused. | 309 | an application specific error. Unused. |
266 | 310 | ||
267 | =back | 311 | =back |
268 | 312 | ||
313 | =head1 BUGS | ||
314 | |||
315 | Although the issuer checks are a considerably improvement over the old technique they still | ||
316 | suffer from limitations in the underlying X509_LOOKUP API. One consequence of this is that | ||
317 | trusted certificates with matching subject name must either appear in a file (as specified by the | ||
318 | B<-CAfile> option) or a directory (as specified by B<-CApath>. If they occur in both then only | ||
319 | the certificates in the file will be recognised. | ||
320 | |||
321 | Previous versions of OpenSSL assume certificates with matching subject name are identical and | ||
322 | mishandled them. | ||
323 | |||
269 | =head1 SEE ALSO | 324 | =head1 SEE ALSO |
270 | 325 | ||
271 | L<x509(1)|x509(1)> | 326 | L<x509(1)|x509(1)> |
diff --git a/src/lib/libssl/src/doc/apps/x509.pod b/src/lib/libssl/src/doc/apps/x509.pod index e4ae5468da..84f76cb421 100644 --- a/src/lib/libssl/src/doc/apps/x509.pod +++ b/src/lib/libssl/src/doc/apps/x509.pod | |||
@@ -19,6 +19,8 @@ B<openssl> B<x509> | |||
19 | [B<-hash>] | 19 | [B<-hash>] |
20 | [B<-subject>] | 20 | [B<-subject>] |
21 | [B<-issuer>] | 21 | [B<-issuer>] |
22 | [B<-nameopt option>] | ||
23 | [B<-email>] | ||
22 | [B<-startdate>] | 24 | [B<-startdate>] |
23 | [B<-enddate>] | 25 | [B<-enddate>] |
24 | [B<-purpose>] | 26 | [B<-purpose>] |
@@ -137,6 +139,16 @@ outputs the subject name. | |||
137 | 139 | ||
138 | outputs the issuer name. | 140 | outputs the issuer name. |
139 | 141 | ||
142 | =item B<-nameopt option> | ||
143 | |||
144 | option which determine how the subject or issuer names are displayed. This | ||
145 | option may be used more than once to set multiple options. See the B<NAME | ||
146 | OPTIONS> section for more information. | ||
147 | |||
148 | =item B<-email> | ||
149 | |||
150 | outputs the email address(es) if any. | ||
151 | |||
140 | =item B<-startdate> | 152 | =item B<-startdate> |
141 | 153 | ||
142 | prints out the start date of the certificate, that is the notBefore date. | 154 | prints out the start date of the certificate, that is the notBefore date. |
@@ -330,6 +342,138 @@ specified then the extensions should either be contained in the unnamed | |||
330 | 342 | ||
331 | =back | 343 | =back |
332 | 344 | ||
345 | =head1 NAME OPTIONS | ||
346 | |||
347 | The B<nameopt> command line switch determines how the subject and issuer | ||
348 | names are displayed. If no B<nameopt> switch is present the default "oneline" | ||
349 | format is used which is compatible with previous versions of OpenSSL. | ||
350 | Each option is described in detail below, all options can be preceded by | ||
351 | a B<-> to turn the option off. Only the first four will normally be used. | ||
352 | |||
353 | =over 4 | ||
354 | |||
355 | =item B<compat> | ||
356 | |||
357 | use the old format. This is equivalent to specifying no name options at all. | ||
358 | |||
359 | =item B<RFC2253> | ||
360 | |||
361 | displays names compatible with RFC2253 equivalent to B<esc_2253>, B<esc_ctrl>, | ||
362 | B<esc_msb>, B<utf8>, B<dump_nostr>, B<dump_unknown>, B<dump_der>, | ||
363 | B<sep_comma_plus>, B<dn_rev> and B<sname>. | ||
364 | |||
365 | =item B<oneline> | ||
366 | |||
367 | a oneline format which is more readable than RFC2253. It is equivalent to | ||
368 | specifying the B<esc_2253>, B<esc_ctrl>, B<esc_msb>, B<utf8>, B<dump_nostr>, | ||
369 | B<dump_der>, B<use_quote>, B<sep_comma_plus_spc>, B<spc_eq> and B<sname> | ||
370 | options. | ||
371 | |||
372 | =item B<multiline> | ||
373 | |||
374 | a multiline format. It is equivalent B<esc_ctrl>, B<esc_msb>, B<sep_multiline>, | ||
375 | B<spc_eq> and B<lname>. | ||
376 | |||
377 | =item B<esc_2253> | ||
378 | |||
379 | 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 | ||
381 | and a space character at the beginning or end of a string. | ||
382 | |||
383 | =item B<esc_ctrl> | ||
384 | |||
385 | escape control characters. That is those with ASCII values less than | ||
386 | 0x20 (space) and the delete (0x7f) character. They are escaped using the | ||
387 | RFC2253 \XX notation (where XX are two hex digits representing the | ||
388 | character value). | ||
389 | |||
390 | =item B<esc_msb> | ||
391 | |||
392 | escape characters with the MSB set, that is with ASCII values larger than | ||
393 | 127. | ||
394 | |||
395 | =item B<use_quote> | ||
396 | |||
397 | escapes some characters by surrounding the whole string with B<"> characters, | ||
398 | without the option all escaping is done with the B<\> character. | ||
399 | |||
400 | =item B<utf8> | ||
401 | |||
402 | convert all strings to UTF8 format first. This is required by RFC2253. If | ||
403 | you are lucky enough to have a UTF8 compatible terminal then the use | ||
404 | of this option (and B<not> setting B<esc_msb>) may result in the correct | ||
405 | display of multibyte (international) characters. Is this option is not | ||
406 | present then multibyte characters larger than 0xff will be represented | ||
407 | using the format \UXXXX for 16 bits and \WXXXXXXXX for 32 bits. | ||
408 | Also if this option is off any UTF8Strings will be converted to their | ||
409 | character form first. | ||
410 | |||
411 | =item B<no_type> | ||
412 | |||
413 | this option does not attempt to interpret multibyte characters in any | ||
414 | way. That is their content octets are merely dumped as though one octet | ||
415 | represents each character. This is useful for diagnostic purposes but | ||
416 | will result in rather odd looking output. | ||
417 | |||
418 | =item B<show_type> | ||
419 | |||
420 | show the type of the ASN1 character string. The type precedes the | ||
421 | field contents. For example "BMPSTRING: Hello World". | ||
422 | |||
423 | =item B<dump_der> | ||
424 | |||
425 | when this option is set any fields that need to be hexdumped will | ||
426 | be dumped using the DER encoding of the field. Otherwise just the | ||
427 | content octets will be displayed. Both options use the RFC2253 | ||
428 | B<#XXXX...> format. | ||
429 | |||
430 | =item B<dump_nostr> | ||
431 | |||
432 | dump non character string types (for example OCTET STRING) if this | ||
433 | option is not set then non character string types will be displayed | ||
434 | as though each content octet repesents a single character. | ||
435 | |||
436 | =item B<dump_all> | ||
437 | |||
438 | dump all fields. This option when used with B<dump_der> allows the | ||
439 | DER encoding of the structure to be unambiguously determined. | ||
440 | |||
441 | =item B<dump_unknown> | ||
442 | |||
443 | dump any field whose OID is not recognised by OpenSSL. | ||
444 | |||
445 | =item B<sep_comma_plus>, B<sep_comma_plus_space>, B<sep_semi_plus_space>, | ||
446 | B<sep_multiline> | ||
447 | |||
448 | these options determine the field separators. The first character is | ||
449 | between RDNs and the second between multiple AVAs (multiple AVAs are | ||
450 | very rare and their use is discouraged). The options ending in | ||
451 | "space" additionally place a space after the separator to make it | ||
452 | more readable. The B<sep_multiline> uses a linefeed character for | ||
453 | the RDN separator and a spaced B<+> for the AVA separator. It also | ||
454 | indents the fields by four characters. | ||
455 | |||
456 | =item B<dn_rev> | ||
457 | |||
458 | reverse the fields of the DN. This is required by RFC2253. As a side | ||
459 | effect this also reverses the order of multiple AVAs but this is | ||
460 | permissible. | ||
461 | |||
462 | =item B<nofname>, B<sname>, B<lname>, B<oid> | ||
463 | |||
464 | these options alter how the field name is displayed. B<nofname> does | ||
465 | not display the field at all. B<sname> uses the "short name" form | ||
466 | (CN for commonName for example). B<lname> uses the long form. | ||
467 | B<oid> represents the OID in numerical form and is useful for | ||
468 | diagnostic purpose. | ||
469 | |||
470 | =item B<spc_eq> | ||
471 | |||
472 | places spaces round the B<=> character which follows the field | ||
473 | name. | ||
474 | |||
475 | =back | ||
476 | |||
333 | =head1 EXAMPLES | 477 | =head1 EXAMPLES |
334 | 478 | ||
335 | Note: in these examples the '\' means the example should be all on one | 479 | Note: in these examples the '\' means the example should be all on one |
@@ -343,6 +487,19 @@ Display the certificate serial number: | |||
343 | 487 | ||
344 | openssl x509 -in cert.pem -noout -serial | 488 | openssl x509 -in cert.pem -noout -serial |
345 | 489 | ||
490 | Display the certificate subject name: | ||
491 | |||
492 | openssl x509 -in cert.pem -noout -subject | ||
493 | |||
494 | Display the certificate subject name in RFC2253 form: | ||
495 | |||
496 | openssl x509 -in cert.pem -noout -subject -nameopt RFC2253 | ||
497 | |||
498 | Display the certificate subject name in oneline form on a terminal | ||
499 | supporting UTF8: | ||
500 | |||
501 | openssl x509 -in cert.pem -noout -subject -nameopt oneline -nameopt -escmsb | ||
502 | |||
346 | Display the certificate MD5 fingerprint: | 503 | Display the certificate MD5 fingerprint: |
347 | 504 | ||
348 | openssl x509 -in cert.pem -noout -fingerprint | 505 | openssl x509 -in cert.pem -noout -fingerprint |
@@ -362,13 +519,13 @@ Convert a certificate to a certificate request: | |||
362 | Convert a certificate request into a self signed certificate using | 519 | Convert a certificate request into a self signed certificate using |
363 | extensions for a CA: | 520 | extensions for a CA: |
364 | 521 | ||
365 | openssl x509 -req -in careq.pem -config openssl.cnf -extensions v3_ca \ | 522 | openssl x509 -req -in careq.pem -extfile openssl.cnf -extensions v3_ca \ |
366 | -signkey key.pem -out cacert.pem | 523 | -signkey key.pem -out cacert.pem |
367 | 524 | ||
368 | Sign a certificate request using the CA certificate above and add user | 525 | Sign a certificate request using the CA certificate above and add user |
369 | certificate extensions: | 526 | certificate extensions: |
370 | 527 | ||
371 | openssl x509 -req -in req.pem -config openssl.cnf -extensions v3_usr \ | 528 | openssl x509 -req -in req.pem -extfile openssl.cnf -extensions v3_usr \ |
372 | -CA cacert.pem -CAkey key.pem -CAcreateserial | 529 | -CA cacert.pem -CAkey key.pem -CAcreateserial |
373 | 530 | ||
374 | 531 | ||
@@ -395,6 +552,11 @@ Trusted certificates have the lines | |||
395 | -----BEGIN TRUSTED CERTIFICATE---- | 552 | -----BEGIN TRUSTED CERTIFICATE---- |
396 | -----END TRUSTED CERTIFICATE---- | 553 | -----END TRUSTED CERTIFICATE---- |
397 | 554 | ||
555 | The conversion to UTF8 format used with the name options assumes that | ||
556 | T61Strings use the ISO8859-1 character set. This is wrong but Netscape | ||
557 | and MSIE do this as do many certificates. So although this is incorrect | ||
558 | it is more likely to display the majority of certificates correctly. | ||
559 | |||
398 | The B<-fingerprint> option takes the digest of the DER encoded certificate. | 560 | The B<-fingerprint> option takes the digest of the DER encoded certificate. |
399 | This is commonly called a "fingerprint". Because of the nature of message | 561 | This is commonly called a "fingerprint". Because of the nature of message |
400 | digests the fingerprint of a certificate is unique to that certificate and | 562 | digests the fingerprint of a certificate is unique to that certificate and |
@@ -402,6 +564,10 @@ two certificates with the same fingerprint can be considered to be the same. | |||
402 | 564 | ||
403 | The Netscape fingerprint uses MD5 whereas MSIE uses SHA1. | 565 | The Netscape fingerprint uses MD5 whereas MSIE uses SHA1. |
404 | 566 | ||
567 | The B<-email> option searches the subject name and the subject alternative | ||
568 | name extension. Only unique email addresses will be printed out: it will | ||
569 | not print the same address more than once. | ||
570 | |||
405 | =head1 CERTIFICATE EXTENSIONS | 571 | =head1 CERTIFICATE EXTENSIONS |
406 | 572 | ||
407 | The B<-purpose> option checks the certificate extensions and determines | 573 | The B<-purpose> option checks the certificate extensions and determines |
@@ -517,10 +683,6 @@ must be present. | |||
517 | 683 | ||
518 | =head1 BUGS | 684 | =head1 BUGS |
519 | 685 | ||
520 | The way DNs are printed is in a "historical SSLeay" format which doesn't | ||
521 | follow any published standard. It should follow some standard like RFC2253 | ||
522 | or RFC1779 with options to make the stuff more readable. | ||
523 | |||
524 | Extensions in certificates are not transferred to certificate requests and | 686 | Extensions in certificates are not transferred to certificate requests and |
525 | vice versa. | 687 | vice versa. |
526 | 688 | ||
@@ -532,7 +694,7 @@ There should be options to explicitly set such things as start and end | |||
532 | dates rather than an offset from the current time. | 694 | dates rather than an offset from the current time. |
533 | 695 | ||
534 | The code to implement the verify behaviour described in the B<TRUST SETTINGS> | 696 | The code to implement the verify behaviour described in the B<TRUST SETTINGS> |
535 | is currently being developed. It thus describes the intended behavior rather | 697 | is currently being developed. It thus describes the intended behaviour rather |
536 | than the current behaviour. It is hoped that it will represent reality in | 698 | than the current behaviour. It is hoped that it will represent reality in |
537 | OpenSSL 0.9.5 and later. | 699 | OpenSSL 0.9.5 and later. |
538 | 700 | ||
diff --git a/src/lib/libssl/src/doc/c-indentation.el b/src/lib/libssl/src/doc/c-indentation.el index 9111450915..48ca3cf69b 100644 --- a/src/lib/libssl/src/doc/c-indentation.el +++ b/src/lib/libssl/src/doc/c-indentation.el | |||
@@ -39,7 +39,8 @@ | |||
39 | (label . -) | 39 | (label . -) |
40 | (arglist-cont-nonempty . +) | 40 | (arglist-cont-nonempty . +) |
41 | (topmost-intro . -) | 41 | (topmost-intro . -) |
42 | (brace-list-close . +) | 42 | (brace-list-close . 0) |
43 | (brace-list-intro . +) | 43 | (brace-list-intro . 0) |
44 | (brace-list-open . +) | ||
44 | )))) | 45 | )))) |
45 | 46 | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_ctrl.pod b/src/lib/libssl/src/doc/crypto/BIO_ctrl.pod new file mode 100644 index 0000000000..722e8b8f46 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_ctrl.pod | |||
@@ -0,0 +1,128 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_ctrl, BIO_callback_ctrl, BIO_ptr_ctrl, BIO_int_ctrl, BIO_reset, | ||
6 | BIO_seek, BIO_tell, BIO_flush, BIO_eof, BIO_set_close, BIO_get_close, | ||
7 | BIO_pending, BIO_wpending, BIO_ctrl_pending, BIO_ctrl_wpending, | ||
8 | BIO_get_info_callback, BIO_set_info_callback - BIO control operations | ||
9 | |||
10 | =head1 SYNOPSIS | ||
11 | |||
12 | #include <openssl/bio.h> | ||
13 | |||
14 | long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg); | ||
15 | long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long)); | ||
16 | char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg); | ||
17 | long BIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg); | ||
18 | |||
19 | int BIO_reset(BIO *b); | ||
20 | int BIO_seek(BIO *b, int ofs); | ||
21 | int BIO_tell(BIO *b); | ||
22 | int BIO_flush(BIO *b); | ||
23 | int BIO_eof(BIO *b); | ||
24 | int BIO_set_close(BIO *b,long flag); | ||
25 | int BIO_get_close(BIO *b); | ||
26 | int BIO_pending(BIO *b); | ||
27 | int BIO_wpending(BIO *b); | ||
28 | size_t BIO_ctrl_pending(BIO *b); | ||
29 | size_t BIO_ctrl_wpending(BIO *b); | ||
30 | |||
31 | int BIO_get_info_callback(BIO *b,bio_info_cb **cbp); | ||
32 | int BIO_set_info_callback(BIO *b,bio_info_cb *cb); | ||
33 | |||
34 | typedef void bio_info_cb(BIO *b, int oper, const char *ptr, int arg1, long arg2, long arg3); | ||
35 | |||
36 | =head1 DESCRIPTION | ||
37 | |||
38 | BIO_ctrl(), BIO_callback_ctrl(), BIO_ptr_ctrl() and BIO_int_ctrl() | ||
39 | are BIO "control" operations taking arguments of various types. | ||
40 | These functions are not normally called directly, various macros | ||
41 | are used instead. The standard macros are described below, macros | ||
42 | specific to a particular type of BIO are described in the specific | ||
43 | BIOs manual page as well as any special features of the standard | ||
44 | calls. | ||
45 | |||
46 | BIO_reset() typically resets a BIO to some initial state, in the case | ||
47 | of file related BIOs for example it rewinds the file pointer to the | ||
48 | start of the file. | ||
49 | |||
50 | BIO_seek() resets a file related BIO's (that is file descriptor and | ||
51 | FILE BIOs) file position pointer to B<ofs> bytes from start of file. | ||
52 | |||
53 | BIO_tell() returns the current file position of a file related BIO. | ||
54 | |||
55 | BIO_flush() normally writes out any internally buffered data, in some | ||
56 | cases it is used to signal EOF and that no more data will be written. | ||
57 | |||
58 | BIO_eof() returns 1 if the BIO has read EOF, the precise meaning of | ||
59 | "EOF" varies according to the BIO type. | ||
60 | |||
61 | BIO_set_close() sets the BIO B<b> close flag to B<flag>. B<flag> can | ||
62 | take the value BIO_CLOSE or BIO_NOCLOSE. Typically BIO_CLOSE is used | ||
63 | in a source/sink BIO to indicate that the underlying I/O stream should | ||
64 | be closed when the BIO is freed. | ||
65 | |||
66 | BIO_get_close() returns the BIOs close flag. | ||
67 | |||
68 | BIO_pending(), BIO_ctrl_pending(), BIO_wpending() and BIO_ctrl_wpending() | ||
69 | return the number of pending characters in the BIOs read and write buffers. | ||
70 | Not all BIOs support these calls. BIO_ctrl_pending() and BIO_ctrl_wpending() | ||
71 | return a size_t type and are functions, BIO_pending() and BIO_wpending() are | ||
72 | macros which call BIO_ctrl(). | ||
73 | |||
74 | =head1 RETURN VALUES | ||
75 | |||
76 | BIO_reset() normally returns 1 for success and 0 or -1 for failure. File | ||
77 | BIOs are an exception, they return 0 for success and -1 for failure. | ||
78 | |||
79 | BIO_seek() and BIO_tell() both return the current file position on success | ||
80 | and -1 for failure, except file BIOs which for BIO_seek() always return 0 | ||
81 | for success and -1 for failure. | ||
82 | |||
83 | BIO_flush() returns 1 for success and 0 or -1 for failure. | ||
84 | |||
85 | BIO_eof() returns 1 if EOF has been reached 0 otherwise. | ||
86 | |||
87 | BIO_set_close() always returns 1. | ||
88 | |||
89 | BIO_get_close() returns the close flag value: BIO_CLOSE or BIO_NOCLOSE. | ||
90 | |||
91 | BIO_pending(), BIO_ctrl_pending(), BIO_wpending() and BIO_ctrl_wpending() | ||
92 | return the amount of pending data. | ||
93 | |||
94 | =head1 NOTES | ||
95 | |||
96 | BIO_flush(), because it can write data may return 0 or -1 indicating | ||
97 | that the call should be retried later in a similar manner to BIO_write(). | ||
98 | The BIO_should_retry() call should be used and appropriate action taken | ||
99 | is the call fails. | ||
100 | |||
101 | The return values of BIO_pending() and BIO_wpending() may not reliably | ||
102 | determine the amount of pending data in all cases. For example in the | ||
103 | case of a file BIO some data may be available in the FILE structures | ||
104 | internal buffers but it is not possible to determine this in a | ||
105 | portably way. For other types of BIO they may not be supported. | ||
106 | |||
107 | Filter BIOs if they do not internally handle a particular BIO_ctrl() | ||
108 | operation usually pass the operation to the next BIO in the chain. | ||
109 | This often means there is no need to locate the required BIO for | ||
110 | a particular operation, it can be called on a chain and it will | ||
111 | be automatically passed to the relevant BIO. However this can cause | ||
112 | unexpected results: for example no current filter BIOs implement | ||
113 | BIO_seek(), but this may still succeed if the chain ends in a FILE | ||
114 | or file descriptor BIO. | ||
115 | |||
116 | Source/sink BIOs return an 0 if they do not recognize the BIO_ctrl() | ||
117 | operation. | ||
118 | |||
119 | =head1 BUGS | ||
120 | |||
121 | Some of the return values are ambiguous and care should be taken. In | ||
122 | particular a return value of 0 can be returned if an operation is not | ||
123 | supported, if an error occurred, if EOF has not been reached and in | ||
124 | the case of BIO_seek() on a file BIO for a successful operation. | ||
125 | |||
126 | =head1 SEE ALSO | ||
127 | |||
128 | TBA | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_f_base64.pod b/src/lib/libssl/src/doc/crypto/BIO_f_base64.pod new file mode 100644 index 0000000000..fdb603b38e --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_f_base64.pod | |||
@@ -0,0 +1,82 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_f_base64 - base64 BIO filter | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bio.h> | ||
10 | #include <openssl/evp.h> | ||
11 | |||
12 | BIO_METHOD * BIO_f_base64(void); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | BIO_f_base64() returns the base64 BIO method. This is a filter | ||
17 | BIO that base64 encodes any data written through it and decodes | ||
18 | any data read through it. | ||
19 | |||
20 | Base64 BIOs do not support BIO_gets() or BIO_puts(). | ||
21 | |||
22 | BIO_flush() on a base64 BIO that is being written through is | ||
23 | used to signal that no more data is to be encoded: this is used | ||
24 | to flush the final block through the BIO. | ||
25 | |||
26 | The flag BIO_FLAGS_BASE64_NO_NL can be set with BIO_set_flags() | ||
27 | to encode the data all on one line or expect the data to be all | ||
28 | on one line. | ||
29 | |||
30 | =head1 NOTES | ||
31 | |||
32 | Because of the format of base64 encoding the end of the encoded | ||
33 | block cannot always be reliably determined. | ||
34 | |||
35 | =head1 RETURN VALUES | ||
36 | |||
37 | BIO_f_base64() returns the base64 BIO method. | ||
38 | |||
39 | =head1 EXAMPLES | ||
40 | |||
41 | Base64 encode the string "Hello World\n" and write the result | ||
42 | to standard output: | ||
43 | |||
44 | BIO *bio, *b64; | ||
45 | char message[] = "Hello World \n"; | ||
46 | |||
47 | b64 = BIO_new(BIO_f_base64()); | ||
48 | bio = BIO_new_fp(stdout, BIO_NOCLOSE); | ||
49 | bio = BIO_push(b64, bio); | ||
50 | BIO_write(bio, message, strlen(message)); | ||
51 | BIO_flush(bio); | ||
52 | |||
53 | BIO_free_all(bio); | ||
54 | |||
55 | Read Base64 encoded data from standard input and write the decoded | ||
56 | data to standard output: | ||
57 | |||
58 | BIO *bio, *b64, bio_out; | ||
59 | char inbuf[512]; | ||
60 | int inlen; | ||
61 | char message[] = "Hello World \n"; | ||
62 | |||
63 | b64 = BIO_new(BIO_f_base64()); | ||
64 | bio = BIO_new_fp(stdin, BIO_NOCLOSE); | ||
65 | bio_out = BIO_new_fp(stdout, BIO_NOCLOSE); | ||
66 | bio = BIO_push(b64, bio); | ||
67 | while((inlen = BIO_read(bio, inbuf, strlen(message))) > 0) | ||
68 | BIO_write(bio_out, inbuf, inlen); | ||
69 | |||
70 | BIO_free_all(bio); | ||
71 | |||
72 | =head1 BUGS | ||
73 | |||
74 | The ambiguity of EOF in base64 encoded data can cause additional | ||
75 | data following the base64 encoded block to be misinterpreted. | ||
76 | |||
77 | There should be some way of specifying a test that the BIO can perform | ||
78 | to reliably determine EOF (for example a MIME boundary). | ||
79 | |||
80 | =head1 SEE ALSO | ||
81 | |||
82 | TBA | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_f_buffer.pod b/src/lib/libssl/src/doc/crypto/BIO_f_buffer.pod new file mode 100644 index 0000000000..c9093c6a57 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_f_buffer.pod | |||
@@ -0,0 +1,69 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_f_buffer - buffering BIO | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bio.h> | ||
10 | |||
11 | BIO_METHOD * BIO_f_buffer(void); | ||
12 | |||
13 | #define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL) | ||
14 | #define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0) | ||
15 | #define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1) | ||
16 | #define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL) | ||
17 | #define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf) | ||
18 | |||
19 | =head1 DESCRIPTION | ||
20 | |||
21 | BIO_f_buffer() returns the buffering BIO method. | ||
22 | |||
23 | Data written to a buffering BIO is buffered and periodically written | ||
24 | to the next BIO in the chain. Data read from a buffering BIO comes from | ||
25 | an internal buffer which is filled from the next BIO in the chain. | ||
26 | Both BIO_gets() and BIO_puts() are supported. | ||
27 | |||
28 | Calling BIO_reset() on a buffering BIO clears any buffered data. | ||
29 | |||
30 | BIO_get_buffer_num_lines() returns the number of lines currently buffered. | ||
31 | |||
32 | BIO_set_read_buffer_size(), BIO_set_write_buffer_size() and BIO_set_buffer_size() | ||
33 | set the read, write or both read and write buffer sizes to B<size>. The initial | ||
34 | buffer size is DEFAULT_BUFFER_SIZE, currently 1024. Any attempt to reduce the | ||
35 | buffer size below DEFAULT_BUFFER_SIZE is ignored. Any buffered data is cleared | ||
36 | when the buffer is resized. | ||
37 | |||
38 | BIO_set_buffer_read_data() clears the read buffer and fills it with B<num> | ||
39 | bytes of B<buf>. If B<num> is larger than the current buffer size the buffer | ||
40 | is expanded. | ||
41 | |||
42 | =head1 NOTES | ||
43 | |||
44 | Buffering BIOs implement BIO_gets() by using BIO_read() operations on the | ||
45 | next BIO in the chain. By prepending a buffering BIO to a chain it is therefore | ||
46 | possible to provide BIO_gets() functionality if the following BIOs do not | ||
47 | support it (for example SSL BIOs). | ||
48 | |||
49 | Data is only written to the next BIO in the chain when the write buffer fills | ||
50 | or when BIO_flush() is called. It is therefore important to call BIO_flush() | ||
51 | whenever any pending data should be written such as when removing a buffering | ||
52 | BIO using BIO_pop(). BIO_flush() may need to be retried if the ultimate | ||
53 | source/sink BIO is non blocking. | ||
54 | |||
55 | =head1 RETURN VALUES | ||
56 | |||
57 | BIO_f_buffer() returns the buffering BIO method. | ||
58 | |||
59 | BIO_get_buffer_num_lines() returns the number of lines buffered (may be 0). | ||
60 | |||
61 | BIO_set_read_buffer_size(), BIO_set_write_buffer_size() and BIO_set_buffer_size() | ||
62 | return 1 if the buffer was successfully resized or 0 for failure. | ||
63 | |||
64 | BIO_set_buffer_read_data() returns 1 if the data was set correctly or 0 if | ||
65 | there was an error. | ||
66 | |||
67 | =head1 SEE ALSO | ||
68 | |||
69 | TBA | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_f_cipher.pod b/src/lib/libssl/src/doc/crypto/BIO_f_cipher.pod new file mode 100644 index 0000000000..4182f2c309 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_f_cipher.pod | |||
@@ -0,0 +1,76 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_f_cipher, BIO_set_cipher, BIO_get_cipher_status, BIO_get_cipher_ctx - cipher BIO filter | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bio.h> | ||
10 | #include <openssl/evp.h> | ||
11 | |||
12 | BIO_METHOD * BIO_f_cipher(void); | ||
13 | void BIO_set_cipher(BIO *b,const EVP_CIPHER *cipher, | ||
14 | unsigned char *key, unsigned char *iv, int enc); | ||
15 | int BIO_get_cipher_status(BIO *b) | ||
16 | int BIO_get_cipher_ctx(BIO *b, EVP_CIPHER_CTX **pctx) | ||
17 | |||
18 | =head1 DESCRIPTION | ||
19 | |||
20 | BIO_f_cipher() returns the cipher BIO method. This is a filter | ||
21 | BIO that encrypts any data written through it, and decrypts any data | ||
22 | read from it. It is a BIO wrapper for the cipher routines | ||
23 | EVP_CipherInit(), EVP_CipherUpdate() and EVP_CipherFinal(). | ||
24 | |||
25 | Cipher BIOs do not support BIO_gets() or BIO_puts(). | ||
26 | |||
27 | BIO_flush() on an encryption BIO that is being written through is | ||
28 | used to signal that no more data is to be encrypted: this is used | ||
29 | to flush and possibly pad the final block through the BIO. | ||
30 | |||
31 | BIO_set_cipher() sets the cipher of BIO <b> to B<cipher> using key B<key> | ||
32 | and IV B<iv>. B<enc> should be set to 1 for encryption and zero for | ||
33 | decryption. | ||
34 | |||
35 | When reading from an encryption BIO the final block is automatically | ||
36 | decrypted and checked when EOF is detected. BIO_get_cipher_status() | ||
37 | is a BIO_ctrl() macro which can be called to determine whether the | ||
38 | decryption operation was successful. | ||
39 | |||
40 | BIO_get_cipher_ctx() is a BIO_ctrl() macro which retrieves the internal | ||
41 | BIO cipher context. The retrieved context can be used in conjunction | ||
42 | with the standard cipher routines to set it up. This is useful when | ||
43 | BIO_set_cipher() is not flexible enough for the applications needs. | ||
44 | |||
45 | =head1 NOTES | ||
46 | |||
47 | When encrypting BIO_flush() B<must> be called to flush the final block | ||
48 | through the BIO. If it is not then the final block will fail a subsequent | ||
49 | decrypt. | ||
50 | |||
51 | When decrypting an error on the final block is signalled by a zero | ||
52 | return value from the read operation. A successful decrypt followed | ||
53 | by EOF will also return zero for the final read. BIO_get_cipher_status() | ||
54 | should be called to determine if the decrypt was successful. | ||
55 | |||
56 | As always, if BIO_gets() or BIO_puts() support is needed then it can | ||
57 | be achieved by preceding the cipher BIO with a buffering BIO. | ||
58 | |||
59 | =head1 RETURN VALUES | ||
60 | |||
61 | BIO_f_cipher() returns the cipher BIO method. | ||
62 | |||
63 | BIO_set_cipher() does not return a value. | ||
64 | |||
65 | BIO_get_cipher_status() returns 1 for a successful decrypt and 0 | ||
66 | for failure. | ||
67 | |||
68 | BIO_get_cipher_ctx() currently always returns 1. | ||
69 | |||
70 | =head1 EXAMPLES | ||
71 | |||
72 | TBA | ||
73 | |||
74 | =head1 SEE ALSO | ||
75 | |||
76 | TBA | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_f_md.pod b/src/lib/libssl/src/doc/crypto/BIO_f_md.pod new file mode 100644 index 0000000000..c32504dfb1 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_f_md.pod | |||
@@ -0,0 +1,138 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_f_md, BIO_set_md, BIO_get_md, BIO_get_md_ctx - message digest BIO filter | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bio.h> | ||
10 | #include <openssl/evp.h> | ||
11 | |||
12 | BIO_METHOD * BIO_f_md(void); | ||
13 | int BIO_set_md(BIO *b,EVP_MD *md); | ||
14 | int BIO_get_md(BIO *b,EVP_MD **mdp); | ||
15 | int BIO_get_md_ctx(BIO *b,EVP_MD_CTX **mdcp); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | BIO_f_md() returns the message digest BIO method. This is a filter | ||
20 | BIO that digests any data passed through it, it is a BIO wrapper | ||
21 | for the digest routines EVP_DigestInit(), EVP_DigestUpdate() | ||
22 | and EVP_DigestFinal(). | ||
23 | |||
24 | Any data written or read through a digest BIO using BIO_read() and | ||
25 | BIO_write() is digested. | ||
26 | |||
27 | BIO_gets(), if its B<size> parameter is large enough finishes the | ||
28 | digest calculation and returns the digest value. BIO_puts() is | ||
29 | not supported. | ||
30 | |||
31 | BIO_reset() reinitializes a digest BIO. | ||
32 | |||
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 | ||
35 | passed through it. It is a BIO_ctrl() macro. | ||
36 | |||
37 | BIO_get_md() places the a pointer to the digest BIOs digest method | ||
38 | in B<mdp>, it is a BIO_ctrl() macro. | ||
39 | |||
40 | BIO_get_md_ctx() returns the digest BIOs context into B<mdcp>. | ||
41 | |||
42 | =head1 NOTES | ||
43 | |||
44 | The context returned by BIO_get_md_ctx() can be used in calls | ||
45 | to EVP_DigestFinal() and also the signature routines EVP_SignFinal() | ||
46 | and EVP_VerifyFinal(). | ||
47 | |||
48 | The context returned by BIO_get_md_ctx() is an internal context | ||
49 | structure. Changes made to this context will affect the digest | ||
50 | BIO itself and the context pointer will become invalid when the digest | ||
51 | BIO is freed. | ||
52 | |||
53 | After the digest has been retrieved from a digest BIO it must be | ||
54 | reinitialized by calling BIO_reset(), or BIO_set_md() before any more | ||
55 | data is passed through it. | ||
56 | |||
57 | If an application needs to call BIO_gets() or BIO_puts() through | ||
58 | a chain containing digest BIOs then this can be done by prepending | ||
59 | a buffering BIO. | ||
60 | |||
61 | =head1 RETURN VALUES | ||
62 | |||
63 | BIO_f_md() returns the digest BIO method. | ||
64 | |||
65 | BIO_set_md(), BIO_get_md() and BIO_md_ctx() return 1 for success and | ||
66 | 0 for failure. | ||
67 | |||
68 | =head1 EXAMPLES | ||
69 | |||
70 | The following example creates a BIO chain containing an SHA1 and MD5 | ||
71 | digest BIO and passes the string "Hello World" through it. Error | ||
72 | checking has been omitted for clarity. | ||
73 | |||
74 | BIO *bio, *mdtmp; | ||
75 | char message[] = "Hello World"; | ||
76 | bio = BIO_new(BIO_s_null()); | ||
77 | mdtmp = BIO_new(BIO_f_md()); | ||
78 | BIO_set_md(mdtmp, EVP_sha1()); | ||
79 | /* For BIO_push() we want to append the sink BIO and keep a note of | ||
80 | * the start of the chain. | ||
81 | */ | ||
82 | bio = BIO_push(mdtmp, bio); | ||
83 | mdtmp = BIO_new(BIO_f_md()); | ||
84 | BIO_set_md(mdtmp, EVP_md5()); | ||
85 | bio = BIO_push(mdtmp, bio); | ||
86 | /* Note: mdtmp can now be discarded */ | ||
87 | BIO_write(bio, message, strlen(message)); | ||
88 | |||
89 | The next example digests data by reading through a chain instead: | ||
90 | |||
91 | BIO *bio, *mdtmp; | ||
92 | char buf[1024]; | ||
93 | int rdlen; | ||
94 | bio = BIO_new_file(file, "rb"); | ||
95 | mdtmp = BIO_new(BIO_f_md()); | ||
96 | BIO_set_md(mdtmp, EVP_sha1()); | ||
97 | bio = BIO_push(mdtmp, bio); | ||
98 | mdtmp = BIO_new(BIO_f_md()); | ||
99 | BIO_set_md(mdtmp, EVP_md5()); | ||
100 | bio = BIO_push(mdtmp, bio); | ||
101 | do { | ||
102 | rdlen = BIO_read(bio, buf, sizeof(buf)); | ||
103 | /* Might want to do something with the data here */ | ||
104 | } while(rdlen > 0); | ||
105 | |||
106 | This next example retrieves the message digests from a BIO chain and | ||
107 | outputs them. This could be used with the examples above. | ||
108 | |||
109 | BIO *mdtmp; | ||
110 | unsigned char mdbuf[EVP_MAX_MD_SIZE]; | ||
111 | int mdlen; | ||
112 | int i; | ||
113 | mdtmp = bio; /* Assume bio has previously been set up */ | ||
114 | do { | ||
115 | EVP_MD *md; | ||
116 | mdtmp = BIO_find_type(mdtmp, BIO_TYPE_MD); | ||
117 | if(!mdtmp) break; | ||
118 | BIO_get_md(mdtmp, &md); | ||
119 | printf("%s digest", OBJ_nid2sn(EVP_MD_type(md))); | ||
120 | mdlen = BIO_gets(mdtmp, mdbuf, EVP_MAX_MD_SIZE); | ||
121 | for(i = 0; i < mdlen; i++) printf(":%02X", mdbuf[i]); | ||
122 | printf("\n"); | ||
123 | mdtmp = BIO_next(mdtmp); | ||
124 | } while(mdtmp); | ||
125 | |||
126 | BIO_free_all(bio); | ||
127 | |||
128 | =head1 BUGS | ||
129 | |||
130 | The lack of support for BIO_puts() and the non standard behaviour of | ||
131 | BIO_gets() could be regarded as anomalous. It could be argued that BIO_gets() | ||
132 | and BIO_puts() should be passed to the next BIO in the chain and digest | ||
133 | the data passed through and that digests should be retrieved using a | ||
134 | separate BIO_ctrl() call. | ||
135 | |||
136 | =head1 SEE ALSO | ||
137 | |||
138 | TBA | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_f_null.pod b/src/lib/libssl/src/doc/crypto/BIO_f_null.pod new file mode 100644 index 0000000000..b057c18408 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_f_null.pod | |||
@@ -0,0 +1,32 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_f_null - null filter | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bio.h> | ||
10 | |||
11 | BIO_METHOD * BIO_f_null(void); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | BIO_f_null() returns the null filter BIO method. This is a filter BIO | ||
16 | that does nothing. | ||
17 | |||
18 | All requests to a null filter BIO are passed through to the next BIO in | ||
19 | the chain: this means that a BIO chain containing a null filter BIO | ||
20 | behaves just as though the BIO was not there. | ||
21 | |||
22 | =head1 NOTES | ||
23 | |||
24 | As may be apparent a null filter BIO is not particularly useful. | ||
25 | |||
26 | =head1 RETURN VALUES | ||
27 | |||
28 | BIO_f_null() returns the null filter BIO method. | ||
29 | |||
30 | =head1 SEE ALSO | ||
31 | |||
32 | TBA | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_f_ssl.pod b/src/lib/libssl/src/doc/crypto/BIO_f_ssl.pod new file mode 100644 index 0000000000..a56ee2b92f --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_f_ssl.pod | |||
@@ -0,0 +1,313 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_f_ssl, BIO_set_ssl, BIO_get_ssl, BIO_set_ssl_mode, BIO_set_ssl_renegotiate_bytes, | ||
6 | BIO_get_num_renegotiates, BIO_set_ssl_renegotiate_timeout, BIO_new_ssl, | ||
7 | BIO_new_ssl_connect, BIO_new_buffer_ssl_connect, BIO_ssl_copy_session_id, | ||
8 | BIO_ssl_shutdown - SSL BIO | ||
9 | |||
10 | =head1 SYNOPSIS | ||
11 | |||
12 | #include <openssl/bio.h> | ||
13 | #include <openssl/ssl.h> | ||
14 | |||
15 | BIO_METHOD *BIO_f_ssl(void); | ||
16 | |||
17 | #define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl) | ||
18 | #define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp) | ||
19 | #define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL) | ||
20 | #define BIO_set_ssl_renegotiate_bytes(b,num) \ | ||
21 | BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL); | ||
22 | #define BIO_set_ssl_renegotiate_timeout(b,seconds) \ | ||
23 | BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL); | ||
24 | #define BIO_get_num_renegotiates(b) \ | ||
25 | BIO_ctrl(b,BIO_C_SET_SSL_NUM_RENEGOTIATES,0,NULL); | ||
26 | |||
27 | BIO *BIO_new_ssl(SSL_CTX *ctx,int client); | ||
28 | BIO *BIO_new_ssl_connect(SSL_CTX *ctx); | ||
29 | BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx); | ||
30 | int BIO_ssl_copy_session_id(BIO *to,BIO *from); | ||
31 | void BIO_ssl_shutdown(BIO *bio); | ||
32 | |||
33 | #define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) | ||
34 | |||
35 | =head1 DESCRIPTION | ||
36 | |||
37 | BIO_f_ssl() returns the SSL BIO method. This is a filter BIO which | ||
38 | is a wrapper round the OpenSSL SSL routines adding a BIO "flavour" to | ||
39 | SSL I/O. | ||
40 | |||
41 | I/O performed on an SSL BIO communicates using the SSL protocol with | ||
42 | the SSLs read and write BIOs. If an SSL connection is not established | ||
43 | then an attempt is made to establish one on the first I/O call. | ||
44 | |||
45 | If a BIO is appended to an SSL BIO using BIO_push() it is automatically | ||
46 | used as the SSL BIOs read and write BIOs. | ||
47 | |||
48 | Calling BIO_reset() on an SSL BIO closes down any current SSL connection | ||
49 | by calling SSL_shutdown(). BIO_reset() is then sent to the next BIO in | ||
50 | the chain: this will typically disconnect the underlying transport. | ||
51 | The SSL BIO is then reset to the initial accept or connect state. | ||
52 | |||
53 | If the close flag is set when an SSL BIO is freed then the internal | ||
54 | SSL structure is also freed using SSL_free(). | ||
55 | |||
56 | BIO_set_ssl() sets the internal SSL pointer of BIO B<b> to B<ssl> using | ||
57 | the close flag B<c>. | ||
58 | |||
59 | BIO_get_ssl() retrieves the SSL pointer of BIO B<b>, it can then be | ||
60 | manipulated using the standard SSL library functions. | ||
61 | |||
62 | BIO_set_ssl_mode() sets the SSL BIO mode to B<client>. If B<client> | ||
63 | is 1 client mode is set. If B<client> is 0 server mode is set. | ||
64 | |||
65 | BIO_set_ssl_renegotiate_bytes() sets the renegotiate byte count | ||
66 | to B<num>. When set after every B<num> bytes of I/O (read and write) | ||
67 | the SSL session is automatically renegotiated. B<num> must be at | ||
68 | least 512 bytes. | ||
69 | |||
70 | BIO_set_ssl_renegotiate_timeout() sets the renegotiate timeout to | ||
71 | B<seconds>. When the renegotiate timeout elapses the session is | ||
72 | automatically renegotiated. | ||
73 | |||
74 | BIO_get_num_renegotiates() returns the total number of session | ||
75 | renegotiations due to I/O or timeout. | ||
76 | |||
77 | BIO_new_ssl() allocates an SSL BIO using SSL_CTX B<ctx> and using | ||
78 | client mode if B<client> is non zero. | ||
79 | |||
80 | BIO_new_ssl_connect() creates a new BIO chain consisting of an | ||
81 | SSL BIO (using B<ctx>) followed by a connect BIO. | ||
82 | |||
83 | BIO_new_buffer_ssl_connect() creates a new BIO chain consisting | ||
84 | of a buffering BIO, an SSL BIO (using B<ctx>) and a connect | ||
85 | BIO. | ||
86 | |||
87 | BIO_ssl_copy_session_id() copies an SSL session id between | ||
88 | BIO chains B<from> and B<to>. It does this by locating the | ||
89 | SSL BIOs in each chain and calling SSL_copy_session_id() on | ||
90 | the internal SSL pointer. | ||
91 | |||
92 | BIO_ssl_shutdown() closes down an SSL connection on BIO | ||
93 | chain B<bio>. It does this by locating the SSL BIO in the | ||
94 | chain and calling SSL_shutdown() on its internal SSL | ||
95 | pointer. | ||
96 | |||
97 | BIO_do_handshake() attempts to complete an SSL handshake on the | ||
98 | supplied BIO and establish the SSL connection. It returns 1 | ||
99 | if the connection was established successfully. A zero or negative | ||
100 | value is returned if the connection could not be established, the | ||
101 | call BIO_should_retry() should be used for non blocking connect BIOs | ||
102 | to determine if the call should be retried. If an SSL connection has | ||
103 | already been established this call has no effect. | ||
104 | |||
105 | =head1 NOTES | ||
106 | |||
107 | SSL BIOs are exceptional in that if the underlying transport | ||
108 | is non blocking they can still request a retry in exceptional | ||
109 | circumstances. Specifically this will happen if a session | ||
110 | renegotiation takes place during a BIO_read() operation, one | ||
111 | case where this happens is when SGC or step up occurs. | ||
112 | |||
113 | In OpenSSL 0.9.6 and later the SSL flag SSL_AUTO_RETRY can be | ||
114 | set to disable this behaviour. That is when this flag is set | ||
115 | an SSL BIO using a blocking transport will never request a | ||
116 | retry. | ||
117 | |||
118 | Since unknown BIO_ctrl() operations are sent through filter | ||
119 | BIOs the servers name and port can be set using BIO_set_host() | ||
120 | on the BIO returned by BIO_new_ssl_connect() without having | ||
121 | to locate the connect BIO first. | ||
122 | |||
123 | Applications do not have to call BIO_do_handshake() but may wish | ||
124 | to do so to separate the handshake process from other I/O | ||
125 | processing. | ||
126 | |||
127 | =head1 RETURN VALUES | ||
128 | |||
129 | TBA | ||
130 | |||
131 | =head1 EXAMPLE | ||
132 | |||
133 | This SSL/TLS client example, attempts to retrieve a page from an | ||
134 | SSL/TLS web server. The I/O routines are identical to those of the | ||
135 | unencrypted example in L<BIO_s_connect(3)|BIO_s_connect(3)>. | ||
136 | |||
137 | BIO *sbio, *out; | ||
138 | int len; | ||
139 | char tmpbuf[1024]; | ||
140 | SSL_CTX *ctx; | ||
141 | SSL *ssl; | ||
142 | |||
143 | ERR_load_crypto_strings(); | ||
144 | ERR_load_SSL_strings(); | ||
145 | OpenSSL_add_all_algorithms(); | ||
146 | |||
147 | /* We would seed the PRNG here if the platform didn't | ||
148 | * do it automatically | ||
149 | */ | ||
150 | |||
151 | ctx = SSL_CTX_new(SSLv23_client_method()); | ||
152 | |||
153 | /* We'd normally set some stuff like the verify paths and | ||
154 | * mode here because as things stand this will connect to | ||
155 | * any server whose certificate is signed by any CA. | ||
156 | */ | ||
157 | |||
158 | sbio = BIO_new_ssl_connect(ctx); | ||
159 | |||
160 | BIO_get_ssl(sbio, &ssl); | ||
161 | |||
162 | if(!ssl) { | ||
163 | fprintf(stderr, "Can't locate SSL pointer\n"); | ||
164 | /* whatever ... */ | ||
165 | } | ||
166 | |||
167 | /* Don't want any retries */ | ||
168 | SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); | ||
169 | |||
170 | /* We might want to do other things with ssl here */ | ||
171 | |||
172 | BIO_set_conn_hostname(sbio, "localhost:https"); | ||
173 | |||
174 | out = BIO_new_fp(stdout, BIO_NOCLOSE); | ||
175 | if(BIO_do_connect(sbio) <= 0) { | ||
176 | fprintf(stderr, "Error connecting to server\n"); | ||
177 | ERR_print_errors_fp(stderr); | ||
178 | /* whatever ... */ | ||
179 | } | ||
180 | |||
181 | if(BIO_do_handshake(sbio) <= 0) { | ||
182 | fprintf(stderr, "Error establishing SSL connection\n"); | ||
183 | ERR_print_errors_fp(stderr); | ||
184 | /* whatever ... */ | ||
185 | } | ||
186 | |||
187 | /* Could examine ssl here to get connection info */ | ||
188 | |||
189 | BIO_puts(sbio, "GET / HTTP/1.0\n\n"); | ||
190 | for(;;) { | ||
191 | len = BIO_read(sbio, tmpbuf, 1024); | ||
192 | if(len <= 0) break; | ||
193 | BIO_write(out, tmpbuf, len); | ||
194 | } | ||
195 | BIO_free_all(sbio); | ||
196 | BIO_free(out); | ||
197 | |||
198 | Here is a simple server example. It makes use of a buffering | ||
199 | BIO to allow lines to be read from the SSL BIO using BIO_gets. | ||
200 | It creates a pseudo web page containing the actual request from | ||
201 | a client and also echoes the request to standard output. | ||
202 | |||
203 | BIO *sbio, *bbio, *acpt, *out; | ||
204 | int len; | ||
205 | char tmpbuf[1024]; | ||
206 | SSL_CTX *ctx; | ||
207 | SSL *ssl; | ||
208 | |||
209 | ERR_load_crypto_strings(); | ||
210 | ERR_load_SSL_strings(); | ||
211 | OpenSSL_add_all_algorithms(); | ||
212 | |||
213 | /* Might seed PRNG here */ | ||
214 | |||
215 | ctx = SSL_CTX_new(SSLv23_server_method()); | ||
216 | |||
217 | if (!SSL_CTX_use_certificate_file(ctx,"server.pem",SSL_FILETYPE_PEM) | ||
218 | || !SSL_CTX_use_PrivateKey_file(ctx,"server.pem",SSL_FILETYPE_PEM) | ||
219 | || !SSL_CTX_check_private_key(ctx)) { | ||
220 | |||
221 | fprintf(stderr, "Error setting up SSL_CTX\n"); | ||
222 | ERR_print_errors_fp(stderr); | ||
223 | return 0; | ||
224 | } | ||
225 | |||
226 | /* Might do other things here like setting verify locations and | ||
227 | * DH and/or RSA temporary key callbacks | ||
228 | */ | ||
229 | |||
230 | /* New SSL BIO setup as server */ | ||
231 | sbio=BIO_new_ssl(ctx,0); | ||
232 | |||
233 | BIO_get_ssl(sbio, &ssl); | ||
234 | |||
235 | if(!ssl) { | ||
236 | fprintf(stderr, "Can't locate SSL pointer\n"); | ||
237 | /* whatever ... */ | ||
238 | } | ||
239 | |||
240 | /* Don't want any retries */ | ||
241 | SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); | ||
242 | |||
243 | /* Create the buffering BIO */ | ||
244 | |||
245 | bbio = BIO_new(BIO_f_buffer()); | ||
246 | |||
247 | /* Add to chain */ | ||
248 | sbio = BIO_push(bbio, sbio); | ||
249 | |||
250 | acpt=BIO_new_accept("4433"); | ||
251 | |||
252 | /* By doing this when a new connection is established | ||
253 | * we automatically have sbio inserted into it. The | ||
254 | * BIO chain is now 'swallowed' by the accept BIO and | ||
255 | * will be freed when the accept BIO is freed. | ||
256 | */ | ||
257 | |||
258 | BIO_set_accept_bios(acpt,sbio); | ||
259 | |||
260 | out = BIO_new_fp(stdout, BIO_NOCLOSE); | ||
261 | |||
262 | /* Setup accept BIO */ | ||
263 | if(BIO_do_accept(acpt) <= 0) { | ||
264 | fprintf(stderr, "Error setting up accept BIO\n"); | ||
265 | ERR_print_errors_fp(stderr); | ||
266 | return 0; | ||
267 | } | ||
268 | |||
269 | /* Now wait for incoming connection */ | ||
270 | if(BIO_do_accept(acpt) <= 0) { | ||
271 | fprintf(stderr, "Error in connection\n"); | ||
272 | ERR_print_errors_fp(stderr); | ||
273 | return 0; | ||
274 | } | ||
275 | |||
276 | /* We only want one connection so remove and free | ||
277 | * accept BIO | ||
278 | */ | ||
279 | |||
280 | sbio = BIO_pop(acpt); | ||
281 | |||
282 | BIO_free_all(acpt); | ||
283 | |||
284 | if(BIO_do_handshake(sbio) <= 0) { | ||
285 | fprintf(stderr, "Error in SSL handshake\n"); | ||
286 | ERR_print_errors_fp(stderr); | ||
287 | return 0; | ||
288 | } | ||
289 | |||
290 | BIO_puts(sbio, "HTTP/1.0 200 OK\r\nContent-type: text/html\r\n\r\n"); | ||
291 | BIO_puts(sbio, "<pre>\r\nConnection Established\r\nRequest headers:\r\n"); | ||
292 | BIO_puts(sbio, "--------------------------------------------------\r\n"); | ||
293 | |||
294 | for(;;) { | ||
295 | len = BIO_gets(sbio, tmpbuf, 1024); | ||
296 | if(len <= 0) break; | ||
297 | BIO_write(sbio, tmpbuf, len); | ||
298 | BIO_write(out, tmpbuf, len); | ||
299 | /* Look for blank line signifying end of headers*/ | ||
300 | if((tmpbuf[0] == '\r') || (tmpbuf[0] == '\n')) break; | ||
301 | } | ||
302 | |||
303 | BIO_puts(sbio, "--------------------------------------------------\r\n"); | ||
304 | BIO_puts(sbio, "</pre>\r\n"); | ||
305 | |||
306 | /* Since there is a buffering BIO present we had better flush it */ | ||
307 | BIO_flush(sbio); | ||
308 | |||
309 | BIO_free_all(sbio); | ||
310 | |||
311 | =head1 SEE ALSO | ||
312 | |||
313 | TBA | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_find_type.pod b/src/lib/libssl/src/doc/crypto/BIO_find_type.pod new file mode 100644 index 0000000000..bd3b256196 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_find_type.pod | |||
@@ -0,0 +1,98 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_find_type, BIO_next - BIO chain traversal | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bio.h> | ||
10 | |||
11 | BIO * BIO_find_type(BIO *b,int bio_type); | ||
12 | BIO * BIO_next(BIO *b); | ||
13 | |||
14 | #define BIO_method_type(b) ((b)->method->type) | ||
15 | |||
16 | #define BIO_TYPE_NONE 0 | ||
17 | #define BIO_TYPE_MEM (1|0x0400) | ||
18 | #define BIO_TYPE_FILE (2|0x0400) | ||
19 | |||
20 | #define BIO_TYPE_FD (4|0x0400|0x0100) | ||
21 | #define BIO_TYPE_SOCKET (5|0x0400|0x0100) | ||
22 | #define BIO_TYPE_NULL (6|0x0400) | ||
23 | #define BIO_TYPE_SSL (7|0x0200) | ||
24 | #define BIO_TYPE_MD (8|0x0200) | ||
25 | #define BIO_TYPE_BUFFER (9|0x0200) | ||
26 | #define BIO_TYPE_CIPHER (10|0x0200) | ||
27 | #define BIO_TYPE_BASE64 (11|0x0200) | ||
28 | #define BIO_TYPE_CONNECT (12|0x0400|0x0100) | ||
29 | #define BIO_TYPE_ACCEPT (13|0x0400|0x0100) | ||
30 | #define BIO_TYPE_PROXY_CLIENT (14|0x0200) | ||
31 | #define BIO_TYPE_PROXY_SERVER (15|0x0200) | ||
32 | #define BIO_TYPE_NBIO_TEST (16|0x0200) | ||
33 | #define BIO_TYPE_NULL_FILTER (17|0x0200) | ||
34 | #define BIO_TYPE_BER (18|0x0200) | ||
35 | #define BIO_TYPE_BIO (19|0x0400) | ||
36 | |||
37 | #define BIO_TYPE_DESCRIPTOR 0x0100 | ||
38 | #define BIO_TYPE_FILTER 0x0200 | ||
39 | #define BIO_TYPE_SOURCE_SINK 0x0400 | ||
40 | |||
41 | =head1 DESCRIPTION | ||
42 | |||
43 | The BIO_find_type() searches for a BIO of a given type in a chain, starting | ||
44 | at BIO B<b>. If B<type> is a specific type (such as BIO_TYPE_MEM) then a search | ||
45 | is made for a BIO of that type. If B<type> is a general type (such as | ||
46 | B<BIO_TYPE_SOURCE_SINK>) then the next matching BIO of the given general type is | ||
47 | searched for. BIO_find_type() returns the next matching BIO or NULL if none is | ||
48 | found. | ||
49 | |||
50 | Note: not all the B<BIO_TYPE_*> types above have corresponding BIO implementations. | ||
51 | |||
52 | BIO_next() returns the next BIO in a chain. It can be used to traverse all BIOs | ||
53 | in a chain or used in conjunction with BIO_find_type() to find all BIOs of a | ||
54 | certain type. | ||
55 | |||
56 | BIO_method_type() returns the type of a BIO. | ||
57 | |||
58 | =head1 RETURN VALUES | ||
59 | |||
60 | BIO_find_type() returns a matching BIO or NULL for no match. | ||
61 | |||
62 | BIO_next() returns the next BIO in a chain. | ||
63 | |||
64 | BIO_method_type() returns the type of the BIO B<b>. | ||
65 | |||
66 | =head1 NOTES | ||
67 | |||
68 | BIO_next() was added to OpenSSL 0.9.6 to provide a 'clean' way to traverse a BIO | ||
69 | chain or find multiple matches using BIO_find_type(). Previous versions had to | ||
70 | use: | ||
71 | |||
72 | next = bio->next_bio; | ||
73 | |||
74 | =head1 BUGS | ||
75 | |||
76 | BIO_find_type() in OpenSSL 0.9.5a and earlier could not be safely passed a | ||
77 | NULL pointer for the B<b> argument. | ||
78 | |||
79 | =head1 EXAMPLE | ||
80 | |||
81 | Traverse a chain looking for digest BIOs: | ||
82 | |||
83 | BIO *btmp; | ||
84 | btmp = in_bio; /* in_bio is chain to search through */ | ||
85 | |||
86 | do { | ||
87 | btmp = BIO_find_type(btmp, BIO_TYPE_MD); | ||
88 | if(btmp == NULL) break; /* Not found */ | ||
89 | /* btmp is a digest BIO, do something with it ...*/ | ||
90 | ... | ||
91 | |||
92 | btmp = BIO_next(btmp); | ||
93 | } while(btmp); | ||
94 | |||
95 | |||
96 | =head1 SEE ALSO | ||
97 | |||
98 | TBA | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_new.pod b/src/lib/libssl/src/doc/crypto/BIO_new.pod new file mode 100644 index 0000000000..2a245fc8de --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_new.pod | |||
@@ -0,0 +1,65 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_new, BIO_set, BIO_free, BIO_vfree, BIO_free_all - BIO allocation and freeing functions | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bio.h> | ||
10 | |||
11 | BIO * BIO_new(BIO_METHOD *type); | ||
12 | int BIO_set(BIO *a,BIO_METHOD *type); | ||
13 | int BIO_free(BIO *a); | ||
14 | void BIO_vfree(BIO *a); | ||
15 | void BIO_free_all(BIO *a); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | The BIO_new() function returns a new BIO using method B<type>. | ||
20 | |||
21 | BIO_set() sets the method of an already existing BIO. | ||
22 | |||
23 | BIO_free() frees up a single BIO, BIO_vfree() also frees up a single BIO | ||
24 | but it does not return a value. Calling BIO_free() may also have some effect | ||
25 | on the underlying I/O structure, for example it may close the file being | ||
26 | referred to under certain circumstances. For more details see the individual | ||
27 | BIO_METHOD descriptions. | ||
28 | |||
29 | BIO_free_all() frees up an entire BIO chain, it does not halt if an error | ||
30 | occurs freeing up an individual BIO in the chain. | ||
31 | |||
32 | =head1 RETURN VALUES | ||
33 | |||
34 | BIO_new() returns a newly created BIO or NULL if the call fails. | ||
35 | |||
36 | BIO_set(), BIO_free() return 1 for success and 0 for failure. | ||
37 | |||
38 | BIO_free_all() and BIO_vfree() do not return values. | ||
39 | |||
40 | =head1 NOTES | ||
41 | |||
42 | Some BIOs (such as memory BIOs) can be used immediately after calling | ||
43 | BIO_new(). Others (such as file BIOs) need some additional initialization, | ||
44 | and frequently a utility function exists to create and initialize such BIOs. | ||
45 | |||
46 | If BIO_free() is called on a BIO chain it will only free one BIO resulting | ||
47 | in a memory leak. | ||
48 | |||
49 | Calling BIO_free_all() a single BIO has the same effect as calling BIO_free() | ||
50 | on it other than the discarded return value. | ||
51 | |||
52 | Normally the B<type> argument is supplied by a function which returns a | ||
53 | pointer to a BIO_METHOD. There is a naming convention for such functions: | ||
54 | a source/sink BIO is normally called BIO_s_*() and a filter BIO | ||
55 | BIO_f_*(); | ||
56 | |||
57 | =head1 EXAMPLE | ||
58 | |||
59 | Create a memory BIO: | ||
60 | |||
61 | BIO *mem = BIO_new(BIO_s_mem()); | ||
62 | |||
63 | =head1 SEE ALSO | ||
64 | |||
65 | TBA | ||
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 new file mode 100644 index 0000000000..2256ba9d34 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_new_bio_pair.pod | |||
@@ -0,0 +1,102 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_new_bio_pair - create a new BIO pair | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bio.h> | ||
10 | |||
11 | int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, BIO **bio2, size_t writebuf2); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | BIO_new_bio_pair() creates a buffering BIO pair. It has two endpoints between | ||
16 | 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 | instead of accessing the network connection directly. | ||
19 | |||
20 | The two new BIOs B<bio1> and B<bio2> are symmetric with respect to their | ||
21 | functionality. The size of their buffers is determined by B<writebuf1> and | ||
22 | B<writebuf2>. If the size give is 0, the default size is used. | ||
23 | |||
24 | BIO_new_bio_pair() does not check whether B<bio1> or B<bio2> do point to | ||
25 | some other BIO, the values are overwritten, BIO_free() is not called. | ||
26 | |||
27 | The two BIOs, even though forming a BIO pair and must be BIO_free()'ed | ||
28 | separately. This can be of importance, as some SSL-functions like SSL_set_bio() | ||
29 | or SSL_free() call BIO_free() implicitly, so that the peer-BIO is left | ||
30 | untouched and must also be BIO_free()'ed. | ||
31 | |||
32 | =head1 EXAMPLE | ||
33 | |||
34 | The BIO pair can be used to have full control over the network access of an | ||
35 | application. The application can call select() on the socket as required | ||
36 | without having to go through the SSL-interface. | ||
37 | |||
38 | BIO *internal_bio, *network_bio; | ||
39 | ... | ||
40 | BIO_new_bio_pair(internal_bio, 0, network_bio, 0); | ||
41 | SSL_set_bio(ssl, internal_bio); | ||
42 | SSL_operations(); | ||
43 | ... | ||
44 | |||
45 | application | TLS-engine | ||
46 | | | | ||
47 | +----------> SSL_operations() | ||
48 | | /\ || | ||
49 | | || \/ | ||
50 | | BIO-pair (internal_bio) | ||
51 | +----------< BIO-pair (network_bio) | ||
52 | | | | ||
53 | socket | | ||
54 | |||
55 | ... | ||
56 | SSL_free(ssl); /* implicitly frees internal_bio */ | ||
57 | BIO_free(network_bio); | ||
58 | ... | ||
59 | |||
60 | As the BIO pair will only buffer the data and never directly access the | ||
61 | connection, it behaves non-blocking and will return as soon as the write | ||
62 | buffer is full or the read buffer is drained. Then the application has to | ||
63 | flush the write buffer and/or fill the read buffer. | ||
64 | |||
65 | Use the BIO_ctrl_pending(), to find out whether data is buffered in the BIO | ||
66 | 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 | SSL_operation() can successfully be continued. | ||
69 | |||
70 | =head1 IMPORTANT | ||
71 | |||
72 | 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 | not rely on the error value of SSL_operation() but must assure that the | ||
75 | write buffer is always flushed first. Otherwise a deadlock may occur as | ||
76 | the peer might be waiting for the data before being able to continue. | ||
77 | |||
78 | =head1 RETURN VALUES | ||
79 | |||
80 | The following return values can occur: | ||
81 | |||
82 | =over 4 | ||
83 | |||
84 | =item 1 | ||
85 | |||
86 | The BIO pair was created successfully. The new BIOs are available in | ||
87 | B<bio1> and B<bio2>. | ||
88 | |||
89 | =item 0 | ||
90 | |||
91 | The operation failed. The NULL pointer is stored into the locations for | ||
92 | B<bio1> and B<bio2>. Check the error stack for more information. | ||
93 | |||
94 | =back | ||
95 | |||
96 | =head1 SEE ALSO | ||
97 | |||
98 | L<SSL_set_bio(3)|SSL_set_bio(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)>, | ||
99 | L<BIO_ctrl_pending(3)|BIO_ctrl_pending(3)>, | ||
100 | L<BIO_ctrl_get_read_request(3)|BIO_ctrl_get_read_request(3)> | ||
101 | |||
102 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_push.pod b/src/lib/libssl/src/doc/crypto/BIO_push.pod new file mode 100644 index 0000000000..8af1d3c097 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_push.pod | |||
@@ -0,0 +1,69 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_push, BIO_pop - add and remove BIOs from a chain. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bio.h> | ||
10 | |||
11 | BIO * BIO_push(BIO *b,BIO *append); | ||
12 | BIO * BIO_pop(BIO *b); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | The BIO_push() function appends the BIO B<append> to B<b>, it returns | ||
17 | B<b>. | ||
18 | |||
19 | BIO_pop() removes the BIO B<b> from a chain and returns the next BIO | ||
20 | in the chain, or NULL if there is no next BIO. The removed BIO then | ||
21 | becomes a single BIO with no association with the original chain, | ||
22 | it can thus be freed or attached to a different chain. | ||
23 | |||
24 | =head1 NOTES | ||
25 | |||
26 | The names of these functions are perhaps a little misleading. BIO_push() | ||
27 | joins two BIO chains whereas BIO_pop() deletes a single BIO from a chain, | ||
28 | the deleted BIO does not need to be at the end of a chain. | ||
29 | |||
30 | The process of calling BIO_push() and BIO_pop() on a BIO may have additional | ||
31 | consequences (a control call is made to the affected BIOs) any effects will | ||
32 | be noted in the descriptions of individual BIOs. | ||
33 | |||
34 | =head1 EXAMPLES | ||
35 | |||
36 | For these examples suppose B<md1> and B<md2> are digest BIOs, B<b64> is | ||
37 | a base64 BIO and B<f> is a file BIO. | ||
38 | |||
39 | If the call: | ||
40 | |||
41 | BIO_push(b64, f); | ||
42 | |||
43 | is made then the new chain will be B<b64-chain>. After making the calls | ||
44 | |||
45 | BIO_push(md2, b64); | ||
46 | BIO_push(md1, md2); | ||
47 | |||
48 | the new chain is B<md1-md2-b64-f>. Data written to B<md1> will be digested | ||
49 | by B<md1> and B<md2>, B<base64> encoded and written to B<f>. | ||
50 | |||
51 | It should be noted that reading causes data to pass in the reverse | ||
52 | direction, that is data is read from B<f>, base64 B<decoded> and digested | ||
53 | by B<md1> and B<md2>. If the call: | ||
54 | |||
55 | BIO_pop(md2); | ||
56 | |||
57 | The call will return B<b64> and the new chain will be B<md1-b64-f> data can | ||
58 | be written to B<md1> as before. | ||
59 | |||
60 | =head1 RETURN VALUES | ||
61 | |||
62 | BIO_push() returns the end of the chain, B<b>. | ||
63 | |||
64 | BIO_pop() returns the next BIO in the chain, or NULL if there is no next | ||
65 | BIO. | ||
66 | |||
67 | =head1 SEE ALSO | ||
68 | |||
69 | TBA | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_read.pod b/src/lib/libssl/src/doc/crypto/BIO_read.pod new file mode 100644 index 0000000000..b34528104d --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_read.pod | |||
@@ -0,0 +1,66 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_read, BIO_write, BIO_gets, BIO_puts - BIO I/O functions | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bio.h> | ||
10 | |||
11 | int BIO_read(BIO *b, void *buf, int len); | ||
12 | int BIO_gets(BIO *b,char *buf, int size); | ||
13 | int BIO_write(BIO *b, const void *buf, int len); | ||
14 | int BIO_puts(BIO *b,const char *buf); | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | BIO_read() attempts to read B<len> bytes from BIO B<b> and places | ||
19 | the data in B<buf>. | ||
20 | |||
21 | BIO_gets() performs the BIOs "gets" operation and places the data | ||
22 | in B<buf>. Usually this operation will attempt to read a line of data | ||
23 | from the BIO of maximum length B<len>. There are exceptions to this | ||
24 | however, for example BIO_gets() on a digest BIO will calculate and | ||
25 | return the digest and other BIOs may not support BIO_gets() at all. | ||
26 | |||
27 | BIO_write() attempts to write B<len> bytes from B<buf> to BIO B<b>. | ||
28 | |||
29 | BIO_puts() attempts to write a null terminated string B<buf> to BIO B<b> | ||
30 | |||
31 | =head1 RETURN VALUES | ||
32 | |||
33 | All these functions return either the amount of data successfully read or | ||
34 | written (if the return value is positive) or that no data was successfully | ||
35 | read or written if the result is 0 or -1. If the return value is -2 then | ||
36 | the operation is not implemented in the specific BIO type. | ||
37 | |||
38 | =head1 NOTES | ||
39 | |||
40 | A 0 or -1 return is not necessarily an indication of an error. In | ||
41 | particular when the source/sink is non-blocking or of a certain type | ||
42 | it may merely be an indication that no data is currently available and that | ||
43 | the application should retry the operation later. | ||
44 | |||
45 | One technique sometimes used with blocking sockets is to use a system call | ||
46 | (such as select(), poll() or equivalent) to determine when data is available | ||
47 | and then call read() to read the data. The equivalent with BIOs (that is call | ||
48 | select() on the underlying I/O structure and then call BIO_read() to | ||
49 | read the data) should B<not> be used because a single call to BIO_read() | ||
50 | can cause several reads (and writes in the case of SSL BIOs) on the underlying | ||
51 | I/O structure and may block as a result. Instead select() (or equivalent) | ||
52 | should be combined with non blocking I/O so successive reads will request | ||
53 | a retry instead of blocking. | ||
54 | |||
55 | See L<BIO_should_retry(3)|BIO_should_retry(3)> for details of how to | ||
56 | determine the cause of a retry and other I/O issues. | ||
57 | |||
58 | If the BIO_gets() function is not supported by a BIO then it possible to | ||
59 | work around this by adding a buffering BIO L<BIO_f_buffer(3)|BIO_f_buffer(3)> | ||
60 | to the chain. | ||
61 | |||
62 | =head1 SEE ALSO | ||
63 | |||
64 | L<BIO_should_retry(3)|BIO_should_retry(3)> | ||
65 | |||
66 | TBA | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_s_accept.pod b/src/lib/libssl/src/doc/crypto/BIO_s_accept.pod new file mode 100644 index 0000000000..c49da7fb02 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_s_accept.pod | |||
@@ -0,0 +1,184 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_s_accept, BIO_set_nbio, BIO_set_accept_port, BIO_get_accept_port, | ||
6 | BIO_set_nbio_accept, BIO_set_accept_bios, BIO_set_bind_mode, | ||
7 | BIO_get_bind_mode, BIO_do_accept - accept BIO | ||
8 | |||
9 | =head1 SYNOPSIS | ||
10 | |||
11 | #include <openssl/bio.h> | ||
12 | |||
13 | BIO_METHOD * BIO_s_accept(void); | ||
14 | |||
15 | #define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name) | ||
16 | #define BIO_get_accept_port(b) BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0) | ||
17 | |||
18 | BIO *BIO_new_accept(char *host_port); | ||
19 | |||
20 | #define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,1,(n)?"a":NULL) | ||
21 | #define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(char *)bio) | ||
22 | |||
23 | #define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL) | ||
24 | #define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL) | ||
25 | |||
26 | #define BIO_BIND_NORMAL 0 | ||
27 | #define BIO_BIND_REUSEADDR_IF_UNUSED 1 | ||
28 | #define BIO_BIND_REUSEADDR 2 | ||
29 | |||
30 | #define BIO_do_accept(b) BIO_do_handshake(b) | ||
31 | |||
32 | =head1 DESCRIPTION | ||
33 | |||
34 | BIO_s_accept() returns the accept BIO method. This is a wrapper | ||
35 | round the platform's TCP/IP socket accept routines. | ||
36 | |||
37 | Using accept BIOs TCP/IP connections can be accepted and data | ||
38 | transferred using only BIO routines. In this way any platform | ||
39 | specific operations are hidden by the BIO abstraction. | ||
40 | |||
41 | Read and write operations on an accept BIO will perform I/O | ||
42 | on the underlying connection. If no connection is established | ||
43 | and the port (see below) is set up properly then the BIO | ||
44 | waits for an incoming connection. | ||
45 | |||
46 | Accept BIOs support BIO_puts() but not BIO_gets(). | ||
47 | |||
48 | If the close flag is set on an accept BIO then any active | ||
49 | connection on that chain is shutdown and the socket closed when | ||
50 | the BIO is freed. | ||
51 | |||
52 | Calling BIO_reset() on a accept BIO will close any active | ||
53 | connection and reset the BIO into a state where it awaits another | ||
54 | incoming connection. | ||
55 | |||
56 | BIO_get_fd() and BIO_set_fd() can be called to retrieve or set | ||
57 | the accept socket. See L<BIO_s_fd(3)|BIO_s_fd(3)> | ||
58 | |||
59 | BIO_set_accept_port() uses the string B<name> to set the accept | ||
60 | port. The port is represented as a string of the form "host:port", | ||
61 | where "host" is the interface to use and "port" is the port. | ||
62 | Either or both values can be "*" which is interpreted as meaning | ||
63 | any interface or port respectively. "port" has the same syntax | ||
64 | as the port specified in BIO_set_conn_port() for connect BIOs, | ||
65 | that is it can be a numerical port string or a string to lookup | ||
66 | using getservbyname() and a string table. | ||
67 | |||
68 | BIO_new_accept() combines BIO_new() and BIO_set_accept_port() into | ||
69 | a single call: that is it creates a new accept BIO with port | ||
70 | B<host_port>. | ||
71 | |||
72 | BIO_set_nbio_accept() sets the accept socket to blocking mode | ||
73 | (the default) if B<n> is 0 or non blocking mode if B<n> is 1. | ||
74 | |||
75 | BIO_set_accept_bios() can be used to set a chain of BIOs which | ||
76 | will be duplicated and prepended to the chain when an incoming | ||
77 | connection is received. This is useful if, for example, a | ||
78 | buffering or SSL BIO is required for each connection. The | ||
79 | chain of BIOs must not be freed after this call, they will | ||
80 | be automatically freed when the accept BIO is freed. | ||
81 | |||
82 | BIO_set_bind_mode() and BIO_get_bind_mode() set and retrieve | ||
83 | the current bind mode. If BIO_BIND_NORMAL (the default) is set | ||
84 | then another socket cannot be bound to the same port. If | ||
85 | BIO_BIND_REUSEADDR is set then other sockets can bind to the | ||
86 | same port. If BIO_BIND_REUSEADDR_IF_UNUSED is set then and | ||
87 | attempt is first made to use BIO_BIN_NORMAL, if this fails | ||
88 | and the port is not in use then a second attempt is made | ||
89 | using BIO_BIND_REUSEADDR. | ||
90 | |||
91 | BIO_do_accept() serves two functions. When it is first | ||
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 | ||
94 | and subsequent calls to BIO_do_accept() will await an incoming | ||
95 | connection. | ||
96 | |||
97 | =head1 NOTES | ||
98 | |||
99 | When an accept BIO is at the end of a chain it will await an | ||
100 | incoming connection before processing I/O calls. When an accept | ||
101 | BIO is not at then end of a chain it passes I/O calls to the next | ||
102 | BIO in the chain. | ||
103 | |||
104 | When a connection is established a new socket BIO is created for | ||
105 | the connection and appended to the chain. That is the chain is now | ||
106 | accept->socket. This effectively means that attempting I/O on | ||
107 | an initial accept socket will await an incoming connection then | ||
108 | perform I/O on it. | ||
109 | |||
110 | If any additional BIOs have been set using BIO_set_accept_bios() | ||
111 | then they are placed between the socket and the accept BIO, | ||
112 | that is the chain will be accept->otherbios->socket. | ||
113 | |||
114 | If a server wishes to process multiple connections (as is normally | ||
115 | the case) then the accept BIO must be made available for further | ||
116 | incoming connections. This can be done by waiting for a connection and | ||
117 | then calling: | ||
118 | |||
119 | connection = BIO_pop(accept); | ||
120 | |||
121 | After this call B<connection> will contain a BIO for the recently | ||
122 | established connection and B<accept> will now be a single BIO | ||
123 | again which can be used to await further incoming connections. | ||
124 | If no further connections will be accepted the B<accept> can | ||
125 | be freed using BIO_free(). | ||
126 | |||
127 | If only a single connection will be processed it is possible to | ||
128 | perform I/O using the accept BIO itself. This is often undesirable | ||
129 | however because the accept BIO will still accept additional incoming | ||
130 | connections. This can be resolved by using BIO_pop() (see above) | ||
131 | and freeing up the accept BIO after the initial connection. | ||
132 | |||
133 | =head1 RETURN VALUES | ||
134 | |||
135 | TBA | ||
136 | |||
137 | =head1 EXAMPLE | ||
138 | |||
139 | This example accepts two connections on port 4444, sends messages | ||
140 | down each and finally closes both down. | ||
141 | |||
142 | BIO *abio, *cbio, *cbio2; | ||
143 | ERR_load_crypto_strings(); | ||
144 | abio = BIO_new_accept("4444"); | ||
145 | |||
146 | /* First call to BIO_accept() sets up accept BIO */ | ||
147 | if(BIO_do_accept(abio) <= 0) { | ||
148 | fprintf(stderr, "Error setting up accept\n"); | ||
149 | ERR_print_errors_fp(stderr); | ||
150 | exit(0); | ||
151 | } | ||
152 | |||
153 | /* Wait for incoming connection */ | ||
154 | if(BIO_do_accept(abio) <= 0) { | ||
155 | fprintf(stderr, "Error accepting connection\n"); | ||
156 | ERR_print_errors_fp(stderr); | ||
157 | exit(0); | ||
158 | } | ||
159 | fprintf(stderr, "Connection 1 established\n"); | ||
160 | /* Retrieve BIO for connection */ | ||
161 | cbio = BIO_pop(abio); | ||
162 | BIO_puts(cbio, "Connection 1: Sending out Data on initial connection\n"); | ||
163 | fprintf(stderr, "Sent out data on connection 1\n"); | ||
164 | /* Wait for another connection */ | ||
165 | if(BIO_do_accept(abio) <= 0) { | ||
166 | fprintf(stderr, "Error accepting connection\n"); | ||
167 | ERR_print_errors_fp(stderr); | ||
168 | exit(0); | ||
169 | } | ||
170 | fprintf(stderr, "Connection 2 established\n"); | ||
171 | /* Close accept BIO to refuse further connections */ | ||
172 | cbio2 = BIO_pop(abio); | ||
173 | BIO_free(abio); | ||
174 | BIO_puts(cbio2, "Connection 2: Sending out Data on second\n"); | ||
175 | fprintf(stderr, "Sent out data on connection 2\n"); | ||
176 | |||
177 | BIO_puts(cbio, "Connection 1: Second connection established\n"); | ||
178 | /* Close the two established connections */ | ||
179 | BIO_free(cbio); | ||
180 | BIO_free(cbio2); | ||
181 | |||
182 | =head1 SEE ALSO | ||
183 | |||
184 | TBA | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_s_bio.pod b/src/lib/libssl/src/doc/crypto/BIO_s_bio.pod new file mode 100644 index 0000000000..95ae802e47 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_s_bio.pod | |||
@@ -0,0 +1,130 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_s_bio, BIO_make_bio_pair, BIO_destroy_bio_pair, BIO_shutdown_wr, | ||
6 | BIO_set_write_buf_size, BIO_get_write_buf_size, BIO_new_bio_pair, | ||
7 | BIO_get_write_guarantee, BIO_ctrl_get_write_guarantee, BIO_get_read_request, | ||
8 | BIO_ctrl_get_read_request, BIO_ctrl_reset_read_request - BIO pair BIO | ||
9 | |||
10 | =head1 SYNOPSIS | ||
11 | |||
12 | #include <openssl/bio.h> | ||
13 | |||
14 | BIO_METHOD *BIO_s_bio(void); | ||
15 | |||
16 | #define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2) | ||
17 | #define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL) | ||
18 | |||
19 | #define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL) | ||
20 | |||
21 | #define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL) | ||
22 | #define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL) | ||
23 | |||
24 | int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, BIO **bio2, size_t writebuf2); | ||
25 | |||
26 | #define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL) | ||
27 | size_t BIO_ctrl_get_write_guarantee(BIO *b); | ||
28 | |||
29 | #define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL) | ||
30 | size_t BIO_ctrl_get_read_request(BIO *b); | ||
31 | |||
32 | int BIO_ctrl_reset_read_request(BIO *b); | ||
33 | |||
34 | =head1 DESCRIPTION | ||
35 | |||
36 | BIO_s_bio() returns the method for a BIO pair. A BIO pair is a pair of source/sink | ||
37 | BIOs where data written to either half of the pair is buffered and can be read from | ||
38 | the other half. Both halves must usually by handled by the same application thread | ||
39 | since no locking is done on the internal data structures. | ||
40 | |||
41 | Since BIO chains typically end in a source/sink BIO it is possible to make this | ||
42 | one half of a BIO pair and have all the data processed by the chain under application | ||
43 | control. | ||
44 | |||
45 | One typical use of BIO pairs is to place TLS/SSL I/O under application control, this | ||
46 | can be used when the application wishes to use a non standard transport for | ||
47 | TLS/SSL or the normal socket routines are inappropriate. | ||
48 | |||
49 | Calls to BIO_read() will read data from the buffer or request a retry if no | ||
50 | data is available. | ||
51 | |||
52 | Calls to BIO_write() will place data in the buffer or request a retry if the | ||
53 | buffer is full. | ||
54 | |||
55 | The standard calls BIO_ctrl_pending() and BIO_ctrl_wpending() can be used to | ||
56 | determine the amount of pending data in the read or write buffer. | ||
57 | |||
58 | BIO_reset() clears any data in the write buffer. | ||
59 | |||
60 | BIO_make_bio_pair() joins two separate BIOs into a connected pair. | ||
61 | |||
62 | BIO_destroy_pair() destroys the association between two connected BIOs. Freeing | ||
63 | up any half of the pair will automatically destroy the association. | ||
64 | |||
65 | BIO_shutdown_wr() is used to close down a BIO B<b>. After this call no further | ||
66 | writes on BIO B<b> are allowed (they will return an error). Reads on the other | ||
67 | half of the pair will return any pending data or EOF when all pending data has | ||
68 | been read. | ||
69 | |||
70 | BIO_set_write_buf_size() sets the write buffer size of BIO B<b> to B<size>. | ||
71 | If the size is not initialized a default value is used. This is currently | ||
72 | 17K, sufficient for a maximum size TLS record. | ||
73 | |||
74 | BIO_get_write_buf_size() returns the size of the write buffer. | ||
75 | |||
76 | BIO_new_bio_pair() combines the calls to BIO_new(), BIO_make_bio_pair() and | ||
77 | BIO_set_write_buf_size() to create a connected pair of BIOs B<bio1>, B<bio2> | ||
78 | with write buffer sizes B<writebuf1> and B<writebuf2>. If either size is | ||
79 | zero then the default size is used. | ||
80 | |||
81 | BIO_get_write_guarantee() and BIO_ctrl_get_write_guarantee() return the maximum | ||
82 | length of data that can be currently written to the BIO. Writes larger than this | ||
83 | value will return a value from BIO_write() less than the amount requested or if the | ||
84 | buffer is full request a retry. BIO_ctrl_get_write_guarantee() is a function | ||
85 | whereas BIO_get_write_guarantee() is a macro. | ||
86 | |||
87 | BIO_get_read_request() and BIO_ctrl_get_read_request() return the | ||
88 | amount of data requested, or the buffer size if it is less, if the | ||
89 | last read attempt at the other half of the BIO pair failed due to an | ||
90 | empty buffer. This can be used to determine how much data should be | ||
91 | written to the BIO so the next read will succeed: this is most useful | ||
92 | in TLS/SSL applications where the amount of data read is usually | ||
93 | meaningful rather than just a buffer size. After a successful read | ||
94 | this call will return zero. It also will return zero once new data | ||
95 | has been written satisfying the read request or part of it. | ||
96 | Note that BIO_get_read_request() never returns an amount larger | ||
97 | than that returned by BIO_get_write_guarantee(). | ||
98 | |||
99 | BIO_ctrl_reset_read_request() can also be used to reset the value returned by | ||
100 | BIO_get_read_request() to zero. | ||
101 | |||
102 | =head1 NOTES | ||
103 | |||
104 | Both halves of a BIO pair should be freed. That is even if one half is implicit | ||
105 | freed due to a BIO_free_all() or SSL_free() call the other half needs to be freed. | ||
106 | |||
107 | When used in bidirectional applications (such as TLS/SSL) care should be taken to | ||
108 | flush any data in the write buffer. This can be done by calling BIO_pending() | ||
109 | on the other half of the pair and, if any data is pending, reading it and sending | ||
110 | it to the underlying transport. This must be done before any normal processing | ||
111 | (such as calling select() ) due to a request and BIO_should_read() being true. | ||
112 | |||
113 | To see why this is important consider a case where a request is sent using | ||
114 | BIO_write() and a response read with BIO_read(), this can occur during an | ||
115 | TLS/SSL handshake for example. BIO_write() will succeed and place data in the write | ||
116 | buffer. BIO_read() will initially fail and BIO_should_read() will be true. If | ||
117 | the application then waits for data to be available on the underlying transport | ||
118 | before flushing the write buffer it will never succeed because the request was | ||
119 | never sent! | ||
120 | |||
121 | =head1 EXAMPLE | ||
122 | |||
123 | TBA | ||
124 | |||
125 | =head1 SEE ALSO | ||
126 | |||
127 | L<SSL_set_bio(3)|SSL_set_bio(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)>, | ||
128 | L<BIO_should_retry(3)|BIO_should_retry(3)>, L<BIO_read(3)|BIO_read(3)> | ||
129 | |||
130 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_s_connect.pod b/src/lib/libssl/src/doc/crypto/BIO_s_connect.pod new file mode 100644 index 0000000000..fe1aa679d4 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_s_connect.pod | |||
@@ -0,0 +1,182 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_s_connect, BIO_set_conn_hostname, BIO_set_conn_port, | ||
6 | BIO_set_conn_ip, BIO_set_conn_int_port, BIO_get_conn_hostname, | ||
7 | BIO_get_conn_port, BIO_get_conn_ip, BIO_get_conn_int_port, | ||
8 | BIO_set_nbio, BIO_do_connect - connect BIO | ||
9 | |||
10 | =head1 SYNOPSIS | ||
11 | |||
12 | #include <openssl/bio.h> | ||
13 | |||
14 | BIO_METHOD * BIO_s_connect(void); | ||
15 | |||
16 | #define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0,(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 | |||
25 | #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) | ||
26 | |||
27 | #define BIO_do_connect(b) BIO_do_handshake(b) | ||
28 | |||
29 | =head1 DESCRIPTION | ||
30 | |||
31 | BIO_s_connect() returns the connect BIO method. This is a wrapper | ||
32 | round the platform's TCP/IP socket connection routines. | ||
33 | |||
34 | Using connect BIOs TCP/IP connections can be made and data | ||
35 | transferred using only BIO routines. In this way any platform | ||
36 | specific operations are hidden by the BIO abstraction. | ||
37 | |||
38 | Read and write operations on a connect BIO will perform I/O | ||
39 | on the underlying connection. If no connection is established | ||
40 | and the port and hostname (see below) is set up properly then | ||
41 | a connection is established first. | ||
42 | |||
43 | Connect BIOs support BIO_puts() but not BIO_gets(). | ||
44 | |||
45 | If the close flag is set on a connect BIO then any active | ||
46 | connection is shutdown and the socket closed when the BIO | ||
47 | is freed. | ||
48 | |||
49 | Calling BIO_reset() on a connect BIO will close any active | ||
50 | connection and reset the BIO into a state where it can connect | ||
51 | to the same host again. | ||
52 | |||
53 | 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 | ||
55 | type (int *). | ||
56 | |||
57 | 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 | ||
59 | 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". | ||
61 | |||
62 | BIO_set_conn_port() sets the port to B<port>. B<port> can be the | ||
63 | numerical form or a string such as "http". A string will be looked | ||
64 | up first using getservbyname() on the host platform but if that | ||
65 | fails a standard table of port names will be used. Currently the | ||
66 | list is http, telnet, socks, https, ssl, ftp, gopher and wais. | ||
67 | |||
68 | BIO_set_conn_ip() sets the IP address to B<ip> using binary form, | ||
69 | that is four bytes specifying the IP address in big-endian form. | ||
70 | |||
71 | BIO_set_conn_int_port() sets the port using B<port>. B<port> should | ||
72 | be of type (int *). | ||
73 | |||
74 | BIO_get_conn_hostname() returns the hostname of the connect BIO or | ||
75 | NULL if the BIO is initialized but no hostname is set. | ||
76 | This return value is an internal pointer which should not be modified. | ||
77 | |||
78 | BIO_get_conn_port() returns the port as a string. | ||
79 | |||
80 | BIO_get_conn_ip() returns the IP address in binary form. | ||
81 | |||
82 | BIO_get_conn_int_port() returns the port as an int. | ||
83 | |||
84 | BIO_set_nbio() sets the non blocking I/O flag to B<n>. If B<n> is | ||
85 | zero then blocking I/O is set. If B<n> is 1 then non blocking I/O | ||
86 | is set. Blocking I/O is the default. The call to BIO_set_nbio() | ||
87 | should be made before the connection is established because | ||
88 | non blocking I/O is set during the connect process. | ||
89 | |||
90 | BIO_do_connect() attempts to connect the supplied BIO. It returns 1 | ||
91 | if the connection was established successfully. A zero or negative | ||
92 | value is returned if the connection could not be established, the | ||
93 | call BIO_should_retry() should be used for non blocking connect BIOs | ||
94 | to determine if the call should be retried. | ||
95 | |||
96 | =head1 NOTES | ||
97 | |||
98 | If blocking I/O is set then a non positive return value from any | ||
99 | I/O call is caused by an error condition, although a zero return | ||
100 | will normally mean that the connection was closed. | ||
101 | |||
102 | If the port name is supplied as part of the host name then this will | ||
103 | override any value set with BIO_set_conn_port(). This may be undesirable | ||
104 | if the application does not wish to allow connection to arbitrary | ||
105 | ports. This can be avoided by checking for the presence of the ':' | ||
106 | character in the passed hostname and either indicating an error or | ||
107 | truncating the string at that point. | ||
108 | |||
109 | The values returned by BIO_get_conn_hostname(), BIO_get_conn_port(), | ||
110 | BIO_get_conn_ip() and BIO_get_conn_int_port() are updated when a | ||
111 | connection attempt is made. Before any connection attempt the values | ||
112 | returned are those set by the application itself. | ||
113 | |||
114 | Applications do not have to call BIO_do_connect() but may wish to do | ||
115 | so to separate the connection process from other I/O processing. | ||
116 | |||
117 | If non blocking I/O is set then retries will be requested as appropriate. | ||
118 | |||
119 | It addition to BIO_should_read() and BIO_should_write() it is also | ||
120 | possible for BIO_should_io_special() to be true during the initial | ||
121 | connection process with the reason BIO_RR_CONNECT. If this is returned | ||
122 | then this is an indication that a connection attempt would block, | ||
123 | the application should then take appropriate action to wait until | ||
124 | the underlying socket has connected and retry the call. | ||
125 | |||
126 | =head1 RETURN VALUES | ||
127 | |||
128 | BIO_s_connect() returns the connect BIO method. | ||
129 | |||
130 | BIO_get_fd() returns the socket or -1 if the BIO has not | ||
131 | been initialized. | ||
132 | |||
133 | BIO_set_conn_hostname(), BIO_set_conn_port(), BIO_set_conn_ip() and | ||
134 | BIO_set_conn_int_port() always return 1. | ||
135 | |||
136 | BIO_get_conn_hostname() returns the connected hostname or NULL is | ||
137 | none was set. | ||
138 | |||
139 | BIO_get_conn_port() returns a string representing the connected | ||
140 | port or NULL if not set. | ||
141 | |||
142 | BIO_get_conn_ip() returns a pointer to the connected IP address in | ||
143 | binary form or all zeros if not set. | ||
144 | |||
145 | BIO_get_conn_int_port() returns the connected port or 0 if none was | ||
146 | set. | ||
147 | |||
148 | BIO_set_nbio() always returns 1. | ||
149 | |||
150 | BIO_do_connect() returns 1 if the connection was successfully | ||
151 | established and 0 or -1 if the connection failed. | ||
152 | |||
153 | =head1 EXAMPLE | ||
154 | |||
155 | This is example connects to a webserver on the local host and attempts | ||
156 | to retrieve a page and copy the result to standard output. | ||
157 | |||
158 | |||
159 | BIO *cbio, *out; | ||
160 | int len; | ||
161 | char tmpbuf[1024]; | ||
162 | ERR_load_crypto_strings(); | ||
163 | cbio = BIO_new_connect("localhost:http"); | ||
164 | out = BIO_new_fp(stdout, BIO_NOCLOSE); | ||
165 | if(BIO_do_connect(cbio) <= 0) { | ||
166 | fprintf(stderr, "Error connecting to server\n"); | ||
167 | ERR_print_errors_fp(stderr); | ||
168 | /* whatever ... */ | ||
169 | } | ||
170 | BIO_puts(cbio, "GET / HTTP/1.0\n\n"); | ||
171 | for(;;) { | ||
172 | len = BIO_read(cbio, tmpbuf, 1024); | ||
173 | if(len <= 0) break; | ||
174 | BIO_write(out, tmpbuf, len); | ||
175 | } | ||
176 | BIO_free(cbio); | ||
177 | BIO_free(out); | ||
178 | |||
179 | |||
180 | =head1 SEE ALSO | ||
181 | |||
182 | TBA | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_s_fd.pod b/src/lib/libssl/src/doc/crypto/BIO_s_fd.pod new file mode 100644 index 0000000000..b1de1d1015 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_s_fd.pod | |||
@@ -0,0 +1,89 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_s_fd, BIO_set_fd, BIO_get_fd, BIO_new_fd - file descriptor BIO | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bio.h> | ||
10 | |||
11 | BIO_METHOD * BIO_s_fd(void); | ||
12 | |||
13 | #define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) | ||
14 | #define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c) | ||
15 | |||
16 | BIO *BIO_new_fd(int fd, int close_flag); | ||
17 | |||
18 | =head1 DESCRIPTION | ||
19 | |||
20 | BIO_s_fd() returns the file descriptor BIO method. This is a wrapper | ||
21 | round the platforms file descriptor routines such as read() and write(). | ||
22 | |||
23 | BIO_read() and BIO_write() read or write the underlying descriptor. | ||
24 | BIO_puts() is supported but BIO_gets() is not. | ||
25 | |||
26 | If the close flag is set then then close() is called on the underlying | ||
27 | file descriptor when the BIO is freed. | ||
28 | |||
29 | BIO_reset() attempts to change the file pointer to the start of file | ||
30 | using lseek(fd, 0, 0). | ||
31 | |||
32 | BIO_seek() sets the file pointer to position B<ofs> from start of file | ||
33 | using lseek(fd, ofs, 0). | ||
34 | |||
35 | BIO_tell() returns the current file position by calling lseek(fd, 0, 1). | ||
36 | |||
37 | BIO_set_fd() sets the file descriptor of BIO B<b> to B<fd> and the close | ||
38 | flag to B<c>. | ||
39 | |||
40 | BIO_get_fd() places the file descriptor in B<c> if it is not NULL, it also | ||
41 | returns the file descriptor. If B<c> is not NULL it should be of type | ||
42 | (int *). | ||
43 | |||
44 | BIO_new_fd() returns a file descriptor BIO using B<fd> and B<close_flag>. | ||
45 | |||
46 | =head1 NOTES | ||
47 | |||
48 | The behaviour of BIO_read() and BIO_write() depends on the behavior of the | ||
49 | platforms read() and write() calls on the descriptor. If the underlying | ||
50 | file descriptor is in a non blocking mode then the BIO will behave in the | ||
51 | manner described in the L<BIO_read(3)|BIO_read(3)> and L<BIO_should_retry(3)|BIO_should_retry(3)> | ||
52 | manual pages. | ||
53 | |||
54 | File descriptor BIOs should not be used for socket I/O. Use socket BIOs | ||
55 | instead. | ||
56 | |||
57 | =head1 RETURN VALUES | ||
58 | |||
59 | BIO_s_fd() returns the file descriptor BIO method. | ||
60 | |||
61 | BIO_reset() returns zero for success and -1 if an error occurred. | ||
62 | BIO_seek() and BIO_tell() return the current file position or -1 | ||
63 | is an error occurred. These values reflect the underlying lseek() | ||
64 | behaviour. | ||
65 | |||
66 | BIO_set_fd() always returns 1. | ||
67 | |||
68 | BIO_get_fd() returns the file descriptor or -1 if the BIO has not | ||
69 | been initialized. | ||
70 | |||
71 | BIO_new_fd() returns the newly allocated BIO or NULL is an error | ||
72 | occurred. | ||
73 | |||
74 | =head1 EXAMPLE | ||
75 | |||
76 | This is a file descriptor BIO version of "Hello World": | ||
77 | |||
78 | BIO *out; | ||
79 | out = BIO_new_fd(fileno(stdout), BIO_NOCLOSE); | ||
80 | BIO_printf(out, "Hello World\n"); | ||
81 | BIO_free(out); | ||
82 | |||
83 | =head1 SEE ALSO | ||
84 | |||
85 | L<BIO_seek(3)|BIO_seek(3)>, L<BIO_tell(3)|BIO_tell(3)>, | ||
86 | L<BIO_reset(3)|BIO_reset(3)>, L<BIO_read(3)|BIO_read(3)>, | ||
87 | L<BIO_write(3)|BIO_write(3)>, L<BIO_puts(3)|BIO_puts(3)>, | ||
88 | L<BIO_gets(3)|BIO_gets(3)>, L<BIO_printf(3)|BIO_printf(3)>, | ||
89 | L<BIO_set_close(3)|BIO_set_close(3)>, L<BIO_get_close(3)|BIO_get_close(3)> | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_s_file.pod b/src/lib/libssl/src/doc/crypto/BIO_s_file.pod new file mode 100644 index 0000000000..b2a29263f4 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_s_file.pod | |||
@@ -0,0 +1,144 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_s_file, BIO_new_file, BIO_new_fp, BIO_set_fp, BIO_get_fp, | ||
6 | BIO_read_filename, BIO_write_filename, BIO_append_filename, | ||
7 | BIO_rw_filename - FILE bio | ||
8 | |||
9 | =head1 SYNOPSIS | ||
10 | |||
11 | #include <openssl/bio.h> | ||
12 | |||
13 | BIO_METHOD * BIO_s_file(void); | ||
14 | BIO *BIO_new_file(const char *filename, const char *mode); | ||
15 | BIO *BIO_new_fp(FILE *stream, int flags); | ||
16 | |||
17 | BIO_set_fp(BIO *b,FILE *fp, int flags); | ||
18 | BIO_get_fp(BIO *b,FILE **fpp); | ||
19 | |||
20 | int BIO_read_filename(BIO *b, char *name) | ||
21 | int BIO_write_filename(BIO *b, char *name) | ||
22 | int BIO_append_filename(BIO *b, char *name) | ||
23 | int BIO_rw_filename(BIO *b, char *name) | ||
24 | |||
25 | =head1 DESCRIPTION | ||
26 | |||
27 | BIO_s_file() returns the BIO file method. As its name implies it | ||
28 | is a wrapper round the stdio FILE structure and it is a | ||
29 | source/sink BIO. | ||
30 | |||
31 | Calls to BIO_read() and BIO_write() read and write data to the | ||
32 | underlying stream. BIO_gets() and BIO_puts() are supported on file BIOs. | ||
33 | |||
34 | BIO_flush() on a file BIO calls the fflush() function on the wrapped | ||
35 | stream. | ||
36 | |||
37 | BIO_reset() attempts to change the file pointer to the start of file | ||
38 | using fseek(stream, 0, 0). | ||
39 | |||
40 | BIO_seek() sets the file pointer to position B<ofs> from start of file | ||
41 | using fseek(stream, ofs, 0). | ||
42 | |||
43 | BIO_eof() calls feof(). | ||
44 | |||
45 | Setting the BIO_CLOSE flag calls fclose() on the stream when the BIO | ||
46 | is freed. | ||
47 | |||
48 | BIO_new_file() creates a new file BIO with mode B<mode> the meaning | ||
49 | of B<mode> is the same as the stdio function fopen(). The BIO_CLOSE | ||
50 | flag is set on the returned BIO. | ||
51 | |||
52 | BIO_new_fp() creates a file BIO wrapping B<stream>. Flags can be: | ||
53 | BIO_CLOSE, BIO_NOCLOSE (the close flag) BIO_FP_TEXT (sets the underlying | ||
54 | stream to text mode, default is binary: this only has any effect under | ||
55 | Win32). | ||
56 | |||
57 | BIO_set_fp() set the fp of a file BIO to B<fp>. B<flags> has the same | ||
58 | meaning as in BIO_new_fp(), it is a macro. | ||
59 | |||
60 | BIO_get_fp() retrieves the fp of a file BIO, it is a macro. | ||
61 | |||
62 | BIO_seek() is a macro that sets the position pointer to B<offset> bytes | ||
63 | from the start of file. | ||
64 | |||
65 | BIO_tell() returns the value of the position pointer. | ||
66 | |||
67 | BIO_read_filename(), BIO_write_filename(), BIO_append_filename() and | ||
68 | BIO_rw_filename() set the file BIO B<b> to use file B<name> for | ||
69 | reading, writing, append or read write respectively. | ||
70 | |||
71 | =head1 NOTES | ||
72 | |||
73 | When wrapping stdout, stdin or stderr the underlying stream should not | ||
74 | normally be closed so the BIO_NOCLOSE flag should be set. | ||
75 | |||
76 | Because the file BIO calls the underlying stdio functions any quirks | ||
77 | in stdio behaviour will be mirrored by the corresponding BIO. | ||
78 | |||
79 | =head1 EXAMPLES | ||
80 | |||
81 | File BIO "hello world": | ||
82 | |||
83 | BIO *bio_out; | ||
84 | bio_out = BIO_new_fp(stdout, BIO_NOCLOSE); | ||
85 | BIO_printf(bio_out, "Hello World\n"); | ||
86 | |||
87 | Alternative technique: | ||
88 | |||
89 | BIO *bio_out; | ||
90 | bio_out = BIO_new(BIO_s_file()); | ||
91 | if(bio_out == NULL) /* Error ... */ | ||
92 | if(!BIO_set_fp(bio_out, stdout, BIO_NOCLOSE)) /* Error ... */ | ||
93 | BIO_printf(bio_out, "Hello World\n"); | ||
94 | |||
95 | Write to a file: | ||
96 | |||
97 | BIO *out; | ||
98 | out = BIO_new_file("filename.txt", "w"); | ||
99 | if(!out) /* Error occurred */ | ||
100 | BIO_printf(out, "Hello World\n"); | ||
101 | BIO_free(out); | ||
102 | |||
103 | Alternative technique: | ||
104 | |||
105 | BIO *out; | ||
106 | out = BIO_new(BIO_s_file()); | ||
107 | if(out == NULL) /* Error ... */ | ||
108 | if(!BIO_write_filename(out, "filename.txt")) /* Error ... */ | ||
109 | BIO_printf(out, "Hello World\n"); | ||
110 | BIO_free(out); | ||
111 | |||
112 | =head1 RETURN VALUES | ||
113 | |||
114 | BIO_s_file() returns the file BIO method. | ||
115 | |||
116 | BIO_new_file() and BIO_new_fp() return a file BIO or NULL if an error | ||
117 | occurred. | ||
118 | |||
119 | BIO_set_fp() and BIO_get_fp() return 1 for success or 0 for failure | ||
120 | (although the current implementation never return 0). | ||
121 | |||
122 | BIO_seek() returns the same value as the underlying fseek() function: | ||
123 | 0 for success or -1 for failure. | ||
124 | |||
125 | BIO_tell() returns the current file position. | ||
126 | |||
127 | BIO_read_filename(), BIO_write_filename(), BIO_append_filename() and | ||
128 | BIO_rw_filename() return 1 for success or 0 for failure. | ||
129 | |||
130 | =head1 BUGS | ||
131 | |||
132 | BIO_reset() and BIO_seek() are implemented using fseek() on the underlying | ||
133 | stream. The return value for fseek() is 0 for success or -1 if an error | ||
134 | occurred this differs from other types of BIO which will typically return | ||
135 | 1 for success and a non positive value if an error occurred. | ||
136 | |||
137 | =head1 SEE ALSO | ||
138 | |||
139 | L<BIO_seek(3)|BIO_seek(3)>, L<BIO_tell(3)|BIO_tell(3)>, | ||
140 | L<BIO_reset(3)|BIO_reset(3)>, L<BIO_flush(3)|BIO_flush(3)>, | ||
141 | L<BIO_read(3)|BIO_read(3)>, | ||
142 | L<BIO_write(3)|BIO_write(3)>, L<BIO_puts(3)|BIO_puts(3)>, | ||
143 | L<BIO_gets(3)|BIO_gets(3)>, L<BIO_printf(3)|BIO_printf(3)>, | ||
144 | L<BIO_set_close(3)|BIO_set_close(3)>, L<BIO_get_close(3)|BIO_get_close(3)> | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_s_mem.pod b/src/lib/libssl/src/doc/crypto/BIO_s_mem.pod new file mode 100644 index 0000000000..19648acfae --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_s_mem.pod | |||
@@ -0,0 +1,115 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_s_mem, BIO_set_mem_eof_return, BIO_get_mem_data, BIO_set_mem_buf, | ||
6 | BIO_get_mem_ptr, BIO_new_mem_buf - memory BIO | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/bio.h> | ||
11 | |||
12 | BIO_METHOD * BIO_s_mem(void); | ||
13 | |||
14 | BIO_set_mem_eof_return(BIO *b,int v) | ||
15 | long BIO_get_mem_data(BIO *b, char **pp) | ||
16 | BIO_set_mem_buf(BIO *b,BUF_MEM *bm,int c) | ||
17 | BIO_get_mem_ptr(BIO *b,BUF_MEM **pp) | ||
18 | |||
19 | BIO *BIO_new_mem_buf(void *buf, int len); | ||
20 | |||
21 | =head1 DESCRIPTION | ||
22 | |||
23 | BIO_s_mem() return the memory BIO method function. | ||
24 | |||
25 | A memory BIO is a source/sink BIO which uses memory for its I/O. Data | ||
26 | written to a memory BIO is stored in a BUF_MEM structure which is extended | ||
27 | as appropriate to accommodate the stored data. | ||
28 | |||
29 | Any data written to a memory BIO can be recalled by reading from it. | ||
30 | Unless the memory BIO is read only any data read from it is deleted from | ||
31 | the BIO. | ||
32 | |||
33 | Memory BIOs support BIO_gets() and BIO_puts(). | ||
34 | |||
35 | If the BIO_CLOSE flag is set when a memory BIO is freed then the underlying | ||
36 | BUF_MEM structure is also freed. | ||
37 | |||
38 | Calling BIO_reset() on a read write memory BIO clears any data in it. On a | ||
39 | read only BIO it restores the BIO to its original state and the read only | ||
40 | data can be read again. | ||
41 | |||
42 | BIO_eof() is true if no data is in the BIO. | ||
43 | |||
44 | BIO_ctrl_pending() returns the number of bytes currently stored. | ||
45 | |||
46 | BIO_set_mem_eof_return() sets the behaviour of memory BIO B<b> when it is | ||
47 | empty. If the B<v> is zero then an empty memory BIO will return EOF (that is | ||
48 | it will return zero and BIO_should_retry(b) will be false. If B<v> is non | ||
49 | zero then it will return B<v> when it is empty and it will set the read retry | ||
50 | flag (that is BIO_read_retry(b) is true). To avoid ambiguity with a normal | ||
51 | positive return value B<v> should be set to a negative value, typically -1. | ||
52 | |||
53 | BIO_get_mem_data() sets B<pp> to a pointer to the start of the memory BIOs data | ||
54 | and returns the total amount of data available. It is implemented as a macro. | ||
55 | |||
56 | BIO_set_mem_buf() sets the internal BUF_MEM structure to B<bm> and sets the | ||
57 | close flag to B<c>, that is B<c> should be either BIO_CLOSE or BIO_NOCLOSE. | ||
58 | It is a macro. | ||
59 | |||
60 | BIO_get_mem_ptr() places the underlying BUF_MEM structure in B<pp>. It is | ||
61 | a macro. | ||
62 | |||
63 | BIO_new_mem_buf() creates a memory BIO using B<len> bytes of data at B<buf>, | ||
64 | if B<len> is -1 then the B<buf> is assumed to be null terminated and its | ||
65 | length is determined by B<strlen>. The BIO is set to a read only state and | ||
66 | as a result cannot be written to. This is useful when some data needs to be | ||
67 | made available from a static area of memory in the form of a BIO. The | ||
68 | supplied data is read directly from the supplied buffer: it is B<not> copied | ||
69 | first, so the supplied area of memory must be unchanged until the BIO is freed. | ||
70 | |||
71 | =head1 NOTES | ||
72 | |||
73 | Writes to memory BIOs will always succeed if memory is available: that is | ||
74 | their size can grow indefinitely. | ||
75 | |||
76 | Every read from a read write memory BIO will remove the data just read with | ||
77 | an internal copy operation, if a BIO contains a lots of data and it is | ||
78 | read in small chunks the operation can be very slow. The use of a read only | ||
79 | memory BIO avoids this problem. If the BIO must be read write then adding | ||
80 | a buffering BIO to the chain will speed up the process. | ||
81 | |||
82 | =head1 BUGS | ||
83 | |||
84 | There should be an option to set the maximum size of a memory BIO. | ||
85 | |||
86 | There should be a way to "rewind" a read write BIO without destroying | ||
87 | its contents. | ||
88 | |||
89 | The copying operation should not occur after every small read of a large BIO | ||
90 | to improve efficiency. | ||
91 | |||
92 | =head1 EXAMPLE | ||
93 | |||
94 | Create a memory BIO and write some data to it: | ||
95 | |||
96 | BIO *mem = BIO_new(BIO_s_mem()); | ||
97 | BIO_puts(mem, "Hello World\n"); | ||
98 | |||
99 | Create a read only memory BIO: | ||
100 | |||
101 | char data[] = "Hello World"; | ||
102 | BIO *mem; | ||
103 | mem = BIO_new_mem_buf(data, -1); | ||
104 | |||
105 | Extract the BUF_MEM structure from a memory BIO and then free up the BIO: | ||
106 | |||
107 | BUF_MEM *bptr; | ||
108 | BIO_get_mem_ptr(mem, &bptr); | ||
109 | BIO_set_close(mem, BIO_NOCLOSE); /* So BIO_free() leaves BUF_MEM alone */ | ||
110 | BIO_free(mem); | ||
111 | |||
112 | |||
113 | =head1 SEE ALSO | ||
114 | |||
115 | TBA | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_s_null.pod b/src/lib/libssl/src/doc/crypto/BIO_s_null.pod new file mode 100644 index 0000000000..e5514f7238 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_s_null.pod | |||
@@ -0,0 +1,37 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_s_null - null data sink | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bio.h> | ||
10 | |||
11 | BIO_METHOD * BIO_s_null(void); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | BIO_s_null() returns the null sink BIO method. Data written to | ||
16 | the null sink is discarded, reads return EOF. | ||
17 | |||
18 | =head1 NOTES | ||
19 | |||
20 | A null sink BIO behaves in a similar manner to the Unix /dev/null | ||
21 | device. | ||
22 | |||
23 | A null bio can be placed on the end of a chain to discard any data | ||
24 | passed through it. | ||
25 | |||
26 | A null sink is useful if, for example, an application wishes to digest some | ||
27 | data by writing through a digest bio but not send the digested data anywhere. | ||
28 | Since a BIO chain must normally include a source/sink BIO this can be achieved | ||
29 | by adding a null sink BIO to the end of the chain | ||
30 | |||
31 | =head1 RETURN VALUES | ||
32 | |||
33 | BIO_s_null() returns the null sink BIO method. | ||
34 | |||
35 | =head1 SEE ALSO | ||
36 | |||
37 | TBA | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_s_socket.pod b/src/lib/libssl/src/doc/crypto/BIO_s_socket.pod new file mode 100644 index 0000000000..253185185c --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_s_socket.pod | |||
@@ -0,0 +1,61 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_s_socket, BIO_new_socket - socket BIO | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bio.h> | ||
10 | |||
11 | BIO_METHOD * BIO_s_socket(void); | ||
12 | |||
13 | #define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) | ||
14 | #define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c) | ||
15 | |||
16 | BIO *BIO_new_socket(int sock, int close_flag); | ||
17 | |||
18 | =head1 DESCRIPTION | ||
19 | |||
20 | BIO_s_socket() returns the socket BIO method. This is a wrapper | ||
21 | round the platform's socket routines. | ||
22 | |||
23 | BIO_read() and BIO_write() read or write the underlying socket. | ||
24 | BIO_puts() is supported but BIO_gets() is not. | ||
25 | |||
26 | If the close flag is set then the socket is shut down and closed | ||
27 | when the BIO is freed. | ||
28 | |||
29 | BIO_set_fd() sets the socket of BIO B<b> to B<fd> and the close | ||
30 | flag to B<c>. | ||
31 | |||
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 *). | ||
34 | |||
35 | BIO_new_socket() returns a socket BIO using B<sock> and B<close_flag>. | ||
36 | |||
37 | =head1 NOTES | ||
38 | |||
39 | Socket BIOs also support any relevant functionality of file descriptor | ||
40 | BIOs. | ||
41 | |||
42 | The reason for having separate file descriptor and socket BIOs is that on some | ||
43 | 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 | ||
45 | all platforms. | ||
46 | |||
47 | =head1 RETURN VALUES | ||
48 | |||
49 | BIO_s_socket() returns the socket BIO method. | ||
50 | |||
51 | BIO_set_fd() always returns 1. | ||
52 | |||
53 | BIO_get_fd() returns the socket or -1 if the BIO has not been | ||
54 | initialized. | ||
55 | |||
56 | BIO_new_socket() returns the newly allocated BIO or NULL is an error | ||
57 | occurred. | ||
58 | |||
59 | =head1 SEE ALSO | ||
60 | |||
61 | TBA | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_set_callback.pod b/src/lib/libssl/src/doc/crypto/BIO_set_callback.pod new file mode 100644 index 0000000000..9b6961ca8d --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_set_callback.pod | |||
@@ -0,0 +1,108 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_set_callback, BIO_get_callback, BIO_set_callback_arg, BIO_get_callback_arg, | ||
6 | BIO_debug_callback - BIO callback functions | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/bio.h> | ||
11 | |||
12 | #define BIO_set_callback(b,cb) ((b)->callback=(cb)) | ||
13 | #define BIO_get_callback(b) ((b)->callback) | ||
14 | #define BIO_set_callback_arg(b,arg) ((b)->cb_arg=(char *)(arg)) | ||
15 | #define BIO_get_callback_arg(b) ((b)->cb_arg) | ||
16 | |||
17 | long BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi, | ||
18 | long argl,long ret); | ||
19 | |||
20 | typedef long callback(BIO *b, int oper, const char *argp, | ||
21 | int argi, long argl, long retvalue); | ||
22 | |||
23 | =head1 DESCRIPTION | ||
24 | |||
25 | BIO_set_callback() and BIO_get_callback() set and retrieve the BIO callback, | ||
26 | they are both macros. The callback is called during most high level BIO | ||
27 | operations. It can be used for debugging purposes to trace operations on | ||
28 | a BIO or to modify its operation. | ||
29 | |||
30 | BIO_set_callback_arg() and BIO_get_callback_arg() are macros which can be | ||
31 | used to set and retrieve an argument for use in the callback. | ||
32 | |||
33 | BIO_debug_callback() is a standard debugging callback which prints | ||
34 | out information relating to each BIO operation. If the callback | ||
35 | argument is set if is interpreted as a BIO to send the information | ||
36 | to, otherwise stderr is used. | ||
37 | |||
38 | callback() is the callback function itself. The meaning of each | ||
39 | argument is described below. | ||
40 | |||
41 | The BIO the callback is attached to is passed in B<b>. | ||
42 | |||
43 | B<oper> is set to the operation being performed. For some operations | ||
44 | the callback is called twice, once before and once after the actual | ||
45 | operation, the latter case has B<oper> or'ed with BIO_CB_RETURN. | ||
46 | |||
47 | The meaning of the arguments B<argp>, B<argi> and B<argl> depends on | ||
48 | the value of B<oper>, that is the operation being performed. | ||
49 | |||
50 | B<retvalue> is the return value that would be returned to the | ||
51 | application if no callback were present. The actual value returned | ||
52 | is the return value of the callback itself. In the case of callbacks | ||
53 | called before the actual BIO operation 1 is placed in retvalue, if | ||
54 | the return value is not positive it will be immediately returned to | ||
55 | the application and the BIO operation will not be performed. | ||
56 | |||
57 | The callback should normally simply return B<retvalue> when it has | ||
58 | finished processing, unless if specifically wishes to modify the | ||
59 | value returned to the application. | ||
60 | |||
61 | =head1 CALLBACK OPERATIONS | ||
62 | |||
63 | =over 4 | ||
64 | |||
65 | =item B<BIO_free(b)> | ||
66 | |||
67 | callback(b, BIO_CB_FREE, NULL, 0L, 0L, 1L) is called before the | ||
68 | free operation. | ||
69 | |||
70 | =item B<BIO_read(b, out, outl)> | ||
71 | |||
72 | callback(b, BIO_CB_READ, out, outl, 0L, 1L) is called before | ||
73 | the read and callback(b, BIO_CB_READ|BIO_CB_RETURN, out, outl, 0L, retvalue) | ||
74 | after. | ||
75 | |||
76 | =item B<BIO_write(b, in, inl)> | ||
77 | |||
78 | callback(b, BIO_CB_WRITE, in, inl, 0L, 1L) is called before | ||
79 | the write and callback(b, BIO_CB_WRITE|BIO_CB_RETURN, in, inl, 0L, retvalue) | ||
80 | after. | ||
81 | |||
82 | =item B<BIO_gets(b, out, outl)> | ||
83 | |||
84 | callback(b, BIO_CB_GETS, out, outl, 0L, 1L) is called before | ||
85 | the operation and callback(b, BIO_CB_GETS|BIO_CB_RETURN, out, outl, 0L, retvalue) | ||
86 | after. | ||
87 | |||
88 | =item B<BIO_puts(b, in)> | ||
89 | |||
90 | callback(b, BIO_CB_WRITE, in, 0, 0L, 1L) is called before | ||
91 | the operation and callback(b, BIO_CB_WRITE|BIO_CB_RETURN, in, 0, 0L, retvalue) | ||
92 | after. | ||
93 | |||
94 | =item B<BIO_ctrl(BIO *b, int cmd, long larg, void *parg)> | ||
95 | |||
96 | callback(b,BIO_CB_CTRL,parg,cmd,larg,1L) is called before the call and | ||
97 | callback(b,BIO_CB_CTRL|BIO_CB_RETURN,parg,cmd, larg,ret) after. | ||
98 | |||
99 | =back | ||
100 | |||
101 | =head1 EXAMPLE | ||
102 | |||
103 | The BIO_debug_callback() function is a good example, its source is | ||
104 | in crypto/bio/bio_cb.c | ||
105 | |||
106 | =head1 SEE ALSO | ||
107 | |||
108 | TBA | ||
diff --git a/src/lib/libssl/src/doc/crypto/BIO_should_retry.pod b/src/lib/libssl/src/doc/crypto/BIO_should_retry.pod new file mode 100644 index 0000000000..539c391272 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_should_retry.pod | |||
@@ -0,0 +1,114 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_should_retry, BIO_should_read, BIO_should_write, | ||
6 | BIO_should_io_special, BIO_retry_type, BIO_should_retry, | ||
7 | BIO_get_retry_BIO, BIO_get_retry_reason - BIO retry functions | ||
8 | |||
9 | =head1 SYNOPSIS | ||
10 | |||
11 | #include <openssl/bio.h> | ||
12 | |||
13 | #define BIO_should_read(a) ((a)->flags & BIO_FLAGS_READ) | ||
14 | #define BIO_should_write(a) ((a)->flags & BIO_FLAGS_WRITE) | ||
15 | #define BIO_should_io_special(a) ((a)->flags & BIO_FLAGS_IO_SPECIAL) | ||
16 | #define BIO_retry_type(a) ((a)->flags & BIO_FLAGS_RWS) | ||
17 | #define BIO_should_retry(a) ((a)->flags & BIO_FLAGS_SHOULD_RETRY) | ||
18 | |||
19 | #define BIO_FLAGS_READ 0x01 | ||
20 | #define BIO_FLAGS_WRITE 0x02 | ||
21 | #define BIO_FLAGS_IO_SPECIAL 0x04 | ||
22 | #define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) | ||
23 | #define BIO_FLAGS_SHOULD_RETRY 0x08 | ||
24 | |||
25 | BIO * BIO_get_retry_BIO(BIO *bio, int *reason); | ||
26 | int BIO_get_retry_reason(BIO *bio); | ||
27 | |||
28 | =head1 DESCRIPTION | ||
29 | |||
30 | These functions determine why a BIO is not able to read or write data. | ||
31 | They will typically be called after a failed BIO_read() or BIO_write() | ||
32 | call. | ||
33 | |||
34 | BIO_should_retry() is true if the call that produced this condition | ||
35 | should then be retried at a later time. | ||
36 | |||
37 | If BIO_should_retry() is false then the cause is an error condition. | ||
38 | |||
39 | BIO_should_read() is true if the cause of the condition is that a BIO | ||
40 | needs to read data. | ||
41 | |||
42 | BIO_should_write() is true if the cause of the condition is that a BIO | ||
43 | needs to read data. | ||
44 | |||
45 | BIO_should_io_special() is true if some "special" condition, that is a | ||
46 | reason other than reading or writing is the cause of the condition. | ||
47 | |||
48 | BIO_get_retry_reason() returns a mask of the cause of a retry condition | ||
49 | consisting of the values B<BIO_FLAGS_READ>, B<BIO_FLAGS_WRITE>, | ||
50 | B<BIO_FLAGS_IO_SPECIAL> though current BIO types will only set one of | ||
51 | these. | ||
52 | |||
53 | BIO_get_retry_BIO() determines the precise reason for the special | ||
54 | condition, it returns the BIO that caused this condition and if | ||
55 | B<reason> is not NULL it contains the reason code. The meaning of | ||
56 | the reason code and the action that should be taken depends on | ||
57 | the type of BIO that resulted in this condition. | ||
58 | |||
59 | BIO_get_retry_reason() returns the reason for a special condition if | ||
60 | passed the relevant BIO, for example as returned by BIO_get_retry_BIO(). | ||
61 | |||
62 | =head1 NOTES | ||
63 | |||
64 | If BIO_should_retry() returns false then the precise "error condition" | ||
65 | depends on the BIO type that caused it and the return code of the BIO | ||
66 | operation. For example if a call to BIO_read() on a socket BIO returns | ||
67 | 0 and BIO_should_retry() is false then the cause will be that the | ||
68 | connection closed. A similar condition on a file BIO will mean that it | ||
69 | has reached EOF. Some BIO types may place additional information on | ||
70 | the error queue. For more details see the individual BIO type manual | ||
71 | pages. | ||
72 | |||
73 | If the underlying I/O structure is in a blocking mode almost all current | ||
74 | BIO types will not request a retry, because the underlying I/O | ||
75 | calls will not. If the application knows that the BIO type will never | ||
76 | signal a retry then it need not call BIO_should_retry() after a failed | ||
77 | BIO I/O call. This is typically done with file BIOs. | ||
78 | |||
79 | SSL BIOs are the only current exception to this rule: they can request a | ||
80 | retry even if the underlying I/O structure is blocking, if a handshake | ||
81 | occurs during a call to BIO_read(). An application can retry the failed | ||
82 | call immediately or avoid this situation by setting SSL_MODE_AUTO_RETRY | ||
83 | on the underlying SSL structure. | ||
84 | |||
85 | While an application may retry a failed non blocking call immediately | ||
86 | this is likely to be very inefficient because the call will fail | ||
87 | repeatedly until data can be processed or is available. An application | ||
88 | will normally wait until the necessary condition is satisfied. How | ||
89 | this is done depends on the underlying I/O structure. | ||
90 | |||
91 | For example if the cause is ultimately a socket and BIO_should_read() | ||
92 | is true then a call to select() may be made to wait until data is | ||
93 | available and then retry the BIO operation. By combining the retry | ||
94 | conditions of several non blocking BIOs in a single select() call | ||
95 | it is possible to service several BIOs in a single thread, though | ||
96 | the performance may be poor if SSL BIOs are present because long delays | ||
97 | can occur during the initial handshake process. | ||
98 | |||
99 | It is possible for a BIO to block indefinitely if the underlying I/O | ||
100 | structure cannot process or return any data. This depends on the behaviour of | ||
101 | the platforms I/O functions. This is often not desirable: one solution | ||
102 | is to use non blocking I/O and use a timeout on the select() (or | ||
103 | equivalent) call. | ||
104 | |||
105 | =head1 BUGS | ||
106 | |||
107 | The OpenSSL ASN1 functions cannot gracefully deal with non blocking I/O: | ||
108 | that is they cannot retry after a partial read or write. This is usually | ||
109 | worked around by only passing the relevant data to ASN1 functions when | ||
110 | the entire structure can be read or written. | ||
111 | |||
112 | =head1 SEE ALSO | ||
113 | |||
114 | TBA | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_CTX_start.pod b/src/lib/libssl/src/doc/crypto/BN_CTX_start.pod index c30552b122..dfcefe1a88 100644 --- a/src/lib/libssl/src/doc/crypto/BN_CTX_start.pod +++ b/src/lib/libssl/src/doc/crypto/BN_CTX_start.pod | |||
@@ -17,7 +17,8 @@ BN_CTX_start, BN_CTX_get, BN_CTX_end - use temporary BIGNUM variables | |||
17 | =head1 DESCRIPTION | 17 | =head1 DESCRIPTION |
18 | 18 | ||
19 | These functions are used to obtain temporary B<BIGNUM> variables from | 19 | These functions are used to obtain temporary B<BIGNUM> variables from |
20 | a B<BN_CTX> in order to save the overhead of repeatedly creating and | 20 | a B<BN_CTX> (which can been created by using L<BN_CTX_new(3)|BN_CTX_new(3)>) |
21 | in order to save the overhead of repeatedly creating and | ||
21 | freeing B<BIGNUM>s in functions that are called from inside a loop. | 22 | freeing B<BIGNUM>s in functions that are called from inside a loop. |
22 | 23 | ||
23 | A function must call BN_CTX_start() first. Then, BN_CTX_get() may be | 24 | A function must call BN_CTX_start() first. Then, BN_CTX_get() may be |
diff --git a/src/lib/libssl/src/doc/crypto/BN_bn2bin.pod b/src/lib/libssl/src/doc/crypto/BN_bn2bin.pod index ca77f0d61b..4f78574ed0 100644 --- a/src/lib/libssl/src/doc/crypto/BN_bn2bin.pod +++ b/src/lib/libssl/src/doc/crypto/BN_bn2bin.pod | |||
@@ -36,7 +36,7 @@ NULL, a new B<BIGNUM> is created. | |||
36 | BN_bn2hex() and BN_bn2dec() return printable strings containing the | 36 | BN_bn2hex() and BN_bn2dec() return printable strings containing the |
37 | hexadecimal and decimal encoding of B<a> respectively. For negative | 37 | hexadecimal and decimal encoding of B<a> respectively. For negative |
38 | numbers, the string is prefaced with a leading '-'. The string must be | 38 | numbers, the string is prefaced with a leading '-'. The string must be |
39 | Free()d later. | 39 | freed later using OPENSSL_free(). |
40 | 40 | ||
41 | BN_hex2bn() converts the string B<str> containing a hexadecimal number | 41 | BN_hex2bn() converts the string B<str> containing a hexadecimal number |
42 | to a B<BIGNUM> and stores it in **B<bn>. If *B<bn> is NULL, a new | 42 | to a B<BIGNUM> and stores it in **B<bn>. If *B<bn> is NULL, a new |
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 3ec6f6172b..f3cee924b9 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 | |||
@@ -39,7 +39,7 @@ BN_MONT_CTX_init() initializes an existing uninitialized B<BN_MONT_CTX>. | |||
39 | BN_MONT_CTX_set() sets up the B<mont> structure from the modulus B<m> | 39 | BN_MONT_CTX_set() sets up the B<mont> structure from the modulus B<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<N_MONT_CTX> B<from> to B<to>. | 42 | BN_MONT_CTX_copy() copies the B<BN_MONT_CTX> B<from> to B<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. |
@@ -49,7 +49,7 @@ the result in B<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 B<r> = B<a>*R^-1. |
51 | 51 | ||
52 | BN_to_montgomery() computes Mont(B<a>,R^2). | 52 | BN_to_montgomery() computes Mont(B<a>,R^2), i.e. B<a>*R. |
53 | 53 | ||
54 | For all functions, B<ctx> is a previously allocated B<BN_CTX> used for | 54 | For all functions, B<ctx> is a previously allocated B<BN_CTX> used for |
55 | temporary variables. | 55 | temporary variables. |
diff --git a/src/lib/libssl/src/doc/crypto/BN_mod_mul_reciprocal.pod b/src/lib/libssl/src/doc/crypto/BN_mod_mul_reciprocal.pod index 38034bba14..74a216ddc2 100644 --- a/src/lib/libssl/src/doc/crypto/BN_mod_mul_reciprocal.pod +++ b/src/lib/libssl/src/doc/crypto/BN_mod_mul_reciprocal.pod | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | BN_mod_mul_reciprocal, BN_RECP_CTX_new, BN_RECP_CTX_init, | 5 | BN_mod_mul_reciprocal, BN_div_recp, BN_RECP_CTX_new, BN_RECP_CTX_init, |
6 | BN_RECP_CTX_free, BN_RECP_CTX_set - modular multiplication using | 6 | BN_RECP_CTX_free, BN_RECP_CTX_set - modular multiplication using |
7 | reciprocal | 7 | reciprocal |
8 | 8 | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_zero.pod b/src/lib/libssl/src/doc/crypto/BN_zero.pod index 165fd9a228..2f33876498 100644 --- a/src/lib/libssl/src/doc/crypto/BN_zero.pod +++ b/src/lib/libssl/src/doc/crypto/BN_zero.pod | |||
@@ -2,7 +2,8 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | BN_zero, BN_one, BN_set_word, BN_get_word - BIGNUM assignment operations | 5 | BN_zero, BN_one, BN_value_one, BN_set_word, BN_get_word - BIGNUM assignment |
6 | operations | ||
6 | 7 | ||
7 | =head1 SYNOPSIS | 8 | =head1 SYNOPSIS |
8 | 9 | ||
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 a8f75bdd9d..62088eea1b 100644 --- a/src/lib/libssl/src/doc/crypto/DH_set_method.pod +++ b/src/lib/libssl/src/doc/crypto/DH_set_method.pod | |||
@@ -2,20 +2,21 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | DH_set_default_method, DH_get_default_method, DH_set_method, | 5 | DH_set_default_openssl_method, DH_get_default_openssl_method, |
6 | DH_new_method, DH_OpenSSL - select DH method | 6 | DH_set_method, DH_new_method, DH_OpenSSL - select DH method |
7 | 7 | ||
8 | =head1 SYNOPSIS | 8 | =head1 SYNOPSIS |
9 | 9 | ||
10 | #include <openssl/dh.h> | 10 | #include <openssl/dh.h> |
11 | #include <openssl/engine.h> | ||
11 | 12 | ||
12 | void DH_set_default_method(DH_METHOD *meth); | 13 | void DH_set_default_openssl_method(DH_METHOD *meth); |
13 | 14 | ||
14 | DH_METHOD *DH_get_default_method(void); | 15 | DH_METHOD *DH_get_default_openssl_method(void); |
15 | 16 | ||
16 | DH_METHOD *DH_set_method(DH *dh, DH_METHOD *meth); | 17 | int DH_set_method(DH *dh, ENGINE *engine); |
17 | 18 | ||
18 | DH *DH_new_method(DH_METHOD *meth); | 19 | DH *DH_new_method(ENGINE *engine); |
19 | 20 | ||
20 | DH_METHOD *DH_OpenSSL(void); | 21 | DH_METHOD *DH_OpenSSL(void); |
21 | 22 | ||
@@ -28,20 +29,26 @@ such as hardware accelerators may be used. | |||
28 | Initially, the default is to use the OpenSSL internal implementation. | 29 | Initially, the default is to use the OpenSSL internal implementation. |
29 | DH_OpenSSL() returns a pointer to that method. | 30 | DH_OpenSSL() returns a pointer to that method. |
30 | 31 | ||
31 | DH_set_default_method() makes B<meth> the default method for all B<DH> | 32 | DH_set_default_openssl_method() makes B<meth> the default method for all DH |
32 | structures created later. | 33 | structures created later. B<NB:> This is true only whilst the default engine |
34 | for Diffie-Hellman operations remains as "openssl". ENGINEs provide an | ||
35 | encapsulation for implementations of one or more algorithms, and all the DH | ||
36 | functions mentioned here operate within the scope of the default | ||
37 | "openssl" engine. | ||
33 | 38 | ||
34 | DH_get_default_method() returns a pointer to the current default | 39 | DH_get_default_openssl_method() returns a pointer to the current default |
35 | method. | 40 | method for the "openssl" engine. |
36 | 41 | ||
37 | DH_set_method() selects B<meth> for all operations using the structure B<dh>. | 42 | DH_set_method() selects B<engine> as the engine that will be responsible for |
43 | all operations using the structure B<dh>. If this function completes successfully, | ||
44 | then the B<dh> structure will have its own functional reference of B<engine>, so | ||
45 | the caller should remember to free their own reference to B<engine> when they are | ||
46 | finished with it. NB: An ENGINE's DH_METHOD can be retrieved (or set) by | ||
47 | ENGINE_get_DH() or ENGINE_set_DH(). | ||
38 | 48 | ||
39 | DH_get_method() returns a pointer to the method currently selected | 49 | DH_new_method() allocates and initializes a DH structure so that |
40 | for B<dh>. | 50 | B<engine> will be used for the DH operations. If B<engine> is NULL, |
41 | 51 | the default engine for Diffie-Hellman opertaions is used. | |
42 | DH_new_method() allocates and initializes a B<DH> structure so that | ||
43 | B<method> will be used for the DH operations. If B<method> is B<NULL>, | ||
44 | the default method is used. | ||
45 | 52 | ||
46 | =head1 THE DH_METHOD STRUCTURE | 53 | =head1 THE DH_METHOD STRUCTURE |
47 | 54 | ||
@@ -75,17 +82,17 @@ the default method is used. | |||
75 | 82 | ||
76 | =head1 RETURN VALUES | 83 | =head1 RETURN VALUES |
77 | 84 | ||
78 | DH_OpenSSL(), DH_get_default_method() and DH_get_method() return | 85 | DH_OpenSSL() and DH_get_default_method() return pointers to the respective |
79 | pointers to the respective B<DH_METHOD>s. | 86 | DH_METHODs. |
80 | 87 | ||
81 | DH_set_default_method() returns no value. | 88 | DH_set_default_openssl_method() returns no value. |
82 | 89 | ||
83 | DH_set_method() returns a pointer to the B<DH_METHOD> previously | 90 | DH_set_method() returns non-zero if the ENGINE associated with B<dh> |
84 | associated with B<dh>. | 91 | was successfully changed to B<engine>. |
85 | 92 | ||
86 | DH_new_method() returns B<NULL> and sets an error code that can be | 93 | DH_new_method() returns NULL and sets an error code that can be |
87 | obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation fails. Otherwise it | 94 | obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation fails. |
88 | returns a pointer to the newly allocated structure. | 95 | Otherwise it returns a pointer to the newly allocated structure. |
89 | 96 | ||
90 | =head1 SEE ALSO | 97 | =head1 SEE ALSO |
91 | 98 | ||
@@ -96,4 +103,9 @@ L<dh(3)|dh(3)>, L<DH_new(3)|DH_new(3)> | |||
96 | DH_set_default_method(), DH_get_default_method(), DH_set_method(), | 103 | DH_set_default_method(), DH_get_default_method(), DH_set_method(), |
97 | DH_new_method() and DH_OpenSSL() were added in OpenSSL 0.9.4. | 104 | DH_new_method() and DH_OpenSSL() were added in OpenSSL 0.9.4. |
98 | 105 | ||
106 | DH_set_default_openssl_method() and DH_get_default_openssl_method() | ||
107 | replaced DH_set_default_method() and DH_get_default_method() respectively, | ||
108 | and DH_set_method() and DH_new_method() were altered to use B<ENGINE>s | ||
109 | rather than B<DH_METHOD>s during development of OpenSSL 0.9.6. | ||
110 | |||
99 | =cut | 111 | =cut |
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 edec46413d..c56dfd0f47 100644 --- a/src/lib/libssl/src/doc/crypto/DSA_set_method.pod +++ b/src/lib/libssl/src/doc/crypto/DSA_set_method.pod | |||
@@ -2,20 +2,21 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | DSA_set_default_method, DSA_get_default_method, DSA_set_method, | 5 | DSA_set_default_openssl_method, DSA_get_default_openssl_method, |
6 | DSA_new_method, DSA_OpenSSL - select RSA method | 6 | DSA_set_method, DSA_new_method, DSA_OpenSSL - select DSA method |
7 | 7 | ||
8 | =head1 SYNOPSIS | 8 | =head1 SYNOPSIS |
9 | 9 | ||
10 | #include <openssl/DSA.h> | 10 | #include <openssl/dsa.h> |
11 | #include <openssl/engine.h> | ||
11 | 12 | ||
12 | void DSA_set_default_method(DSA_METHOD *meth); | 13 | void DSA_set_default_openssl_method(DSA_METHOD *meth); |
13 | 14 | ||
14 | DSA_METHOD *DSA_get_default_method(void); | 15 | DSA_METHOD *DSA_get_default_openssl_method(void); |
15 | 16 | ||
16 | DSA_METHOD *DSA_set_method(DSA *dsa, DSA_METHOD *meth); | 17 | int DSA_set_method(DSA *dsa, ENGINE *engine); |
17 | 18 | ||
18 | DSA *DSA_new_method(DSA_METHOD *meth); | 19 | DSA *DSA_new_method(ENGINE *engine); |
19 | 20 | ||
20 | DSA_METHOD *DSA_OpenSSL(void); | 21 | DSA_METHOD *DSA_OpenSSL(void); |
21 | 22 | ||
@@ -28,20 +29,21 @@ such as hardware accelerators may be used. | |||
28 | Initially, the default is to use the OpenSSL internal implementation. | 29 | Initially, the default is to use the OpenSSL internal implementation. |
29 | DSA_OpenSSL() returns a pointer to that method. | 30 | DSA_OpenSSL() returns a pointer to that method. |
30 | 31 | ||
31 | DSA_set_default_method() makes B<meth> the default method for all B<DSA> | 32 | DSA_set_default_openssl_method() makes B<meth> the default method for |
32 | structures created later. | 33 | all DSA structures created later. B<NB:> This is true only whilst the |
34 | default engine for DSA operations remains as "openssl". ENGINEs | ||
35 | provide an encapsulation for implementations of one or more algorithms at a | ||
36 | time, and all the DSA functions mentioned here operate within the scope | ||
37 | of the default "openssl" engine. | ||
33 | 38 | ||
34 | DSA_get_default_method() returns a pointer to the current default | 39 | DSA_get_default_openssl_method() returns a pointer to the current default |
35 | method. | 40 | method for the "openssl" engine. |
36 | 41 | ||
37 | DSA_set_method() selects B<meth> for all operations using the structure B<DSA>. | 42 | DSA_set_method() selects B<engine> for all operations using the structure B<dsa>. |
38 | 43 | ||
39 | DSA_get_method() returns a pointer to the method currently selected | 44 | DSA_new_method() allocates and initializes a DSA structure so that |
40 | for B<DSA>. | 45 | B<engine> will be used for the DSA operations. If B<engine> is NULL, |
41 | 46 | the default engine for DSA operations is used. | |
42 | DSA_new_method() allocates and initializes a B<DSA> structure so that | ||
43 | B<method> will be used for the DSA operations. If B<method> is B<NULL>, | ||
44 | the default method is used. | ||
45 | 47 | ||
46 | =head1 THE DSA_METHOD STRUCTURE | 48 | =head1 THE DSA_METHOD STRUCTURE |
47 | 49 | ||
@@ -87,18 +89,17 @@ struct | |||
87 | 89 | ||
88 | =head1 RETURN VALUES | 90 | =head1 RETURN VALUES |
89 | 91 | ||
90 | DSA_OpenSSL(), DSA_get_default_method() and DSA_get_method() return | 92 | DSA_OpenSSL() and DSA_get_default_openssl_method() return pointers to the |
91 | pointers to the respective B<DSA_METHOD>s. | 93 | respective DSA_METHODs. |
92 | 94 | ||
93 | DSA_set_default_method() returns no value. | 95 | DSA_set_default_openssl_method() returns no value. |
94 | 96 | ||
95 | DSA_set_method() returns a pointer to the B<DSA_METHOD> previously | 97 | DSA_set_method() returns non-zero if the ENGINE associated with B<dsa> |
96 | associated with B<dsa>. | 98 | was successfully changed to B<engine>. |
97 | 99 | ||
98 | DSA_new_method() returns B<NULL> and sets an error code that can be | 100 | DSA_new_method() returns NULL and sets an error code that can be |
99 | obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation | 101 | obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation |
100 | fails. Otherwise it returns a pointer to the newly allocated | 102 | fails. Otherwise it returns a pointer to the newly allocated structure. |
101 | structure. | ||
102 | 103 | ||
103 | =head1 SEE ALSO | 104 | =head1 SEE ALSO |
104 | 105 | ||
@@ -109,4 +110,9 @@ L<dsa(3)|dsa(3)>, L<DSA_new(3)|DSA_new(3)> | |||
109 | DSA_set_default_method(), DSA_get_default_method(), DSA_set_method(), | 110 | DSA_set_default_method(), DSA_get_default_method(), DSA_set_method(), |
110 | DSA_new_method() and DSA_OpenSSL() were added in OpenSSL 0.9.4. | 111 | DSA_new_method() and DSA_OpenSSL() were added in OpenSSL 0.9.4. |
111 | 112 | ||
113 | DSA_set_default_openssl_method() and DSA_get_default_openssl_method() | ||
114 | replaced DSA_set_default_method() and DSA_get_default_method() respectively, | ||
115 | and DSA_set_method() and DSA_new_method() were altered to use B<ENGINE>s | ||
116 | rather than B<DSA_METHOD>s during development of OpenSSL 0.9.6. | ||
117 | |||
112 | =cut | 118 | =cut |
diff --git a/src/lib/libssl/src/doc/crypto/ERR_error_string.pod b/src/lib/libssl/src/doc/crypto/ERR_error_string.pod index 0d2417599c..e01beb817a 100644 --- a/src/lib/libssl/src/doc/crypto/ERR_error_string.pod +++ b/src/lib/libssl/src/doc/crypto/ERR_error_string.pod | |||
@@ -2,13 +2,16 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | ERR_error_string - obtain human-readable error message | 5 | ERR_error_string, ERR_error_string_n, ERR_lib_error_string, |
6 | ERR_func_error_string, ERR_reason_error_string - obtain human-readable | ||
7 | error message | ||
6 | 8 | ||
7 | =head1 SYNOPSIS | 9 | =head1 SYNOPSIS |
8 | 10 | ||
9 | #include <openssl/err.h> | 11 | #include <openssl/err.h> |
10 | 12 | ||
11 | char *ERR_error_string(unsigned long e, char *buf); | 13 | char *ERR_error_string(unsigned long e, char *buf); |
14 | char *ERR_error_string_n(unsigned long e, char *buf, size_t len); | ||
12 | 15 | ||
13 | const char *ERR_lib_error_string(unsigned long e); | 16 | const char *ERR_lib_error_string(unsigned long e); |
14 | const char *ERR_func_error_string(unsigned long e); | 17 | const char *ERR_func_error_string(unsigned long e); |
@@ -17,9 +20,13 @@ ERR_error_string - obtain human-readable error message | |||
17 | =head1 DESCRIPTION | 20 | =head1 DESCRIPTION |
18 | 21 | ||
19 | ERR_error_string() generates a human-readable string representing the | 22 | ERR_error_string() generates a human-readable string representing the |
20 | error code B<e>, and places it at B<buf>. B<buf> must be at least 120 | 23 | error code I<e>, and places it at I<buf>. I<buf> must be at least 120 |
21 | bytes long. If B<buf> is B<NULL>, the error string is placed in a | 24 | bytes long. If I<buf> is B<NULL>, the error string is placed in a |
22 | static buffer. | 25 | static buffer. |
26 | ERR_error_string_n() is a variant of ERR_error_string() that writes | ||
27 | at most I<len> characters (including the terminating 0) | ||
28 | and truncates the string if necessary. | ||
29 | For ERR_error_string_n(), I<buf> may not be B<NULL>. | ||
23 | 30 | ||
24 | The string will have the following format: | 31 | The string will have the following format: |
25 | 32 | ||
@@ -45,7 +52,7 @@ all error codes currently in the queue. | |||
45 | =head1 RETURN VALUES | 52 | =head1 RETURN VALUES |
46 | 53 | ||
47 | ERR_error_string() returns a pointer to a static buffer containing the | 54 | ERR_error_string() returns a pointer to a static buffer containing the |
48 | string if B<buf == NULL>, B<buf> otherwise. | 55 | string if I<buf> B<== NULL>, I<buf> otherwise. |
49 | 56 | ||
50 | ERR_lib_error_string(), ERR_func_error_string() and | 57 | ERR_lib_error_string(), ERR_func_error_string() and |
51 | ERR_reason_error_string() return the strings, and B<NULL> if | 58 | ERR_reason_error_string() return the strings, and B<NULL> if |
@@ -61,5 +68,6 @@ L<ERR_print_errors(3)|ERR_print_errors(3)> | |||
61 | =head1 HISTORY | 68 | =head1 HISTORY |
62 | 69 | ||
63 | ERR_error_string() is available in all versions of SSLeay and OpenSSL. | 70 | ERR_error_string() is available in all versions of SSLeay and OpenSSL. |
71 | ERR_error_string_n() was added in OpenSSL 0.9.6. | ||
64 | 72 | ||
65 | =cut | 73 | =cut |
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 75ece00d97..3551bacb8d 100644 --- a/src/lib/libssl/src/doc/crypto/ERR_get_error.pod +++ b/src/lib/libssl/src/doc/crypto/ERR_get_error.pod | |||
@@ -2,7 +2,8 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | ERR_get_error, ERR_peek_error - obtain error code | 5 | ERR_get_error, ERR_peek_error, ERR_get_error_line, ERR_peek_error_line, |
6 | ERR_get_error_line_data, ERR_peek_error_line_data - obtain error code and data | ||
6 | 7 | ||
7 | =head1 SYNOPSIS | 8 | =head1 SYNOPSIS |
8 | 9 | ||
@@ -40,7 +41,7 @@ the error occurred in *B<file> and *B<line>, unless these are B<NULL>. | |||
40 | ERR_get_error_line_data() and ERR_peek_error_line_data() store | 41 | ERR_get_error_line_data() and ERR_peek_error_line_data() store |
41 | additional data and flags associated with the error code in *B<data> | 42 | additional data and flags associated with the error code in *B<data> |
42 | and *B<flags>, unless these are B<NULL>. *B<data> contains a string | 43 | and *B<flags>, unless these are B<NULL>. *B<data> contains a string |
43 | if *B<flags>&B<ERR_TXT_STRING>. If it has been allocated by Malloc(), | 44 | if *B<flags>&B<ERR_TXT_STRING>. If it has been allocated by OPENSSL_malloc(), |
44 | *B<flags>&B<ERR_TXT_MALLOCED> is true. | 45 | *B<flags>&B<ERR_TXT_MALLOCED> is true. |
45 | 46 | ||
46 | =head1 RETURN VALUES | 47 | =head1 RETURN VALUES |
diff --git a/src/lib/libssl/src/doc/crypto/ERR_remove_state.pod b/src/lib/libssl/src/doc/crypto/ERR_remove_state.pod index ebcdc0f5a5..72925fb9f4 100644 --- a/src/lib/libssl/src/doc/crypto/ERR_remove_state.pod +++ b/src/lib/libssl/src/doc/crypto/ERR_remove_state.pod | |||
@@ -16,7 +16,7 @@ ERR_remove_state() frees the error queue associated with thread B<pid>. | |||
16 | If B<pid> == 0, the current thread will have its error queue removed. | 16 | If B<pid> == 0, the current thread will have its error queue removed. |
17 | 17 | ||
18 | Since error queue data structures are allocated automatically for new | 18 | Since error queue data structures are allocated automatically for new |
19 | threads, they must be freed when threads are terminated in oder to | 19 | threads, they must be freed when threads are terminated in order to |
20 | avoid memory leaks. | 20 | avoid memory leaks. |
21 | 21 | ||
22 | =head1 RETURN VALUE | 22 | =head1 RETURN VALUE |
diff --git a/src/lib/libssl/src/doc/crypto/EVP_DigestInit.pod b/src/lib/libssl/src/doc/crypto/EVP_DigestInit.pod index 6d4e156ae3..fefc858f7e 100644 --- a/src/lib/libssl/src/doc/crypto/EVP_DigestInit.pod +++ b/src/lib/libssl/src/doc/crypto/EVP_DigestInit.pod | |||
@@ -2,7 +2,12 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | EVP_DigestInit, EVP_DigestUpdate, EVP_DigestFinal - EVP digest routines | 5 | EVP_DigestInit, EVP_DigestUpdate, EVP_DigestFinal, EVP_MAX_MD_SIZE, |
6 | EVP_MD_CTX_copy, EVP_MD_type, EVP_MD_pkey_type, EVP_MD_size, EVP_MD_block_size, | ||
7 | 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_ripemd160, EVP_get_digestbyname, EVP_get_digestbynid, EVP_get_digestbyobj - | ||
10 | EVP digest routines | ||
6 | 11 | ||
7 | =head1 SYNOPSIS | 12 | =head1 SYNOPSIS |
8 | 13 | ||
@@ -45,12 +50,12 @@ EVP_DigestInit, EVP_DigestUpdate, EVP_DigestFinal - EVP digest routines | |||
45 | 50 | ||
46 | The EVP digest routines are a high level interface to message digests. | 51 | The EVP digest routines are a high level interface to message digests. |
47 | 52 | ||
48 | EVP_DigestInit() initialises a digest context B<ctx> to use a digest | 53 | EVP_DigestInit() initializes a digest context B<ctx> to use a digest |
49 | B<type>: this will typically be supplied by a function such as | 54 | B<type>: this will typically be supplied by a function such as |
50 | EVP_sha1(). | 55 | EVP_sha1(). |
51 | 56 | ||
52 | EVP_DigestUpdate() hashes B<cnt> bytes of data at B<d> into the | 57 | EVP_DigestUpdate() hashes B<cnt> bytes of data at B<d> into the |
53 | digest context B<ctx>. This funtion can be called several times on the | 58 | digest context B<ctx>. This function can be called several times on the |
54 | same B<ctx> to hash additional data. | 59 | same B<ctx> to hash additional data. |
55 | 60 | ||
56 | EVP_DigestFinal() retrieves the digest value from B<ctx> and places | 61 | EVP_DigestFinal() retrieves the digest value from B<ctx> and places |
@@ -58,7 +63,7 @@ it in B<md>. If the B<s> parameter is not NULL then the number of | |||
58 | bytes of data written (i.e. the length of the digest) will be written | 63 | bytes of data written (i.e. the length of the digest) will be written |
59 | to the integer at B<s>, at most B<EVP_MAX_MD_SIZE> bytes will be written. | 64 | to the integer at B<s>, at most B<EVP_MAX_MD_SIZE> bytes will be written. |
60 | After calling EVP_DigestFinal() no additional calls to EVP_DigestUpdate() | 65 | After calling EVP_DigestFinal() no additional calls to EVP_DigestUpdate() |
61 | can be made, but EVP_DigestInit() can be called to initialiase a new | 66 | can be made, but EVP_DigestInit() can be called to initialize a new |
62 | digest operation. | 67 | digest operation. |
63 | 68 | ||
64 | EVP_MD_CTX_copy() can be used to copy the message digest state from | 69 | EVP_MD_CTX_copy() can be used to copy the message digest state from |
@@ -97,7 +102,7 @@ returns is of zero length. | |||
97 | 102 | ||
98 | EVP_get_digestbyname(), EVP_get_digestbynid() and EVP_get_digestbyobj() | 103 | EVP_get_digestbyname(), EVP_get_digestbynid() and EVP_get_digestbyobj() |
99 | return an B<EVP_MD> structure when passed a digest name, a digest NID or | 104 | return an B<EVP_MD> structure when passed a digest name, a digest NID or |
100 | an ASN1_OBJECT structure respectively. The digest table must be initialised | 105 | an ASN1_OBJECT structure respectively. The digest table must be initialized |
101 | using, for example, OpenSSL_add_all_digests() for these functions to work. | 106 | using, for example, OpenSSL_add_all_digests() for these functions to work. |
102 | 107 | ||
103 | =head1 RETURN VALUES | 108 | =head1 RETURN VALUES |
diff --git a/src/lib/libssl/src/doc/crypto/EVP_EncryptInit.pod b/src/lib/libssl/src/doc/crypto/EVP_EncryptInit.pod index 77ed4ccdba..9afe2396e2 100644 --- a/src/lib/libssl/src/doc/crypto/EVP_EncryptInit.pod +++ b/src/lib/libssl/src/doc/crypto/EVP_EncryptInit.pod | |||
@@ -2,34 +2,46 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | EVP_EncryptInit, EVP_EncryptUpdate, EVP_EncryptFinal - EVP cipher routines | 5 | EVP_EncryptInit, EVP_EncryptUpdate, EVP_EncryptFinal, EVP_DecryptInit, |
6 | EVP_DecryptUpdate, EVP_DecryptFinal, EVP_CipherInit, EVP_CipherUpdate, | ||
7 | EVP_CipherFinal, EVP_CIPHER_CTX_set_key_length, EVP_CIPHER_CTX_ctrl, | ||
8 | EVP_CIPHER_CTX_cleanup, EVP_get_cipherbyname, EVP_get_cipherbynid, | ||
9 | EVP_get_cipherbyobj, EVP_CIPHER_nid, EVP_CIPHER_block_size, | ||
10 | EVP_CIPHER_key_length, EVP_CIPHER_iv_length, EVP_CIPHER_flags, | ||
11 | EVP_CIPHER_mode, EVP_CIPHER_type, EVP_CIPHER_CTX_cipher, EVP_CIPHER_CTX_nid, | ||
12 | EVP_CIPHER_CTX_block_size, EVP_CIPHER_CTX_key_length, EVP_CIPHER_CTX_iv_length, | ||
13 | EVP_CIPHER_CTX_get_app_data, EVP_CIPHER_CTX_set_app_data, EVP_CIPHER_CTX_type, | ||
14 | EVP_CIPHER_CTX_flags, EVP_CIPHER_CTX_mode, EVP_CIPHER_param_to_asn1, | ||
15 | EVP_CIPHER_asn1_to_param - EVP cipher routines | ||
6 | 16 | ||
7 | =head1 SYNOPSIS | 17 | =head1 SYNOPSIS |
8 | 18 | ||
9 | #include <openssl/evp.h> | 19 | #include <openssl/evp.h> |
10 | 20 | ||
11 | void EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | 21 | int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, |
12 | unsigned char *key, unsigned char *iv); | 22 | unsigned char *key, unsigned char *iv); |
13 | void EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 23 | int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, |
14 | int *outl, unsigned char *in, int inl); | 24 | int *outl, unsigned char *in, int inl); |
15 | void EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, | 25 | int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, |
16 | int *outl); | 26 | int *outl); |
17 | 27 | ||
18 | void EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | 28 | int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, |
19 | unsigned char *key, unsigned char *iv); | 29 | unsigned char *key, unsigned char *iv); |
20 | void EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 30 | int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, |
21 | int *outl, unsigned char *in, int inl); | 31 | int *outl, unsigned char *in, int inl); |
22 | int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, | 32 | int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, |
23 | int *outl); | 33 | int *outl); |
24 | 34 | ||
25 | void EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | 35 | int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, |
26 | unsigned char *key, unsigned char *iv, int enc); | 36 | unsigned char *key, unsigned char *iv, int enc); |
27 | void EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 37 | int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, |
28 | int *outl, unsigned char *in, int inl); | 38 | int *outl, unsigned char *in, int inl); |
29 | int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, | 39 | int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, |
30 | int *outl); | 40 | int *outl); |
31 | 41 | ||
32 | void EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); | 42 | 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); | ||
44 | int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); | ||
33 | 45 | ||
34 | const EVP_CIPHER *EVP_get_cipherbyname(const char *name); | 46 | const EVP_CIPHER *EVP_get_cipherbyname(const char *name); |
35 | #define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) | 47 | #define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) |
@@ -38,15 +50,21 @@ EVP_EncryptInit, EVP_EncryptUpdate, EVP_EncryptFinal - EVP cipher routines | |||
38 | #define EVP_CIPHER_nid(e) ((e)->nid) | 50 | #define EVP_CIPHER_nid(e) ((e)->nid) |
39 | #define EVP_CIPHER_block_size(e) ((e)->block_size) | 51 | #define EVP_CIPHER_block_size(e) ((e)->block_size) |
40 | #define EVP_CIPHER_key_length(e) ((e)->key_len) | 52 | #define EVP_CIPHER_key_length(e) ((e)->key_len) |
41 | #define EVP_CIPHER_iv_length(e) ((e)->iv_len) | 53 | #define EVP_CIPHER_iv_length(e) ((e)->iv_len) |
42 | 54 | #define EVP_CIPHER_flags(e) ((e)->flags) | |
55 | #define EVP_CIPHER_mode(e) ((e)->flags) & EVP_CIPH_MODE) | ||
43 | int EVP_CIPHER_type(const EVP_CIPHER *ctx); | 56 | int EVP_CIPHER_type(const EVP_CIPHER *ctx); |
57 | |||
44 | #define EVP_CIPHER_CTX_cipher(e) ((e)->cipher) | 58 | #define EVP_CIPHER_CTX_cipher(e) ((e)->cipher) |
45 | #define EVP_CIPHER_CTX_nid(e) ((e)->cipher->nid) | 59 | #define EVP_CIPHER_CTX_nid(e) ((e)->cipher->nid) |
46 | #define EVP_CIPHER_CTX_block_size(e) ((e)->cipher->block_size) | 60 | #define EVP_CIPHER_CTX_block_size(e) ((e)->cipher->block_size) |
47 | #define EVP_CIPHER_CTX_key_length(e) ((e)->cipher->key_len) | 61 | #define EVP_CIPHER_CTX_key_length(e) ((e)->key_len) |
48 | #define EVP_CIPHER_CTX_iv_length(e) ((e)->cipher->iv_len) | 62 | #define EVP_CIPHER_CTX_iv_length(e) ((e)->cipher->iv_len) |
63 | #define EVP_CIPHER_CTX_get_app_data(e) ((e)->app_data) | ||
64 | #define EVP_CIPHER_CTX_set_app_data(e,d) ((e)->app_data=(char *)(d)) | ||
49 | #define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) | 65 | #define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) |
66 | #define EVP_CIPHER_CTX_flags(e) ((e)->cipher->flags) | ||
67 | #define EVP_CIPHER_CTX_mode(e) ((e)->cipher->flags & EVP_CIPH_MODE) | ||
50 | 68 | ||
51 | int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | 69 | int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); |
52 | int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | 70 | int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); |
@@ -56,16 +74,14 @@ EVP_EncryptInit, EVP_EncryptUpdate, EVP_EncryptFinal - EVP cipher routines | |||
56 | The EVP cipher routines are a high level interface to certain | 74 | The EVP cipher routines are a high level interface to certain |
57 | symmetric ciphers. | 75 | symmetric ciphers. |
58 | 76 | ||
59 | EVP_EncryptInit() initialises a cipher context B<ctx> for encryption | 77 | EVP_EncryptInit() initializes a cipher context B<ctx> for encryption |
60 | with cipher B<type>. B<type> is normally supplied by a function such | 78 | with cipher B<type>. B<type> is normally supplied by a function such |
61 | as EVP_des_cbc() . B<key> is the symmetric key to use and B<iv> is the | 79 | as EVP_des_cbc() . B<key> is the symmetric key to use and B<iv> is the |
62 | IV to use (if necessary), the actual number of bytes used for the | 80 | IV to use (if necessary), the actual number of bytes used for the |
63 | key and IV depends on the cipher. It is possible to set all parameters | 81 | key and IV depends on the cipher. It is possible to set all parameters |
64 | to NULL except B<type> in an initial call and supply the remaining | 82 | to NULL except B<type> in an initial call and supply the remaining |
65 | parameters in subsequent calls. This is normally done when the | 83 | parameters in subsequent calls, all of which have B<type> set to NULL. |
66 | EVP_CIPHER_asn1_to_param() function is called to set the cipher | 84 | This is done when the default cipher parameters are not appropriate. |
67 | parameters from an ASN1 AlgorithmIdentifier and the key from a | ||
68 | different source. | ||
69 | 85 | ||
70 | EVP_EncryptUpdate() encrypts B<inl> bytes from the buffer B<in> and | 86 | EVP_EncryptUpdate() encrypts B<inl> bytes from the buffer B<in> and |
71 | writes the encrypted version to B<out>. This function can be called | 87 | writes the encrypted version to B<out>. This function can be called |
@@ -93,7 +109,8 @@ cipher block size is 1 in which case B<inl> bytes is sufficient. | |||
93 | EVP_CipherInit(), EVP_CipherUpdate() and EVP_CipherFinal() are functions | 109 | EVP_CipherInit(), EVP_CipherUpdate() and EVP_CipherFinal() are functions |
94 | that can be used for decryption or encryption. The operation performed | 110 | that can be used for decryption or encryption. The operation performed |
95 | depends on the value of the B<enc> parameter. It should be set to 1 for | 111 | depends on the value of the B<enc> parameter. It should be set to 1 for |
96 | encryption and 0 for decryption. | 112 | encryption, 0 for decryption and -1 to leave the value unchanged (the |
113 | actual value of 'enc' being supplied in a previous call). | ||
97 | 114 | ||
98 | EVP_CIPHER_CTX_cleanup() clears all information from a cipher context. | 115 | EVP_CIPHER_CTX_cleanup() clears all information from a cipher context. |
99 | It should be called after all operations using a cipher are complete | 116 | It should be called after all operations using a cipher are complete |
@@ -111,7 +128,13 @@ IDENTIFIER. | |||
111 | EVP_CIPHER_key_length() and EVP_CIPHER_CTX_key_length() return the key | 128 | EVP_CIPHER_key_length() and EVP_CIPHER_CTX_key_length() return the key |
112 | length of a cipher when passed an B<EVP_CIPHER> or B<EVP_CIPHER_CTX> | 129 | length of a cipher when passed an B<EVP_CIPHER> or B<EVP_CIPHER_CTX> |
113 | structure. The constant B<EVP_MAX_KEY_LENGTH> is the maximum key length | 130 | structure. The constant B<EVP_MAX_KEY_LENGTH> is the maximum key length |
114 | for all ciphers. | 131 | for all ciphers. Note: although EVP_CIPHER_key_length() is fixed for a |
132 | given cipher, the value of EVP_CIPHER_CTX_key_length() may be different | ||
133 | for variable key length ciphers. | ||
134 | |||
135 | EVP_CIPHER_CTX_set_key_length() sets the key length of the cipher ctx. | ||
136 | If the cipher is a fixed length cipher then attempting to set the key | ||
137 | length to any value other than the fixed value is an error. | ||
115 | 138 | ||
116 | EVP_CIPHER_iv_length() and EVP_CIPHER_CTX_iv_length() return the IV | 139 | EVP_CIPHER_iv_length() and EVP_CIPHER_CTX_iv_length() return the IV |
117 | length of a cipher when passed an B<EVP_CIPHER> or B<EVP_CIPHER_CTX>. | 140 | length of a cipher when passed an B<EVP_CIPHER> or B<EVP_CIPHER_CTX>. |
@@ -133,6 +156,11 @@ B<NID_undef>. | |||
133 | EVP_CIPHER_CTX_cipher() returns the B<EVP_CIPHER> structure when passed | 156 | EVP_CIPHER_CTX_cipher() returns the B<EVP_CIPHER> structure when passed |
134 | an B<EVP_CIPHER_CTX> structure. | 157 | an B<EVP_CIPHER_CTX> structure. |
135 | 158 | ||
159 | EVP_CIPHER_mode() and EVP_CIPHER_CTX_mode() return the block cipher mode: | ||
160 | EVP_CIPH_ECB_MODE, EVP_CIPH_CBC_MODE, EVP_CIPH_CFB_MODE or | ||
161 | EVP_CIPH_OFB_MODE. If the cipher is a stream cipher then | ||
162 | EVP_CIPH_STREAM_CIPHER is returned. | ||
163 | |||
136 | EVP_CIPHER_param_to_asn1() sets the AlgorithmIdentifier "parameter" based | 164 | EVP_CIPHER_param_to_asn1() sets the AlgorithmIdentifier "parameter" based |
137 | on the passed cipher. This will typically include any parameters and an | 165 | on the passed cipher. This will typically include any parameters and an |
138 | IV. The cipher IV (if any) must be set when this call is made. This call | 166 | IV. The cipher IV (if any) must be set when this call is made. This call |
@@ -149,21 +177,24 @@ key set to NULL, EVP_CIPHER_asn1_to_param() will be called and finally | |||
149 | EVP_CipherInit() again with all parameters except the key set to NULL. It is | 177 | EVP_CipherInit() again with all parameters except the key set to NULL. It is |
150 | possible for this function to fail if the cipher does not have any ASN1 support | 178 | possible for this function to fail if the cipher does not have any ASN1 support |
151 | or the parameters cannot be set (for example the RC2 effective key length | 179 | or the parameters cannot be set (for example the RC2 effective key length |
152 | does not have an B<EVP_CIPHER> structure). | 180 | is not supported. |
181 | |||
182 | EVP_CIPHER_CTX_ctrl() allows various cipher specific parameters to be determined | ||
183 | and set. Currently only the RC2 effective key length and the number of rounds of | ||
184 | RC5 can be set. | ||
153 | 185 | ||
154 | =head1 RETURN VALUES | 186 | =head1 RETURN VALUES |
155 | 187 | ||
156 | EVP_EncryptInit(), EVP_EncryptUpdate() and EVP_EncryptFinal() do not return | 188 | EVP_EncryptInit(), EVP_EncryptUpdate() and EVP_EncryptFinal() return 1 for success |
157 | values. | 189 | and 0 for failure. |
158 | 190 | ||
159 | EVP_DecryptInit() and EVP_DecryptUpdate() do not return values. | 191 | EVP_DecryptInit() and EVP_DecryptUpdate() return 1 for success and 0 for failure. |
160 | EVP_DecryptFinal() returns 0 if the decrypt failed or 1 for success. | 192 | EVP_DecryptFinal() returns 0 if the decrypt failed or 1 for success. |
161 | 193 | ||
162 | EVP_CipherInit() and EVP_CipherUpdate() do not return values. | 194 | EVP_CipherInit() and EVP_CipherUpdate() return 1 for success and 0 for failure. |
163 | EVP_CipherFinal() returns 1 for a decryption failure or 1 for success, if | 195 | EVP_CipherFinal() returns 1 for a decryption failure or 1 for success. |
164 | the operation is encryption then it always returns 1. | ||
165 | 196 | ||
166 | EVP_CIPHER_CTX_cleanup() does not return a value. | 197 | EVP_CIPHER_CTX_cleanup() returns 1 for success and 0 for failure. |
167 | 198 | ||
168 | EVP_get_cipherbyname(), EVP_get_cipherbynid() and EVP_get_cipherbyobj() | 199 | EVP_get_cipherbyname(), EVP_get_cipherbynid() and EVP_get_cipherbyobj() |
169 | return an B<EVP_CIPHER> structure or NULL on error. | 200 | return an B<EVP_CIPHER> structure or NULL on error. |
@@ -187,6 +218,75 @@ EVP_CIPHER_CTX_cipher() returns an B<EVP_CIPHER> structure. | |||
187 | EVP_CIPHER_param_to_asn1() and EVP_CIPHER_asn1_to_param() return 1 for | 218 | EVP_CIPHER_param_to_asn1() and EVP_CIPHER_asn1_to_param() return 1 for |
188 | success or zero for failure. | 219 | success or zero for failure. |
189 | 220 | ||
221 | =head1 CIPHER LISTING | ||
222 | |||
223 | All algorithms have a fixed key length unless otherwise stated. | ||
224 | |||
225 | =over 4 | ||
226 | |||
227 | =item EVP_enc_null() | ||
228 | |||
229 | Null cipher: does nothing. | ||
230 | |||
231 | =item EVP_des_cbc(void), EVP_des_ecb(void), EVP_des_cfb(void), EVP_des_ofb(void) | ||
232 | |||
233 | DES in CBC, ECB, CFB and OFB modes respectively. | ||
234 | |||
235 | =item EVP_des_ede_cbc(void), EVP_des_ede(), EVP_des_ede_ofb(void), EVP_des_ede_cfb(void) | ||
236 | |||
237 | Two key triple DES in CBC, ECB, CFB and OFB modes respectively. | ||
238 | |||
239 | =item EVP_des_ede3_cbc(void), EVP_des_ede3(), EVP_des_ede3_ofb(void), EVP_des_ede3_cfb(void) | ||
240 | |||
241 | Three key triple DES in CBC, ECB, CFB and OFB modes respectively. | ||
242 | |||
243 | =item EVP_desx_cbc(void) | ||
244 | |||
245 | DESX algorithm in CBC mode. | ||
246 | |||
247 | =item EVP_rc4(void) | ||
248 | |||
249 | RC4 stream cipher. This is a variable key length cipher with default key length 128 bits. | ||
250 | |||
251 | =item EVP_rc4_40(void) | ||
252 | |||
253 | RC4 stream cipher with 40 bit key length. This is obsolete and new code should use EVP_rc4() | ||
254 | and the EVP_CIPHER_CTX_set_key_length() function. | ||
255 | |||
256 | =item EVP_idea_cbc() EVP_idea_ecb(void), EVP_idea_cfb(void), EVP_idea_ofb(void), EVP_idea_cbc(void) | ||
257 | |||
258 | IDEA encryption algorithm in CBC, ECB, CFB and OFB modes respectively. | ||
259 | |||
260 | =item EVP_rc2_cbc(void), EVP_rc2_ecb(void), EVP_rc2_cfb(void), EVP_rc2_ofb(void) | ||
261 | |||
262 | RC2 encryption algorithm in CBC, ECB, CFB and OFB modes respectively. This is a variable key | ||
263 | length cipher with an additional parameter called "effective key bits" or "effective key length". | ||
264 | By default both are set to 128 bits. | ||
265 | |||
266 | =item EVP_rc2_40_cbc(void), EVP_rc2_64_cbc(void) | ||
267 | |||
268 | RC2 algorithm in CBC mode with a default key length and effective key length of 40 and 64 bits. | ||
269 | These are obsolete and new code should use EVP_rc2_cbc(), EVP_CIPHER_CTX_set_key_length() and | ||
270 | EVP_CIPHER_CTX_ctrl() to set the key length and effective key length. | ||
271 | |||
272 | =item EVP_bf_cbc(void), EVP_bf_ecb(void), EVP_bf_cfb(void), EVP_bf_ofb(void); | ||
273 | |||
274 | Blowfish encryption algorithm in CBC, ECB, CFB and OFB modes respectively. This is a variable key | ||
275 | length cipher. | ||
276 | |||
277 | =item EVP_cast5_cbc(void), EVP_cast5_ecb(void), EVP_cast5_cfb(void), EVP_cast5_ofb(void) | ||
278 | |||
279 | CAST encryption algorithm in CBC, ECB, CFB and OFB modes respectively. This is a variable key | ||
280 | length cipher. | ||
281 | |||
282 | =item EVP_rc5_32_12_16_cbc(void), EVP_rc5_32_12_16_ecb(void), EVP_rc5_32_12_16_cfb(void), EVP_rc5_32_12_16_ofb(void) | ||
283 | |||
284 | RC5 encryption algorithm in CBC, ECB, CFB and OFB modes respectively. This is a variable key length | ||
285 | cipher with an additional "number of rounds" parameter. By default the key length is set to 128 | ||
286 | bits and 12 rounds. | ||
287 | |||
288 | =back | ||
289 | |||
190 | =head1 NOTES | 290 | =head1 NOTES |
191 | 291 | ||
192 | Where possible the B<EVP> interface to symmetric ciphers should be used in | 292 | Where possible the B<EVP> interface to symmetric ciphers should be used in |
@@ -206,14 +306,49 @@ test that the input data or key is correct. A random block has better than | |||
206 | 1 in 256 chance of being of the correct format and problems with the | 306 | 1 in 256 chance of being of the correct format and problems with the |
207 | input data earlier on will not produce a final decrypt error. | 307 | input data earlier on will not produce a final decrypt error. |
208 | 308 | ||
309 | The functions EVP_EncryptInit(), EVP_EncryptUpdate(), EVP_EncryptFinal(), | ||
310 | EVP_DecryptInit(), EVP_DecryptUpdate(), EVP_CipherInit() and EVP_CipherUpdate() | ||
311 | and EVP_CIPHER_CTX_cleanup() did not return errors in OpenSSL version 0.9.5a or | ||
312 | earlier. Software only versions of encryption algorithms will never return | ||
313 | error codes for these functions, unless there is a programming error (for example | ||
314 | and attempt to set the key before the cipher is set in EVP_EncryptInit() ). | ||
315 | |||
209 | =head1 BUGS | 316 | =head1 BUGS |
210 | 317 | ||
211 | The current B<EVP> cipher interface is not as flexible as it should be. Only | 318 | For RC5 the number of rounds can currently only be set to 8, 12 or 16. This is |
212 | certain "spot" encryption algorithms can be used for ciphers which have various | 319 | a limitation of the current RC5 code rather than the EVP interface. |
213 | parameters associated with them (RC2, RC5 for example) this is inadequate. | 320 | |
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 | ||
324 | 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 | ||
326 | generic key as a fixed unsigned char array containing EVP_MAX_KEY_LENGTH bytes. | ||
327 | |||
328 | The ASN1 code is incomplete (and sometimes inaccurate) it has only been tested | ||
329 | for certain common S/MIME ciphers (RC2, DES, triple DES) in CBC mode. | ||
330 | |||
331 | =head1 EXAMPLES | ||
332 | |||
333 | Get the number of rounds used in RC5: | ||
334 | |||
335 | int nrounds; | ||
336 | EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GET_RC5_ROUNDS, 0, &i); | ||
337 | |||
338 | Get the RC2 effective key length: | ||
339 | |||
340 | int key_bits; | ||
341 | EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GET_RC2_KEY_BITS, 0, &i); | ||
342 | |||
343 | Set the number of rounds used in RC5: | ||
344 | |||
345 | int nrounds; | ||
346 | EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_RC5_ROUNDS, i, NULL); | ||
347 | |||
348 | Set the number of rounds used in RC2: | ||
214 | 349 | ||
215 | Several of the functions do not return error codes because the software versions | 350 | int nrounds; |
216 | can never fail. This is not true of hardware versions. | 351 | EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_RC2_KEY_BITS, i, NULL); |
217 | 352 | ||
218 | =head1 SEE ALSO | 353 | =head1 SEE ALSO |
219 | 354 | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_OpenInit.pod b/src/lib/libssl/src/doc/crypto/EVP_OpenInit.pod index 50edb124e4..2e710da945 100644 --- a/src/lib/libssl/src/doc/crypto/EVP_OpenInit.pod +++ b/src/lib/libssl/src/doc/crypto/EVP_OpenInit.pod | |||
@@ -10,9 +10,9 @@ EVP_OpenInit, EVP_OpenUpdate, EVP_OpenFinal - EVP envelope decryption | |||
10 | 10 | ||
11 | int EVP_OpenInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type,unsigned char *ek, | 11 | int EVP_OpenInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type,unsigned char *ek, |
12 | int ekl,unsigned char *iv,EVP_PKEY *priv); | 12 | int ekl,unsigned char *iv,EVP_PKEY *priv); |
13 | void EVP_OpenUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 13 | int EVP_OpenUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, |
14 | int *outl, unsigned char *in, int inl); | 14 | int *outl, unsigned char *in, int inl); |
15 | void EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, | 15 | int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, |
16 | int *outl); | 16 | int *outl); |
17 | 17 | ||
18 | =head1 DESCRIPTION | 18 | =head1 DESCRIPTION |
@@ -21,7 +21,7 @@ The EVP envelope routines are a high level interface to envelope | |||
21 | decryption. They decrypt a public key encrypted symmetric key and | 21 | decryption. They decrypt a public key encrypted symmetric key and |
22 | then decrypt data using it. | 22 | then decrypt data using it. |
23 | 23 | ||
24 | EVP_OpenInit() initialises a cipher context B<ctx> for decryption | 24 | EVP_OpenInit() initializes a cipher context B<ctx> for decryption |
25 | with cipher B<type>. It decrypts the encrypted symmetric key of length | 25 | with cipher B<type>. It decrypts the encrypted symmetric key of length |
26 | B<ekl> bytes passed in the B<ek> parameter using the private key B<priv>. | 26 | B<ekl> bytes passed in the B<ek> parameter using the private key B<priv>. |
27 | The IV is supplied in the B<iv> parameter. | 27 | The IV is supplied in the B<iv> parameter. |
@@ -29,20 +29,32 @@ The IV is supplied in the B<iv> parameter. | |||
29 | EVP_OpenUpdate() and EVP_OpenFinal() have exactly the same properties | 29 | EVP_OpenUpdate() and EVP_OpenFinal() have exactly the same properties |
30 | as the EVP_DecryptUpdate() and EVP_DecryptFinal() routines, as | 30 | as the EVP_DecryptUpdate() and EVP_DecryptFinal() routines, as |
31 | documented on the L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> manual | 31 | documented on the L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> manual |
32 | page. | 32 | page. |
33 | |||
34 | =head1 NOTES | ||
35 | |||
36 | It is possible to call EVP_OpenInit() twice in the same way as | ||
37 | EVP_DecryptInit(). The first call should have B<priv> set to NULL | ||
38 | and (after setting any cipher parameters) it should be called again | ||
39 | with B<type> set to NULL. | ||
40 | |||
41 | If the cipher passed in the B<type> parameter is a variable length | ||
42 | cipher then the key length will be set to the value of the recovered | ||
43 | key length. If the cipher is a fixed length cipher then the recovered | ||
44 | key length must match the fixed cipher length. | ||
33 | 45 | ||
34 | =head1 RETURN VALUES | 46 | =head1 RETURN VALUES |
35 | 47 | ||
36 | EVP_OpenInit() returns -1 on error or an non zero integer (actually the | 48 | EVP_OpenInit() returns 0 on error or a non zero integer (actually the |
37 | recovered secret key size) if successful. | 49 | recovered secret key size) if successful. |
38 | 50 | ||
39 | EVP_SealUpdate() does not return a value. | 51 | EVP_OpenUpdate() returns 1 for success or 0 for failure. |
40 | 52 | ||
41 | EVP_SealFinal() returns 0 if the decrypt failed or 1 for success. | 53 | EVP_OpenFinal() returns 0 if the decrypt failed or 1 for success. |
42 | 54 | ||
43 | =head1 SEE ALSO | 55 | =head1 SEE ALSO |
44 | 56 | ||
45 | L<evp(3)|evp(3)>, | 57 | L<evp(3)|evp(3)>, L<rand(3)|rand(3)>, |
46 | L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>, | 58 | L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>, |
47 | L<EVP_SealInit(3)|EVP_SealInit(3)> | 59 | L<EVP_SealInit(3)|EVP_SealInit(3)> |
48 | 60 | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_SealInit.pod b/src/lib/libssl/src/doc/crypto/EVP_SealInit.pod index 42beed33bd..0451eb648a 100644 --- a/src/lib/libssl/src/doc/crypto/EVP_SealInit.pod +++ b/src/lib/libssl/src/doc/crypto/EVP_SealInit.pod | |||
@@ -10,9 +10,9 @@ EVP_SealInit, EVP_SealUpdate, EVP_SealFinal - EVP envelope encryption | |||
10 | 10 | ||
11 | int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek, | 11 | int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek, |
12 | int *ekl, unsigned char *iv,EVP_PKEY **pubk, int npubk); | 12 | int *ekl, unsigned char *iv,EVP_PKEY **pubk, int npubk); |
13 | void EVP_SealUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 13 | int EVP_SealUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, |
14 | int *outl, unsigned char *in, int inl); | 14 | int *outl, unsigned char *in, int inl); |
15 | void EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, | 15 | int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, |
16 | int *outl); | 16 | int *outl); |
17 | 17 | ||
18 | =head1 DESCRIPTION | 18 | =head1 DESCRIPTION |
@@ -22,7 +22,7 @@ encryption. They generate a random key and then "envelope" it by | |||
22 | using public key encryption. Data can then be encrypted using this | 22 | using public key encryption. Data can then be encrypted using this |
23 | key. | 23 | key. |
24 | 24 | ||
25 | EVP_SealInit() initialises a cipher context B<ctx> for encryption | 25 | EVP_SealInit() initializes a cipher context B<ctx> for encryption |
26 | with cipher B<type> using a random secret key and IV supplied in | 26 | with cipher B<type> using a random secret key and IV supplied in |
27 | the B<iv> parameter. B<type> is normally supplied by a function such | 27 | the B<iv> parameter. B<type> is normally supplied by a function such |
28 | as EVP_des_cbc(). The secret key is encrypted using one or more public | 28 | as EVP_des_cbc(). The secret key is encrypted using one or more public |
@@ -41,9 +41,10 @@ page. | |||
41 | 41 | ||
42 | =head1 RETURN VALUES | 42 | =head1 RETURN VALUES |
43 | 43 | ||
44 | EVP_SealInit() returns -1 on error or B<npubk> if successful. | 44 | EVP_SealInit() returns 0 on error or B<npubk> if successful. |
45 | 45 | ||
46 | EVP_SealUpdate() and EVP_SealFinal() do not return values. | 46 | EVP_SealUpdate() and EVP_SealFinal() return 1 for success and 0 for |
47 | failure. | ||
47 | 48 | ||
48 | =head1 NOTES | 49 | =head1 NOTES |
49 | 50 | ||
@@ -59,9 +60,14 @@ but symmetric encryption is fast. So symmetric encryption is used for | |||
59 | bulk encryption and the small random symmetric key used is transferred | 60 | bulk encryption and the small random symmetric key used is transferred |
60 | using public key encryption. | 61 | using public key encryption. |
61 | 62 | ||
63 | It is possible to call EVP_SealInit() twice in the same way as | ||
64 | EVP_EncryptInit(). The first call should have B<npubk> set to 0 | ||
65 | and (after setting any cipher parameters) it should be called again | ||
66 | with B<type> set to NULL. | ||
67 | |||
62 | =head1 SEE ALSO | 68 | =head1 SEE ALSO |
63 | 69 | ||
64 | L<evp(3)|evp(3)>, | 70 | L<evp(3)|evp(3)>, L<rand(3)|rand(3)>, |
65 | L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>, | 71 | L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>, |
66 | L<EVP_OpenInit(3)|EVP_OpenInit(3)> | 72 | L<EVP_OpenInit(3)|EVP_OpenInit(3)> |
67 | 73 | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_SignInit.pod b/src/lib/libssl/src/doc/crypto/EVP_SignInit.pod index 1167cefb45..d5ce245ecd 100644 --- a/src/lib/libssl/src/doc/crypto/EVP_SignInit.pod +++ b/src/lib/libssl/src/doc/crypto/EVP_SignInit.pod | |||
@@ -19,12 +19,12 @@ EVP_SignInit, EVP_SignUpdate, EVP_SignFinal - EVP signing functions | |||
19 | The EVP signature routines are a high level interface to digital | 19 | The EVP signature routines are a high level interface to digital |
20 | signatures. | 20 | signatures. |
21 | 21 | ||
22 | EVP_SignInit() initialises a signing context B<ctx> to using digest | 22 | EVP_SignInit() initializes a signing context B<ctx> to using digest |
23 | B<type>: this will typically be supplied by a function such as | 23 | B<type>: this will typically be supplied by a function such as |
24 | EVP_sha1(). | 24 | EVP_sha1(). |
25 | 25 | ||
26 | EVP_SignUpdate() hashes B<cnt> bytes of data at B<d> into the | 26 | EVP_SignUpdate() hashes B<cnt> bytes of data at B<d> into the |
27 | signature context B<ctx>. This funtion can be called several times on the | 27 | signature context B<ctx>. This function can be called several times on the |
28 | same B<ctx> to include additional data. | 28 | same B<ctx> to include additional data. |
29 | 29 | ||
30 | EVP_SignFinal() signs the data in B<ctx> using the private key B<pkey> | 30 | EVP_SignFinal() signs the data in B<ctx> using the private key B<pkey> |
@@ -32,7 +32,7 @@ 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) | 32 | 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 | 33 | 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 | 34 | will be written. After calling EVP_SignFinal() no additional calls to |
35 | EVP_SignUpdate() can be made, but EVP_SignInit() can be called to initialiase | 35 | EVP_SignUpdate() can be made, but EVP_SignInit() can be called to initialize |
36 | a new signature operation. | 36 | a new signature operation. |
37 | 37 | ||
38 | EVP_PKEY_size() returns the maximum size of a signature in bytes. The actual | 38 | EVP_PKEY_size() returns the maximum size of a signature in bytes. The actual |
diff --git a/src/lib/libssl/src/doc/crypto/EVP_VerifyInit.pod b/src/lib/libssl/src/doc/crypto/EVP_VerifyInit.pod index 5e74c5dcf9..736a0f4a82 100644 --- a/src/lib/libssl/src/doc/crypto/EVP_VerifyInit.pod +++ b/src/lib/libssl/src/doc/crypto/EVP_VerifyInit.pod | |||
@@ -17,17 +17,17 @@ EVP_VerifyInit, EVP_VerifyUpdate, EVP_VerifyFinal - EVP signature verification f | |||
17 | The EVP signature verification routines are a high level interface to digital | 17 | The EVP signature verification routines are a high level interface to digital |
18 | signatures. | 18 | signatures. |
19 | 19 | ||
20 | EVP_VerifyInit() initialises a verification context B<ctx> to using digest | 20 | EVP_VerifyInit() initializes a verification context B<ctx> to using digest |
21 | B<type>: this will typically be supplied by a function such as EVP_sha1(). | 21 | B<type>: this will typically be supplied by a function such as EVP_sha1(). |
22 | 22 | ||
23 | EVP_VerifyUpdate() hashes B<cnt> bytes of data at B<d> into the | 23 | EVP_VerifyUpdate() hashes B<cnt> bytes of data at B<d> into the |
24 | verification context B<ctx>. This funtion can be called several times on the | 24 | verification context B<ctx>. This function can be called several times on the |
25 | same B<ctx> to include additional data. | 25 | same B<ctx> to include additional data. |
26 | 26 | ||
27 | EVP_VerifyFinal() verifies the data in B<ctx> using the public key B<pkey> | 27 | 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() | 28 | and against the B<siglen> bytes at B<sigbuf>. After calling EVP_VerifyFinal() |
29 | no additional calls to EVP_VerifyUpdate() can be made, but EVP_VerifyInit() | 29 | no additional calls to EVP_VerifyUpdate() can be made, but EVP_VerifyInit() |
30 | can be called to initialiase a new verification operation. | 30 | can be called to initialize a new verification operation. |
31 | 31 | ||
32 | =head1 RETURN VALUES | 32 | =head1 RETURN VALUES |
33 | 33 | ||
@@ -57,11 +57,12 @@ might. | |||
57 | 57 | ||
58 | =head1 SEE ALSO | 58 | =head1 SEE ALSO |
59 | 59 | ||
60 | L<evp(3)|evp(3)>, | ||
60 | L<EVP_SignInit(3)|EVP_SignInit(3)>, | 61 | L<EVP_SignInit(3)|EVP_SignInit(3)>, |
61 | L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, | 62 | L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>, |
62 | L<evp(3)|evp(3)>, L<HMAC(3)|HMAC(3)>, L<MD2(3)|MD2(3)>, | 63 | L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, |
63 | L<MD5(3)|MD5(3)>, L<MDC2(3)|MDC2(3)>, L<RIPEMD(3)|RIPEMD(3)>, | 64 | L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, |
64 | L<SHA1(3)|SHA1(3)>, L<digest(1)|digest(1)> | 65 | L<sha(3)|sha(3)>, L<digest(1)|digest(1)> |
65 | 66 | ||
66 | =head1 HISTORY | 67 | =head1 HISTORY |
67 | 68 | ||
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 b0b1058d19..68ea723259 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 - 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,11 +11,27 @@ OPENSSL_VERSION_NUMBER, SSLeay - 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 | 15 | ||
15 | =head1 DESCRIPTION | 16 | =head1 DESCRIPTION |
16 | 17 | ||
17 | OPENSSL_VERSION_NUMBER is a numeric release version identifier: | 18 | OPENSSL_VERSION_NUMBER is a numeric release version identifier: |
18 | 19 | ||
20 | MMNNFFPPS: major minor fix patch status | ||
21 | |||
22 | The status nibble has one of the values 0 for development, 1 to e for betas | ||
23 | 1 to 14, and f for release. | ||
24 | |||
25 | for example | ||
26 | |||
27 | 0x000906000 == 0.9.6 dev | ||
28 | 0x000906023 == 0.9.6b beta 3 | ||
29 | 0x00090605f == 0.9.6e release | ||
30 | |||
31 | Versions prior to 0.9.3 have identifiers E<lt> 0x0930. | ||
32 | Versions between 0.9.3 and 0.9.5 had a version identifier with this | ||
33 | interpretation: | ||
34 | |||
19 | MMNNFFRBB major minor fix final beta/patch | 35 | MMNNFFRBB major minor fix final beta/patch |
20 | 36 | ||
21 | for example | 37 | for example |
@@ -23,13 +39,39 @@ for example | |||
23 | 0x000904100 == 0.9.4 release | 39 | 0x000904100 == 0.9.4 release |
24 | 0x000905000 == 0.9.5 dev | 40 | 0x000905000 == 0.9.5 dev |
25 | 41 | ||
26 | Versions prior to 0.9.3 have identifiers E<lt> 0x0930. | 42 | Version 0.9.5a had an interim interpretation that is like the current one, |
43 | except the patch level got the highest bit set, to keep continuity. The | ||
44 | number was therefore 0x0090581f. | ||
45 | |||
46 | |||
27 | For backward compatibility, SSLEAY_VERSION_NUMBER is also defined. | 47 | For backward compatibility, SSLEAY_VERSION_NUMBER is also defined. |
28 | 48 | ||
29 | SSLeay() returns this number. The return value can be compared to the | 49 | SSLeay() returns this number. The return value can be compared to the |
30 | macro to make sure that the correct version of the library has been | 50 | macro to make sure that the correct version of the library has been |
31 | loaded, especially when using DLLs on Windows systems. | 51 | loaded, especially when using DLLs on Windows systems. |
32 | 52 | ||
53 | SSLeay_version() returns different strings depending on B<t>: | ||
54 | |||
55 | =over 4 | ||
56 | |||
57 | =item SSLEAY_VERSION | ||
58 | The text variant of the version number and the release date. For example, | ||
59 | "OpenSSL 0.9.5a 1 Apr 2000". | ||
60 | |||
61 | =item SSLEAY_CFLAGS | ||
62 | The flags given to the C compiler when compiling OpenSSL are returned in a | ||
63 | string. | ||
64 | |||
65 | =item SSLEAY_PLATFORM | ||
66 | The platform name used when OpenSSL was configured is returned. | ||
67 | |||
68 | =back | ||
69 | |||
70 | If the data request isn't available, a text saying that the information is | ||
71 | not available is returned. | ||
72 | |||
73 | For an unknown B<t>, the text "not available" is returned. | ||
74 | |||
33 | =head1 RETURN VALUE | 75 | =head1 RETURN VALUE |
34 | 76 | ||
35 | The version number. | 77 | The version number. |
diff --git a/src/lib/libssl/src/doc/crypto/OpenSSL_add_all_algorithms.pod b/src/lib/libssl/src/doc/crypto/OpenSSL_add_all_algorithms.pod index 015d4eaf36..e63411b5bb 100644 --- a/src/lib/libssl/src/doc/crypto/OpenSSL_add_all_algorithms.pod +++ b/src/lib/libssl/src/doc/crypto/OpenSSL_add_all_algorithms.pod | |||
@@ -2,7 +2,8 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | OpenSSL_add_all_algorithms() - add algorithms to internal table | 5 | OpenSSL_add_all_algorithms, OpenSSL_add_all_ciphers, OpenSSL_add_all_digests - |
6 | add algorithms to internal table | ||
6 | 7 | ||
7 | =head1 SYNOPSIS | 8 | =head1 SYNOPSIS |
8 | 9 | ||
@@ -43,7 +44,7 @@ by EVP_sha1(). It just needs to add them if it (or any of the functions it calls | |||
43 | needs to lookup algorithms. | 44 | needs to lookup algorithms. |
44 | 45 | ||
45 | The cipher and digest lookup functions are used in many parts of the library. If | 46 | The cipher and digest lookup functions are used in many parts of the library. If |
46 | the table is not initialised several functions will misbehave and complain they | 47 | the table is not initialized several functions will misbehave and complain they |
47 | cannot find algorithms. This includes the PEM, PKCS#12, SSL and S/MIME libraries. | 48 | cannot find algorithms. This includes the PEM, PKCS#12, SSL and S/MIME libraries. |
48 | This is a common query in the OpenSSL mailing lists. | 49 | This is a common query in the OpenSSL mailing lists. |
49 | 50 | ||
diff --git a/src/lib/libssl/src/doc/crypto/RAND_egd.pod b/src/lib/libssl/src/doc/crypto/RAND_egd.pod index a40bd96198..40241e2df8 100644 --- a/src/lib/libssl/src/doc/crypto/RAND_egd.pod +++ b/src/lib/libssl/src/doc/crypto/RAND_egd.pod | |||
@@ -21,6 +21,10 @@ RAND_egd() is called with that path as an argument, it tries to read | |||
21 | random bytes that EGD has collected. The read is performed in | 21 | random bytes that EGD has collected. The read is performed in |
22 | non-blocking mode. | 22 | non-blocking mode. |
23 | 23 | ||
24 | Alternatively, the EGD-compatible daemon PRNGD can be used. It is | ||
25 | available from | ||
26 | http://www.aet.tu-cottbus.de/personen/jaenicke/postfix_tls/prngd.html . | ||
27 | |||
24 | =head1 RETURN VALUE | 28 | =head1 RETURN VALUE |
25 | 29 | ||
26 | RAND_egd() returns the number of bytes read from the daemon on | 30 | RAND_egd() returns the number of bytes read from the daemon on |
diff --git a/src/lib/libssl/src/doc/crypto/RSA_get_ex_new_index.pod b/src/lib/libssl/src/doc/crypto/RSA_get_ex_new_index.pod index 920dc76325..46cc8f5359 100644 --- a/src/lib/libssl/src/doc/crypto/RSA_get_ex_new_index.pod +++ b/src/lib/libssl/src/doc/crypto/RSA_get_ex_new_index.pod | |||
@@ -17,14 +17,12 @@ RSA_get_ex_new_index, RSA_set_ex_data, RSA_get_ex_data - add application specifi | |||
17 | 17 | ||
18 | void *RSA_get_ex_data(RSA *r, int idx); | 18 | void *RSA_get_ex_data(RSA *r, int idx); |
19 | 19 | ||
20 | int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | 20 | typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, |
21 | int idx, long argl, void *argp); | 21 | int idx, long argl, void *argp); |
22 | 22 | typedef void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | |
23 | void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | 23 | int idx, long argl, void *argp); |
24 | int idx, long argl, void *argp); | 24 | typedef int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, |
25 | 25 | int idx, long argl, void *argp); | |
26 | int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, | ||
27 | int idx, long argl, void *argp); | ||
28 | 26 | ||
29 | =head1 DESCRIPTION | 27 | =head1 DESCRIPTION |
30 | 28 | ||
diff --git a/src/lib/libssl/src/doc/crypto/RSA_print.pod b/src/lib/libssl/src/doc/crypto/RSA_print.pod index dd968a5274..67876facc5 100644 --- a/src/lib/libssl/src/doc/crypto/RSA_print.pod +++ b/src/lib/libssl/src/doc/crypto/RSA_print.pod | |||
@@ -2,8 +2,9 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | RSA_print, RSA_print_fp, DHparams_print, DHparams_print_fp - print | 5 | RSA_print, RSA_print_fp, DHparams_print, DHparams_print_fp, DSA_print, |
6 | cryptographic parameters | 6 | DSA_print_fp, DHparams_print, DHparams_print_fp - print cryptographic |
7 | parameters | ||
7 | 8 | ||
8 | =head1 SYNOPSIS | 9 | =head1 SYNOPSIS |
9 | 10 | ||
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 13b7df62be..23861c0004 100644 --- a/src/lib/libssl/src/doc/crypto/RSA_public_encrypt.pod +++ b/src/lib/libssl/src/doc/crypto/RSA_public_encrypt.pod | |||
@@ -47,7 +47,7 @@ Encrypting user data directly with RSA is insecure. | |||
47 | =back | 47 | =back |
48 | 48 | ||
49 | B<flen> must be less than RSA_size(B<rsa>) - 11 for the PKCS #1 v1.5 | 49 | B<flen> must be less than RSA_size(B<rsa>) - 11 for the PKCS #1 v1.5 |
50 | based padding modes, and less than RSA_size(B<rsa>) - 21 for | 50 | based padding modes, and less than RSA_size(B<rsa>) - 41 for |
51 | RSA_PKCS1_OAEP_PADDING. The random number generator must be seeded | 51 | RSA_PKCS1_OAEP_PADDING. The random number generator must be seeded |
52 | prior to calling RSA_public_encrypt(). | 52 | prior to calling RSA_public_encrypt(). |
53 | 53 | ||
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 14b0b4cf35..b672712292 100644 --- a/src/lib/libssl/src/doc/crypto/RSA_set_method.pod +++ b/src/lib/libssl/src/doc/crypto/RSA_set_method.pod | |||
@@ -4,17 +4,18 @@ | |||
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, RSA_PKCS1_RSAref, |
7 | RSA_PKCS1_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 |
10 | 10 | ||
11 | #include <openssl/rsa.h> | 11 | #include <openssl/rsa.h> |
12 | #include <openssl/engine.h> | ||
12 | 13 | ||
13 | void RSA_set_default_method(RSA_METHOD *meth); | 14 | void RSA_set_default_openssl_method(RSA_METHOD *meth); |
14 | 15 | ||
15 | RSA_METHOD *RSA_get_default_method(void); | 16 | RSA_METHOD *RSA_get_default_openssl_method(void); |
16 | 17 | ||
17 | RSA_METHOD *RSA_set_method(RSA *rsa, RSA_METHOD *meth); | 18 | RSA_METHOD *RSA_set_method(RSA *rsa, ENGINE *engine); |
18 | 19 | ||
19 | RSA_METHOD *RSA_get_method(RSA *rsa); | 20 | RSA_METHOD *RSA_get_method(RSA *rsa); |
20 | 21 | ||
@@ -26,7 +27,7 @@ RSA_PKCS1_null_method, RSA_flags, RSA_new_method - select RSA method | |||
26 | 27 | ||
27 | int RSA_flags(RSA *rsa); | 28 | int RSA_flags(RSA *rsa); |
28 | 29 | ||
29 | RSA *RSA_new_method(RSA_METHOD *method); | 30 | RSA *RSA_new_method(ENGINE *engine); |
30 | 31 | ||
31 | =head1 DESCRIPTION | 32 | =head1 DESCRIPTION |
32 | 33 | ||
@@ -46,23 +47,27 @@ the RSA transformation. It is the default if OpenSSL is compiled with | |||
46 | C<-DRSA_NULL>. These methods may be useful in the USA because of a | 47 | C<-DRSA_NULL>. These methods may be useful in the USA because of a |
47 | patent on the RSA cryptosystem. | 48 | patent on the RSA cryptosystem. |
48 | 49 | ||
49 | RSA_set_default_method() makes B<meth> the default method for all B<RSA> | 50 | RSA_set_default_openssl_method() makes B<meth> the default method for all B<RSA> |
50 | structures created later. | 51 | structures created later. B<NB:> This is true only whilst the default engine |
52 | for RSA operations remains as "openssl". ENGINEs provide an | ||
53 | encapsulation for implementations of one or more algorithms at a time, and all | ||
54 | the RSA functions mentioned here operate within the scope of the default | ||
55 | "openssl" engine. | ||
51 | 56 | ||
52 | RSA_get_default_method() returns a pointer to the current default | 57 | RSA_get_default_openssl_method() returns a pointer to the current default |
53 | method. | 58 | method for the "openssl" engine. |
54 | 59 | ||
55 | RSA_set_method() selects B<meth> for all operations using the key | 60 | RSA_set_method() selects B<engine> for all operations using the key |
56 | B<rsa>. | 61 | B<rsa>. |
57 | 62 | ||
58 | RSA_get_method() returns a pointer to the method currently selected | 63 | RSA_get_method() returns a pointer to the RSA_METHOD from the currently |
59 | for B<rsa>. | 64 | selected ENGINE for B<rsa>. |
60 | 65 | ||
61 | RSA_flags() returns the B<flags> that are set for B<rsa>'s current method. | 66 | RSA_flags() returns the B<flags> that are set for B<rsa>'s current method. |
62 | 67 | ||
63 | RSA_new_method() allocates and initializes an B<RSA> structure so that | 68 | RSA_new_method() allocates and initializes an RSA structure so that |
64 | B<method> will be used for the RSA operations. If B<method> is B<NULL>, | 69 | B<engine> will be used for the RSA operations. If B<engine> is NULL, |
65 | the default method is used. | 70 | the default engine for RSA operations is used. |
66 | 71 | ||
67 | =head1 THE RSA_METHOD STRUCTURE | 72 | =head1 THE RSA_METHOD STRUCTURE |
68 | 73 | ||
@@ -128,17 +133,21 @@ the default method is used. | |||
128 | =head1 RETURN VALUES | 133 | =head1 RETURN VALUES |
129 | 134 | ||
130 | RSA_PKCS1_SSLeay(), RSA_PKCS1_RSAref(), RSA_PKCS1_null_method(), | 135 | RSA_PKCS1_SSLeay(), RSA_PKCS1_RSAref(), RSA_PKCS1_null_method(), |
131 | RSA_get_default_method() and RSA_get_method() return pointers to the | 136 | RSA_get_default_openssl_method() and RSA_get_method() return pointers to |
132 | respective B<RSA_METHOD>s. | 137 | the respective RSA_METHODs. |
133 | 138 | ||
134 | RSA_set_default_method() returns no value. | 139 | RSA_set_default_openssl_method() returns no value. |
135 | 140 | ||
136 | RSA_set_method() returns a pointer to the B<RSA_METHOD> previously | 141 | RSA_set_method() selects B<engine> as the engine that will be responsible for |
137 | associated with B<rsa>. | 142 | all operations using the structure B<rsa>. If this function completes successfully, |
143 | then the B<rsa> structure will have its own functional reference of B<engine>, so | ||
144 | the caller should remember to free their own reference to B<engine> when they are | ||
145 | finished with it. NB: An ENGINE's RSA_METHOD can be retrieved (or set) by | ||
146 | ENGINE_get_RSA() or ENGINE_set_RSA(). | ||
138 | 147 | ||
139 | RSA_new_method() returns B<NULL> and sets an error code that can be | 148 | RSA_new_method() returns NULL and sets an error code that can be |
140 | obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation fails. Otherwise it | 149 | obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation fails. Otherwise |
141 | returns a pointer to the newly allocated structure. | 150 | it returns a pointer to the newly allocated structure. |
142 | 151 | ||
143 | =head1 SEE ALSO | 152 | =head1 SEE ALSO |
144 | 153 | ||
@@ -151,4 +160,9 @@ RSA_get_default_method(), RSA_set_method() and RSA_get_method() as | |||
151 | well as the rsa_sign and rsa_verify components of RSA_METHOD were | 160 | well as the rsa_sign and rsa_verify components of RSA_METHOD were |
152 | added in OpenSSL 0.9.4. | 161 | added in OpenSSL 0.9.4. |
153 | 162 | ||
163 | RSA_set_default_openssl_method() and RSA_get_default_openssl_method() | ||
164 | 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 | ||
166 | rather than B<DH_METHOD>s during development of OpenSSL 0.9.6. | ||
167 | |||
154 | =cut | 168 | =cut |
diff --git a/src/lib/libssl/src/doc/crypto/bio.pod b/src/lib/libssl/src/doc/crypto/bio.pod new file mode 100644 index 0000000000..24f61dfb56 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/bio.pod | |||
@@ -0,0 +1,54 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | bio - I/O abstraction | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bio.h> | ||
10 | |||
11 | TBA | ||
12 | |||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | A BIO is an I/O abstraction, it hides many of the underlying I/O | ||
17 | details from an application. If an application uses a BIO for its | ||
18 | I/O it can transparently handle SSL connections, unencrypted network | ||
19 | connections and file I/O. | ||
20 | |||
21 | There are two type of BIO, a source/sink BIO and a filter BIO. | ||
22 | |||
23 | As its name implies a source/sink BIO is a source and/or sink of data, | ||
24 | examples include a socket BIO and a file BIO. | ||
25 | |||
26 | A filter BIO takes data from one BIO and passes it through to | ||
27 | another, or the application. The data may be left unmodified (for | ||
28 | example a message digest BIO) or translated (for example an | ||
29 | encryption BIO). The effect of a filter BIO may change according | ||
30 | to the I/O operation it is performing: for example an encryption | ||
31 | BIO will encrypt data if it is being written to and decrypt data | ||
32 | if it is being read from. | ||
33 | |||
34 | BIOs can be joined together to form a chain (a single BIO is a chain | ||
35 | with one component). A chain normally consist of one source/sink | ||
36 | BIO and one or more filter BIOs. Data read from or written to the | ||
37 | first BIO then traverses the chain to the end (normally a source/sink | ||
38 | BIO). | ||
39 | |||
40 | =head1 SEE ALSO | ||
41 | |||
42 | L<BIO_ctrl(3)|BIO_ctrl(3)>, | ||
43 | L<BIO_f_base64(3)|BIO_f_base64(3)>, | ||
44 | L<BIO_f_cipher(3)|BIO_f_cipher(3)>, L<BIO_f_md(3)|BIO_f_md(3)>, | ||
45 | L<BIO_f_null(3)|BIO_f_null(3)>, L<BIO_f_ssl(3)|BIO_f_ssl(3)>, | ||
46 | L<BIO_find_type(3)|BIO_find_type(3)>, L<BIO_new(3)|BIO_new(3)>, | ||
47 | L<BIO_new_bio_pair(3)|BIO_new_bio_pair(3)>, | ||
48 | L<BIO_push(3)|BIO_push(3)>, L<BIO_read(3)|BIO_read(3)>, | ||
49 | L<BIO_s_accept(3)|BIO_s_accept(3)>, L<BIO_s_bio(3)|BIO_s_bio(3)>, | ||
50 | L<BIO_s_connect(3)|BIO_s_connect(3)>, L<BIO_s_fd(3)|BIO_s_fd(3)>, | ||
51 | L<BIO_s_file(3)|BIO_s_file(3)>, L<BIO_s_mem(3)|BIO_s_mem(3)>, | ||
52 | L<BIO_s_null(3)|BIO_s_null(3)>, L<BIO_s_socket(3)|BIO_s_socket(3)>, | ||
53 | L<BIO_set_callback(3)|BIO_set_callback(3)>, | ||
54 | L<BIO_should_retry(3)|BIO_should_retry(3)> | ||
diff --git a/src/lib/libssl/src/doc/crypto/blowfish.pod b/src/lib/libssl/src/doc/crypto/blowfish.pod index e0b777418f..65b8be388c 100644 --- a/src/lib/libssl/src/doc/crypto/blowfish.pod +++ b/src/lib/libssl/src/doc/crypto/blowfish.pod | |||
@@ -11,9 +11,6 @@ BF_cfb64_encrypt, BF_ofb64_encrypt, BF_options - Blowfish encryption | |||
11 | 11 | ||
12 | void BF_set_key(BF_KEY *key, int len, const unsigned char *data); | 12 | void BF_set_key(BF_KEY *key, int len, const unsigned char *data); |
13 | 13 | ||
14 | void BF_encrypt(BF_LONG *data,const BF_KEY *key); | ||
15 | void BF_decrypt(BF_LONG *data,const BF_KEY *key); | ||
16 | |||
17 | void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, | 14 | void BF_ecb_encrypt(const unsigned char *in, unsigned char *out, |
18 | BF_KEY *key, int enc); | 15 | BF_KEY *key, int enc); |
19 | void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, | 16 | void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, |
@@ -25,10 +22,13 @@ BF_cfb64_encrypt, BF_ofb64_encrypt, BF_options - Blowfish encryption | |||
25 | long length, BF_KEY *schedule, unsigned char *ivec, int *num); | 22 | long length, BF_KEY *schedule, unsigned char *ivec, int *num); |
26 | const char *BF_options(void); | 23 | const char *BF_options(void); |
27 | 24 | ||
25 | void BF_encrypt(BF_LONG *data,const BF_KEY *key); | ||
26 | void BF_decrypt(BF_LONG *data,const BF_KEY *key); | ||
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 is invented and described |
31 | by Counterpane (see http://www.counterpane.com/blowfish/ ). | 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. |
34 | It uses a variable size key, but typically, 128 bit (16 byte) keys are | 34 | It uses a variable size key, but typically, 128 bit (16 byte) keys are |
@@ -43,11 +43,6 @@ phase. | |||
43 | BF_set_key() sets up the B<BF_KEY> B<key> using the B<len> bytes long key | 43 | BF_set_key() sets up the B<BF_KEY> B<key> using the B<len> bytes long key |
44 | at B<data>. | 44 | at B<data>. |
45 | 45 | ||
46 | BF_encrypt() and BF_decrypt() are the lowest level functions for Blowfish | ||
47 | encryption. They encrypt/decrypt the first 64 bits of the vector pointed by | ||
48 | B<data>, using the key B<key>. These functions should not be used unless you | ||
49 | implement 'modes' of Blowfish. | ||
50 | |||
51 | BF_ecb_encrypt() is the basic Blowfish encryption and decryption function. | 46 | BF_ecb_encrypt() is the basic Blowfish encryption and decryption function. |
52 | It encrypts or decrypts the first 64 bits of B<in> using the key B<key>, | 47 | It encrypts or decrypts the first 64 bits of B<in> using the key B<key>, |
53 | putting the result in B<out>. B<enc> decides if encryption (B<BF_ENCRYPT>) | 48 | putting the result in B<out>. B<enc> decides if encryption (B<BF_ENCRYPT>) |
@@ -56,37 +51,45 @@ B<in> and B<out> must be 64 bits in length, no less. If they are larger, | |||
56 | everything after the first 64 bits is ignored. | 51 | everything after the first 64 bits is ignored. |
57 | 52 | ||
58 | The mode functions BF_cbc_encrypt(), BF_cfb64_encrypt() and BF_ofb64_encrypt() | 53 | The mode functions BF_cbc_encrypt(), BF_cfb64_encrypt() and BF_ofb64_encrypt() |
59 | all operate on variable length data. They all take an initialisation vector | 54 | all operate on variable length data. They all take an initialization vector |
60 | B<ivec> which needs to be passed along into the next call of the same function | 55 | B<ivec> which needs to be passed along into the next call of the same function |
61 | for the same message. B<ivec> may be initialised with anything, but the | 56 | for the same message. B<ivec> may be initialized with anything, but the |
62 | recipient needs to know what it was initialised with, or it won't be able | 57 | recipient needs to know what it was initialized with, or it won't be able |
63 | to decrypt. Some programs and protocols simplify this, like SSH, where | 58 | to decrypt. Some programs and protocols simplify this, like SSH, where |
64 | B<ivec> is simply initialised to zero. | 59 | B<ivec> is simply initialized to zero. |
65 | BF_cbc_encrypt() operates of data that is a multiple of 8 bytes long, while | 60 | BF_cbc_encrypt() operates of data that is a multiple of 8 bytes long, while |
66 | 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 |
67 | 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 |
68 | 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 |
69 | need the parameter B<num>, which is a pointer to an integer where the current | 64 | need the parameter B<num>, which is a pointer to an integer where the current |
70 | offset in B<ivec> is stored between calls. This integer must be initialised | 65 | offset in B<ivec> is stored between calls. This integer must be initialized |
71 | to zero when B<ivec> is initialised. | 66 | to zero when B<ivec> is initialized. |
72 | 67 | ||
73 | BF_cbc_encrypt() is the Cipher Block Chaining function for Blowfish. It | 68 | BF_cbc_encrypt() is the Cipher Block Chaining function for Blowfish. It |
74 | encrypts or decrypts the 64 bits chunks of B<in> using the key B<schedule>, | 69 | encrypts or decrypts the 64 bits chunks of B<in> using the key B<schedule>, |
75 | putting the result in B<out>. B<enc> decides if encryption (BF_ENCRYPT) or | 70 | putting the result in B<out>. B<enc> decides if encryption (BF_ENCRYPT) or |
76 | decryption (BF_DECRYPT) shall be performed. B<ivec> must point at an 8 byte | 71 | decryption (BF_DECRYPT) shall be performed. B<ivec> must point at an 8 byte |
77 | long initialisation vector. | 72 | long initialization vector. |
78 | 73 | ||
79 | BF_cfb64_encrypt() is the CFB mode for Blowfish with 64 bit feedback. | 74 | BF_cfb64_encrypt() is the CFB mode for Blowfish with 64 bit feedback. |
80 | It encrypts or decrypts the bytes in B<in> using the key B<schedule>, | 75 | It encrypts or decrypts the bytes in B<in> using the key B<schedule>, |
81 | putting the result in B<out>. B<enc> decides if encryption (B<BF_ENCRYPT>) | 76 | putting the result in B<out>. B<enc> decides if encryption (B<BF_ENCRYPT>) |
82 | or decryption (B<BF_DECRYPT>) shall be performed. B<ivec> must point at an | 77 | or decryption (B<BF_DECRYPT>) shall be performed. B<ivec> must point at an |
83 | 8 byte long initialisation vector. B<num> must point at an integer which must | 78 | 8 byte long initialization vector. B<num> must point at an integer which must |
84 | be initially zero. | 79 | be initially zero. |
85 | 80 | ||
86 | BF_ofb64_encrypt() is the OFB mode for Blowfish with 64 bit feedback. | 81 | BF_ofb64_encrypt() is the OFB mode for Blowfish with 64 bit feedback. |
87 | It uses the same parameters as BF_cfb64_encrypt(), which must be initialised | 82 | It uses the same parameters as BF_cfb64_encrypt(), which must be initialized |
88 | the same way. | 83 | the same way. |
89 | 84 | ||
85 | BF_encrypt() and BF_decrypt() are the lowest level functions for Blowfish | ||
86 | encryption. They encrypt/decrypt the first 64 bits of the vector pointed by | ||
87 | B<data>, using the key B<key>. These functions should not be used unless you | ||
88 | implement 'modes' of Blowfish. The alternative is to use BF_ecb_encrypt(). | ||
89 | If you still want to use these functions, you should be aware that they take | ||
90 | each 32-bit chunk in host-byte order, which is little-endian on little-endian | ||
91 | platforms and big-endian on big-endian ones. | ||
92 | |||
90 | =head1 RETURN VALUES | 93 | =head1 RETURN VALUES |
91 | 94 | ||
92 | None of the functions presented here return any value. | 95 | None of the functions presented here return any value. |
diff --git a/src/lib/libssl/src/doc/crypto/bn_internal.pod b/src/lib/libssl/src/doc/crypto/bn_internal.pod index 5af0c791c8..8da244aed4 100644 --- a/src/lib/libssl/src/doc/crypto/bn_internal.pod +++ b/src/lib/libssl/src/doc/crypto/bn_internal.pod | |||
@@ -149,7 +149,7 @@ word array B<a>, the B<nb> word array B<b> and the B<na>+B<nb> word | |||
149 | array B<r>. It computes B<a>*B<b> and places the result in B<r>. | 149 | array B<r>. It computes B<a>*B<b> and places the result in B<r>. |
150 | 150 | ||
151 | bn_mul_low_normal(B<r>, B<a>, B<b>, B<n>) operates on the B<n> word | 151 | bn_mul_low_normal(B<r>, B<a>, B<b>, B<n>) operates on the B<n> word |
152 | arrays B<r>, B<a> und 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<t>) operates on the B<n2> |
diff --git a/src/lib/libssl/src/doc/crypto/buffer.pod b/src/lib/libssl/src/doc/crypto/buffer.pod index 7088f51bc4..781f5b11ee 100644 --- a/src/lib/libssl/src/doc/crypto/buffer.pod +++ b/src/lib/libssl/src/doc/crypto/buffer.pod | |||
@@ -46,11 +46,11 @@ size. | |||
46 | 46 | ||
47 | BUF_strdup() copies a null terminated string into a block of allocated | 47 | BUF_strdup() copies a null terminated string into a block of allocated |
48 | memory and returns a pointer to the allocated block. | 48 | memory and returns a pointer to the allocated block. |
49 | Unlike the standard C library strdup() this function uses Malloc() and so | 49 | Unlike the standard C library strdup() this function uses OPENSSL_malloc() and so |
50 | should be used in preference to the standard library strdup() because it can | 50 | should be used in preference to the standard library strdup() because it can |
51 | be used for memory leak checking or replacing the malloc() function. | 51 | be used for memory leak checking or replacing the malloc() function. |
52 | 52 | ||
53 | The memory allocated from BUF_strdup() should be freed up using the Free() | 53 | The memory allocated from BUF_strdup() should be freed up using the OPENSSL_free() |
54 | function. | 54 | function. |
55 | 55 | ||
56 | =head1 RETURN VALUES | 56 | =head1 RETURN VALUES |
@@ -68,6 +68,6 @@ L<bio(3)|bio(3)> | |||
68 | =head1 HISTORY | 68 | =head1 HISTORY |
69 | 69 | ||
70 | BUF_MEM_new(), BUF_MEM_free() and BUF_MEM_grow() are available in all | 70 | BUF_MEM_new(), BUF_MEM_free() and BUF_MEM_grow() are available in all |
71 | versions of SSLeay and OpenSSL. BUF_strdup() was addded in SSLeay 0.8. | 71 | versions of SSLeay and OpenSSL. BUF_strdup() was added in SSLeay 0.8. |
72 | 72 | ||
73 | =cut | 73 | =cut |
diff --git a/src/lib/libssl/src/doc/crypto/crypto.pod b/src/lib/libssl/src/doc/crypto/crypto.pod index c3d74b4587..07ba7e5bc9 100644 --- a/src/lib/libssl/src/doc/crypto/crypto.pod +++ b/src/lib/libssl/src/doc/crypto/crypto.pod | |||
@@ -28,7 +28,7 @@ hash functions and a cryptographic pseudo-random number generator. | |||
28 | =item SYMMETRIC CIPHERS | 28 | =item SYMMETRIC CIPHERS |
29 | 29 | ||
30 | L<blowfish(3)|blowfish(3)>, L<cast(3)|cast(3)>, L<des(3)|des(3)>, | 30 | L<blowfish(3)|blowfish(3)>, L<cast(3)|cast(3)>, L<des(3)|des(3)>, |
31 | L<idea(3)|idea(3)>, L<rc2(3)|rc2(3)>, L<RC4(3)|RC4(3)>, L<rc5(3)|rc5(3)> | 31 | L<idea(3)|idea(3)>, L<rc2(3)|rc2(3)>, L<rc4(3)|rc4(3)>, L<rc5(3)|rc5(3)> |
32 | 32 | ||
33 | =item PUBLIC KEY CRYPTOGRAPHY AND KEY AGREEMENT | 33 | =item PUBLIC KEY CRYPTOGRAPHY AND KEY AGREEMENT |
34 | 34 | ||
@@ -40,17 +40,17 @@ L<x509(3)|x509(3)>, L<x509v3(3)|x509v3(3)> | |||
40 | 40 | ||
41 | =item AUTHENTICATION CODES, HASH FUNCTIONS | 41 | =item AUTHENTICATION CODES, HASH FUNCTIONS |
42 | 42 | ||
43 | L<HMAC(3)|HMAC(3)>, L<MD2(3)|MD2(3)>, L<MD5(3)|MD5(3)>, L<MDC2(3)|MDC2(3)>, | 43 | L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, L<md4(3)|md4(3)>, |
44 | L<RIPEMD160(3)|RIPEMD160(3)>, L<SHA1(3)|SHA1(3)> | 44 | L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, |
45 | L<sha(3)|sha(3)> | ||
45 | 46 | ||
46 | =item AUXILIARY FUNCTIONS | 47 | =item AUXILIARY FUNCTIONS |
47 | 48 | ||
48 | L<err(3)|err(3)>, L<CRYPTO_set_locking_callback(3)|CRYPTO_set_locking_callback(3)>, L<rand(3)|rand(3)> | 49 | L<err(3)|err(3)>, L<threads(3)|threads(3)>, L<rand(3)|rand(3)> |
49 | 50 | ||
50 | =item INPUT/OUTPUT, DATA ENCODING | 51 | =item INPUT/OUTPUT, DATA ENCODING |
51 | 52 | ||
52 | L<asn1(3)|asn1(3)>, L<bio(3)|bio(3)>, L<evp(3)|evp(3)>, | 53 | L<asn1(3)|asn1(3)>, L<bio(3)|bio(3)>, L<evp(3)|evp(3)>, L<pem(3)|pem(3)>, |
53 | L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<pem(3)|pem(3)>, | ||
54 | L<pkcs7(3)|pkcs7(3)>, L<pkcs12(3)|pkcs12(3)> | 54 | L<pkcs7(3)|pkcs7(3)>, L<pkcs12(3)|pkcs12(3)> |
55 | 55 | ||
56 | =item INTERNAL FUNCTIONS | 56 | =item INTERNAL FUNCTIONS |
diff --git a/src/lib/libssl/src/doc/crypto/des.pod b/src/lib/libssl/src/doc/crypto/des.pod index 1ca6bfb78f..99080391b1 100644 --- a/src/lib/libssl/src/doc/crypto/des.pod +++ b/src/lib/libssl/src/doc/crypto/des.pod | |||
@@ -130,7 +130,7 @@ earlier versions of the library, des_random_key() did not generate | |||
130 | secure keys. | 130 | secure keys. |
131 | 131 | ||
132 | Before a DES key can be used, it must be converted into the | 132 | Before a DES key can be used, it must be converted into the |
133 | architecture dependant I<des_key_schedule> via the | 133 | architecture dependent I<des_key_schedule> via the |
134 | des_set_key_checked() or des_set_key_unchecked() function. | 134 | des_set_key_checked() or des_set_key_unchecked() function. |
135 | 135 | ||
136 | des_set_key_checked() will check that the key passed is of odd parity | 136 | des_set_key_checked() will check that the key passed is of odd parity |
@@ -200,7 +200,7 @@ 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. | 200 | This form of Triple-DES is used by the RSAREF library. |
201 | 201 | ||
202 | des_pcbc_encrypt() encrypt/decrypts using the propagating cipher block | 202 | des_pcbc_encrypt() encrypt/decrypts using the propagating cipher block |
203 | chaing mode used by Kerberos v4. Its parameters are the same as | 203 | chaining mode used by Kerberos v4. Its parameters are the same as |
204 | des_ncbc_encrypt(). | 204 | des_ncbc_encrypt(). |
205 | 205 | ||
206 | des_cfb_encrypt() encrypt/decrypts using cipher feedback mode. This | 206 | des_cfb_encrypt() encrypt/decrypts using cipher feedback mode. This |
@@ -241,7 +241,7 @@ compatibility with the MIT Kerberos library. des_read_pw_string() | |||
241 | is also available under the name EVP_read_pw_string(). | 241 | is also available under the name EVP_read_pw_string(). |
242 | 242 | ||
243 | des_read_pw_string() writes the string specified by I<prompt> to | 243 | des_read_pw_string() writes the string specified by I<prompt> to |
244 | standarf output, turns echo off and reads in input string from the | 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 | 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 | 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 | 247 | the password twice and unless the two copies match, an error is |
@@ -268,9 +268,9 @@ 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 | 268 | non-NULL, the 8 bytes generated by each pass are written into |
269 | I<output>. | 269 | I<output>. |
270 | 270 | ||
271 | The following are DES-based tranformations: | 271 | The following are DES-based transformations: |
272 | 272 | ||
273 | des_fcrypt() is a fast version of the unix crypt(3) function. This | 273 | 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 | 274 | version takes only a small amount of space relative to other fast |
275 | crypt() implementations. This is different to the normal crypt in | 275 | crypt() implementations. This is different to the normal crypt in |
276 | that the third parameter is the buffer that the return value is | 276 | that the third parameter is the buffer that the return value is |
diff --git a/src/lib/libssl/src/doc/crypto/des_modes.pod b/src/lib/libssl/src/doc/crypto/des_modes.pod index ee4f2238c7..8e5074d24c 100644 --- a/src/lib/libssl/src/doc/crypto/des_modes.pod +++ b/src/lib/libssl/src/doc/crypto/des_modes.pod | |||
@@ -6,7 +6,7 @@ des_modes - the variants of DES and other crypto algorithms of OpenSSL | |||
6 | 6 | ||
7 | =head1 DESCRIPTION | 7 | =head1 DESCRIPTION |
8 | 8 | ||
9 | Several crypto algorithms fo OpenSSL can be used in a number of modes. Those | 9 | Several crypto algorithms for OpenSSL can be used in a number of modes. Those |
10 | are used for using block ciphers in a way similar to stream ciphers, among | 10 | are used for using block ciphers in a way similar to stream ciphers, among |
11 | other things. | 11 | other things. |
12 | 12 | ||
@@ -165,13 +165,13 @@ only one bit to be in error in the deciphered plaintext. | |||
165 | 165 | ||
166 | =item * | 166 | =item * |
167 | 167 | ||
168 | OFB mode is not self-synchronising. If the two operation of | 168 | OFB mode is not self-synchronizing. If the two operation of |
169 | encipherment and decipherment get out of synchronism, the system needs | 169 | encipherment and decipherment get out of synchronism, the system needs |
170 | to be re-initialised. | 170 | to be re-initialized. |
171 | 171 | ||
172 | =item * | 172 | =item * |
173 | 173 | ||
174 | Each re-initialisation should use a value of the start variable | 174 | Each re-initialization should use a value of the start variable |
175 | different from the start variable values used before with the same | 175 | different from the start variable values used before with the same |
176 | key. The reason for this is that an identical bit stream would be | 176 | key. The reason for this is that an identical bit stream would be |
177 | produced each time from the same parameters. This would be | 177 | produced each time from the same parameters. This would be |
diff --git a/src/lib/libssl/src/doc/crypto/dh.pod b/src/lib/libssl/src/doc/crypto/dh.pod index 0a9b7c03a2..b4be4be405 100644 --- a/src/lib/libssl/src/doc/crypto/dh.pod +++ b/src/lib/libssl/src/doc/crypto/dh.pod | |||
@@ -7,6 +7,7 @@ dh - Diffie-Hellman key agreement | |||
7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
8 | 8 | ||
9 | #include <openssl/dh.h> | 9 | #include <openssl/dh.h> |
10 | #include <openssl/engine.h> | ||
10 | 11 | ||
11 | DH * DH_new(void); | 12 | DH * DH_new(void); |
12 | void DH_free(DH *dh); | 13 | void DH_free(DH *dh); |
@@ -20,10 +21,10 @@ dh - Diffie-Hellman key agreement | |||
20 | int DH_generate_key(DH *dh); | 21 | int DH_generate_key(DH *dh); |
21 | int DH_compute_key(unsigned char *key, BIGNUM *pub_key, DH *dh); | 22 | int DH_compute_key(unsigned char *key, BIGNUM *pub_key, DH *dh); |
22 | 23 | ||
23 | void DH_set_default_method(DH_METHOD *meth); | 24 | void DH_set_default_openssl_method(DH_METHOD *meth); |
24 | DH_METHOD *DH_get_default_method(void); | 25 | DH_METHOD *DH_get_default_openssl_method(void); |
25 | DH_METHOD *DH_set_method(DH *dh, DH_METHOD *meth); | 26 | int DH_set_method(DH *dh, ENGINE *engine); |
26 | DH *DH_new_method(DH_METHOD *meth); | 27 | DH *DH_new_method(ENGINE *engine); |
27 | DH_METHOD *DH_OpenSSL(void); | 28 | DH_METHOD *DH_OpenSSL(void); |
28 | 29 | ||
29 | int DH_get_ex_new_index(long argl, char *argp, int (*new_func)(), | 30 | int DH_get_ex_new_index(long argl, char *argp, int (*new_func)(), |
diff --git a/src/lib/libssl/src/doc/crypto/dsa.pod b/src/lib/libssl/src/doc/crypto/dsa.pod index 80ecf38178..573500204b 100644 --- a/src/lib/libssl/src/doc/crypto/dsa.pod +++ b/src/lib/libssl/src/doc/crypto/dsa.pod | |||
@@ -7,6 +7,7 @@ dsa - Digital Signature Algorithm | |||
7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
8 | 8 | ||
9 | #include <openssl/dsa.h> | 9 | #include <openssl/dsa.h> |
10 | #include <openssl/engine.h> | ||
10 | 11 | ||
11 | DSA * DSA_new(void); | 12 | DSA * DSA_new(void); |
12 | void DSA_free(DSA *dsa); | 13 | void DSA_free(DSA *dsa); |
@@ -28,10 +29,10 @@ dsa - Digital Signature Algorithm | |||
28 | int DSA_verify(int dummy, const unsigned char *dgst, int len, | 29 | int DSA_verify(int dummy, const unsigned char *dgst, int len, |
29 | unsigned char *sigbuf, int siglen, DSA *dsa); | 30 | unsigned char *sigbuf, int siglen, DSA *dsa); |
30 | 31 | ||
31 | void DSA_set_default_method(DSA_METHOD *meth); | 32 | void DSA_set_default_openssl_method(DSA_METHOD *meth); |
32 | DSA_METHOD *DSA_get_default_method(void); | 33 | DSA_METHOD *DSA_get_default_openssl_method(void); |
33 | DSA_METHOD *DSA_set_method(DSA *dsa, DSA_METHOD *meth); | 34 | int DSA_set_method(DSA *dsa, ENGINE *engine); |
34 | DSA *DSA_new_method(DSA_METHOD *meth); | 35 | DSA *DSA_new_method(ENGINE *engine); |
35 | DSA_METHOD *DSA_OpenSSL(void); | 36 | DSA_METHOD *DSA_OpenSSL(void); |
36 | 37 | ||
37 | int DSA_get_ex_new_index(long argl, char *argp, int (*new_func)(), | 38 | int DSA_get_ex_new_index(long argl, char *argp, int (*new_func)(), |
diff --git a/src/lib/libssl/src/doc/crypto/err.pod b/src/lib/libssl/src/doc/crypto/err.pod index b824c92b57..264e30103d 100644 --- a/src/lib/libssl/src/doc/crypto/err.pod +++ b/src/lib/libssl/src/doc/crypto/err.pod | |||
@@ -143,7 +143,7 @@ The closing #endif etc will be automatically added by the script. | |||
143 | 143 | ||
144 | The generated C error code file B<xxx_err.c> will load the header | 144 | The generated C error code file B<xxx_err.c> will load the header |
145 | files B<stdio.h>, B<openssl/err.h> and B<openssl/xxx.h> so the | 145 | files B<stdio.h>, B<openssl/err.h> and B<openssl/xxx.h> so the |
146 | header file must load any additional header files containg any | 146 | header file must load any additional header files containing any |
147 | definitions it uses. | 147 | definitions it uses. |
148 | 148 | ||
149 | =head1 USING ERROR CODES IN EXTERNAL LIBRARIES | 149 | =head1 USING ERROR CODES IN EXTERNAL LIBRARIES |
diff --git a/src/lib/libssl/src/doc/crypto/evp.pod b/src/lib/libssl/src/doc/crypto/evp.pod new file mode 100644 index 0000000000..f089dd49a2 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/evp.pod | |||
@@ -0,0 +1,37 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | evp - high-level cryptographic functions | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/evp.h> | ||
10 | |||
11 | =head1 DESCRIPTION | ||
12 | |||
13 | The EVP library provided a high-level interface to cryptographic | ||
14 | functions. | ||
15 | |||
16 | B<EVP_Seal>I<...> and B<EVP_Open>I<...> provide public key encryption | ||
17 | and decryption to implement digital "envelopes". | ||
18 | |||
19 | The B<EVP_Sign>I<...> and B<EVP_Verify>I<...> functions implement | ||
20 | digital signatures. | ||
21 | |||
22 | Symmetric encryption is available with the B<EVP_Encrypt>I<...> | ||
23 | functions. The B<EVP_Digest>I<...> functions provide message digests. | ||
24 | |||
25 | Algorithms are loaded with OpenSSL_add_all_algorithms(3). | ||
26 | |||
27 | =head1 SEE ALSO | ||
28 | |||
29 | L<EVP_DigestInit(3)|EVP_DigestInit(3)>, | ||
30 | L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>, | ||
31 | L<EVP_OpenInit(3)|EVP_OpenInit(3)>, | ||
32 | L<EVP_SealInit(3)|EVP_SealInit(3)>, | ||
33 | L<EVP_SignInit(3)|EVP_SignInit(3)>, | ||
34 | L<EVP_VerifyInit(3)|EVP_VerifyInit(3)>, | ||
35 | L<OpenSSL_add_all_algorithms(3)|OpenSSL_add_all_algorithms(3)> | ||
36 | |||
37 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/hmac.pod b/src/lib/libssl/src/doc/crypto/hmac.pod index 095e537da1..631f40377e 100644 --- a/src/lib/libssl/src/doc/crypto/hmac.pod +++ b/src/lib/libssl/src/doc/crypto/hmac.pod | |||
@@ -2,7 +2,8 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | HMAC, HMAC_Init, HMAC_Update, HMAC_Final - HMAC message authentication code | 5 | HMAC, HMAC_Init, HMAC_Update, HMAC_Final, HMAC_cleanup - HMAC message |
6 | authentication code | ||
6 | 7 | ||
7 | =head1 SYNOPSIS | 8 | =head1 SYNOPSIS |
8 | 9 | ||
diff --git a/src/lib/libssl/src/doc/crypto/lhash.pod b/src/lib/libssl/src/doc/crypto/lhash.pod index af2c9a7102..4e87aee824 100644 --- a/src/lib/libssl/src/doc/crypto/lhash.pod +++ b/src/lib/libssl/src/doc/crypto/lhash.pod | |||
@@ -102,7 +102,7 @@ The following description is based on the SSLeay documentation: | |||
102 | The B<lhash> library implements a hash table described in the | 102 | The B<lhash> library implements a hash table described in the |
103 | I<Communications of the ACM> in 1991. What makes this hash table | 103 | I<Communications of the ACM> in 1991. What makes this hash table |
104 | different is that as the table fills, the hash table is increased (or | 104 | different is that as the table fills, the hash table is increased (or |
105 | decreased) in size via Realloc(). When a 'resize' is done, instead of | 105 | decreased) in size via OPENSSL_realloc(). When a 'resize' is done, instead of |
106 | all hashes being redistributed over twice as many 'buckets', one | 106 | all hashes being redistributed over twice as many 'buckets', one |
107 | bucket is split. So when an 'expand' is done, there is only a minimal | 107 | bucket is split. So when an 'expand' is done, there is only a minimal |
108 | cost to redistribute some values. Subsequent inserts will cause more | 108 | cost to redistribute some values. Subsequent inserts will cause more |
diff --git a/src/lib/libssl/src/doc/crypto/md5.pod b/src/lib/libssl/src/doc/crypto/md5.pod index e9d7ccd689..6e6322dcdc 100644 --- a/src/lib/libssl/src/doc/crypto/md5.pod +++ b/src/lib/libssl/src/doc/crypto/md5.pod | |||
@@ -2,8 +2,8 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | MD2, MD5, MD2_Init, MD2_Update, MD2_Final, MD5_Init, MD5_Update, | 5 | MD2, MD4, MD5, MD2_Init, MD2_Update, MD2_Final, MD4_Init, MD4_Update, |
6 | MD5_Final - MD2 and MD5 hash functions | 6 | MD4_Final, MD5_Init, MD5_Update, MD5_Final - MD2, MD4, and MD5 hash functions |
7 | 7 | ||
8 | =head1 SYNOPSIS | 8 | =head1 SYNOPSIS |
9 | 9 | ||
@@ -18,6 +18,17 @@ MD5_Final - MD2 and MD5 hash functions | |||
18 | void MD2_Final(unsigned char *md, MD2_CTX *c); | 18 | void MD2_Final(unsigned char *md, MD2_CTX *c); |
19 | 19 | ||
20 | 20 | ||
21 | #include <openssl/md4.h> | ||
22 | |||
23 | unsigned char *MD4(const unsigned char *d, unsigned long n, | ||
24 | unsigned char *md); | ||
25 | |||
26 | void MD4_Init(MD4_CTX *c); | ||
27 | void MD4_Update(MD4_CTX *c, const void *data, | ||
28 | unsigned long len); | ||
29 | void MD4_Final(unsigned char *md, MD4_CTX *c); | ||
30 | |||
31 | |||
21 | #include <openssl/md5.h> | 32 | #include <openssl/md5.h> |
22 | 33 | ||
23 | unsigned char *MD5(const unsigned char *d, unsigned long n, | 34 | unsigned char *MD5(const unsigned char *d, unsigned long n, |
@@ -30,12 +41,13 @@ MD5_Final - MD2 and MD5 hash functions | |||
30 | 41 | ||
31 | =head1 DESCRIPTION | 42 | =head1 DESCRIPTION |
32 | 43 | ||
33 | MD2 and MD5 are cryptographic hash functions with a 128 bit output. | 44 | MD2, MD4, and MD5 are cryptographic hash functions with a 128 bit output. |
34 | 45 | ||
35 | MD2() and MD5() compute the MD2 and MD5 message digest of the B<n> | 46 | MD2(), MD4(), and MD5() compute the MD2, MD4, and MD5 message digest |
36 | bytes at B<d> and place it in B<md> (which must have space for | 47 | of the B<n> bytes at B<d> and place it in B<md> (which must have space |
37 | MD2_DIGEST_LENGTH == MD5_DIGEST_LENGTH == 16 bytes of output). If | 48 | for MD2_DIGEST_LENGTH == MD4_DIGEST_LENGTH == MD5_DIGEST_LENGTH == 16 |
38 | B<md> is NULL, the digest is placed in a static array. | 49 | bytes of output). If B<md> is NULL, the digest is placed in a static |
50 | array. | ||
39 | 51 | ||
40 | The following functions may be used if the message is not completely | 52 | The following functions may be used if the message is not completely |
41 | stored in memory: | 53 | stored in memory: |
@@ -48,8 +60,8 @@ be hashed (B<len> bytes at B<data>). | |||
48 | MD2_Final() places the message digest in B<md>, which must have space | 60 | MD2_Final() places the message digest in B<md>, which must have space |
49 | for MD2_DIGEST_LENGTH == 16 bytes of output, and erases the B<MD2_CTX>. | 61 | for MD2_DIGEST_LENGTH == 16 bytes of output, and erases the B<MD2_CTX>. |
50 | 62 | ||
51 | MD5_Init(), MD5_Update() and MD5_Final() are analogous using an | 63 | MD4_Init(), MD4_Update(), MD4_Final(), MD5_Init(), MD5_Update(), and |
52 | B<MD5_CTX> structure. | 64 | MD5_Final() are analogous using an B<MD4_CTX> and B<MD5_CTX> structure. |
53 | 65 | ||
54 | Applications should use the higher level functions | 66 | Applications should use the higher level functions |
55 | L<EVP_DigestInit(3)|EVP_DigestInit(3)> | 67 | L<EVP_DigestInit(3)|EVP_DigestInit(3)> |
@@ -57,24 +69,25 @@ etc. instead of calling the hash functions directly. | |||
57 | 69 | ||
58 | =head1 NOTE | 70 | =head1 NOTE |
59 | 71 | ||
60 | MD2 and MD5 are recommended only for compatibility with existing | 72 | MD2, MD4, and MD5 are recommended only for compatibility with existing |
61 | applications. In new applications, SHA-1 or RIPEMD-160 should be | 73 | applications. In new applications, SHA-1 or RIPEMD-160 should be |
62 | preferred. | 74 | preferred. |
63 | 75 | ||
64 | =head1 RETURN VALUES | 76 | =head1 RETURN VALUES |
65 | 77 | ||
66 | MD2() and MD5() return pointers to the hash value. | 78 | MD2(), MD4(), and MD5() return pointers to the hash value. |
67 | 79 | ||
68 | MD2_Init(), MD2_Update() MD2_Final(), MD5_Init(), MD5_Update() and | 80 | MD2_Init(), MD2_Update(), MD2_Final(), MD4_Init(), MD4_Update(), |
69 | MD5_Final() do not return values. | 81 | MD4_Final(), MD5_Init(), MD5_Update(), and MD5_Final() do not return |
82 | values. | ||
70 | 83 | ||
71 | =head1 CONFORMING TO | 84 | =head1 CONFORMING TO |
72 | 85 | ||
73 | RFC 1319, RFC 1321 | 86 | RFC 1319, RFC 1320, RFC 1321 |
74 | 87 | ||
75 | =head1 SEE ALSO | 88 | =head1 SEE ALSO |
76 | 89 | ||
77 | L<SHA1(3)|SHA1(3)>, L<RIPEMD160(3)|RIPEMD160(3)>, L<EVP_DigestInit(3)|EVP_DigestInit(3)> | 90 | L<sha(3)|sha(3)>, L<ripemd(3)|ripemd(3)>, L<EVP_DigestInit(3)|EVP_DigestInit(3)> |
78 | 91 | ||
79 | =head1 HISTORY | 92 | =head1 HISTORY |
80 | 93 | ||
@@ -82,4 +95,7 @@ MD2(), MD2_Init(), MD2_Update() MD2_Final(), MD5(), MD5_Init(), | |||
82 | MD5_Update() and MD5_Final() are available in all versions of SSLeay | 95 | MD5_Update() and MD5_Final() are available in all versions of SSLeay |
83 | and OpenSSL. | 96 | and OpenSSL. |
84 | 97 | ||
98 | MD4(), MD4_Init(), and MD4_Update() are available in OpenSSL 0.9.6 and | ||
99 | above. | ||
100 | |||
85 | =cut | 101 | =cut |
diff --git a/src/lib/libssl/src/doc/crypto/rsa.pod b/src/lib/libssl/src/doc/crypto/rsa.pod index eb8ba612c4..ef0d4df205 100644 --- a/src/lib/libssl/src/doc/crypto/rsa.pod +++ b/src/lib/libssl/src/doc/crypto/rsa.pod | |||
@@ -7,6 +7,7 @@ rsa - RSA public key cryptosystem | |||
7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
8 | 8 | ||
9 | #include <openssl/rsa.h> | 9 | #include <openssl/rsa.h> |
10 | #include <openssl/engine.h> | ||
10 | 11 | ||
11 | RSA * RSA_new(void); | 12 | RSA * RSA_new(void); |
12 | void RSA_free(RSA *rsa); | 13 | void RSA_free(RSA *rsa); |
@@ -31,15 +32,15 @@ rsa - RSA public key cryptosystem | |||
31 | int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); | 32 | int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); |
32 | void RSA_blinding_off(RSA *rsa); | 33 | void RSA_blinding_off(RSA *rsa); |
33 | 34 | ||
34 | void RSA_set_default_method(RSA_METHOD *meth); | 35 | void RSA_set_default_openssl_method(RSA_METHOD *meth); |
35 | RSA_METHOD *RSA_get_default_method(void); | 36 | RSA_METHOD *RSA_get_default_openssl_method(void); |
36 | RSA_METHOD *RSA_set_method(RSA *rsa, RSA_METHOD *meth); | 37 | int RSA_set_method(RSA *rsa, ENGINE *engine); |
37 | RSA_METHOD *RSA_get_method(RSA *rsa); | 38 | RSA_METHOD *RSA_get_method(RSA *rsa); |
38 | RSA_METHOD *RSA_PKCS1_SSLeay(void); | 39 | RSA_METHOD *RSA_PKCS1_SSLeay(void); |
39 | RSA_METHOD *RSA_PKCS1_RSAref(void); | 40 | RSA_METHOD *RSA_PKCS1_RSAref(void); |
40 | RSA_METHOD *RSA_null_method(void); | 41 | RSA_METHOD *RSA_null_method(void); |
41 | int RSA_flags(RSA *rsa); | 42 | int RSA_flags(RSA *rsa); |
42 | RSA *RSA_new_method(RSA_METHOD *method); | 43 | RSA *RSA_new_method(ENGINE *engine); |
43 | 44 | ||
44 | int RSA_print(BIO *bp, RSA *x, int offset); | 45 | int RSA_print(BIO *bp, RSA *x, int offset); |
45 | int RSA_print_fp(FILE *fp, RSA *x, int offset); | 46 | int RSA_print_fp(FILE *fp, RSA *x, int offset); |
@@ -96,7 +97,7 @@ SSL, PKCS #1 v2.0 | |||
96 | 97 | ||
97 | =head1 PATENTS | 98 | =head1 PATENTS |
98 | 99 | ||
99 | RSA is covered by a US patent which expires in September 2000. | 100 | RSA was covered by a US patent which expired in September 2000. |
100 | 101 | ||
101 | =head1 SEE ALSO | 102 | =head1 SEE ALSO |
102 | 103 | ||
diff --git a/src/lib/libssl/src/doc/crypto/threads.pod b/src/lib/libssl/src/doc/crypto/threads.pod index 5da056f3f8..bc7ff9b705 100644 --- a/src/lib/libssl/src/doc/crypto/threads.pod +++ b/src/lib/libssl/src/doc/crypto/threads.pod | |||
@@ -2,7 +2,10 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | CRYPTO_set_locking_callback, CRYPTO_set_id_callback - OpenSSL thread support | 5 | CRYPTO_set_locking_callback, CRYPTO_set_id_callback, CRYPTO_num_locks, |
6 | CRYPTO_set_dynlock_create_callback, CRYPTO_set_dynlock_lock_callback, | ||
7 | CRYPTO_set_dynlock_destroy_callback, CRYPTO_get_new_dynlockid, | ||
8 | CRYPTO_destroy_dynlockid, CRYPTO_lock - OpenSSL thread support | ||
6 | 9 | ||
7 | =head1 SYNOPSIS | 10 | =head1 SYNOPSIS |
8 | 11 | ||
@@ -15,13 +18,42 @@ CRYPTO_set_locking_callback, CRYPTO_set_id_callback - OpenSSL thread support | |||
15 | 18 | ||
16 | int CRYPTO_num_locks(void); | 19 | int CRYPTO_num_locks(void); |
17 | 20 | ||
21 | |||
22 | /* struct CRYPTO_dynlock_value needs to be defined by the user */ | ||
23 | struct CRYPTO_dynlock_value; | ||
24 | |||
25 | void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value * | ||
26 | (*dyn_create_function)(char *file, int line)); | ||
27 | void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function) | ||
28 | (int mode, struct CRYPTO_dynlock_value *l, | ||
29 | const char *file, int line)); | ||
30 | void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function) | ||
31 | (struct CRYPTO_dynlock_value *l, const char *file, int line)); | ||
32 | |||
33 | int CRYPTO_get_new_dynlockid(void); | ||
34 | |||
35 | void CRYPTO_destroy_dynlockid(int i); | ||
36 | |||
37 | void CRYPTO_lock(int mode, int n, const char *file, int line); | ||
38 | |||
39 | #define CRYPTO_w_lock(type) \ | ||
40 | CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__) | ||
41 | #define CRYPTO_w_unlock(type) \ | ||
42 | CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__) | ||
43 | #define CRYPTO_r_lock(type) \ | ||
44 | CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__) | ||
45 | #define CRYPTO_r_unlock(type) \ | ||
46 | CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__) | ||
47 | #define CRYPTO_add(addr,amount,type) \ | ||
48 | CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__) | ||
49 | |||
18 | =head1 DESCRIPTION | 50 | =head1 DESCRIPTION |
19 | 51 | ||
20 | OpenSSL can safely be used in multi-threaded applications provided | 52 | OpenSSL can safely be used in multi-threaded applications provided |
21 | that two callback functions are set. | 53 | that at least two callback functions are set. |
22 | 54 | ||
23 | 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 |
24 | needed to perform locking on shared data stuctures. Multi-threaded | 56 | needed to perform locking on shared data structures. Multi-threaded |
25 | applications will crash at random if it is not set. | 57 | applications will crash at random if it is not set. |
26 | 58 | ||
27 | locking_function() must be able to handle up to CRYPTO_num_locks() | 59 | locking_function() must be able to handle up to CRYPTO_num_locks() |
@@ -35,9 +67,59 @@ id_function(void) is a function that returns a thread ID. It is not | |||
35 | needed on Windows nor on platforms where getpid() returns a different | 67 | needed on Windows nor on platforms where getpid() returns a different |
36 | ID for each thread (most notably Linux). | 68 | ID for each thread (most notably Linux). |
37 | 69 | ||
70 | Additionally, OpenSSL supports dynamic locks, and sometimes, some parts | ||
71 | of OpenSSL need it for better performance. To enable this, the following | ||
72 | is required: | ||
73 | |||
74 | =over 4 | ||
75 | |||
76 | =item * | ||
77 | Three additional callback function, dyn_create_function, dyn_lock_function | ||
78 | and dyn_destroy_function. | ||
79 | |||
80 | =item * | ||
81 | A structure defined with the data that each lock needs to handle. | ||
82 | |||
83 | =back | ||
84 | |||
85 | struct CRYPTO_dynlock_value has to be defined to contain whatever structure | ||
86 | is needed to handle locks. | ||
87 | |||
88 | dyn_create_function(const char *file, int line) is needed to create a | ||
89 | lock. Multi-threaded applications might crash at random if it is not set. | ||
90 | |||
91 | dyn_lock_function(int mode, CRYPTO_dynlock *l, const char *file, int line) | ||
92 | is needed to perform locking off dynamic lock numbered n. Multi-threaded | ||
93 | applications might crash at random if it is not set. | ||
94 | |||
95 | dyn_destroy_function(CRYPTO_dynlock *l, const char *file, int line) is | ||
96 | needed to destroy the lock l. Multi-threaded applications might crash at | ||
97 | random if it is not set. | ||
98 | |||
99 | CRYPTO_get_new_dynlockid() is used to create locks. It will call | ||
100 | dyn_create_function for the actual creation. | ||
101 | |||
102 | CRYPTO_destroy_dynlockid() is used to destroy locks. It will call | ||
103 | dyn_destroy_function for the actual destruction. | ||
104 | |||
105 | CRYPTO_lock() is used to lock and unlock the locks. mode is a bitfield | ||
106 | describing what should be done with the lock. n is the number of the | ||
107 | lock as returned from CRYPTO_get_new_dynlockid(). mode can be combined | ||
108 | from the following values. These values are pairwise exclusive, with | ||
109 | undefined behaviour if misused (for example, CRYPTO_READ and CRYPTO_WRITE | ||
110 | should not be used together): | ||
111 | |||
112 | CRYPTO_LOCK 0x01 | ||
113 | CRYPTO_UNLOCK 0x02 | ||
114 | CRYPTO_READ 0x04 | ||
115 | CRYPTO_WRITE 0x08 | ||
116 | |||
38 | =head1 RETURN VALUES | 117 | =head1 RETURN VALUES |
39 | 118 | ||
40 | CRYPTO_num_locks() returns the required number of locks. | 119 | CRYPTO_num_locks() returns the required number of locks. |
120 | |||
121 | CRYPTO_get_new_dynlockid() returns the index to the newly created lock. | ||
122 | |||
41 | The other functions return no values. | 123 | The other functions return no values. |
42 | 124 | ||
43 | =head1 NOTE | 125 | =head1 NOTE |
@@ -52,6 +134,9 @@ You can find out if OpenSSL was configured with thread support: | |||
52 | // no thread support | 134 | // no thread support |
53 | #endif | 135 | #endif |
54 | 136 | ||
137 | Also, dynamic locks are currently not used internally by OpenSSL, but | ||
138 | may do so in the future. | ||
139 | |||
55 | =head1 EXAMPLES | 140 | =head1 EXAMPLES |
56 | 141 | ||
57 | B<crypto/threads/mttest.c> shows examples of the callback functions on | 142 | B<crypto/threads/mttest.c> shows examples of the callback functions on |
@@ -62,6 +147,7 @@ Solaris, Irix and Win32. | |||
62 | CRYPTO_set_locking_callback() and CRYPTO_set_id_callback() are | 147 | CRYPTO_set_locking_callback() and CRYPTO_set_id_callback() are |
63 | available in all versions of SSLeay and OpenSSL. | 148 | available in all versions of SSLeay and OpenSSL. |
64 | CRYPTO_num_locks() was added in OpenSSL 0.9.4. | 149 | CRYPTO_num_locks() was added in OpenSSL 0.9.4. |
150 | All functions dealing with dynamic locks were added in OpenSSL 0.9.5b-dev. | ||
65 | 151 | ||
66 | =head1 SEE ALSO | 152 | =head1 SEE ALSO |
67 | 153 | ||
diff --git a/src/lib/libssl/src/doc/openssl.txt b/src/lib/libssl/src/doc/openssl.txt index 880eace4da..5da519e7e4 100644 --- a/src/lib/libssl/src/doc/openssl.txt +++ b/src/lib/libssl/src/doc/openssl.txt | |||
@@ -355,6 +355,24 @@ that would not make sense. It does support an additional issuer:copy option | |||
355 | that will copy all the subject alternative name values from the issuer | 355 | that will copy all the subject alternative name values from the issuer |
356 | certificate (if possible). | 356 | certificate (if possible). |
357 | 357 | ||
358 | Example: | ||
359 | |||
360 | issuserAltName = issuer:copy | ||
361 | |||
362 | Authority Info Access. | ||
363 | |||
364 | The authority information access extension gives details about how to access | ||
365 | certain information relating to the CA. Its syntax is accessOID;location | ||
366 | where 'location' has the same syntax as subject alternative name (except | ||
367 | that email:copy is not supported). accessOID can be any valid OID but only | ||
368 | certain values are meaningful for example OCSP and caIssuers. OCSP gives the | ||
369 | location of an OCSP responder: this is used by Netscape PSM and other software. | ||
370 | |||
371 | Example: | ||
372 | |||
373 | authorityInfoAccess = OCSP;URI:http://ocsp.my.host/ | ||
374 | authorityInfoAccess = caIssuers;URI:http://my.ca/ca.html | ||
375 | |||
358 | CRL distribution points. | 376 | CRL distribution points. |
359 | 377 | ||
360 | This is a multi-valued extension that supports all the literal options of | 378 | This is a multi-valued extension that supports all the literal options of |
@@ -489,6 +507,47 @@ details about the structures returned. The returned structure should be freed | |||
489 | after use using the relevant free function, BASIC_CONSTRAINTS_free() for | 507 | after use using the relevant free function, BASIC_CONSTRAINTS_free() for |
490 | example. | 508 | example. |
491 | 509 | ||
510 | void * X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx); | ||
511 | void * X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx); | ||
512 | void * X509_REVOKED_get_ext_d2i(X509_REVOKED *x, int nid, int *crit, int *idx); | ||
513 | void * X509V3_get_d2i(STACK_OF(X509_EXTENSION) *x, int nid, int *crit, int *idx); | ||
514 | |||
515 | These functions combine the operations of searching for extensions and | ||
516 | parsing them. They search a certificate, a CRL a CRL entry or a stack | ||
517 | of extensions respectively for extension whose NID is 'nid' and return | ||
518 | the parsed result of NULL if an error occurred. For example: | ||
519 | |||
520 | BASIC_CONSTRAINTS *bs; | ||
521 | bs = X509_get_ext_d2i(cert, NID_basic_constraints, NULL, NULL); | ||
522 | |||
523 | This will search for the basicConstraints extension and either return | ||
524 | it value or NULL. NULL can mean either the extension was not found, it | ||
525 | occurred more than once or it could not be parsed. | ||
526 | |||
527 | If 'idx' is NULL then an extension is only parsed if it occurs precisely | ||
528 | once. This is standard behaviour because extensions normally cannot occur | ||
529 | more than once. If however more than one extension of the same type can | ||
530 | occur it can be used to parse successive extensions for example: | ||
531 | |||
532 | int i; | ||
533 | void *ext; | ||
534 | |||
535 | i = -1; | ||
536 | for(;;) { | ||
537 | ext = X509_get_ext_d2i(x, nid, crit, &idx); | ||
538 | if(ext == NULL) break; | ||
539 | /* Do something with ext */ | ||
540 | } | ||
541 | |||
542 | If 'crit' is not NULL and the extension was found then the int it points to | ||
543 | is set to 1 for critical extensions and 0 for non critical. Therefore if the | ||
544 | function returns NULL but 'crit' is set to 0 or 1 then the extension was | ||
545 | found but it could not be parsed. | ||
546 | |||
547 | The int pointed to by crit will be set to -1 if the extension was not found | ||
548 | and -2 if the extension occurred more than once (this will only happen if | ||
549 | idx is NULL). In both cases the function will return NULL. | ||
550 | |||
492 | 3. Generating extensions. | 551 | 3. Generating extensions. |
493 | 552 | ||
494 | An extension will typically be generated from a configuration file, or some | 553 | An extension will typically be generated from a configuration file, or some |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CIPHER_get_name.pod b/src/lib/libssl/src/doc/ssl/SSL_CIPHER_get_name.pod new file mode 100644 index 0000000000..7fea14ee68 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CIPHER_get_name.pod | |||
@@ -0,0 +1,57 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CIPHER_get_name, SSL_CIPHER_get_bits, SSL_CIPHER_get_version, | ||
6 | SSL_CIPHER_description - get SSL_CIPHER properties | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | const char *SSL_CIPHER_get_name(SSL_CIPHER *cipher); | ||
13 | int SSL_CIPHER_get_bits(SSL_CIPHER *cipher, int *alg_bits); | ||
14 | char *SSL_CIPHER_get_version(SSL_CIPHER *cipher); | ||
15 | char *SSL_CIPHER_description(SSL_CIPHER *cipher, char *buf, int size); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | SSL_CIPHER_get_name() returns a pointer to the name of B<cipher>. If the | ||
20 | argument is the NULL pointer, a pointer to the constant value "NONE" is | ||
21 | returned. | ||
22 | |||
23 | SSL_CIPHER_get_bits() returns the number of secret bits used for B<cipher>. If | ||
24 | B<alg_bits> is not NULL, it contains the number of bits processed by the | ||
25 | chosen algorithm. If B<cipher> is NULL, 0 is returned. | ||
26 | |||
27 | SSL_CIPHER_get_version() returns the protocol version for B<cipher>, currently | ||
28 | "SSLv2", "SSLv3", or "TLSv1". If B<cipher> is NULL, "(NONE)" is returned. | ||
29 | |||
30 | SSL_CIPHER_description() returns a textual description of the cipher used | ||
31 | into the buffer B<buf> of length B<len> provided. B<len> must be at least | ||
32 | 128 bytes, otherwise the string "Buffer too small" is returned. If B<buf> | ||
33 | is NULL, a buffer of 128 bytes is allocated using OPENSSL_malloc(). If the | ||
34 | allocation fails, the string "OPENSSL_malloc Error" is returned. | ||
35 | |||
36 | =head1 NOTES | ||
37 | |||
38 | The number of bits processed can be different from the secret bits. An | ||
39 | export cipher like e.g. EXP-RC4-MD5 has only 40 secret bits. The algorithm | ||
40 | does use the full 128 bits (which would be returned for B<alg_bits>), of | ||
41 | which however 88bits are fixed. The search space is hence only 40 bits. | ||
42 | |||
43 | =head1 BUGS | ||
44 | |||
45 | If SSL_CIPHER_description() is called with B<cipher> being NULL, the | ||
46 | library crashes. | ||
47 | |||
48 | =head1 RETURN VALUES | ||
49 | |||
50 | See DESCRIPTION | ||
51 | |||
52 | =head1 SEE ALSO | ||
53 | |||
54 | L<ssl(3)|ssl(3)>, L<SSL_get_current_cipher(3)|SSL_get_current_cipher(3)>, | ||
55 | L<SSL_get_ciphers(3)|SSL_get_ciphers(3)> | ||
56 | |||
57 | =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 new file mode 100644 index 0000000000..de69672422 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_free.pod | |||
@@ -0,0 +1,29 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_free - free an allocated SSL_CTX object | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | void SSL_CTX_free(SSL_CTX *ctx); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_CTX_free() decrements the reference count of B<ctx>, and removes the | ||
16 | SSL_CTX object pointed to by B<ctx> and frees up the allocated memory if the | ||
17 | the reference count has reached 0. | ||
18 | |||
19 | It also calls the free()ing procedures for indirectly affected items, if | ||
20 | applicable: the session cacahe, the list of ciphers, the list of Client CAs, | ||
21 | the certificates and keys. | ||
22 | |||
23 | =head1 RETURN VALUES | ||
24 | |||
25 | SSL_CTX_free() does not provide diagnostic information. | ||
26 | |||
27 | L<SSL_CTX_new(3)|SSL_CTX_new(3)>, L<ssl(3)|ssl(3)> | ||
28 | |||
29 | =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 new file mode 100644 index 0000000000..e166c692c3 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_new.pod | |||
@@ -0,0 +1,93 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_new - create a new SSL_CTX object as framework for TLS/SSL enabled functions | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | SSL_CTX *SSL_CTX_new(SSL_METHOD *method); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_CTX_new() creates a new B<SSL_CTX> object as framework to establish | ||
16 | TLS/SSL enabled connections. | ||
17 | |||
18 | =head1 NOTES | ||
19 | |||
20 | The SSL_CTX object uses B<method> as connection method. The methods exist | ||
21 | in a generic type (for client and server use), a server only type, and a | ||
22 | client only type. B<method> can be of the following types: | ||
23 | |||
24 | =over 4 | ||
25 | |||
26 | =item SSLv2_method(void), SSLv2_server_method(void), SSLv2_client_method(void) | ||
27 | |||
28 | A TLS/SSL connection established with these methods will only understand | ||
29 | the SSLv2 protocol. A client will send out SSLv2 client hello messages | ||
30 | and will also indicate that it only understand SSLv2. A server will only | ||
31 | understand SSLv2 client hello messages. | ||
32 | |||
33 | =item SSLv3_method(void), SSLv3_server_method(void), SSLv3_client_method(void) | ||
34 | |||
35 | A TLS/SSL connection established with these methods will only understand the | ||
36 | SSLv3 and TLSv1 protocol. A client will send out SSLv3 client hello messages | ||
37 | and will indicate that it also understands TLSv1. A server will only understand | ||
38 | SSLv3 and TLSv1 client hello messages. This especially means, that it will | ||
39 | not understand SSLv2 client hello messages which are widely used for | ||
40 | compatibility reasons, see SSLv23_*_method(). | ||
41 | |||
42 | =item TLSv1_method(void), TLSv1_server_method(void), TLSv1_client_method(void) | ||
43 | |||
44 | A TLS/SSL connection established with these methods will only understand the | ||
45 | TLSv1 protocol. A client will send out TLSv1 client hello messages | ||
46 | and will indicate that it only understands TLSv1. A server will only understand | ||
47 | TLSv1 client hello messages. This especially means, that it will | ||
48 | not understand SSLv2 client hello messages which are widely used for | ||
49 | compatibility reasons, see SSLv23_*_method(). | ||
50 | |||
51 | =item SSLv23_method(void), SSLv23_server_method(void), SSLv23_client_method(void) | ||
52 | |||
53 | A TLS/SSL connection established with these methods will understand the SSLv2, | ||
54 | SSLv3, and TLSv1 protocol. A client will send out SSLv2 client hello messages | ||
55 | and will indicate that it also understands SSLv3 and TLSv1. A server will | ||
56 | understand SSLv2, SSLv3, and TLSv1 client hello messages. This is the best | ||
57 | choice when compatibility is a concern. | ||
58 | |||
59 | =back | ||
60 | |||
61 | The list of protocols available can later be limited using the SSL_OP_NO_SSLv2, | ||
62 | SSL_OP_NO_SSLv3, SSL_OP_NO_TLSv1 options of the B<SSL_CTX_set_options()> or | ||
63 | B<SSL_set_options()> functions. Using these options it is possible to choose | ||
64 | e.g. SSLv23_server_method() and be able to negotiate with all possible | ||
65 | clients, but to only allow newer protocols like SSLv3 or TLSv1. | ||
66 | |||
67 | SSL_CTX_new() initializes the list of ciphers, the session cache setting, | ||
68 | the callbacks, the keys and certificates, and the options to its default | ||
69 | values. | ||
70 | |||
71 | =head1 RETURN VALUES | ||
72 | |||
73 | The following return values can occur: | ||
74 | |||
75 | =over 4 | ||
76 | |||
77 | =item NULL | ||
78 | |||
79 | The creation of a new SSL_CTX object failed. Check the error stack to | ||
80 | find out the reason. | ||
81 | |||
82 | =item Pointer to an SSL_CTX object | ||
83 | |||
84 | The return value points to an allocated SSL_CTX object. | ||
85 | |||
86 | =back | ||
87 | |||
88 | =head1 SEE ALSO | ||
89 | |||
90 | L<SSL_CTX_free(3)|SSL_CTX_free(3)>, L<SSL_accept(3)|SSL_accept(3)>, | ||
91 | L<ssl(3)|ssl(3)> | ||
92 | |||
93 | =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 new file mode 100644 index 0000000000..272d6b3de2 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cipher_list.pod | |||
@@ -0,0 +1,52 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_cipher_list, SSL_set_cipher_list | ||
6 | - choose list of available SSL_CIPHERs | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str); | ||
13 | int SSL_set_cipher_list(SSL *ssl, const char *str); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | SSL_CTX_set_cipher_list() sets the list of available ciphers for B<ctx> | ||
18 | using the control string B<str>. The format of the string is described | ||
19 | in L<ciphers(1)|ciphers(1)>. The list of ciphers is inherited by all | ||
20 | B<ssl> objects created from B<ctx>. | ||
21 | |||
22 | SSL_set_cipher_list() sets the list of ciphers only for B<ssl>. | ||
23 | |||
24 | =head1 NOTES | ||
25 | |||
26 | The control string B<str> should be universally usable and not depend | ||
27 | on details of the library configuration (ciphers compiled in). Thus no | ||
28 | syntax checking takes place. Items that are not recognized, because the | ||
29 | corresponding ciphers are not compiled in or because they are mistyped, | ||
30 | are simply ignored. Failure is only flagged if no ciphers could be collected | ||
31 | at all. | ||
32 | |||
33 | It should be noted, that inclusion of a cipher to be used into the list is | ||
34 | a necessary condition. On the client side, the inclusion into the list is | ||
35 | also sufficient. On the server side, additional restrictions apply. All ciphers | ||
36 | have additional requirements. ADH ciphers don't need a certificate, but | ||
37 | DH-parameters must have been set. All other ciphers need a corresponding | ||
38 | certificate and key. A RSA cipher can only be chosen, when a RSA certificate is | ||
39 | available, the respective is valid for DSA ciphers. Ciphers using EDH need | ||
40 | a certificate and key and DH-parameters. | ||
41 | |||
42 | =head1 RETURN VALUES | ||
43 | |||
44 | SSL_CTX_set_cipher_list() and SSL_set_cipher_list() return 1 if any cipher | ||
45 | could be selected and 0 on complete failure. | ||
46 | |||
47 | =head1 SEE ALSO | ||
48 | |||
49 | L<ssl(3)|ssl(3)>, L<SSL_get_ciphers(3)|SSL_get_ciphers(3)>, | ||
50 | L<ciphers(1)|ciphers(1)> | ||
51 | |||
52 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_ssl_version.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_ssl_version.pod new file mode 100644 index 0000000000..3091bd6895 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_ssl_version.pod | |||
@@ -0,0 +1,60 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_ssl_version, SSL_set_ssl_method, SSL_get_ssl_method | ||
6 | - choose a new TLS/SSL method | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | int SSL_CTX_set_ssl_version(SSL_CTX *ctx, SSL_METHOD *method); | ||
13 | int SSL_set_ssl_method(SSL *s, SSL_METHOD *method); | ||
14 | SSL_METHOD *SSL_get_ssl_method(SSL *ssl); | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | SSL_CTX_set_ssl_version() sets a new default TLS/SSL B<method> for SSL objects | ||
19 | newly created from this B<ctx>. SSL objects already created with | ||
20 | L<SSL_new(3)|SSL_new(3)> are not affected, except when SSL_clear() is | ||
21 | being called. | ||
22 | |||
23 | SSL_set_ssl_method() sets a new TLS/SSL B<method> for a particular B<ssl> | ||
24 | object. It may be reset, when SSL_clear() is called. | ||
25 | |||
26 | SSL_get_ssl_method() returns a function pointer to the TLS/SSL method | ||
27 | set in B<ssl>. | ||
28 | |||
29 | =head1 NOTES | ||
30 | |||
31 | The available B<method> choices are described in | ||
32 | L<SSL_CTX_new(3)|SSL_CTX_new(3)>. | ||
33 | |||
34 | When SSL_clear() is called and no session is connected to an SSL object, | ||
35 | the method of the SSL object is reset to the method currently set in | ||
36 | the corresponding SSL_CTX object. | ||
37 | |||
38 | =head1 RETURN VALUES | ||
39 | |||
40 | The following return values can occur for SSL_CTX_set_ssl_version() | ||
41 | and SSL_set_ssl_method(): | ||
42 | |||
43 | =over 4 | ||
44 | |||
45 | =item 0 | ||
46 | |||
47 | The new choice failed, check the error stack to find out the reason. | ||
48 | |||
49 | =item 1 | ||
50 | |||
51 | The operation succeeded. | ||
52 | |||
53 | =back | ||
54 | |||
55 | =head1 SEE ALSO | ||
56 | |||
57 | L<SSL_CTX_new(3)|SSL_CTX_new(3)>, L<SSL_new(3)|SSL_new(3)>, | ||
58 | L<SSL_clear(3)|SSL_clear(3)>, L<ssl(3)|ssl(3)> | ||
59 | |||
60 | =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 new file mode 100644 index 0000000000..df30ccbb32 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_SESSION_free.pod | |||
@@ -0,0 +1,25 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_SESSION_free - free an allocated SSL_SESSION structure | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | void SSL_SESSION_free(SSL_SESSION *session); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | 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 | ||
17 | memory, if the the reference count has reached 0. | ||
18 | |||
19 | =head1 RETURN VALUES | ||
20 | |||
21 | SSL_SESSION_free() does not provide diagnostic information. | ||
22 | |||
23 | L<ssl(3)|ssl(3)>, L<SSL_get_session(3)|SSL_get_session(3)> | ||
24 | |||
25 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_accept.pod b/src/lib/libssl/src/doc/ssl/SSL_accept.pod new file mode 100644 index 0000000000..0c79ac515e --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_accept.pod | |||
@@ -0,0 +1,72 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_accept - wait for a TLS/SSL client to initiate a TLS/SSL handshake | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_accept(SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_accept() waits for a TLS/SSL client to initiate the TLS/SSL handshake. | ||
16 | The communication channel must already have been set and assigned to the | ||
17 | B<ssl> by setting an underlying B<BIO>. | ||
18 | |||
19 | =head1 NOTES | ||
20 | |||
21 | The behaviour of SSL_accept() depends on the underlying BIO. | ||
22 | |||
23 | If the underlying BIO is B<blocking>, SSL_accept() will only return once the | ||
24 | handshake has been finished or an error occurred, except for SGC (Server | ||
25 | Gated Cryptography). For SGC, SSL_accept() may return with -1, but | ||
26 | SSL_get_error() will yield B<SSL_ERROR_WANT_READ/WRITE> and SSL_accept() | ||
27 | should be called again. | ||
28 | |||
29 | If the underlying BIO is B<non-blocking>, SSL_accept() will also return | ||
30 | when the underlying BIO could not satisfy the needs of SSL_accept() | ||
31 | to continue the handshake. In this case a call to SSL_get_error() with the | ||
32 | return value of SSL_accept() will yield B<SSL_ERROR_WANT_READ> or | ||
33 | B<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after | ||
34 | taking appropriate action to satisfy the needs of SSL_accept(). | ||
35 | The action depends on the underlying BIO. When using a non-blocking socket, | ||
36 | 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 | ||
38 | into or retrieved out of the BIO before being able to continue. | ||
39 | |||
40 | =head1 RETURN VALUES | ||
41 | |||
42 | The following return values can occur: | ||
43 | |||
44 | =over 4 | ||
45 | |||
46 | =item 1 | ||
47 | |||
48 | The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been | ||
49 | established. | ||
50 | |||
51 | =item 0 | ||
52 | |||
53 | The TLS/SSL handshake was not successful but was shut down controlled and | ||
54 | by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the | ||
55 | return value B<ret> to find out the reason. | ||
56 | |||
57 | =item -1 | ||
58 | |||
59 | The TLS/SSL handshake was not successful because a fatal error occurred either | ||
60 | at the protocol level or a connection failure occurred. The shutdown was | ||
61 | not clean. It can also occur of action is need to continue the operation | ||
62 | for non-blocking BIOs. Call SSL_get_error() with the return value B<ret> | ||
63 | to find out the reason. | ||
64 | |||
65 | =back | ||
66 | |||
67 | =head1 SEE ALSO | ||
68 | |||
69 | L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_connect(3)|SSL_connect(3)>, | ||
70 | L<SSL_shutdown(3)|SSL_shutdown(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> | ||
71 | |||
72 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_clear.pod b/src/lib/libssl/src/doc/ssl/SSL_clear.pod new file mode 100644 index 0000000000..862fd8291d --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_clear.pod | |||
@@ -0,0 +1,39 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_clear - reset SSL object to allow another connection | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_clear(SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | Reset B<ssl> to allow another connection. All settings (method, ciphers, | ||
16 | BIOs) are kept. A completely negotiated B<SSL_SESSION> is not freed but left | ||
17 | untouched for the underlying B<SSL_CTX>. | ||
18 | |||
19 | =head1 RETURN VALUES | ||
20 | |||
21 | The following return values can occur: | ||
22 | |||
23 | =over 4 | ||
24 | |||
25 | =item 0 | ||
26 | |||
27 | The SSL_clear() operation could not be performed. Check the error stack to | ||
28 | find out the reason. | ||
29 | |||
30 | =item 1 | ||
31 | |||
32 | The SSL_clear() operation was successful. | ||
33 | |||
34 | =back | ||
35 | |||
36 | L<SSL_new(3)|SSL_new(3)>, L<SSL_free(3)|SSL_free(3)>, | ||
37 | L<ssl(3)|ssl(3)> | ||
38 | |||
39 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_connect.pod b/src/lib/libssl/src/doc/ssl/SSL_connect.pod new file mode 100644 index 0000000000..debe41744f --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_connect.pod | |||
@@ -0,0 +1,69 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_connect - initiate the TLS/SSL handshake with an TLS/SSL server | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_connect(SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_connect() initiates the TLS/SSL handshake with a server. The communication | ||
16 | channel must already have been set and assigned to the B<ssl> by setting an | ||
17 | underlying B<BIO>. | ||
18 | |||
19 | =head1 NOTES | ||
20 | |||
21 | The behaviour of SSL_connect() depends on the underlying BIO. | ||
22 | |||
23 | If the underlying BIO is B<blocking>, SSL_connect() will only return once the | ||
24 | handshake has been finished or an error occurred. | ||
25 | |||
26 | If the underlying BIO is B<non-blocking>, SSL_connect() will also return | ||
27 | when the underlying BIO could not satisfy the needs of SSL_connect() | ||
28 | to continue the handshake. In this case a call to SSL_get_error() with the | ||
29 | return value of SSL_connect() will yield B<SSL_ERROR_WANT_READ> or | ||
30 | B<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after | ||
31 | taking appropriate action to satisfy the needs of SSL_connect(). | ||
32 | The action depends on the underlying BIO. When using a non-blocking socket, | ||
33 | 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 | ||
35 | into or retrieved out of the BIO before being able to continue. | ||
36 | |||
37 | =head1 RETURN VALUES | ||
38 | |||
39 | The following return values can occur: | ||
40 | |||
41 | =over 4 | ||
42 | |||
43 | =item 1 | ||
44 | |||
45 | The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been | ||
46 | established. | ||
47 | |||
48 | =item 0 | ||
49 | |||
50 | The TLS/SSL handshake was not successful but was shut down controlled and | ||
51 | by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the | ||
52 | return value B<ret> to find out the reason. | ||
53 | |||
54 | =item -1 | ||
55 | |||
56 | The TLS/SSL handshake was not successful, because a fatal error occurred either | ||
57 | at the protocol level or a connection failure occurred. The shutdown was | ||
58 | not clean. It can also occur of action is need to continue the operation | ||
59 | for non-blocking BIOs. Call SSL_get_error() with the return value B<ret> | ||
60 | to find out the reason. | ||
61 | |||
62 | =back | ||
63 | |||
64 | =head1 SEE ALSO | ||
65 | |||
66 | L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_accept(3)|SSL_accept(3)>, | ||
67 | L<SSL_shutdown(3)|SSL_shutdown(3)>, L<ssl(3)|ssl(3)> , L<bio(3)|bio(3)> | ||
68 | |||
69 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_free.pod b/src/lib/libssl/src/doc/ssl/SSL_free.pod new file mode 100644 index 0000000000..f3f0c345f8 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_free.pod | |||
@@ -0,0 +1,33 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_free - free an allocated SSL structure | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | void SSL_free(SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_free() decrements the reference count of B<ssl>, and removes the SSL | ||
16 | structure pointed to by B<ssl> and frees up the allocated memory if the | ||
17 | the reference count has reached 0. | ||
18 | |||
19 | It also calls the free()ing procedures for indirectly affected items, if | ||
20 | applicable: the buffering BIO, the read and write BIOs, | ||
21 | cipher lists specially created for this B<ssl>, the B<SSL_SESSION>. | ||
22 | Do not explicitly free these indirectly freed up items before or after | ||
23 | calling SSL_free(), as trying to free things twice may lead to program | ||
24 | failure. | ||
25 | |||
26 | =head1 RETURN VALUES | ||
27 | |||
28 | SSL_free() does not provide diagnostic information. | ||
29 | |||
30 | L<SSL_new(3)|SSL_new(3)>, L<SSL_clear(3)|SSL_clear(3)>, | ||
31 | L<ssl(3)|ssl(3)> | ||
32 | |||
33 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_ciphers.pod b/src/lib/libssl/src/doc/ssl/SSL_get_ciphers.pod new file mode 100644 index 0000000000..2a57455c23 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_ciphers.pod | |||
@@ -0,0 +1,42 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_ciphers, SSL_get_cipher_list - get list of available SSL_CIPHERs | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | STACK_OF(SSL_CIPHER) *SSL_get_ciphers(SSL *ssl); | ||
12 | const char *SSL_get_cipher_list(SSL *ssl, int priority); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | SSL_get_ciphers() returns the stack of available SSL_CIPHERs for B<ssl>, | ||
17 | sorted by preference. If B<ssl> is NULL or no ciphers are available, NULL | ||
18 | is returned. | ||
19 | |||
20 | SSL_get_cipher_list() returns a pointer to the name of the SSL_CIPHER | ||
21 | listed for B<ssl> with B<priority>. If B<ssl> is NULL, no ciphers are | ||
22 | available, or there are less ciphers than B<priority> available, NULL | ||
23 | is returned. | ||
24 | |||
25 | =head1 NOTES | ||
26 | |||
27 | The details of the ciphers obtained by SSL_get_ciphers() can be obtained using | ||
28 | the L<SSL_CIPHER_get_name(3)|SSL_CIPHER_get_name(3)> family of functions. | ||
29 | |||
30 | Call SSL_get_cipher_list() with B<priority> starting from 0 to obtain the | ||
31 | sorted list of available ciphers, until NULL is returned. | ||
32 | |||
33 | =head1 RETURN VALUES | ||
34 | |||
35 | See DESCRIPTION | ||
36 | |||
37 | =head1 SEE ALSO | ||
38 | |||
39 | L<ssl(3)|ssl(3)>, L<SSL_CTX_set_cipher_list(3)|SSL_CTX_set_cipher_list(3)>, | ||
40 | L<SSL_CIPHER_get_name(3)|SSL_CIPHER_get_name(3)> | ||
41 | |||
42 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_current_cipher.pod b/src/lib/libssl/src/doc/ssl/SSL_get_current_cipher.pod new file mode 100644 index 0000000000..2dd7261d89 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_current_cipher.pod | |||
@@ -0,0 +1,43 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_current_cipher, SSL_get_cipher, SSL_get_cipher_name, | ||
6 | SSL_get_cipher_bits, SSL_get_cipher_version - get SSL_CIPHER of a connection | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | SSL_CIPHER *SSL_get_current_cipher(SSL *ssl); | ||
13 | #define SSL_get_cipher(s) \ | ||
14 | SSL_CIPHER_get_name(SSL_get_current_cipher(s)) | ||
15 | #define SSL_get_cipher_name(s) \ | ||
16 | SSL_CIPHER_get_name(SSL_get_current_cipher(s)) | ||
17 | #define SSL_get_cipher_bits(s,np) \ | ||
18 | SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np) | ||
19 | #define SSL_get_cipher_version(s) \ | ||
20 | SSL_CIPHER_get_version(SSL_get_current_cipher(s)) | ||
21 | |||
22 | =head1 DESCRIPTION | ||
23 | |||
24 | SSL_get_current_cipher() returns a pointer to an SSL_CIPHER object containing | ||
25 | the description of the actually used cipher of a connection established with | ||
26 | the B<ssl> object. | ||
27 | |||
28 | SSL_get_cipher() and SSL_get_cipher_name() are identical macros to obtain the | ||
29 | name of the currently used cipher. SSL_get_cipher_bits() is a | ||
30 | macro to obtain the number of secret/algorithm bits used and | ||
31 | SSL_get_cipher_version() returns the protocol name. | ||
32 | See L<SSL_CIPHER_get_name(3)|SSL_CIPHER_get_name(3)> for more details. | ||
33 | |||
34 | =head1 RETURN VALUES | ||
35 | |||
36 | SSL_get_current_cipher() returns the cipher actually used or NULL, when | ||
37 | no session has been established. | ||
38 | |||
39 | =head1 SEE ALSO | ||
40 | |||
41 | L<ssl(3)|ssl(3)>, L<SSL_CIPHER_get_name(3)|SSL_CIPHER_get_name(3)> | ||
42 | |||
43 | =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 9cacdedc57..d85b564258 100644 --- a/src/lib/libssl/src/doc/ssl/SSL_get_error.pod +++ b/src/lib/libssl/src/doc/ssl/SSL_get_error.pod | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | SSL_get_error - obtain result code for SSL I/O operation | 5 | SSL_get_error - obtain result code for TLS/SSL I/O operation |
6 | 6 | ||
7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
8 | 8 | ||
@@ -15,14 +15,14 @@ SSL_get_error - obtain result code for SSL I/O operation | |||
15 | SSL_get_error() returns a result code (suitable for the C "switch" | 15 | SSL_get_error() returns a result code (suitable for the C "switch" |
16 | statement) for a preceding call to SSL_connect(), SSL_accept(), | 16 | statement) for a preceding call to SSL_connect(), SSL_accept(), |
17 | SSL_read(), or SSL_write() on B<ssl>. The value returned by that | 17 | SSL_read(), or SSL_write() on B<ssl>. The value returned by that |
18 | SSL I/O function must be passed to SSL_get_error() in parameter | 18 | TLS/SSL I/O function must be passed to SSL_get_error() in parameter |
19 | B<ret>. | 19 | B<ret>. |
20 | 20 | ||
21 | In addition to B<ssl> and B<ret>, SSL_get_error() inspects the | 21 | In addition to B<ssl> and B<ret>, SSL_get_error() inspects the |
22 | current thread's OpenSSL error queue. Thus, SSL_get_error() must be | 22 | current thread's OpenSSL error queue. Thus, SSL_get_error() must be |
23 | used in the same thread that performed the SSL I/O operation, and no | 23 | used in the same thread that performed the TLS/SSL I/O operation, and no |
24 | other OpenSSL function calls should appear in between. The current | 24 | other OpenSSL function calls should appear in between. The current |
25 | thread's error queue must be empty before the SSL I/O operation is | 25 | thread's error queue must be empty before the TLS/SSL I/O operation is |
26 | attempted, or SSL_get_error() will not work reliably. | 26 | attempted, or SSL_get_error() will not work reliably. |
27 | 27 | ||
28 | =head1 RETURN VALUES | 28 | =head1 RETURN VALUES |
@@ -33,27 +33,29 @@ The following return values can currently occur: | |||
33 | 33 | ||
34 | =item SSL_ERROR_NONE | 34 | =item SSL_ERROR_NONE |
35 | 35 | ||
36 | The SSL I/O operation completed. This result code is returned | 36 | The TLS/SSL I/O operation completed. This result code is returned |
37 | if and only if B<ret E<gt> 0>. | 37 | if and only if B<ret E<gt> 0>. |
38 | 38 | ||
39 | =item SSL_ERROR_ZERO_RETURN | 39 | =item SSL_ERROR_ZERO_RETURN |
40 | 40 | ||
41 | The SSL connection has been closed. If the protocol version is SSL 3.0 | 41 | The TLS/SSL connection has been closed. If the protocol version is SSL 3.0 |
42 | or TLS 1.0, this result code is returned only if a closure | 42 | or TLS 1.0, this result code is returned only if a closure |
43 | alerts has occurred in the protocol, i.e. if the connection has been | 43 | alert has occurred in the protocol, i.e. if the connection has been |
44 | closed cleanly. | 44 | closed cleanly. Note that in this case B<SSL_ERROR_ZERO_RETURN> |
45 | does not necessarily indicate that the underlying transport | ||
46 | has been closed. | ||
45 | 47 | ||
46 | =item SSL_ERROR_WANT_READ, SSL_ERROR_WANT_WRITE | 48 | =item SSL_ERROR_WANT_READ, SSL_ERROR_WANT_WRITE |
47 | 49 | ||
48 | The operation did not complete; the same SSL I/O function should be | 50 | The operation did not complete; the same TLS/SSL I/O function should be |
49 | called again later. There will be protocol progress if, by then, the | 51 | called again later. There will be protocol progress if, by then, the |
50 | underlying B<BIO> has data available for reading (if the result code is | 52 | underlying B<BIO> has data available for reading (if the result code is |
51 | B<SSL_ERROR_WANT_READ>) or allows writing data (B<SSL_ERROR_WANT_WRITE>). | 53 | B<SSL_ERROR_WANT_READ>) or allows writing data (B<SSL_ERROR_WANT_WRITE>). |
52 | For socket B<BIO>s (e.g. when SSL_set_fd() was used) this means that | 54 | For socket B<BIO>s (e.g. when SSL_set_fd() was used) this means that |
53 | select() or poll() on the underlying socket can be used to find out | 55 | select() or poll() on the underlying socket can be used to find out |
54 | when the SSL I/O function should be retried. | 56 | when the TLS/SSL I/O function should be retried. |
55 | 57 | ||
56 | Caveat: Any SSL I/O function can lead to either of | 58 | Caveat: Any TLS/SSL I/O function can lead to either of |
57 | B<SSL_ERROR_WANT_READ> and B<SSL_ERROR_WANT_WRITE>, i.e. SSL_read() | 59 | B<SSL_ERROR_WANT_READ> and B<SSL_ERROR_WANT_WRITE>, i.e. SSL_read() |
58 | may want to write data and SSL_write() may want to read data. | 60 | may want to write data and SSL_write() may want to read data. |
59 | 61 | ||
@@ -61,7 +63,7 @@ may want to write data and SSL_write() may want to read data. | |||
61 | 63 | ||
62 | The operation did not complete because an application callback set by | 64 | The operation did not complete because an application callback set by |
63 | SSL_CTX_set_client_cert_cb() has asked to be called again. | 65 | SSL_CTX_set_client_cert_cb() has asked to be called again. |
64 | The SSL I/O function should be called again later. | 66 | The TLS/SSL I/O function should be called again later. |
65 | Details depend on the application. | 67 | Details depend on the application. |
66 | 68 | ||
67 | =item SSL_ERROR_SYSCALL | 69 | =item SSL_ERROR_SYSCALL |
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_fd.pod b/src/lib/libssl/src/doc/ssl/SSL_get_fd.pod new file mode 100644 index 0000000000..a3f7625931 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_fd.pod | |||
@@ -0,0 +1,44 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_fd - get file descriptor linked to an SSL object | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_get_fd(SSL *ssl); | ||
12 | int SSL_get_rfd(SSL *ssl); | ||
13 | int SSL_get_wfd(SSL *ssl); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | SSL_get_fd() returns the file descriptor which is linked to B<ssl>. | ||
18 | SSL_get_rfd() and SSL_get_wfd() return the file descriptors for the | ||
19 | read or the write channel, which can be different. If the read and the | ||
20 | write channel are different, SSL_get_fd() will return the file descriptor | ||
21 | of the read channel. | ||
22 | |||
23 | =head1 RETURN VALUES | ||
24 | |||
25 | The following return values can occur: | ||
26 | |||
27 | =over 4 | ||
28 | |||
29 | =item -1 | ||
30 | |||
31 | The operation failed, because the underlying BIO is not of the correct type | ||
32 | (suitable for file descriptors). | ||
33 | |||
34 | =item E<gt>=0 | ||
35 | |||
36 | The file descriptor linked to B<ssl>. | ||
37 | |||
38 | =back | ||
39 | |||
40 | =head1 SEE ALSO | ||
41 | |||
42 | L<SSL_set_fd(3)|SSL_set_fd(3)>, L<ssl(3)|ssl(3)> , L<bio(3)|bio(3)> | ||
43 | |||
44 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_peer_cert_chain.pod b/src/lib/libssl/src/doc/ssl/SSL_get_peer_cert_chain.pod new file mode 100644 index 0000000000..e93e8206fa --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_peer_cert_chain.pod | |||
@@ -0,0 +1,52 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_peer_cert_chain - get the X509 certificate chain of the peer | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | STACKOF(X509) *SSL_get_peer_cert_chain(SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_get_peer_cert_chain() returns a pointer to STACKOF(X509) certificates | ||
16 | forming the certificate chain of the peer. If called on the client side, | ||
17 | the stack also contains the peer's certificate; if called on the server | ||
18 | side, the peer's certificate must be obtained seperately using | ||
19 | L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)>. | ||
20 | If the peer did not present a certificate, NULL is returned. | ||
21 | |||
22 | =head1 NOTES | ||
23 | |||
24 | The peer certificate chain is not necessarily available after reusing | ||
25 | a session, in which case a NULL pointer is returned. | ||
26 | |||
27 | The reference count of the STACKOF(X509) object is not incremented. | ||
28 | If the corresponding session is freed, the pointer must not be used | ||
29 | any longer. | ||
30 | |||
31 | =head1 RETURN VALUES | ||
32 | |||
33 | The following return values can occur: | ||
34 | |||
35 | =over 4 | ||
36 | |||
37 | =item NULL | ||
38 | |||
39 | No certificate was presented by the peer or no connection was established | ||
40 | or the certificate chain is no longer available when a session is reused. | ||
41 | |||
42 | =item Pointer to a STACKOF(X509) | ||
43 | |||
44 | The return value points to the certificate chain presented by the peer. | ||
45 | |||
46 | =back | ||
47 | |||
48 | =head1 SEE ALSO | ||
49 | |||
50 | L<ssl(3)|ssl(3)>, L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)> | ||
51 | |||
52 | =cut | ||
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 new file mode 100644 index 0000000000..79c089aa51 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_peer_certificate.pod | |||
@@ -0,0 +1,48 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_peer_certificate - get the X509 certificate of the peer | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | X509 *SSL_get_peer_certificate(SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_get_peer_certificate() returns a pointer to the X509 certificate the | ||
16 | peer presented. If the peer did not present a certificate, NULL is returned. | ||
17 | |||
18 | =head1 NOTES | ||
19 | |||
20 | That a certificate is returned does not indicate information about the | ||
21 | verification state, use L<SSL_get_verify_result(3)|SSL_get_verify_result(3)> | ||
22 | to check the verification state. | ||
23 | |||
24 | The reference count of the X509 object is incremented by one, so that it | ||
25 | will not be destroyed when the session containing the peer certificate is | ||
26 | freed. The X509 object must be explicitely freed using X509_free(). | ||
27 | |||
28 | =head1 RETURN VALUES | ||
29 | |||
30 | The following return values can occur: | ||
31 | |||
32 | =over 4 | ||
33 | |||
34 | =item NULL | ||
35 | |||
36 | No certificate was presented by the peer or no connection was established. | ||
37 | |||
38 | =item Pointer to an X509 certificate | ||
39 | |||
40 | The return value points to the certificate presented by the peer. | ||
41 | |||
42 | =back | ||
43 | |||
44 | =head1 SEE ALSO | ||
45 | |||
46 | L<ssl(3)|ssl(3)>, L<SSL_get_verify_result(3)|SSL_get_verify_result(3)> | ||
47 | |||
48 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_rbio.pod b/src/lib/libssl/src/doc/ssl/SSL_get_rbio.pod new file mode 100644 index 0000000000..3d98233cac --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_rbio.pod | |||
@@ -0,0 +1,40 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_rbio - get BIO linked to an SSL object | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | BIO *SSL_get_rbio(SSL *ssl); | ||
12 | BIO *SSL_get_wbio(SSL *ssl); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | SSL_get_rbio() and SSL_get_wbio() return pointers to the BIOs for the | ||
17 | read or the write channel, which can be different. The reference count | ||
18 | of the BIO is not incremented. | ||
19 | |||
20 | =head1 RETURN VALUES | ||
21 | |||
22 | The following return values can occur: | ||
23 | |||
24 | =over 4 | ||
25 | |||
26 | =item NULL | ||
27 | |||
28 | No BIO was connected to the SSL object | ||
29 | |||
30 | =item Any other pointer | ||
31 | |||
32 | The BIO linked to B<ssl>. | ||
33 | |||
34 | =back | ||
35 | |||
36 | =head1 SEE ALSO | ||
37 | |||
38 | L<SSL_set_bio(3)|SSL_set_bio(3)>, L<ssl(3)|ssl(3)> , L<bio(3)|bio(3)> | ||
39 | |||
40 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_session.pod b/src/lib/libssl/src/doc/ssl/SSL_get_session.pod new file mode 100644 index 0000000000..aff41fb9cf --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_session.pod | |||
@@ -0,0 +1,48 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_session - retrieve TLS/SSL session data | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | SSL_SESSION *SSL_get_session(SSL *ssl); | ||
12 | SSL_SESSION *SSL_get0_session(SSL *ssl); | ||
13 | SSL_SESSION *SSL_get1_session(SSL *ssl); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | SSL_get_session() returns a pointer to the B<SSL_SESSION> actually used in | ||
18 | B<ssl>. The reference count of the B<SSL_SESSION> is not incremented, so | ||
19 | that the pointer can become invalid when the B<ssl> is freed and | ||
20 | SSL_SESSION_free() is implicitly called. | ||
21 | |||
22 | SSL_get0_session() is the same as SSL_get_session(). | ||
23 | |||
24 | SSL_get1_session() is the same as SSL_get_session(), but the reference | ||
25 | count of the B<SSL_SESSION> is incremented by one. | ||
26 | |||
27 | =head1 RETURN VALUES | ||
28 | |||
29 | The following return values can occur: | ||
30 | |||
31 | =over 4 | ||
32 | |||
33 | =item NULL | ||
34 | |||
35 | There is no session available in B<ssl>. | ||
36 | |||
37 | =item Pointer to an SSL | ||
38 | |||
39 | The return value points to the data of an SSL session. | ||
40 | |||
41 | =back | ||
42 | |||
43 | =head1 SEE ALSO | ||
44 | |||
45 | L<ssl(3)|ssl(3)>, L<SSL_free(3)|SSL_free(3)>, | ||
46 | L<SSL_SESSION_free(3)|SSL_SESSION_free(3)> | ||
47 | |||
48 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_verify_result.pod b/src/lib/libssl/src/doc/ssl/SSL_get_verify_result.pod new file mode 100644 index 0000000000..4d66236a05 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_verify_result.pod | |||
@@ -0,0 +1,57 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_verify_result - get result of peer certificate verification | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | long SSL_get_verify_result(SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_get_verify_result() returns the result of the verification of the | ||
16 | X509 certificate presented by the peer, if any. | ||
17 | |||
18 | =head1 NOTES | ||
19 | |||
20 | SSL_get_verify_result() can only return one error code while the verification | ||
21 | of a certificate can fail because of many reasons at the same time. Only | ||
22 | the last verification error that occured during the processing is available | ||
23 | from SSL_get_verify_result(). | ||
24 | |||
25 | The verification result is part of the established session and is restored | ||
26 | when a session is reused. | ||
27 | |||
28 | =head1 BUGS | ||
29 | |||
30 | If no peer certificate was presented, the returned result code is | ||
31 | X509_V_OK. This is because no verification error occured, it does however | ||
32 | not indicate success. SSL_get_verify_result() is only useful in connection | ||
33 | with L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)>. | ||
34 | |||
35 | =head1 RETURN VALUES | ||
36 | |||
37 | The following return values can currently occur: | ||
38 | |||
39 | =over 4 | ||
40 | |||
41 | =item X509_V_OK | ||
42 | |||
43 | The verification succeeded or no peer certificate was presented. | ||
44 | |||
45 | =item Any other value | ||
46 | |||
47 | Documented in L<verify(1)|verify(1)>. | ||
48 | |||
49 | =back | ||
50 | |||
51 | =head1 SEE ALSO | ||
52 | |||
53 | L<ssl(3)|ssl(3)>, L<SSL_set_verify_result(3)|SSL_set_verify_result(3)>, | ||
54 | L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)>, | ||
55 | L<verify(1)|verify(1)> | ||
56 | |||
57 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_library_init.pod b/src/lib/libssl/src/doc/ssl/SSL_library_init.pod new file mode 100644 index 0000000000..ecf3c4858e --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_library_init.pod | |||
@@ -0,0 +1,52 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_library_init, OpenSSL_add_ssl_algorithms, SSLeay_add_ssl_algorithms | ||
6 | - initialize SSL library by registering algorithms | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | int SSL_library_init(void); | ||
13 | #define OpenSSL_add_ssl_algorithms() SSL_library_init() | ||
14 | #define SSLeay_add_ssl_algorithms() SSL_library_init() | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | SSL_library_init() registers the available ciphers and digests. | ||
19 | |||
20 | OpenSSL_add_ssl_algorithms() and SSLeay_add_ssl_algorithms() are synonyms | ||
21 | for SSL_library_init(). | ||
22 | |||
23 | =head1 NOTES | ||
24 | |||
25 | SSL_library_init() must be called before any other action takes place. | ||
26 | |||
27 | =head1 WARNING | ||
28 | |||
29 | SSL_library_init() only registers ciphers. Another important initialization | ||
30 | is the seeding of the PRNG (Pseudo Random Number Generator), which has to | ||
31 | be performed separately. | ||
32 | |||
33 | =head1 EXAMPLES | ||
34 | |||
35 | A typical TLS/SSL application will start with the library initialization, | ||
36 | will provide readable error messages and will seed the PRNG. | ||
37 | |||
38 | SSL_load_error_strings(); /* readable error messages */ | ||
39 | SSL_library_init(); /* initialize library */ | ||
40 | actions_to_seed_PRNG(); | ||
41 | |||
42 | =head1 RETURN VALUES | ||
43 | |||
44 | SSL_library_init() always returns "1", so it is safe to discard the return | ||
45 | value. | ||
46 | |||
47 | =head1 SEE ALSO | ||
48 | |||
49 | L<ssl(3)|ssl(3)>, L<SSL_load_error_strings(3)|SSL_load_error_strings(3)>, | ||
50 | L<RAND_add(3)|RAND_add(3)> | ||
51 | |||
52 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_new.pod b/src/lib/libssl/src/doc/ssl/SSL_new.pod new file mode 100644 index 0000000000..8e8638fa95 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_new.pod | |||
@@ -0,0 +1,42 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_new - create a new SSL structure for a connection | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | SSL *SSL_new(SSL_CTX *ctx); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_new() creates a new B<SSL> structure which is needed to hold the | ||
16 | data for a TLS/SSL connection. The new structure inherits the settings | ||
17 | of the underlying context B<ctx>: connection method (SSLv2/v3/TLSv1), | ||
18 | options, verification settings, timeout settings. | ||
19 | |||
20 | =head1 RETURN VALUES | ||
21 | |||
22 | The following return values can occur: | ||
23 | |||
24 | =over 4 | ||
25 | |||
26 | =item NULL | ||
27 | |||
28 | The creation of a new SSL structure failed. Check the error stack to | ||
29 | find out the reason. | ||
30 | |||
31 | =item Pointer to an SSL structure | ||
32 | |||
33 | The return value points to an allocated SSL structure. | ||
34 | |||
35 | =back | ||
36 | |||
37 | =head1 SEE ALSO | ||
38 | |||
39 | L<SSL_free(3)|SSL_free(3)>, L<SSL_clear(3)|SSL_clear(3)>, | ||
40 | L<ssl(3)|ssl(3)> | ||
41 | |||
42 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_pending.pod b/src/lib/libssl/src/doc/ssl/SSL_pending.pod new file mode 100644 index 0000000000..744e1855e1 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_pending.pod | |||
@@ -0,0 +1,30 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_pending - obtain number of readable bytes buffered in an SSL object | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_pending(SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_pending() returns the number of bytes which are available inside | ||
16 | B<ssl> for immediate read. | ||
17 | |||
18 | =head1 NOTES | ||
19 | |||
20 | Data are received in blocks from the peer. Therefore data can be buffered | ||
21 | inside B<ssl> and are ready for immediate retrieval with | ||
22 | L<SSL_read(3)|SSL_read(3)>. | ||
23 | |||
24 | =head1 RETURN VALUES | ||
25 | |||
26 | The number of bytes pending is returned. | ||
27 | |||
28 | L<SSL_read(3)|SSL_read(3)>, L<ssl(3)|ssl(3)> | ||
29 | |||
30 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_read.pod b/src/lib/libssl/src/doc/ssl/SSL_read.pod new file mode 100644 index 0000000000..072dc26cf2 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_read.pod | |||
@@ -0,0 +1,77 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_read - read bytes from a TLS/SSL connection. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_read(SSL *ssl, char *buf, int num); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_read() tries to read B<num> bytes from the specified B<ssl> into the | ||
16 | buffer B<buf>. | ||
17 | |||
18 | =head1 NOTES | ||
19 | |||
20 | If necessary, SSL_read() will negotiate a TLS/SSL session, if | ||
21 | not already explicitly performed by SSL_connect() or SSL_accept(). If the | ||
22 | peer requests a re-negotiation, it will be performed transparently during | ||
23 | the SSL_read() operation. The behaviour of SSL_read() depends on the | ||
24 | underlying BIO. | ||
25 | |||
26 | If the underlying BIO is B<blocking>, SSL_read() will only return, once the | ||
27 | read operation has been finished or an error occurred. | ||
28 | |||
29 | If the underlying BIO is B<non-blocking>, SSL_read() will also return | ||
30 | when the underlying BIO could not satisfy the needs of SSL_read() | ||
31 | to continue the operation. In this case a call to SSL_get_error() with the | ||
32 | return value of SSL_read() will yield B<SSL_ERROR_WANT_READ> or | ||
33 | B<SSL_ERROR_WANT_WRITE>. As at any time a re-negotiation is possible, a | ||
34 | call to SSL_read() can also cause write operations! The calling process | ||
35 | then must repeat the call after taking appropriate action to satisfy the | ||
36 | needs of SSL_read(). The action depends on the underlying BIO. When using a | ||
37 | non-blocking socket, nothing is to be done, but select() can be used to check | ||
38 | for the required condition. When using a buffering BIO, like a BIO pair, data | ||
39 | must be written into or retrieved out of the BIO before being able to continue. | ||
40 | |||
41 | =head1 WARNING | ||
42 | |||
43 | When an SSL_read() operation has to be repeated because of | ||
44 | B<SSL_ERROR_WANT_READ> or B<SSL_ERROR_WANT_WRITE>, it must be repeated | ||
45 | with the same arguments. | ||
46 | |||
47 | =head1 RETURN VALUES | ||
48 | |||
49 | The following return values can occur: | ||
50 | |||
51 | =over 4 | ||
52 | |||
53 | =item E<gt>0 | ||
54 | |||
55 | The read operation was successful; the return value is the number of | ||
56 | bytes actually read from the TLS/SSL connection. | ||
57 | |||
58 | =item 0 | ||
59 | |||
60 | The read operation was not successful, probably because no data was | ||
61 | available. Call SSL_get_error() with the return value B<ret> to find out, | ||
62 | whether an error occurred. | ||
63 | |||
64 | =item -1 | ||
65 | |||
66 | The read operation was not successful, because either an error occurred | ||
67 | or action must be taken by the calling process. Call SSL_get_error() with the | ||
68 | return value B<ret> to find out the reason. | ||
69 | |||
70 | =back | ||
71 | |||
72 | =head1 SEE ALSO | ||
73 | |||
74 | L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_write(3)|SSL_write(3)>, | ||
75 | L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> | ||
76 | |||
77 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_set_bio.pod b/src/lib/libssl/src/doc/ssl/SSL_set_bio.pod new file mode 100644 index 0000000000..67c9756d3f --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_set_bio.pod | |||
@@ -0,0 +1,34 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_set_bio - connect the SSL object with a BIO | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_set_bio() connects the BIOs B<rbio> and B<wbio> for the read and write | ||
16 | operations of the TLS/SSL (encrypted) side of B<ssl>. | ||
17 | |||
18 | The SSL engine inherits the behaviour of B<rbio> and B<wbio>, respectively. | ||
19 | If a BIO is non-blocking, the B<ssl> will also have non-blocking behaviour. | ||
20 | |||
21 | If there was already a BIO connected to B<ssl>, BIO_free() will be called | ||
22 | (for both the reading and writing side, if different). | ||
23 | |||
24 | =head1 RETURN VALUES | ||
25 | |||
26 | SSL_set_bio() cannot fail. | ||
27 | |||
28 | =head1 SEE ALSO | ||
29 | |||
30 | L<SSL_get_rbio(3)|SSL_get_rbio(3)>, | ||
31 | L<SSL_connect(3)|SSL_connect(3)>, L<SSL_accept(3)|SSL_accept(3)>, | ||
32 | L<SSL_shutdown(3)|SSL_shutdown(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> | ||
33 | |||
34 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_set_fd.pod b/src/lib/libssl/src/doc/ssl/SSL_set_fd.pod new file mode 100644 index 0000000000..70291128fc --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_set_fd.pod | |||
@@ -0,0 +1,54 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_set_fd - connect the SSL object with a file descriptor | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_set_fd(SSL *ssl, int fd); | ||
12 | int SSL_set_rfd(SSL *ssl, int fd); | ||
13 | int SSL_set_wfd(SSL *ssl, int fd); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | SSL_set_fd() sets the file descriptor B<fd> as the input/output facility | ||
18 | for the TLS/SSL (encrypted) side of B<ssl>. B<fd> will typically be the | ||
19 | socket file descriptor of a network connection. | ||
20 | |||
21 | When performing the operation, a B<socket BIO> is automatically created to | ||
22 | interface between the B<ssl> and B<fd>. The BIO and hence the SSL engine | ||
23 | inherit the behaviour of B<fd>. If B<fd> is non-blocking, the B<ssl> will | ||
24 | also have non-blocking behaviour. | ||
25 | |||
26 | If there was already a BIO connected to B<ssl>, BIO_free() will be called | ||
27 | (for both the reading and writing side, if different). | ||
28 | |||
29 | SSL_set_rfd() and SSL_set_wfd() perform the respective action, but only | ||
30 | for the read channel or the write channel, which can be set independently. | ||
31 | |||
32 | =head1 RETURN VALUES | ||
33 | |||
34 | The following return values can occur: | ||
35 | |||
36 | =over 4 | ||
37 | |||
38 | =item 0 | ||
39 | |||
40 | The operation failed. Check the error stack to find out why. | ||
41 | |||
42 | =item 1 | ||
43 | |||
44 | The operation succeeded. | ||
45 | |||
46 | =back | ||
47 | |||
48 | =head1 SEE ALSO | ||
49 | |||
50 | L<SSL_get_fd(3)|SSL_get_fd(3)>, L<SSL_set_bio(3)|SSL_set_bio(3)>, | ||
51 | L<SSL_connect(3)|SSL_connect(3)>, L<SSL_accept(3)|SSL_accept(3)>, | ||
52 | L<SSL_shutdown(3)|SSL_shutdown(3)>, L<ssl(3)|ssl(3)> , L<bio(3)|bio(3)> | ||
53 | |||
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 new file mode 100644 index 0000000000..9f78d9e434 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_set_session.pod | |||
@@ -0,0 +1,45 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_set_session - set a TLS/SSL session to be used during TLS/SSL connect | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_set_session(SSL *ssl, SSL_SESSION *session); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | 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. | ||
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 | ||
19 | again during SSL_connect(). | ||
20 | |||
21 | 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 | a connection), SSL_SESSION_free() will be called for that session. | ||
24 | |||
25 | =head1 RETURN VALUES | ||
26 | |||
27 | The following return values can occur: | ||
28 | |||
29 | =over 4 | ||
30 | |||
31 | =item 0 | ||
32 | |||
33 | The operation failed; check the error stack to find out the reason. | ||
34 | |||
35 | =item 1 | ||
36 | |||
37 | The operation succeeded. | ||
38 | |||
39 | =back | ||
40 | |||
41 | =head1 SEE ALSO | ||
42 | |||
43 | L<ssl(3)|ssl(3)>, L<SSL_SESSION_free(3)|SSL_SESSION_free(3)> | ||
44 | |||
45 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_set_verify_result.pod b/src/lib/libssl/src/doc/ssl/SSL_set_verify_result.pod new file mode 100644 index 0000000000..04ab101aad --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_set_verify_result.pod | |||
@@ -0,0 +1,38 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_set_verify_result - override result of peer certificate verification | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | void SSL_set_verify_result(SSL *ssl, long verify_result); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_set_verify_result() sets B<verify_result> of the object B<ssl> to be the | ||
16 | result of the verification of the X509 certificate presented by the peer, | ||
17 | if any. | ||
18 | |||
19 | =head1 NOTES | ||
20 | |||
21 | SSL_set_verify_result() overrides the verification result. It only changes | ||
22 | the verification result of the B<ssl> object. It does not become part of the | ||
23 | established session, so if the session is to be reused later, the original | ||
24 | value will reappear. | ||
25 | |||
26 | The valid codes for B<verify_result> are documented in L<verify(1)|verify(1)>. | ||
27 | |||
28 | =head1 RETURN VALUES | ||
29 | |||
30 | SSL_set_verify_result() does not provide a return value. | ||
31 | |||
32 | =head1 SEE ALSO | ||
33 | |||
34 | L<ssl(3)|ssl(3)>, L<SSL_get_verify_result(3)|SSL_get_verify_result(3)>, | ||
35 | L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)>, | ||
36 | L<verify(1)|verify(1)> | ||
37 | |||
38 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_shutdown.pod b/src/lib/libssl/src/doc/ssl/SSL_shutdown.pod new file mode 100644 index 0000000000..20e273bd4d --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_shutdown.pod | |||
@@ -0,0 +1,62 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_shutdown - shut down a TLS/SSL connection | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_shutdown(SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_shutdown() shuts down an active TLS/SSL connection. It sends the shutdown | ||
16 | alert to the peer. The behaviour of SSL_shutdown() depends on the underlying | ||
17 | BIO. | ||
18 | |||
19 | If the underlying BIO is B<blocking>, SSL_shutdown() will only return once the | ||
20 | handshake has been finished or an error occurred. | ||
21 | |||
22 | If the underlying BIO is B<non-blocking>, SSL_shutdown() will also return | ||
23 | when the underlying BIO could not satisfy the needs of SSL_shutdown() | ||
24 | to continue the handshake. In this case a call to SSL_get_error() with the | ||
25 | return value of SSL_shutdown() will yield B<SSL_ERROR_WANT_READ> or | ||
26 | B<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after | ||
27 | taking appropriate action to satisfy the needs of SSL_shutdown(). | ||
28 | The action depends on the underlying BIO. When using a non-blocking socket, | ||
29 | nothing is to be done, but select() can be used to check for the required | ||
30 | condition. When using a buffering BIO, like a BIO pair, data must be written | ||
31 | into or retrieved out of the BIO before being able to continue. | ||
32 | |||
33 | =head1 RETURN VALUES | ||
34 | |||
35 | The following return values can occur: | ||
36 | |||
37 | =over 4 | ||
38 | |||
39 | =item 1 | ||
40 | |||
41 | The shutdown was successfully completed. | ||
42 | |||
43 | =item 0 | ||
44 | |||
45 | The shutdown was not successful. Call SSL_get_error() with the return | ||
46 | value B<ret> to find out the reason. | ||
47 | |||
48 | =item -1 | ||
49 | |||
50 | The shutdown was not successful because a fatal error occurred either | ||
51 | at the protocol level or a connection failure occurred. It can also occur of | ||
52 | action is need to continue the operation for non-blocking BIOs. | ||
53 | Call SSL_get_error() with the return value B<ret> to find out the reason. | ||
54 | |||
55 | =back | ||
56 | |||
57 | =head1 SEE ALSO | ||
58 | |||
59 | L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_connect(3)|SSL_connect(3)>, | ||
60 | L<SSL_accept(3)|SSL_accept(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> | ||
61 | |||
62 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_write.pod b/src/lib/libssl/src/doc/ssl/SSL_write.pod new file mode 100644 index 0000000000..db67c187e0 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_write.pod | |||
@@ -0,0 +1,76 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_read - write bytes to a TLS/SSL connection. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_write(SSL *ssl, char *buf, int num); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_write() writes B<num> bytes from the buffer B<buf> into the specified | ||
16 | B<ssl> connection. | ||
17 | |||
18 | =head1 NOTES | ||
19 | |||
20 | If necessary, SSL_write() will negotiate a TLS/SSL session, if | ||
21 | not already explicitly performed by SSL_connect() or SSL_accept(). If the | ||
22 | peer requests a re-negotiation, it will be performed transparently during | ||
23 | the SSL_write() operation. The behaviour of SSL_write() depends on the | ||
24 | underlying BIO. | ||
25 | |||
26 | If the underlying BIO is B<blocking>, SSL_write() will only return, once the | ||
27 | write operation has been finished or an error occurred. | ||
28 | |||
29 | If the underlying BIO is B<non-blocking>, SSL_write() will also return, | ||
30 | when the underlying BIO could not satisfy the needs of SSL_write() | ||
31 | to continue the operation. In this case a call to SSL_get_error() with the | ||
32 | return value of SSL_write() will yield B<SSL_ERROR_WANT_READ> or | ||
33 | B<SSL_ERROR_WANT_WRITE>. As at any time a re-negotiation is possible, a | ||
34 | call to SSL_write() can also cause write operations! The calling process | ||
35 | then must repeat the call after taking appropriate action to satisfy the | ||
36 | needs of SSL_write(). The action depends on the underlying BIO. When using a | ||
37 | non-blocking socket, nothing is to be done, but select() can be used to check | ||
38 | for the required condition. When using a buffering BIO, like a BIO pair, data | ||
39 | must be written into or retrieved out of the BIO before being able to continue. | ||
40 | |||
41 | =head1 WARNING | ||
42 | |||
43 | When an SSL_write() operation has to be repeated because of | ||
44 | B<SSL_ERROR_WANT_READ> or B<SSL_ERROR_WANT_WRITE>, it must be repeated | ||
45 | with the same arguments. | ||
46 | |||
47 | =head1 RETURN VALUES | ||
48 | |||
49 | The following return values can occur: | ||
50 | |||
51 | =over 4 | ||
52 | |||
53 | =item E<gt>0 | ||
54 | |||
55 | The write operation was successful, the return value is the number of | ||
56 | bytes actually written to the TLS/SSL connection. | ||
57 | |||
58 | =item 0 | ||
59 | |||
60 | The write operation was not successful. Call SSL_get_error() with the return | ||
61 | value B<ret> to find out, whether an error occurred. | ||
62 | |||
63 | =item -1 | ||
64 | |||
65 | The read operation was not successful, because either an error occurred | ||
66 | or action must be taken by the calling process. Call SSL_get_error() with the | ||
67 | return value B<ret> to find out the reason. | ||
68 | |||
69 | =back | ||
70 | |||
71 | =head1 SEE ALSO | ||
72 | |||
73 | L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_read(3)|SSL_read(3)>, | ||
74 | L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> | ||
75 | |||
76 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/ssl.pod b/src/lib/libssl/src/doc/ssl/ssl.pod index 9dae13d9eb..7787376f7b 100644 --- a/src/lib/libssl/src/doc/ssl/ssl.pod +++ b/src/lib/libssl/src/doc/ssl/ssl.pod | |||
@@ -83,7 +83,7 @@ B<SSL> structures which are later created for the connections. | |||
83 | 83 | ||
84 | =item B<SSL_SESSION> (SSL Session) | 84 | =item B<SSL_SESSION> (SSL Session) |
85 | 85 | ||
86 | This is a structure containing the current SSL session details for a | 86 | This is a structure containing the current TLS/SSL session details for a |
87 | connection: B<SSL_CIPHER>s, client and server certificates, keys, etc. | 87 | connection: B<SSL_CIPHER>s, client and server certificates, keys, etc. |
88 | 88 | ||
89 | =item B<SSL> (SSL Connection) | 89 | =item B<SSL> (SSL Connection) |
@@ -163,7 +163,7 @@ Determine the number of bits in I<cipher>. Because of export crippled ciphers | |||
163 | there are two bits: The bits the algorithm supports in general (stored to | 163 | there are two bits: The bits the algorithm supports in general (stored to |
164 | I<alg_bits>) and the bits which are actually used (the return value). | 164 | I<alg_bits>) and the bits which are actually used (the return value). |
165 | 165 | ||
166 | =item char *B<SSL_CIPHER_get_name>(SSL_CIPHER *cipher); | 166 | =item const char *B<SSL_CIPHER_get_name>(SSL_CIPHER *cipher); |
167 | 167 | ||
168 | Return the internal name of I<cipher> as a string. These are the various | 168 | Return the internal name of I<cipher> as a string. These are the various |
169 | strings defined by the I<SSL2_TXT_xxx>, I<SSL3_TXT_xxx> and I<TLS1_TXT_xxx> | 169 | strings defined by the I<SSL2_TXT_xxx>, I<SSL3_TXT_xxx> and I<TLS1_TXT_xxx> |
@@ -437,7 +437,7 @@ connection defined in the B<SSL> structure. | |||
437 | 437 | ||
438 | =item X509 *B<SSL_get_certificate>(SSL *ssl); | 438 | =item X509 *B<SSL_get_certificate>(SSL *ssl); |
439 | 439 | ||
440 | =item SSL_CIPHER *B<SSL_get_cipher>(SSL *ssl); | 440 | =item const char *B<SSL_get_cipher>(SSL *ssl); |
441 | 441 | ||
442 | =item int B<SSL_get_cipher_bits>(SSL *ssl, int *alg_bits); | 442 | =item int B<SSL_get_cipher_bits>(SSL *ssl, int *alg_bits); |
443 | 443 | ||
@@ -624,7 +624,21 @@ connection defined in the B<SSL> structure. | |||
624 | =head1 SEE ALSO | 624 | =head1 SEE ALSO |
625 | 625 | ||
626 | L<openssl(1)|openssl(1)>, L<crypto(3)|crypto(3)>, | 626 | L<openssl(1)|openssl(1)>, L<crypto(3)|crypto(3)>, |
627 | L<SSL_get_error(3)|SSL_get_error(3)> | 627 | L<SSL_accept(3)|SSL_accept(3)>, L<SSL_clear(3)|SSL_clear(3)>, |
628 | L<SSL_connect(3)|SSL_connect(3)>, L<SSL_CTX_new(3)|SSL_CTX_new(3)>, | ||
629 | L<SSL_CTX_set_ssl_version(3)|SSL_CTX_set_ssl_version(3)>, | ||
630 | L<SSL_get_ciphers(3)|SSL_get_ciphers(3)>, | ||
631 | L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_get_fd(3)|SSL_get_fd(3)>, | ||
632 | L<SSL_get_peer_cert_chain(3)|SSL_get_peer_cert_chain(3)>, | ||
633 | L<SSL_get_rbio(3)|SSL_get_rbio(3)>, | ||
634 | L<SSL_get_session(3)|SSL_get_session(3)>, | ||
635 | L<SSL_get_verify_result(3)|SSL_get_verify_result(3)>, | ||
636 | L<SSL_library_init(3)|SSL_library_init(3)>, L<SSL_new(3)|SSL_new(3)>, | ||
637 | L<SSL_read(3)|SSL_read(3)>, L<SSL_set_bio(3)|SSL_set_bio(3)>, | ||
638 | L<SSL_set_fd(3)|SSL_set_fd(3)>, L<SSL_pending(3)|SSL_pending(3)>, | ||
639 | L<SSL_set_session(3)|SSL_set_session(3)>, | ||
640 | L<SSL_shutdown(3)|SSL_shutdown(3)>, L<SSL_write(3)|SSL_write(3)>, | ||
641 | L<SSL_SESSION_free(3)|SSL_SESSION_free(3)> | ||
628 | 642 | ||
629 | =head1 HISTORY | 643 | =head1 HISTORY |
630 | 644 | ||
diff --git a/src/lib/libssl/src/doc/standards.txt b/src/lib/libssl/src/doc/standards.txt new file mode 100644 index 0000000000..61ccc5d7e0 --- /dev/null +++ b/src/lib/libssl/src/doc/standards.txt | |||
@@ -0,0 +1,121 @@ | |||
1 | Standards related to OpenSSL | ||
2 | ============================ | ||
3 | |||
4 | [Please, this is currently a draft. I made a first try at finding | ||
5 | documents that describe parts of what OpenSSL implements. There are | ||
6 | big gaps, and I've most certainly done something wrong. Please | ||
7 | correct whatever is... Also, this note should be removed when this | ||
8 | file is reaching a somewhat correct state. -- Richard Levitte] | ||
9 | |||
10 | |||
11 | All pointers in here will be either URL's or blobs of text borrowed | ||
12 | from miscellaneous indexes, like rfc-index.txt (index of RFCs), | ||
13 | 1id-index.txt (index of Internet drafts) and the like. | ||
14 | |||
15 | To find the latest possible RFCs, it's recommended to either browse | ||
16 | ftp://ftp.isi.edu/in-notes/ or go to http://www.rfc-editor.org/ and | ||
17 | use the search mechanism found there. | ||
18 | To find the latest possible Internet drafts, it's recommended to | ||
19 | browse ftp://ftp.isi.edu/internet-drafts/. | ||
20 | To find the latest possible PKCS, it's recommended to browse | ||
21 | http://www.rsasecurity.com/rsalabs/pkcs/. | ||
22 | |||
23 | |||
24 | Implemented: | ||
25 | ------------ | ||
26 | |||
27 | These are documents that describe things that are implemented in OpenSSL. | ||
28 | |||
29 | 1319 The MD2 Message-Digest Algorithm. B. Kaliski. April 1992. | ||
30 | (Format: TXT=25661 bytes) (Status: INFORMATIONAL) | ||
31 | |||
32 | 1320 The MD4 Message-Digest Algorithm. R. Rivest. April 1992. (Format: | ||
33 | TXT=32407 bytes) (Status: INFORMATIONAL) | ||
34 | |||
35 | 1321 The MD5 Message-Digest Algorithm. R. Rivest. April 1992. (Format: | ||
36 | TXT=35222 bytes) (Status: INFORMATIONAL) | ||
37 | |||
38 | 2246 The TLS Protocol Version 1.0. T. Dierks, C. Allen. January 1999. | ||
39 | (Format: TXT=170401 bytes) (Status: PROPOSED STANDARD) | ||
40 | |||
41 | 2268 A Description of the RC2(r) Encryption Algorithm. R. Rivest. | ||
42 | January 1998. (Format: TXT=19048 bytes) (Status: INFORMATIONAL) | ||
43 | |||
44 | 2314 PKCS 10: Certification Request Syntax Version 1.5. B. Kaliski. | ||
45 | March 1998. (Format: TXT=15814 bytes) (Status: INFORMATIONAL) | ||
46 | |||
47 | 2315 PKCS 7: Cryptographic Message Syntax Version 1.5. B. Kaliski. | ||
48 | March 1998. (Format: TXT=69679 bytes) (Status: INFORMATIONAL) | ||
49 | |||
50 | 2437 PKCS #1: RSA Cryptography Specifications Version 2.0. B. Kaliski, | ||
51 | J. Staddon. October 1998. (Format: TXT=73529 bytes) (Obsoletes | ||
52 | RFC2313) (Status: INFORMATIONAL) | ||
53 | |||
54 | 2459 Internet X.509 Public Key Infrastructure Certificate and CRL | ||
55 | Profile. R. Housley, W. Ford, W. Polk, D. Solo. January 1999. | ||
56 | (Format: TXT=278438 bytes) (Status: PROPOSED STANDARD) | ||
57 | |||
58 | PKCS#8: Private-Key Information Syntax Standard | ||
59 | |||
60 | PKCS#12: Personal Information Exchange Syntax Standard, version 1.0. | ||
61 | |||
62 | |||
63 | Related: | ||
64 | -------- | ||
65 | |||
66 | These are documents that are close to OpenSSL, for example the | ||
67 | STARTTLS documents. | ||
68 | |||
69 | 1421 Privacy Enhancement for Internet Electronic Mail: Part I: Message | ||
70 | Encryption and Authentication Procedures. J. Linn. February 1993. | ||
71 | (Format: TXT=103894 bytes) (Obsoletes RFC1113) (Status: PROPOSED | ||
72 | STANDARD) | ||
73 | |||
74 | 1422 Privacy Enhancement for Internet Electronic Mail: Part II: | ||
75 | Certificate-Based Key Management. S. Kent. February 1993. (Format: | ||
76 | TXT=86085 bytes) (Obsoletes RFC1114) (Status: PROPOSED STANDARD) | ||
77 | |||
78 | 1423 Privacy Enhancement for Internet Electronic Mail: Part III: | ||
79 | Algorithms, Modes, and Identifiers. D. Balenson. February 1993. | ||
80 | (Format: TXT=33277 bytes) (Obsoletes RFC1115) (Status: PROPOSED | ||
81 | STANDARD) | ||
82 | |||
83 | 1424 Privacy Enhancement for Internet Electronic Mail: Part IV: Key | ||
84 | Certification and Related Services. B. Kaliski. February 1993. | ||
85 | (Format: TXT=17537 bytes) (Status: PROPOSED STANDARD) | ||
86 | |||
87 | 2487 SMTP Service Extension for Secure SMTP over TLS. P. Hoffman. | ||
88 | January 1999. (Format: TXT=15120 bytes) (Status: PROPOSED STANDARD) | ||
89 | |||
90 | 2585 Internet X.509 Public Key Infrastructure Operational Protocols: | ||
91 | FTP and HTTP. R. Housley, P. Hoffman. May 1999. (Format: TXT=14813 | ||
92 | bytes) (Status: PROPOSED STANDARD) | ||
93 | |||
94 | 2595 Using TLS with IMAP, POP3 and ACAP. C. Newman. June 1999. | ||
95 | (Format: TXT=32440 bytes) (Status: PROPOSED STANDARD) | ||
96 | |||
97 | 2712 Addition of Kerberos Cipher Suites to Transport Layer Security | ||
98 | (TLS). A. Medvinsky, M. Hur. October 1999. (Format: TXT=13763 bytes) | ||
99 | (Status: PROPOSED STANDARD) | ||
100 | |||
101 | 2817 Upgrading to TLS Within HTTP/1.1. R. Khare, S. Lawrence. May | ||
102 | 2000. (Format: TXT=27598 bytes) (Updates RFC2616) (Status: PROPOSED | ||
103 | STANDARD) | ||
104 | |||
105 | 2818 HTTP Over TLS. E. Rescorla. May 2000. (Format: TXT=15170 bytes) | ||
106 | (Status: INFORMATIONAL) | ||
107 | |||
108 | "Securing FTP with TLS", 01/27/2000, <draft-murray-auth-ftp-ssl-05.txt> | ||
109 | |||
110 | |||
111 | To be implemented: | ||
112 | ------------------ | ||
113 | |||
114 | These are documents that describe things that are planed to be | ||
115 | implemented in the hopefully short future. | ||
116 | |||
117 | 2560 X.509 Internet Public Key Infrastructure Online Certificate | ||
118 | Status Protocol - OCSP. M. Myers, R. Ankney, A. Malpani, S. Galperin, | ||
119 | C. Adams. June 1999. (Format: TXT=43243 bytes) (Status: PROPOSED | ||
120 | STANDARD) | ||
121 | |||