diff options
Diffstat (limited to 'src/lib/libssl/src/doc')
127 files changed, 13228 insertions, 1031 deletions
diff --git a/src/lib/libssl/src/doc/README b/src/lib/libssl/src/doc/README index a9a588262a..14469a82e3 100644 --- a/src/lib/libssl/src/doc/README +++ b/src/lib/libssl/src/doc/README | |||
@@ -1,9 +1,9 @@ | |||
1 | 1 | ||
2 | openssl.pod ..... Documentation of OpenSSL `openssl' command | 2 | apps/openssl.pod .... Documentation of OpenSSL `openssl' command |
3 | crypto.pod ...... Documentation of OpenSSL crypto.h+libcrypto.a | 3 | crypto/crypto.pod ... Documentation of OpenSSL crypto.h+libcrypto.a |
4 | ssl.pod ......... Documentation of OpenSSL ssl.h+libssl.a | 4 | ssl/ssl.pod ......... Documentation of OpenSSL ssl.h+libssl.a |
5 | ssleay.txt ...... Assembled documentation files of ancestor SSLeay [obsolete] | 5 | openssl.txt ......... Assembled documentation files for OpenSSL [not final] |
6 | openssl.txt ..... Assembled documentation files for OpenSSL [not final] | 6 | ssleay.txt .......... Assembled documentation of ancestor SSLeay [obsolete] |
7 | 7 | ||
8 | An archive of HTML documents for the SSLeay library is available from | 8 | An archive of HTML documents for the SSLeay library is available from |
9 | http://www.columbia.edu/~ariel/ssleay/ | 9 | 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 new file mode 100644 index 0000000000..83e4c0af81 --- /dev/null +++ b/src/lib/libssl/src/doc/apps/CA.pl.pod | |||
@@ -0,0 +1,138 @@ | |||
1 | |||
2 | =pod | ||
3 | |||
4 | =head1 NAME | ||
5 | |||
6 | CA.pl - friendlier interface for OpenSSL certificate programs | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | B<CA.pl> | ||
11 | [B<-?>] | ||
12 | [B<-h>] | ||
13 | [B<-help>] | ||
14 | [B<-newcert>] | ||
15 | [B<-newreq>] | ||
16 | [B<-newca>] | ||
17 | [B<-xsign>] | ||
18 | [B<-sign>] | ||
19 | [B<-signreq>] | ||
20 | [B<-signcert>] | ||
21 | [B<-verify>] | ||
22 | [B<files>] | ||
23 | |||
24 | =head1 DESCRIPTION | ||
25 | |||
26 | The B<CA.pl> script is a perl script that supplies the relevant command line | ||
27 | arguments to the B<openssl> command for some common certificate operations. | ||
28 | It is intended to simplify the process of certificate creation and management | ||
29 | by the use of some simple options. | ||
30 | |||
31 | =head1 COMMAND OPTIONS | ||
32 | |||
33 | =over 4 | ||
34 | |||
35 | =item B<?>, B<-h>, B<-help> | ||
36 | |||
37 | prints a usage message. | ||
38 | |||
39 | =item B<-newcert> | ||
40 | |||
41 | creates a new self signed certificate. The private key and certificate are | ||
42 | written to the file "newreq.pem". | ||
43 | |||
44 | =item B<-newreq> | ||
45 | |||
46 | creates a new certificate request. The private key and request are | ||
47 | written to the file "newreq.pem". | ||
48 | |||
49 | =item B<-newca> | ||
50 | |||
51 | creates a new CA hierarchy for use with the B<ca> program (or the B<-signcert> | ||
52 | and B<-xsign> options). The user is prompted to enter the filename of the CA | ||
53 | certificates (which should also contain the private key) or by hitting ENTER | ||
54 | details of the CA will be prompted for. The relevant files and directories | ||
55 | are created in a directory called "demoCA" in the current directory. | ||
56 | |||
57 | =item B<-pkcs12> | ||
58 | |||
59 | create a PKCS#12 file containing the user certificate, private key and CA | ||
60 | certificate. It expects the user certificate and private key to be in the | ||
61 | file "newcert.pem" and the CA certificate to be in the file demoCA/cacert.pem, | ||
62 | it creates a file "newcert.p12". This command can thus be called after the | ||
63 | B<-sign> option. The PKCS#12 file can be imported directly into a browser. | ||
64 | If there is an additional argument on the command line it will be used as the | ||
65 | "friendly name" for the certificate (which is typically displayed in the browser | ||
66 | list box), otherwise the name "My Certificate" is used. | ||
67 | |||
68 | =item B<-sign>, B<-signreq>, B<-xsign> | ||
69 | |||
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 | ||
72 | "newcert.pem" except in the case of the B<-xcert> option when it is written | ||
73 | to standard output. | ||
74 | |||
75 | =item B<-signcert> | ||
76 | |||
77 | this option is the same as B<-sign> except it expects a self signed certificate | ||
78 | to be present in the file "newreq.pem". | ||
79 | |||
80 | =item B<-verify> | ||
81 | |||
82 | verifies certificates against the CA certificate for "demoCA". If no certificates | ||
83 | are specified on the command line it tries to verify the file "newcert.pem". | ||
84 | |||
85 | =item B<files> | ||
86 | |||
87 | one or more optional certificate file names for use with the B<-verify> command. | ||
88 | |||
89 | =back | ||
90 | |||
91 | =head1 EXAMPLES | ||
92 | |||
93 | Create a CA hierarchy: | ||
94 | |||
95 | CA.pl -newca | ||
96 | |||
97 | Complete certificate creation example: create a CA, create a request, sign | ||
98 | the request and finally create a PKCS#12 file containing it. | ||
99 | |||
100 | CA.pl -newca | ||
101 | CA.pl -newreq | ||
102 | CA.pl -signreq | ||
103 | CA.pl -pkcs12 "My Test Certificate" | ||
104 | |||
105 | =head1 NOTES | ||
106 | |||
107 | Most of the filenames mentioned can be modified by editing the B<CA.pl> script. | ||
108 | |||
109 | If the demoCA directory already exists then the B<-newca> command will not | ||
110 | overwrite it and will do nothing. This can happen if a previous call using | ||
111 | the B<-newca> option terminated abnormally. To get the correct behaviour | ||
112 | delete the demoCA directory if it already exists. | ||
113 | |||
114 | Under some environments it may not be possible to run the B<CA.pl> script | ||
115 | directly (for example Win32) and the default configuration file location may | ||
116 | be wrong. In this case the command: | ||
117 | |||
118 | perl -S CA.pl | ||
119 | |||
120 | can be used and the B<OPENSSL_CONF> environment variable changed to point to | ||
121 | the correct path of the configuration file "openssl.cnf". | ||
122 | |||
123 | The script is intended as a simple front end for the B<openssl> program for use | ||
124 | by a beginner. Its behaviour isn't always what is wanted. For more control over the | ||
125 | behaviour of the certificate commands call the B<openssl> command directly. | ||
126 | |||
127 | =head1 ENVIRONMENT VARIABLES | ||
128 | |||
129 | The variable B<OPENSSL_CONF> if defined allows an alternative configuration | ||
130 | file location to be specified, it should contain the full path to the | ||
131 | configuration file, not just its directory. | ||
132 | |||
133 | =head1 SEE ALSO | ||
134 | |||
135 | L<x509(1)|x509(1)>, L<ca(1)|ca(1)>, L<req(1)|req(1)>, L<pkcs12(1)|pkcs12(1)>, | ||
136 | L<config(5)|config(5)> | ||
137 | |||
138 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/asn1parse.pod b/src/lib/libssl/src/doc/apps/asn1parse.pod new file mode 100644 index 0000000000..e76e9813ab --- /dev/null +++ b/src/lib/libssl/src/doc/apps/asn1parse.pod | |||
@@ -0,0 +1,129 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | asn1parse - ASN.1 parsing tool | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<openssl> B<asn1parse> | ||
10 | [B<-inform PEM|DER>] | ||
11 | [B<-in filename>] | ||
12 | [B<-out filename>] | ||
13 | [B<-noout>] | ||
14 | [B<-offset number>] | ||
15 | [B<-length number>] | ||
16 | [B<-i>] | ||
17 | [B<-oid filename>] | ||
18 | [B<-strparse offset>] | ||
19 | |||
20 | =head1 DESCRIPTION | ||
21 | |||
22 | The B<asn1parse> command is a diagnostic utility that can parse ASN.1 | ||
23 | structures. It can also be used to extract data from ASN.1 formatted data. | ||
24 | |||
25 | =head1 OPTIONS | ||
26 | |||
27 | =over 4 | ||
28 | |||
29 | =item B<-inform> B<DER|PEM> | ||
30 | |||
31 | the input format. B<DER> is binary format and B<PEM> (the default) is base64 | ||
32 | encoded. | ||
33 | |||
34 | =item B<-in filename> | ||
35 | |||
36 | the input file, default is standard input | ||
37 | |||
38 | =item B<-out filename> | ||
39 | |||
40 | output file to place the DER encoded data into. If this | ||
41 | option is not present then no data will be output. This is most useful when | ||
42 | combined with the B<-strparse> option. | ||
43 | |||
44 | =item B<-noout> | ||
45 | |||
46 | don't output the parsed version of the input file. | ||
47 | |||
48 | =item B<-offset number> | ||
49 | |||
50 | starting offset to begin parsing, default is start of file. | ||
51 | |||
52 | =item B<-length number> | ||
53 | |||
54 | number of bytes to parse, default is until end of file. | ||
55 | |||
56 | =item B<-i> | ||
57 | |||
58 | indents the output according to the "depth" of the structures. | ||
59 | |||
60 | =item B<-oid filename> | ||
61 | |||
62 | a file containing additional OBJECT IDENTIFIERs (OIDs). The format of this | ||
63 | file is described in the NOTES section below. | ||
64 | |||
65 | =item B<-strparse offset> | ||
66 | |||
67 | parse the contents octets of the ASN.1 object starting at B<offset>. This | ||
68 | option can be used multiple times to "drill down" into a nested structure. | ||
69 | |||
70 | |||
71 | =back | ||
72 | |||
73 | =head2 OUTPUT | ||
74 | |||
75 | The output will typically contain lines like this: | ||
76 | |||
77 | 0:d=0 hl=4 l= 681 cons: SEQUENCE | ||
78 | |||
79 | ..... | ||
80 | |||
81 | 229:d=3 hl=3 l= 141 prim: BIT STRING | ||
82 | 373:d=2 hl=3 l= 162 cons: cont [ 3 ] | ||
83 | 376:d=3 hl=3 l= 159 cons: SEQUENCE | ||
84 | 379:d=4 hl=2 l= 29 cons: SEQUENCE | ||
85 | 381:d=5 hl=2 l= 3 prim: OBJECT :X509v3 Subject Key Identifier | ||
86 | 386:d=5 hl=2 l= 22 prim: OCTET STRING | ||
87 | 410:d=4 hl=2 l= 112 cons: SEQUENCE | ||
88 | 412:d=5 hl=2 l= 3 prim: OBJECT :X509v3 Authority Key Identifier | ||
89 | 417:d=5 hl=2 l= 105 prim: OCTET STRING | ||
90 | 524:d=4 hl=2 l= 12 cons: SEQUENCE | ||
91 | |||
92 | ..... | ||
93 | |||
94 | This example is part of a self signed certificate. Each line starts with the | ||
95 | offset in decimal. B<d=XX> specifies the current depth. The depth is increased | ||
96 | within the scope of any SET or SEQUENCE. B<hl=XX> gives the header length | ||
97 | (tag and length octets) of the current type. B<l=XX> gives the length of | ||
98 | the contents octets. | ||
99 | |||
100 | The B<-i> option can be used to make the output more readable. | ||
101 | |||
102 | Some knowledge of the ASN.1 structure is needed to interpret the output. | ||
103 | |||
104 | In this example the BIT STRING at offset 229 is the certificate public key. | ||
105 | The contents octets of this will contain the public key information. This can | ||
106 | be examined using the option B<-strparse 229> to yield: | ||
107 | |||
108 | 0:d=0 hl=3 l= 137 cons: SEQUENCE | ||
109 | 3:d=1 hl=3 l= 129 prim: INTEGER :E5D21E1F5C8D208EA7A2166C7FAF9F6BDF2059669C60876DDB70840F1A5AAFA59699FE471F379F1DD6A487E7D5409AB6A88D4A9746E24B91D8CF55DB3521015460C8EDE44EE8A4189F7A7BE77D6CD3A9AF2696F486855CF58BF0EDF2B4068058C7A947F52548DDF7E15E96B385F86422BEA9064A3EE9E1158A56E4A6F47E5897 | ||
110 | 135:d=1 hl=2 l= 3 prim: INTEGER :010001 | ||
111 | |||
112 | =head1 NOTES | ||
113 | |||
114 | If an OID is not part of OpenSSL's internal table it will be represented in | ||
115 | numerical form (for example 1.2.3.4). The file passed to the B<-oid> option | ||
116 | allows additional OIDs to be included. Each line consists of three columns, | ||
117 | the first column is the OID in numerical format and should be followed by white | ||
118 | space. The second column is the "short name" which is a single word followed | ||
119 | by white space. The final column is the rest of the line and is the | ||
120 | "long name". B<asn1parse> displays the long name. Example: | ||
121 | |||
122 | C<1.2.3.4 shortName A long name> | ||
123 | |||
124 | =head1 BUGS | ||
125 | |||
126 | There should be options to change the format of input lines. The output of some | ||
127 | ASN.1 types is not well handled (if at all). | ||
128 | |||
129 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/ca.pod b/src/lib/libssl/src/doc/apps/ca.pod new file mode 100644 index 0000000000..03209aa6b1 --- /dev/null +++ b/src/lib/libssl/src/doc/apps/ca.pod | |||
@@ -0,0 +1,479 @@ | |||
1 | |||
2 | =pod | ||
3 | |||
4 | =head1 NAME | ||
5 | |||
6 | ca - sample minimal CA application | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | B<openssl> B<ca> | ||
11 | [B<-verbose>] | ||
12 | [B<-config filename>] | ||
13 | [B<-name section>] | ||
14 | [B<-gencrl>] | ||
15 | [B<-revoke file>] | ||
16 | [B<-crldays days>] | ||
17 | [B<-crlhours hours>] | ||
18 | [B<-crlexts section>] | ||
19 | [B<-startdate date>] | ||
20 | [B<-enddate date>] | ||
21 | [B<-days arg>] | ||
22 | [B<-md arg>] | ||
23 | [B<-policy arg>] | ||
24 | [B<-keyfile arg>] | ||
25 | [B<-key arg>] | ||
26 | [B<-cert file>] | ||
27 | [B<-in file>] | ||
28 | [B<-out file>] | ||
29 | [B<-notext>] | ||
30 | [B<-outdir dir>] | ||
31 | [B<-infiles>] | ||
32 | [B<-spkac file>] | ||
33 | [B<-ss_cert file>] | ||
34 | [B<-preserveDN>] | ||
35 | [B<-batch>] | ||
36 | [B<-msie_hack>] | ||
37 | [B<-extensions section>] | ||
38 | |||
39 | =head1 DESCRIPTION | ||
40 | |||
41 | The B<ca> command is a minimal CA application. It can be used | ||
42 | to sign certificate requests in a variety of forms and generate | ||
43 | CRLs it also maintains a text database of issued certificates | ||
44 | and their status. | ||
45 | |||
46 | The options descriptions will be divided into each purpose. | ||
47 | |||
48 | =head1 CA OPTIONS | ||
49 | |||
50 | =over 4 | ||
51 | |||
52 | =item B<-config filename> | ||
53 | |||
54 | specifies the configuration file to use. | ||
55 | |||
56 | =item B<-in filename> | ||
57 | |||
58 | an input filename containing a single certificate request to be | ||
59 | signed by the CA. | ||
60 | |||
61 | =item B<-ss_cert filename> | ||
62 | |||
63 | a single self signed certificate to be signed by the CA. | ||
64 | |||
65 | =item B<-spkac filename> | ||
66 | |||
67 | a file containing a single Netscape signed public key and challenge | ||
68 | and additional field values to be signed by the CA. See the B<NOTES> | ||
69 | section for information on the required format. | ||
70 | |||
71 | =item B<-infiles> | ||
72 | |||
73 | if present this should be the last option, all subsequent arguments | ||
74 | are assumed to the the names of files containing certificate requests. | ||
75 | |||
76 | =item B<-out filename> | ||
77 | |||
78 | the output file to output certificates to. The default is standard | ||
79 | output. The certificate details will also be printed out to this | ||
80 | file. | ||
81 | |||
82 | =item B<-outdir directory> | ||
83 | |||
84 | the directory to output certificates to. The certificate will be | ||
85 | written to a filename consisting of the serial number in hex with | ||
86 | ".pem" appended. | ||
87 | |||
88 | =item B<-cert> | ||
89 | |||
90 | the CA certificate file. | ||
91 | |||
92 | =item B<-keyfile filename> | ||
93 | |||
94 | the private key to sign requests with. | ||
95 | |||
96 | =item B<-key password> | ||
97 | |||
98 | the password used to encrypt the private key. Since on some | ||
99 | systems the command line arguments are visible (e.g. Unix with | ||
100 | the 'ps' utility) this option should be used with caution. | ||
101 | |||
102 | =item B<-verbose> | ||
103 | |||
104 | this prints extra details about the operations being performed. | ||
105 | |||
106 | =item B<-notext> | ||
107 | |||
108 | don't output the text form of a certificate to the output file. | ||
109 | |||
110 | =item B<-startdate date> | ||
111 | |||
112 | this allows the start date to be explicitly set. The format of the | ||
113 | date is YYMMDDHHMMSSZ (the same as an ASN1 UTCTime structure). | ||
114 | |||
115 | =item B<-enddate date> | ||
116 | |||
117 | this allows the expiry date to be explicitly set. The format of the | ||
118 | date is YYMMDDHHMMSSZ (the same as an ASN1 UTCTime structure). | ||
119 | |||
120 | =item B<-days arg> | ||
121 | |||
122 | the number of days to certify the certificate for. | ||
123 | |||
124 | =item B<-md alg> | ||
125 | |||
126 | the message digest to use. Possible values include md5, sha1 and mdc2. | ||
127 | This option also applies to CRLs. | ||
128 | |||
129 | =item B<-policy arg> | ||
130 | |||
131 | this option defines the CA "policy" to use. This is a section in | ||
132 | the configuration file which decides which fields should be mandatory | ||
133 | or match the CA certificate. Check out the B<POLICY FORMAT> section | ||
134 | for more information. | ||
135 | |||
136 | =item B<-msie_hack> | ||
137 | |||
138 | this is a legacy option to make B<ca> work with very old versions of | ||
139 | the IE certificate enrollment control "certenr3". It used UniversalStrings | ||
140 | for almost everything. Since the old control has various security bugs | ||
141 | its use is strongly discouraged. The newer control "Xenroll" does not | ||
142 | need this option. | ||
143 | |||
144 | =item B<-preserveDN> | ||
145 | |||
146 | Normally the DN order of a certificate is the same as the order of the | ||
147 | fields in the relevant policy section. When this option is set the order | ||
148 | is the same as the request. This is largely for compatibility with the | ||
149 | older IE enrollment control which would only accept certificates if their | ||
150 | DNs match the order of the request. This is not needed for Xenroll. | ||
151 | |||
152 | =item B<-batch> | ||
153 | |||
154 | this sets the batch mode. In this mode no questions will be asked | ||
155 | and all certificates will be certified automatically. | ||
156 | |||
157 | =item B<-extensions section> | ||
158 | |||
159 | the section of the configuration file containing certificate extensions | ||
160 | to be added when a certificate is issued. If no extension section is | ||
161 | present then a V1 certificate is created. If the extension section | ||
162 | is present (even if it is empty) then a V3 certificate is created. | ||
163 | |||
164 | =back | ||
165 | |||
166 | =head1 CRL OPTIONS | ||
167 | |||
168 | =over 4 | ||
169 | |||
170 | =item B<-gencrl> | ||
171 | |||
172 | this option generates a CRL based on information in the index file. | ||
173 | |||
174 | =item B<-crldays num> | ||
175 | |||
176 | the number of days before the next CRL is due. That is the days from | ||
177 | now to place in the CRL nextUpdate field. | ||
178 | |||
179 | =item B<-crlhours num> | ||
180 | |||
181 | the number of hours before the next CRL is due. | ||
182 | |||
183 | =item B<-revoke filename> | ||
184 | |||
185 | a filename containing a certificate to revoke. | ||
186 | |||
187 | =item B<-crlexts section> | ||
188 | |||
189 | the section of the configuration file containing CRL extensions to | ||
190 | include. If no CRL extension section is present then a V1 CRL is | ||
191 | created, if the CRL extension section is present (even if it is | ||
192 | empty) then a V2 CRL is created. The CRL extensions specified are | ||
193 | CRL extensions and B<not> CRL entry extensions. It should be noted | ||
194 | that some software (for example Netscape) can't handle V2 CRLs. | ||
195 | |||
196 | =back | ||
197 | |||
198 | =head1 CONFIGURATION FILE OPTIONS | ||
199 | |||
200 | The options for B<ca> are contained in the B<ca> section of the | ||
201 | configuration file. Many of these are identical to command line | ||
202 | options. Where the option is present in the configuration file | ||
203 | and the command line the command line value is used. Where an | ||
204 | option is described as mandatory then it must be present in | ||
205 | the configuration file or the command line equivalent (if | ||
206 | any) used. | ||
207 | |||
208 | =over 4 | ||
209 | |||
210 | =item B<oid_file> | ||
211 | |||
212 | This specifies a file containing additional B<OBJECT IDENTIFIERS>. | ||
213 | Each line of the file should consist of the numerical form of the | ||
214 | object identifier followed by white space then the short name followed | ||
215 | by white space and finally the long name. | ||
216 | |||
217 | =item B<oid_section> | ||
218 | |||
219 | This specifies a section in the configuration file containing extra | ||
220 | object identifiers. Each line should consist of the short name of the | ||
221 | object identifier followed by B<=> and the numerical form. The short | ||
222 | and long names are the same when this option is used. | ||
223 | |||
224 | =item B<new_certs_dir> | ||
225 | |||
226 | the same as the B<-outdir> command line option. It specifies | ||
227 | the directory where new certificates will be placed. Mandatory. | ||
228 | |||
229 | =item B<certificate> | ||
230 | |||
231 | the same as B<-cert>. It gives the file containing the CA | ||
232 | certificate. Mandatory. | ||
233 | |||
234 | =item B<private_key> | ||
235 | |||
236 | same as the B<-keyfile> option. The file containing the | ||
237 | CA private key. Mandatory. | ||
238 | |||
239 | =item B<RANDFILE> | ||
240 | |||
241 | a file used to read and write random number seed information, or | ||
242 | an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). | ||
243 | |||
244 | =item B<default_days> | ||
245 | |||
246 | the same as the B<-days> option. The number of days to certify | ||
247 | a certificate for. | ||
248 | |||
249 | =item B<default_startdate> | ||
250 | |||
251 | the same as the B<-startdate> option. The start date to certify | ||
252 | a certificate for. If not set the current time is used. | ||
253 | |||
254 | =item B<default_enddate> | ||
255 | |||
256 | the same as the B<-enddate> option. Either this option or | ||
257 | B<default_days> (or the command line equivalents) must be | ||
258 | present. | ||
259 | |||
260 | =item B<default_crl_hours default_crl_days> | ||
261 | |||
262 | the same as the B<-crlhours> and the B<-crldays> options. These | ||
263 | will only be used if neither command line option is present. At | ||
264 | least one of these must be present to generate a CRL. | ||
265 | |||
266 | =item B<default_md> | ||
267 | |||
268 | the same as the B<-md> option. The message digest to use. Mandatory. | ||
269 | |||
270 | =item B<database> | ||
271 | |||
272 | the text database file to use. Mandatory. This file must be present | ||
273 | though initially it will be empty. | ||
274 | |||
275 | =item B<serialfile> | ||
276 | |||
277 | a text file containing the next serial number to use in hex. Mandatory. | ||
278 | This file must be present and contain a valid serial number. | ||
279 | |||
280 | =item B<x509_extensions> | ||
281 | |||
282 | the same as B<-extensions>. | ||
283 | |||
284 | =item B<crl_extensions> | ||
285 | |||
286 | the same as B<-crlexts>. | ||
287 | |||
288 | =item B<preserve> | ||
289 | |||
290 | the same as B<-preserveDN> | ||
291 | |||
292 | =item B<msie_hack> | ||
293 | |||
294 | the same as B<-msie_hack> | ||
295 | |||
296 | =item B<policy> | ||
297 | |||
298 | the same as B<-policy>. Mandatory. See the B<POLICY FORMAT> section | ||
299 | for more information. | ||
300 | |||
301 | =back | ||
302 | |||
303 | =head1 POLICY FORMAT | ||
304 | |||
305 | The policy section consists of a set of variables corresponding to | ||
306 | certificate DN fields. If the value is "match" then the field value | ||
307 | must match the same field in the CA certificate. If the value is | ||
308 | "supplied" then it must be present. If the value is "optional" then | ||
309 | it may be present. Any fields not mentioned in the policy section | ||
310 | are silently deleted, unless the B<-preserveDN> option is set but | ||
311 | this can be regarded more of a quirk than intended behaviour. | ||
312 | |||
313 | =head1 SPKAC FORMAT | ||
314 | |||
315 | The input to the B<-spkac> command line option is a Netscape | ||
316 | signed public key and challenge. This will usually come from | ||
317 | the B<KEYGEN> tag in an HTML form to create a new private key. | ||
318 | It is however possible to create SPKACs using the B<spkac> utility. | ||
319 | |||
320 | The file should contain the variable SPKAC set to the value of | ||
321 | the SPKAC and also the required DN components as name value pairs. | ||
322 | If you need to include the same component twice then it can be | ||
323 | preceded by a number and a '.'. | ||
324 | |||
325 | =head1 EXAMPLES | ||
326 | |||
327 | Note: these examples assume that the B<ca> directory structure is | ||
328 | already set up and the relevant files already exist. This usually | ||
329 | involves creating a CA certificate and private key with B<req>, a | ||
330 | serial number file and an empty index file and placing them in | ||
331 | the relevant directories. | ||
332 | |||
333 | To use the sample configuration file below the directories demoCA, | ||
334 | demoCA/private and demoCA/newcerts would be created. The CA | ||
335 | certificate would be copied to demoCA/cacert.pem and its private | ||
336 | key to demoCA/private/cakey.pem. A file demoCA/serial would be | ||
337 | created containing for example "01" and the empty index file | ||
338 | demoCA/index.txt. | ||
339 | |||
340 | |||
341 | Sign a certificate request: | ||
342 | |||
343 | openssl ca -in req.pem -out newcert.pem | ||
344 | |||
345 | Generate a CRL | ||
346 | |||
347 | openssl ca -gencrl -out crl.pem | ||
348 | |||
349 | Sign several requests: | ||
350 | |||
351 | openssl ca -infiles req1.pem req2.pem req3.pem | ||
352 | |||
353 | Certify a Netscape SPKAC: | ||
354 | |||
355 | openssl ca -spkac spkac.txt | ||
356 | |||
357 | A sample SPKAC file (the SPKAC line has been truncated for clarity): | ||
358 | |||
359 | SPKAC=MIG0MGAwXDANBgkqhkiG9w0BAQEFAANLADBIAkEAn7PDhCeV/xIxUg8V70YRxK2A5 | ||
360 | CN=Steve Test | ||
361 | emailAddress=steve@openssl.org | ||
362 | 0.OU=OpenSSL Group | ||
363 | 1.OU=Another Group | ||
364 | |||
365 | A sample configuration file with the relevant sections for B<ca>: | ||
366 | |||
367 | [ ca ] | ||
368 | default_ca = CA_default # The default ca section | ||
369 | |||
370 | [ CA_default ] | ||
371 | |||
372 | dir = ./demoCA # top dir | ||
373 | database = $dir/index.txt # index file. | ||
374 | new_certs_dir = $dir/newcerts # new certs dir | ||
375 | |||
376 | certificate = $dir/cacert.pem # The CA cert | ||
377 | serial = $dir/serial # serial no file | ||
378 | private_key = $dir/private/cakey.pem# CA private key | ||
379 | RANDFILE = $dir/private/.rand # random number file | ||
380 | |||
381 | default_days = 365 # how long to certify for | ||
382 | default_crl_days= 30 # how long before next CRL | ||
383 | default_md = md5 # md to use | ||
384 | |||
385 | policy = policy_any # default policy | ||
386 | |||
387 | [ policy_any ] | ||
388 | countryName = supplied | ||
389 | stateOrProvinceName = optional | ||
390 | organizationName = optional | ||
391 | organizationalUnitName = optional | ||
392 | commonName = supplied | ||
393 | emailAddress = optional | ||
394 | |||
395 | =head1 WARNINGS | ||
396 | |||
397 | The B<ca> command is quirky and at times downright unfriendly. | ||
398 | |||
399 | The B<ca> utility was originally meant as an example of how to do things | ||
400 | in a CA. It was not supposed be be used as a full blown CA itself: | ||
401 | nevertheless some people are using it for this purpose. | ||
402 | |||
403 | The B<ca> command is effectively a single user command: no locking is | ||
404 | done on the various files and attempts to run more than one B<ca> command | ||
405 | on the same database can have unpredictable results. | ||
406 | |||
407 | =head1 FILES | ||
408 | |||
409 | Note: the location of all files can change either by compile time options, | ||
410 | configuration file entries, environment variables or command line options. | ||
411 | The values below reflect the default values. | ||
412 | |||
413 | /usr/local/ssl/lib/openssl.cnf - master configuration file | ||
414 | ./demoCA - main CA directory | ||
415 | ./demoCA/cacert.pem - CA certificate | ||
416 | ./demoCA/private/cakey.pem - CA private key | ||
417 | ./demoCA/serial - CA serial number file | ||
418 | ./demoCA/serial.old - CA serial number backup file | ||
419 | ./demoCA/index.txt - CA text database file | ||
420 | ./demoCA/index.txt.old - CA text database backup file | ||
421 | ./demoCA/certs - certificate output file | ||
422 | ./demoCA/.rnd - CA random seed information | ||
423 | |||
424 | =head1 ENVIRONMENT VARIABLES | ||
425 | |||
426 | B<OPENSSL_CONF> reflects the location of master configuration file it can | ||
427 | be overridden by the B<-config> command line option. | ||
428 | |||
429 | =head1 RESTRICTIONS | ||
430 | |||
431 | The text database index file is a critical part of the process and | ||
432 | if corrupted it can be difficult to fix. It is theoretically possible | ||
433 | to rebuild the index file from all the issued certificates and a current | ||
434 | CRL: however there is no option to do this. | ||
435 | |||
436 | CRL entry extensions cannot currently be created: only CRL extensions | ||
437 | can be added. | ||
438 | |||
439 | V2 CRL features like delta CRL support and CRL numbers are not currently | ||
440 | supported. | ||
441 | |||
442 | Although several requests can be input and handled at once it is only | ||
443 | possible to include one SPKAC or self signed certificate. | ||
444 | |||
445 | =head1 BUGS | ||
446 | |||
447 | The use of an in memory text database can cause problems when large | ||
448 | numbers of certificates are present because, as the name implies | ||
449 | the database has to be kept in memory. | ||
450 | |||
451 | Certificate request extensions are ignored: some kind of "policy" should | ||
452 | be included to use certain static extensions and certain extensions | ||
453 | from the request. | ||
454 | |||
455 | It is not possible to certify two certificates with the same DN: this | ||
456 | is a side effect of how the text database is indexed and it cannot easily | ||
457 | be fixed without introducing other problems. Some S/MIME clients can use | ||
458 | two certificates with the same DN for separate signing and encryption | ||
459 | keys. | ||
460 | |||
461 | The B<ca> command really needs rewriting or the required functionality | ||
462 | exposed at either a command or interface level so a more friendly utility | ||
463 | (perl script or GUI) can handle things properly. The scripts B<CA.sh> and | ||
464 | B<CA.pl> help a little but not very much. | ||
465 | |||
466 | Any fields in a request that are not present in a policy are silently | ||
467 | deleted. This does not happen if the B<-preserveDN> option is used but | ||
468 | the extra fields are not displayed when the user is asked to certify | ||
469 | a request. The behaviour should be more friendly and configurable. | ||
470 | |||
471 | Cancelling some commands by refusing to certify a certificate can | ||
472 | create an empty file. | ||
473 | |||
474 | =head1 SEE ALSO | ||
475 | |||
476 | L<req(1)|req(1)>, L<spkac(1)|spkac(1)>, L<x509(1)|x509(1)>, L<CA.pl(1)|CA.pl(1)>, | ||
477 | L<config(5)|config(5)> | ||
478 | |||
479 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/ciphers.pod b/src/lib/libssl/src/doc/apps/ciphers.pod new file mode 100644 index 0000000000..2301e28251 --- /dev/null +++ b/src/lib/libssl/src/doc/apps/ciphers.pod | |||
@@ -0,0 +1,342 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | ciphers - SSL cipher display and cipher list tool. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<openssl> B<ciphers> | ||
10 | [B<-v>] | ||
11 | [B<-ssl2>] | ||
12 | [B<-ssl3>] | ||
13 | [B<-tls1>] | ||
14 | [B<cipherlist>] | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | The B<cipherlist> command converts OpenSSL cipher lists into ordered | ||
19 | SSL cipher preference lists. It can be used as a test tool to determine | ||
20 | the appropriate cipherlist. | ||
21 | |||
22 | =head1 COMMAND OPTIONS | ||
23 | |||
24 | =over 4 | ||
25 | |||
26 | =item B<-v> | ||
27 | |||
28 | verbose option. List ciphers with a complete description of the authentication, | ||
29 | key exchange, encryption and mac algorithms used along with any key size | ||
30 | restrictions and whether the algorithm is classed as an "export" cipher. | ||
31 | |||
32 | =item B<-ssl3> | ||
33 | |||
34 | only include SSL v3 ciphers. | ||
35 | |||
36 | =item B<-ssl2> | ||
37 | |||
38 | only include SSL v2 ciphers. | ||
39 | |||
40 | =item B<-tls1> | ||
41 | |||
42 | only include TLS v1 ciphers. | ||
43 | |||
44 | =item B<-h>, B<-?> | ||
45 | |||
46 | print a brief usage message. | ||
47 | |||
48 | =item B<cipherlist> | ||
49 | |||
50 | a cipher list to convert to a cipher preference list. If it is not included | ||
51 | then the default cipher list will be used. The format is described below. | ||
52 | |||
53 | =back | ||
54 | |||
55 | =head1 CIPHER LIST FORMAT | ||
56 | |||
57 | The cipher list consists of one or more I<cipher strings> separated by colons. | ||
58 | Commas or spaces are also acceptable separators but colons are normally used. | ||
59 | |||
60 | The actual cipher string can take several different forms. | ||
61 | |||
62 | It can consist of a single cipher suite such as B<RC4-SHA>. | ||
63 | |||
64 | It can represent a list of cipher suites containing a certain algorithm, or | ||
65 | cipher suites of a certain type. For example B<SHA1> represents all ciphers | ||
66 | suites using the digest algorithm SHA1 and B<SSLv3> represents all SSL v3 | ||
67 | algorithms. | ||
68 | |||
69 | Lists of cipher suites can be combined in a single cipher string using the | ||
70 | B<+> character. This is used as a logical B<and> operation. For example | ||
71 | B<SHA1+DES> represents all cipher suites containing the SHA1 B<and> the DES | ||
72 | algorithms. | ||
73 | |||
74 | Each cipher string can be optionally preceded by the characters B<!>, | ||
75 | B<-> or B<+>. | ||
76 | |||
77 | If B<!> is used then the ciphers are permanently deleted from the list. | ||
78 | The ciphers deleted can never reappear in the list even if they are | ||
79 | explicitly stated. | ||
80 | |||
81 | If B<-> is used then the ciphers are deleted from the list, but some or | ||
82 | all of the ciphers can be added again by later options. | ||
83 | |||
84 | If B<+> is used then the ciphers are moved to the end of the list. This | ||
85 | option doesn't add any new ciphers it just moves matching existing ones. | ||
86 | |||
87 | If none of these characters is present then the string is just interpreted | ||
88 | as a list of ciphers to be appended to the current preference list. If the | ||
89 | list includes any ciphers already present they will be ignored: that is they | ||
90 | will not moved to the end of the list. | ||
91 | |||
92 | Additionally the cipher string B<@STRENGTH> can be used at any point to sort | ||
93 | the current cipher list in order of encryption algorithm key length. | ||
94 | |||
95 | =head1 CIPHER STRINGS | ||
96 | |||
97 | The following is a list of all permitted cipher strings and their meanings. | ||
98 | |||
99 | =over 4 | ||
100 | |||
101 | =item B<DEFAULT> | ||
102 | |||
103 | the default cipher list. This is determined at compile time and is normally | ||
104 | B<ALL:!ADH:RC4+RSA:+SSLv2:@STRENGTH>. This must be the first cipher string | ||
105 | specified. | ||
106 | |||
107 | =item B<ALL> | ||
108 | |||
109 | all ciphers suites except the B<eNULL> ciphers which must be explicitly enabled. | ||
110 | |||
111 | =item B<HIGH> | ||
112 | |||
113 | "high" encryption cipher suites. This currently means those with key lengths larger | ||
114 | than 128 bits. | ||
115 | |||
116 | =item B<MEDIUM> | ||
117 | |||
118 | "medium" encryption cipher suites, currently those using 128 bit encryption. | ||
119 | |||
120 | =item B<LOW> | ||
121 | |||
122 | "low" encryption cipher suites, currently those using 64 or 56 bit encryption algorithms | ||
123 | but excluding export cipher suites. | ||
124 | |||
125 | =item B<EXP>, B<EXPORT> | ||
126 | |||
127 | export encryption algorithms. Including 40 and 56 bits algorithms. | ||
128 | |||
129 | =item B<EXPORT40> | ||
130 | |||
131 | 40 bit export encryption algorithms | ||
132 | |||
133 | =item B<EXPORT56> | ||
134 | |||
135 | 56 bit export encryption algorithms. | ||
136 | |||
137 | =item B<eNULL>, B<NULL> | ||
138 | |||
139 | the "NULL" ciphers that is those offering no encryption. Because these offer no | ||
140 | encryption at all and are a security risk they are disabled unless explicitly | ||
141 | included. | ||
142 | |||
143 | =item B<aNULL> | ||
144 | |||
145 | the cipher suites offering no authentication. This is currently the anonymous | ||
146 | DH algorithms. These cipher suites are vulnerable to a "man in the middle" | ||
147 | attack and so their use is normally discouraged. | ||
148 | |||
149 | =item B<kRSA>, B<RSA> | ||
150 | |||
151 | cipher suites using RSA key exchange. | ||
152 | |||
153 | =item B<kEDH> | ||
154 | |||
155 | cipher suites using ephemeral DH key agreement. | ||
156 | |||
157 | =item B<kDHr>, B<kDHd> | ||
158 | |||
159 | cipher suites using DH key agreement and DH certificates signed by CAs with RSA | ||
160 | and DSS keys respectively. Not implemented. | ||
161 | |||
162 | =item B<aRSA> | ||
163 | |||
164 | cipher suites using RSA authentication, i.e. the certificates carry RSA keys. | ||
165 | |||
166 | =item B<aDSS>, B<DSS> | ||
167 | |||
168 | cipher suites using DSS authentication, i.e. the certificates carry DSS keys. | ||
169 | |||
170 | =item B<aDH> | ||
171 | |||
172 | cipher suites effectively using DH authentication, i.e. the certificates carry | ||
173 | DH keys. Not implemented. | ||
174 | |||
175 | =item B<kFZA>, B<aFZA>, B<eFZA>, B<FZA> | ||
176 | |||
177 | ciphers suites using FORTEZZA key exchange, authentication, encryption or all | ||
178 | FORTEZZA algorithms. Not implemented. | ||
179 | |||
180 | =item B<TLSv1>, B<SSLv3>, B<SSLv2> | ||
181 | |||
182 | TLS v1.0, SSL v3.0 or SSL v2.0 cipher suites respectively. | ||
183 | |||
184 | =item B<DH> | ||
185 | |||
186 | cipher suites using DH, including anonymous DH. | ||
187 | |||
188 | =item B<ADH> | ||
189 | |||
190 | anonymous DH cipher suites. | ||
191 | |||
192 | =item B<3DES> | ||
193 | |||
194 | cipher suites using triple DES. | ||
195 | |||
196 | =item B<DES> | ||
197 | |||
198 | cipher suites using DES (not triple DES). | ||
199 | |||
200 | =item B<RC4> | ||
201 | |||
202 | cipher suites using RC4. | ||
203 | |||
204 | =item B<RC2> | ||
205 | |||
206 | cipher suites using RC2. | ||
207 | |||
208 | =item B<IDEA> | ||
209 | |||
210 | cipher suites using IDEA. | ||
211 | |||
212 | =item B<MD5> | ||
213 | |||
214 | cipher suites using MD5. | ||
215 | |||
216 | =item B<SHA1>, B<SHA> | ||
217 | |||
218 | cipher suites using SHA1. | ||
219 | |||
220 | =back | ||
221 | |||
222 | =head1 CIPHER SUITE NAMES | ||
223 | |||
224 | The following lists give the SSL or TLS cipher suites names from the | ||
225 | relevant specification and their OpenSSL equivalents. | ||
226 | |||
227 | =head2 SSL v3.0 cipher suites. | ||
228 | |||
229 | SSL_RSA_WITH_NULL_MD5 NULL-MD5 | ||
230 | SSL_RSA_WITH_NULL_SHA NULL-SHA | ||
231 | SSL_RSA_EXPORT_WITH_RC4_40_MD5 EXP-RC4-MD5 | ||
232 | SSL_RSA_WITH_RC4_128_MD5 RC4-MD5 | ||
233 | SSL_RSA_WITH_RC4_128_SHA RC4-SHA | ||
234 | SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5 EXP-RC2-CBC-MD5 | ||
235 | SSL_RSA_WITH_IDEA_CBC_SHA IDEA-CBC-SHA | ||
236 | SSL_RSA_EXPORT_WITH_DES40_CBC_SHA EXP-DES-CBC-SHA | ||
237 | SSL_RSA_WITH_DES_CBC_SHA DES-CBC-SHA | ||
238 | SSL_RSA_WITH_3DES_EDE_CBC_SHA DES-CBC3-SHA | ||
239 | |||
240 | SSL_DH_DSS_EXPORT_WITH_DES40_CBC_SHA Not implemented. | ||
241 | SSL_DH_DSS_WITH_DES_CBC_SHA Not implemented. | ||
242 | SSL_DH_DSS_WITH_3DES_EDE_CBC_SHA Not implemented. | ||
243 | SSL_DH_RSA_EXPORT_WITH_DES40_CBC_SHA Not implemented. | ||
244 | SSL_DH_RSA_WITH_DES_CBC_SHA Not implemented. | ||
245 | SSL_DH_RSA_WITH_3DES_EDE_CBC_SHA Not implemented. | ||
246 | SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA EXP-EDH-DSS-DES-CBC-SHA | ||
247 | SSL_DHE_DSS_WITH_DES_CBC_SHA EDH-DSS-CBC-SHA | ||
248 | SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA EDH-DSS-DES-CBC3-SHA | ||
249 | SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA EXP-EDH-RSA-DES-CBC-SHA | ||
250 | SSL_DHE_RSA_WITH_DES_CBC_SHA EDH-RSA-DES-CBC-SHA | ||
251 | SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA EDH-RSA-DES-CBC3-SHA | ||
252 | |||
253 | SSL_DH_anon_EXPORT_WITH_RC4_40_MD5 EXP-ADH-RC4-MD5 | ||
254 | SSL_DH_anon_WITH_RC4_128_MD5 ADH-RC4-MD5 | ||
255 | SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA EXP-ADH-DES-CBC-SHA | ||
256 | SSL_DH_anon_WITH_DES_CBC_SHA ADH-DES-CBC-SHA | ||
257 | SSL_DH_anon_WITH_3DES_EDE_CBC_SHA ADH-DES-CBC3-SHA | ||
258 | |||
259 | SSL_FORTEZZA_KEA_WITH_NULL_SHA Not implemented. | ||
260 | SSL_FORTEZZA_KEA_WITH_FORTEZZA_CBC_SHA Not implemented. | ||
261 | SSL_FORTEZZA_KEA_WITH_RC4_128_SHA Not implemented. | ||
262 | |||
263 | =head2 TLS v1.0 cipher suites. | ||
264 | |||
265 | TLS_RSA_WITH_NULL_MD5 NULL-MD5 | ||
266 | TLS_RSA_WITH_NULL_SHA NULL-SHA | ||
267 | TLS_RSA_EXPORT_WITH_RC4_40_MD5 EXP-RC4-MD5 | ||
268 | TLS_RSA_WITH_RC4_128_MD5 RC4-MD5 | ||
269 | TLS_RSA_WITH_RC4_128_SHA RC4-SHA | ||
270 | TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 EXP-RC2-CBC-MD5 | ||
271 | TLS_RSA_WITH_IDEA_CBC_SHA IDEA-CBC-SHA | ||
272 | TLS_RSA_EXPORT_WITH_DES40_CBC_SHA EXP-DES-CBC-SHA | ||
273 | TLS_RSA_WITH_DES_CBC_SHA DES-CBC-SHA | ||
274 | TLS_RSA_WITH_3DES_EDE_CBC_SHA DES-CBC3-SHA | ||
275 | |||
276 | TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA Not implemented. | ||
277 | TLS_DH_DSS_WITH_DES_CBC_SHA Not implemented. | ||
278 | TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA Not implemented. | ||
279 | TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA Not implemented. | ||
280 | TLS_DH_RSA_WITH_DES_CBC_SHA Not implemented. | ||
281 | TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA Not implemented. | ||
282 | TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA EXP-EDH-DSS-DES-CBC-SHA | ||
283 | TLS_DHE_DSS_WITH_DES_CBC_SHA EDH-DSS-CBC-SHA | ||
284 | TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA EDH-DSS-DES-CBC3-SHA | ||
285 | TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA EXP-EDH-RSA-DES-CBC-SHA | ||
286 | TLS_DHE_RSA_WITH_DES_CBC_SHA EDH-RSA-DES-CBC-SHA | ||
287 | TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA EDH-RSA-DES-CBC3-SHA | ||
288 | |||
289 | TLS_DH_anon_EXPORT_WITH_RC4_40_MD5 EXP-ADH-RC4-MD5 | ||
290 | TLS_DH_anon_WITH_RC4_128_MD5 ADH-RC4-MD5 | ||
291 | TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA EXP-ADH-DES-CBC-SHA | ||
292 | TLS_DH_anon_WITH_DES_CBC_SHA ADH-DES-CBC-SHA | ||
293 | TLS_DH_anon_WITH_3DES_EDE_CBC_SHA ADH-DES-CBC3-SHA | ||
294 | |||
295 | =head2 Additional Export 1024 and other cipher suites | ||
296 | |||
297 | Note: these ciphers can also be used in SSL v3. | ||
298 | |||
299 | TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA EXP1024-DES-CBC-SHA | ||
300 | TLS_RSA_EXPORT1024_WITH_RC4_56_SHA EXP1024-RC4-SHA | ||
301 | TLS_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA EXP1024-DHE-DSS-DES-CBC-SHA | ||
302 | TLS_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA EXP1024-DHE-DSS-RC4-SHA | ||
303 | TLS_DHE_DSS_WITH_RC4_128_SHA DHE-DSS-RC4-SHA | ||
304 | |||
305 | =head2 SSL v2.0 cipher suites. | ||
306 | |||
307 | SSL_CK_RC4_128_WITH_MD5 RC4-MD5 | ||
308 | SSL_CK_RC4_128_EXPORT40_WITH_MD5 EXP-RC4-MD5 | ||
309 | SSL_CK_RC2_128_CBC_WITH_MD5 RC2-MD5 | ||
310 | SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5 EXP-RC2-MD5 | ||
311 | SSL_CK_IDEA_128_CBC_WITH_MD5 IDEA-CBC-MD5 | ||
312 | SSL_CK_DES_64_CBC_WITH_MD5 DES-CBC-MD5 | ||
313 | SSL_CK_DES_192_EDE3_CBC_WITH_MD5 DES-CBC3-MD5 | ||
314 | |||
315 | =head1 NOTES | ||
316 | |||
317 | The non-ephemeral DH modes are currently unimplemented in OpenSSL | ||
318 | because there is no support for DH certificates. | ||
319 | |||
320 | Some compiled versions of OpenSSL may not include all the ciphers | ||
321 | listed here because some ciphers were excluded at compile time. | ||
322 | |||
323 | =head1 EXAMPLES | ||
324 | |||
325 | Verbose listing of all OpenSSL ciphers including NULL ciphers: | ||
326 | |||
327 | openssl ciphers -v 'ALL:eNULL' | ||
328 | |||
329 | Include all ciphers except NULL and anonymous DH then sort by | ||
330 | strength: | ||
331 | |||
332 | openssl ciphers -v 'ALL:!ADH:@STRENGTH' | ||
333 | |||
334 | Include only 3DES ciphers and then place RSA ciphers last: | ||
335 | |||
336 | openssl ciphers -v '3DES:+RSA' | ||
337 | |||
338 | =head1 SEE ALSO | ||
339 | |||
340 | L<s_client(1)|s_client(1)>, L<s_server(1)|s_server(1)>, L<ssl(3)|ssl(3)> | ||
341 | |||
342 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/config.pod b/src/lib/libssl/src/doc/apps/config.pod new file mode 100644 index 0000000000..ce874a42ce --- /dev/null +++ b/src/lib/libssl/src/doc/apps/config.pod | |||
@@ -0,0 +1,138 @@ | |||
1 | |||
2 | =pod | ||
3 | |||
4 | =head1 NAME | ||
5 | |||
6 | config - OpenSSL CONF library configuration files | ||
7 | |||
8 | =head1 DESCRIPTION | ||
9 | |||
10 | The OpenSSL CONF library can be used to read configuration files. | ||
11 | It is used for the OpenSSL master configuration file B<openssl.cnf> | ||
12 | and in a few other places like B<SPKAC> files and certificate extension | ||
13 | files for the B<x509> utility. | ||
14 | |||
15 | A configuration file is divided into a number of sections. Each section | ||
16 | starts with a line B<[ section_name ]> and ends when a new section is | ||
17 | started or end of file is reached. A section name can consist of | ||
18 | alphanumeric characters and underscores. | ||
19 | |||
20 | The first section of a configuration file is special and is referred | ||
21 | to as the B<default> section this is usually unnamed and is from the | ||
22 | start of file until the first named section. When a name is being looked up | ||
23 | it is first looked up in a named section (if any) and then the | ||
24 | default section. | ||
25 | |||
26 | The environment is mapped onto a section called B<ENV>. | ||
27 | |||
28 | Comments can be included by preceding them with the B<#> character | ||
29 | |||
30 | Each section in a configuration file consists of a number of name and | ||
31 | value pairs of the form B<name=value> | ||
32 | |||
33 | The B<name> string can contain any alphanumeric characters as well as | ||
34 | a few punctuation symbols such as B<.> B<,> B<;> and B<_>. | ||
35 | |||
36 | The B<value> string consists of the string following the B<=> character | ||
37 | until end of line with any leading and trailing white space removed. | ||
38 | |||
39 | The value string undergoes variable expansion. This can be done by | ||
40 | including the form B<$var> or B<${var}>: this will substitute the value | ||
41 | of the named variable in the current section. It is also possible to | ||
42 | substitute a value from another section using the syntax B<$section::name> | ||
43 | or B<${section::name}>. By using the form B<$ENV::name> environment | ||
44 | variables can be substituted. It is also possible to assign values to | ||
45 | environment variables by using the name B<ENV::name>, this will work | ||
46 | if the program looks up environment variables using the B<CONF> library | ||
47 | instead of calling B<getenv()> directly. | ||
48 | |||
49 | It is possible to escape certain characters by using any kind of quote | ||
50 | or the B<\> character. By making the last character of a line a B<\> | ||
51 | a B<value> string can be spread across multiple lines. In addition | ||
52 | the sequences B<\n>, B<\r>, B<\b> and B<\t> are recognized. | ||
53 | |||
54 | =head1 NOTES | ||
55 | |||
56 | If a configuration file attempts to expand a variable that doesn't exist | ||
57 | then an error is flagged and the file will not load. This can happen | ||
58 | if an attempt is made to expand an environment variable that doesn't | ||
59 | exist. For example the default OpenSSL master configuration file used | ||
60 | the value of B<HOME> which may not be defined on non Unix systems. | ||
61 | |||
62 | This can be worked around by including a B<default> section to provide | ||
63 | a default value: then if the environment lookup fails the default value | ||
64 | will be used instead. For this to work properly the default value must | ||
65 | be defined earlier in the configuration file than the expansion. See | ||
66 | the B<EXAMPLES> section for an example of how to do this. | ||
67 | |||
68 | If the same variable exists in the same section then all but the last | ||
69 | value will be silently ignored. In certain circumstances such as with | ||
70 | DNs the same field may occur multiple times. This is usually worked | ||
71 | around by ignoring any characters before an initial B<.> e.g. | ||
72 | |||
73 | 1.OU="My first OU" | ||
74 | 2.OU="My Second OU" | ||
75 | |||
76 | =head1 EXAMPLES | ||
77 | |||
78 | Here is a sample configuration file using some of the features | ||
79 | mentioned above. | ||
80 | |||
81 | # This is the default section. | ||
82 | |||
83 | HOME=/temp | ||
84 | RANDFILE= ${ENV::HOME}/.rnd | ||
85 | configdir=$ENV::HOME/config | ||
86 | |||
87 | [ section_one ] | ||
88 | |||
89 | # We are now in section one. | ||
90 | |||
91 | # Quotes permit leading and trailing whitespace | ||
92 | any = " any variable name " | ||
93 | |||
94 | other = A string that can \ | ||
95 | cover several lines \ | ||
96 | by including \\ characters | ||
97 | |||
98 | message = Hello World\n | ||
99 | |||
100 | [ section_two ] | ||
101 | |||
102 | greeting = $section_one::message | ||
103 | |||
104 | This next example shows how to expand environment variables safely. | ||
105 | |||
106 | Suppose you want a variable called B<tmpfile> to refer to a | ||
107 | temporary filename. The directory it is placed in can determined by | ||
108 | the the B<TEMP> or B<TMP> environment variables but they may not be | ||
109 | set to any value at all. If you just include the environment variable | ||
110 | names and the variable doesn't exist then this will cause an error when | ||
111 | an attempt is made to load the configuration file. By making use of the | ||
112 | default section both values can be looked up with B<TEMP> taking | ||
113 | priority and B</tmp> used if neither is defined: | ||
114 | |||
115 | TMP=/tmp | ||
116 | # The above value is used if TMP isn't in the environment | ||
117 | TEMP=$ENV::TMP | ||
118 | # The above value is used if TEMP isn't in the environment | ||
119 | tmpfile=${ENV::TEMP}/tmp.filename | ||
120 | |||
121 | =head1 BUGS | ||
122 | |||
123 | Currently there is no way to include characters using the octal B<\nnn> | ||
124 | form. Strings are all null terminated so nulls cannot form part of | ||
125 | the value. | ||
126 | |||
127 | The escaping isn't quite right: if you want to use sequences like B<\n> | ||
128 | you can't use any quote escaping on the same line. | ||
129 | |||
130 | Files are loaded in a single pass. This means that an variable expansion | ||
131 | will only work if the variables referenced are defined earlier in the | ||
132 | file. | ||
133 | |||
134 | =head1 SEE ALSO | ||
135 | |||
136 | L<x509(1)|x509(1)>, L<req(1)|req(1)>, L<ca(1)|ca(1)> | ||
137 | |||
138 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/crl.pod b/src/lib/libssl/src/doc/apps/crl.pod new file mode 100644 index 0000000000..a40c873b95 --- /dev/null +++ b/src/lib/libssl/src/doc/apps/crl.pod | |||
@@ -0,0 +1,117 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | crl - CRL utility | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<openssl> B<crl> | ||
10 | [B<-inform PEM|DER>] | ||
11 | [B<-outform PEM|DER>] | ||
12 | [B<-text>] | ||
13 | [B<-in filename>] | ||
14 | [B<-out filename>] | ||
15 | [B<-noout>] | ||
16 | [B<-hash>] | ||
17 | [B<-issuer>] | ||
18 | [B<-lastupdate>] | ||
19 | [B<-nextupdate>] | ||
20 | [B<-CAfile file>] | ||
21 | [B<-CApath dir>] | ||
22 | |||
23 | =head1 DESCRIPTION | ||
24 | |||
25 | The B<crl> command processes CRL files in DER or PEM format. | ||
26 | |||
27 | =head1 COMMAND OPTIONS | ||
28 | |||
29 | =over 4 | ||
30 | |||
31 | =item B<-inform DER|PEM> | ||
32 | |||
33 | This specifies the input format. B<DER> format is DER encoded CRL | ||
34 | structure. B<PEM> (the default) is a base64 encoded version of | ||
35 | the DER form with header and footer lines. | ||
36 | |||
37 | =item B<-outform DER|PEM> | ||
38 | |||
39 | This specifies the output format, the options have the same meaning as the | ||
40 | B<-inform> option. | ||
41 | |||
42 | =item B<-in filename> | ||
43 | |||
44 | This specifies the input filename to read from or standard input if this | ||
45 | option is not specified. | ||
46 | |||
47 | =item B<-out filename> | ||
48 | |||
49 | specifies the output filename to write to or standard output by | ||
50 | default. | ||
51 | |||
52 | =item B<-text> | ||
53 | |||
54 | print out the CRL in text form. | ||
55 | |||
56 | =item B<-noout> | ||
57 | |||
58 | don't output the encoded version of the CRL. | ||
59 | |||
60 | =item B<-hash> | ||
61 | |||
62 | output a hash of the issuer name. This can be use to lookup CRLs in | ||
63 | a directory by issuer name. | ||
64 | |||
65 | =item B<-issuer> | ||
66 | |||
67 | output the issuer name. | ||
68 | |||
69 | =item B<-lastupdate> | ||
70 | |||
71 | output the lastUpdate field. | ||
72 | |||
73 | =item B<-nextupdate> | ||
74 | |||
75 | output the nextUpdate field. | ||
76 | |||
77 | =item B<-CAfile file> | ||
78 | |||
79 | verify the signature on a CRL by looking up the issuing certificate in | ||
80 | B<file> | ||
81 | |||
82 | =item B<-CApath dir> | ||
83 | |||
84 | verify the signature on a CRL by looking up the issuing certificate in | ||
85 | B<dir>. This directory must be a standard certificate directory: that | ||
86 | is a hash of each subject name (using B<x509 -hash>) should be linked | ||
87 | to each certificate. | ||
88 | |||
89 | =back | ||
90 | |||
91 | =head1 NOTES | ||
92 | |||
93 | The PEM CRL format uses the header and footer lines: | ||
94 | |||
95 | -----BEGIN X509 CRL----- | ||
96 | -----END X509 CRL----- | ||
97 | |||
98 | =head1 EXAMPLES | ||
99 | |||
100 | Convert a CRL file from PEM to DER: | ||
101 | |||
102 | openssl crl -in crl.pem -outform DER -out crl.der | ||
103 | |||
104 | Output the text form of a DER encoded certificate: | ||
105 | |||
106 | openssl crl -in crl.der -text -noout | ||
107 | |||
108 | =head1 BUGS | ||
109 | |||
110 | Ideally it should be possible to create a CRL using appropriate options | ||
111 | and files too. | ||
112 | |||
113 | =head1 SEE ALSO | ||
114 | |||
115 | L<crl2pkcs7(1)|crl2pkcs7(1)>, L<ca(1)|ca(1)>, L<x509(1)|x509(1)> | ||
116 | |||
117 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/crl2pkcs7.pod b/src/lib/libssl/src/doc/apps/crl2pkcs7.pod new file mode 100644 index 0000000000..da199b044a --- /dev/null +++ b/src/lib/libssl/src/doc/apps/crl2pkcs7.pod | |||
@@ -0,0 +1,90 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | crl2pkcs7 - Create a PKCS#7 structure from a CRL and certificates. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<openssl> B<pkcs7> | ||
10 | [B<-inform PEM|DER>] | ||
11 | [B<-outform PEM|DER>] | ||
12 | [B<-in filename>] | ||
13 | [B<-out filename>] | ||
14 | [B<-print_certs>] | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | The B<crl2pkcs7> command takes an optional CRL and one or more | ||
19 | certificates and converts them into a PKCS#7 degenerate "certificates | ||
20 | only" structure. | ||
21 | |||
22 | =head1 COMMAND OPTIONS | ||
23 | |||
24 | =over 4 | ||
25 | |||
26 | =item B<-inform DER|PEM> | ||
27 | |||
28 | This specifies the CRL input format. B<DER> format is DER encoded CRL | ||
29 | structure.B<PEM> (the default) is a base64 encoded version of | ||
30 | the DER form with header and footer lines. | ||
31 | |||
32 | =item B<-outform DER|PEM> | ||
33 | |||
34 | This specifies the PKCS#7 structure output format. B<DER> format is DER | ||
35 | encoded PKCS#7 structure.B<PEM> (the default) is a base64 encoded version of | ||
36 | the DER form with header and footer lines. | ||
37 | |||
38 | =item B<-in filename> | ||
39 | |||
40 | This specifies the input filename to read a CRL from or standard input if this | ||
41 | option is not specified. | ||
42 | |||
43 | =item B<-out filename> | ||
44 | |||
45 | specifies the output filename to write the PKCS#7 structure to or standard | ||
46 | output by default. | ||
47 | |||
48 | =item B<-certfile filename> | ||
49 | |||
50 | specifies a filename containing one or more certificates in B<PEM> format. | ||
51 | All certificates in the file will be added to the PKCS#7 structure. This | ||
52 | option can be used more than once to read certificates form multiple | ||
53 | files. | ||
54 | |||
55 | =item B<-nocrl> | ||
56 | |||
57 | normally a CRL is included in the output file. With this option no CRL is | ||
58 | included in the output file and a CRL is not read from the input file. | ||
59 | |||
60 | =back | ||
61 | |||
62 | =head1 EXAMPLES | ||
63 | |||
64 | Create a PKCS#7 structure from a certificate and CRL: | ||
65 | |||
66 | openssl crl2pkcs7 -in crl.pem -certfile cert.pem -out p7.pem | ||
67 | |||
68 | Creates a PKCS#7 structure in DER format with no CRL from several | ||
69 | different certificates: | ||
70 | |||
71 | openssl crl2pkcs7 -nocrl -certfile newcert.pem | ||
72 | -certfile demoCA/cacert.pem -outform DER -out p7.der | ||
73 | |||
74 | =head1 NOTES | ||
75 | |||
76 | The output file is a PKCS#7 signed data structure containing no signers and | ||
77 | just certificates and an optional CRL. | ||
78 | |||
79 | This utility can be used to send certificates and CAs to Netscape as part of | ||
80 | the certificate enrollment process. This involves sending the DER encoded output | ||
81 | as MIME type application/x-x509-user-cert. | ||
82 | |||
83 | The B<PEM> encoded form with the header and footer lines removed can be used to | ||
84 | install user certificates and CAs in MSIE using the Xenroll control. | ||
85 | |||
86 | =head1 SEE ALSO | ||
87 | |||
88 | L<pkcs7(1)|pkcs7(1)> | ||
89 | |||
90 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/dgst.pod b/src/lib/libssl/src/doc/apps/dgst.pod new file mode 100644 index 0000000000..cbf2cc529a --- /dev/null +++ b/src/lib/libssl/src/doc/apps/dgst.pod | |||
@@ -0,0 +1,49 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | dgst, md5, md2, sha1, sha, mdc2, ripemd160 - message digests | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | [B<dgst>] | ||
10 | [B<-md5|-md2|-sha1|-sha|mdc2|-ripemd160>] | ||
11 | [B<-c>] | ||
12 | [B<-d>] | ||
13 | [B<file...>] | ||
14 | |||
15 | [B<md5|md2|sha1|sha|mdc2|ripemd160>] | ||
16 | [B<-c>] | ||
17 | [B<-d>] | ||
18 | [B<file...>] | ||
19 | |||
20 | =head1 DESCRIPTION | ||
21 | |||
22 | The digest functions print out the message digest of a supplied file or files | ||
23 | in hexadecimal form. | ||
24 | |||
25 | =head1 OPTIONS | ||
26 | |||
27 | =over 4 | ||
28 | |||
29 | =item B<-c> | ||
30 | |||
31 | print out the digest in two digit groups separated by colons. | ||
32 | |||
33 | =item B<-d> | ||
34 | |||
35 | print out BIO debugging information. | ||
36 | |||
37 | =item B<file...> | ||
38 | |||
39 | file or files to digest. If no files are specified then standard input is | ||
40 | used. | ||
41 | |||
42 | =back | ||
43 | |||
44 | =head1 NOTES | ||
45 | |||
46 | The digest of choice for all new applications is SHA1. Other digests are | ||
47 | however still widely used. | ||
48 | |||
49 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/dhparam.pod b/src/lib/libssl/src/doc/apps/dhparam.pod new file mode 100644 index 0000000000..6b237ec05a --- /dev/null +++ b/src/lib/libssl/src/doc/apps/dhparam.pod | |||
@@ -0,0 +1,115 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | dhparam - DH parameter manipulation and generation | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<openssl dh> | ||
10 | [B<-inform DER|PEM>] | ||
11 | [B<-outform DER|PEM>] | ||
12 | [B<-in filename>] | ||
13 | [B<-out filename>] | ||
14 | [B<-noout>] | ||
15 | [B<-text>] | ||
16 | [B<-C>] | ||
17 | [B<-2>] | ||
18 | [B<-5>] | ||
19 | [B<-rand file(s)>] | ||
20 | [numbits] | ||
21 | |||
22 | =head1 DESCRIPTION | ||
23 | |||
24 | This command is used to manipulate DH parameter files. | ||
25 | |||
26 | =head1 OPTIONS | ||
27 | |||
28 | =over 4 | ||
29 | |||
30 | =item B<-inform DER|PEM> | ||
31 | |||
32 | This specifies the input format. The B<DER> option uses an ASN1 DER encoded | ||
33 | form compatible with the PKCS#3 DHparameter structure. The PEM form is the | ||
34 | default format: it consists of the B<DER> format base64 encoded with | ||
35 | additional header and footer lines. | ||
36 | |||
37 | =item B<-outform DER|PEM> | ||
38 | |||
39 | This specifies the output format, the options have the same meaning as the | ||
40 | B<-inform> option. | ||
41 | |||
42 | =item B<-in filename> | ||
43 | |||
44 | This specifies the input filename to read parameters from or standard input if | ||
45 | this option is not specified. | ||
46 | |||
47 | =item B<-out filename> | ||
48 | |||
49 | This specifies the output filename parameters to. Standard output is used | ||
50 | if this option is not present. The output filename should B<not> be the same | ||
51 | as the input filename. | ||
52 | |||
53 | =item B<-2>, B<-5> | ||
54 | |||
55 | The generator to use, either 2 or 5. 2 is the default. If present then the | ||
56 | input file is ignored and parameters are generated instead. | ||
57 | |||
58 | =item B<-rand file(s)> | ||
59 | |||
60 | a file or files containing random data used to seed the random number | ||
61 | generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). | ||
62 | Multiple files can be specified separated by a OS-dependent character. | ||
63 | The separator is B<;> for MS-Windows, B<,> for OpenVSM, and B<:> for | ||
64 | all others. | ||
65 | |||
66 | =item B<numbits> | ||
67 | |||
68 | this option specifies that a parameter set should be generated of size | ||
69 | B<numbits>. It must be the last option. If not present then a value of 512 | ||
70 | is used. If this option is present then the input file is ignored and | ||
71 | parameters are generated instead. | ||
72 | |||
73 | =item B<-noout> | ||
74 | |||
75 | this option inhibits the output of the encoded version of the parameters. | ||
76 | |||
77 | =item B<-text> | ||
78 | |||
79 | this option prints out the DH parameters in human readable form. | ||
80 | |||
81 | =item B<-C> | ||
82 | |||
83 | this option converts the parameters into C code. The parameters can then | ||
84 | be loaded by calling the B<get_dhXXX()> function. | ||
85 | |||
86 | =back | ||
87 | |||
88 | =head1 WARNINGS | ||
89 | |||
90 | The program B<dhparam> combines the functionality of the programs B<dh> and | ||
91 | B<gendh> in previous versions of OpenSSL and SSLeay. The B<dh> and B<gendh> | ||
92 | programs are retained for now but may have different purposes in future | ||
93 | versions of OpenSSL. | ||
94 | |||
95 | =head1 NOTES | ||
96 | |||
97 | PEM format DH parameters use the header and footer lines: | ||
98 | |||
99 | -----BEGIN DH PARAMETERS----- | ||
100 | -----END DH PARAMETERS----- | ||
101 | |||
102 | OpenSSL currently only supports the older PKCS#3 DH, not the newer X9.42 | ||
103 | DH. | ||
104 | |||
105 | This program manipulates DH parameters not keys. | ||
106 | |||
107 | =head1 BUGS | ||
108 | |||
109 | There should be a way to generate and manipulate DH keys. | ||
110 | |||
111 | =head1 SEE ALSO | ||
112 | |||
113 | L<dsaparam(1)|dsaparam(1)> | ||
114 | |||
115 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/dsa.pod b/src/lib/libssl/src/doc/apps/dsa.pod new file mode 100644 index 0000000000..28e534bb95 --- /dev/null +++ b/src/lib/libssl/src/doc/apps/dsa.pod | |||
@@ -0,0 +1,150 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | dsa - DSA key processing | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<openssl> B<dsa> | ||
10 | [B<-inform PEM|DER>] | ||
11 | [B<-outform PEM|DER>] | ||
12 | [B<-in filename>] | ||
13 | [B<-passin arg>] | ||
14 | [B<-out filename>] | ||
15 | [B<-passout arg>] | ||
16 | [B<-des>] | ||
17 | [B<-des3>] | ||
18 | [B<-idea>] | ||
19 | [B<-text>] | ||
20 | [B<-noout>] | ||
21 | [B<-modulus>] | ||
22 | [B<-pubin>] | ||
23 | [B<-pubout>] | ||
24 | |||
25 | =head1 DESCRIPTION | ||
26 | |||
27 | The B<dsa> command processes DSA keys. They can be converted between various | ||
28 | forms and their components printed out. B<Note> This command uses the | ||
29 | traditional SSLeay compatible format for private key encryption: newer | ||
30 | applications should use the more secure PKCS#8 format using the B<pkcs8> | ||
31 | |||
32 | =head1 COMMAND OPTIONS | ||
33 | |||
34 | =over 4 | ||
35 | |||
36 | =item B<-inform DER|PEM> | ||
37 | |||
38 | This specifies the input format. The B<DER> option with a private key uses | ||
39 | an ASN1 DER encoded form of an ASN.1 SEQUENCE consisting of the values of | ||
40 | version (currently zero), p, q, g, the public and private key components | ||
41 | respectively as ASN.1 INTEGERs. When used with a public key it uses a | ||
42 | SubjectPublicKeyInfo structure: it is an error if the key is not DSA. | ||
43 | |||
44 | The B<PEM> form is the default format: it consists of the B<DER> format base64 | ||
45 | encoded with additional header and footer lines. In the case of a private key | ||
46 | PKCS#8 format is also accepted. | ||
47 | |||
48 | =item B<-outform DER|PEM> | ||
49 | |||
50 | This specifies the output format, the options have the same meaning as the | ||
51 | B<-inform> option. | ||
52 | |||
53 | =item B<-in filename> | ||
54 | |||
55 | This specifies the input filename to read a key from or standard input if this | ||
56 | option is not specified. If the key is encrypted a pass phrase will be | ||
57 | prompted for. | ||
58 | |||
59 | =item B<-passin arg> | ||
60 | |||
61 | the input file password source. For more information about the format of B<arg> | ||
62 | see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. | ||
63 | |||
64 | =item B<-out filename> | ||
65 | |||
66 | This specifies the output filename to write a key to or standard output by | ||
67 | is not specified. If any encryption options are set then a pass phrase will be | ||
68 | prompted for. The output filename should B<not> be the same as the input | ||
69 | filename. | ||
70 | |||
71 | =item B<-passout arg> | ||
72 | |||
73 | the output file password source. For more information about the format of B<arg> | ||
74 | see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. | ||
75 | |||
76 | =item B<-des|-des3|-idea> | ||
77 | |||
78 | These options encrypt the private key with the DES, triple DES, or the | ||
79 | IDEA ciphers respectively before outputting it. A pass phrase is prompted for. | ||
80 | If none of these options is specified the key is written in plain text. This | ||
81 | means that using the B<dsa> utility to read in an encrypted key with no | ||
82 | encryption option can be used to remove the pass phrase from a key, or by | ||
83 | setting the encryption options it can be use to add or change the pass phrase. | ||
84 | These options can only be used with PEM format output files. | ||
85 | |||
86 | =item B<-text> | ||
87 | |||
88 | prints out the public, private key components and parameters. | ||
89 | |||
90 | =item B<-noout> | ||
91 | |||
92 | this option prevents output of the encoded version of the key. | ||
93 | |||
94 | =item B<-modulus> | ||
95 | |||
96 | this option prints out the value of the public key component of the key. | ||
97 | |||
98 | =item B<-pubin> | ||
99 | |||
100 | by default a private key is read from the input file: with this option a | ||
101 | public key is read instead. | ||
102 | |||
103 | =item B<-pubout> | ||
104 | |||
105 | by default a private key is output. With this option a public | ||
106 | key will be output instead. This option is automatically set if the input is | ||
107 | a public key. | ||
108 | |||
109 | =back | ||
110 | |||
111 | =head1 NOTES | ||
112 | |||
113 | The PEM private key format uses the header and footer lines: | ||
114 | |||
115 | -----BEGIN DSA PRIVATE KEY----- | ||
116 | -----END DSA PRIVATE KEY----- | ||
117 | |||
118 | The PEM public key format uses the header and footer lines: | ||
119 | |||
120 | -----BEGIN PUBLIC KEY----- | ||
121 | -----END PUBLIC KEY----- | ||
122 | |||
123 | =head1 EXAMPLES | ||
124 | |||
125 | To remove the pass phrase on a DSA private key: | ||
126 | |||
127 | openssl dsa -in key.pem -out keyout.pem | ||
128 | |||
129 | To encrypt a private key using triple DES: | ||
130 | |||
131 | openssl dsa -in key.pem -des3 -out keyout.pem | ||
132 | |||
133 | To convert a private key from PEM to DER format: | ||
134 | |||
135 | openssl dsa -in key.pem -outform DER -out keyout.der | ||
136 | |||
137 | To print out the components of a private key to standard output: | ||
138 | |||
139 | openssl dsa -in key.pem -text -noout | ||
140 | |||
141 | To just output the public part of a private key: | ||
142 | |||
143 | openssl dsa -in key.pem -pubout -out pubkey.pem | ||
144 | |||
145 | =head1 SEE ALSO | ||
146 | |||
147 | L<dsaparam(1)|dsaparam(1)>, L<gendsa(1)|gendsa(1)>, L<rsa(1)|rsa(1)>, | ||
148 | L<genrsa(1)|genrsa(1)> | ||
149 | |||
150 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/dsaparam.pod b/src/lib/libssl/src/doc/apps/dsaparam.pod new file mode 100644 index 0000000000..8647f34698 --- /dev/null +++ b/src/lib/libssl/src/doc/apps/dsaparam.pod | |||
@@ -0,0 +1,102 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | dsaparam - DSA parameter manipulation and generation | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<openssl dsaparam> | ||
10 | [B<-inform DER|PEM>] | ||
11 | [B<-outform DER|PEM>] | ||
12 | [B<-in filename>] | ||
13 | [B<-out filename>] | ||
14 | [B<-noout>] | ||
15 | [B<-text>] | ||
16 | [B<-C>] | ||
17 | [B<-rand file(s)>] | ||
18 | [B<-genkey>] | ||
19 | [B<numbits>] | ||
20 | |||
21 | =head1 DESCRIPTION | ||
22 | |||
23 | This command is used to manipulate or generate DSA parameter files. | ||
24 | |||
25 | =head1 OPTIONS | ||
26 | |||
27 | =over 4 | ||
28 | |||
29 | =item B<-inform DER|PEM> | ||
30 | |||
31 | This specifies the input format. The B<DER> option uses an ASN1 DER encoded | ||
32 | form compatible with RFC2459 (PKIX) DSS-Parms that is a SEQUENCE consisting | ||
33 | of p, q and g respectively. The PEM form is the default format: it consists | ||
34 | of the B<DER> format base64 encoded with additional header and footer lines. | ||
35 | |||
36 | =item B<-outform DER|PEM> | ||
37 | |||
38 | This specifies the output format, the options have the same meaning as the | ||
39 | B<-inform> option. | ||
40 | |||
41 | =item B<-in filename> | ||
42 | |||
43 | This specifies the input filename to read parameters from or standard input if | ||
44 | this option is not specified. If the B<numbits> parameter is included then | ||
45 | this option will be ignored. | ||
46 | |||
47 | =item B<-out filename> | ||
48 | |||
49 | This specifies the output filename parameters to. Standard output is used | ||
50 | if this option is not present. The output filename should B<not> be the same | ||
51 | as the input filename. | ||
52 | |||
53 | =item B<-noout> | ||
54 | |||
55 | this option inhibits the output of the encoded version of the parameters. | ||
56 | |||
57 | =item B<-text> | ||
58 | |||
59 | this option prints out the DSA parameters in human readable form. | ||
60 | |||
61 | =item B<-C> | ||
62 | |||
63 | this option converts the parameters into C code. The parameters can then | ||
64 | be loaded by calling the B<get_dsaXXX()> function. | ||
65 | |||
66 | =item B<-genkey> | ||
67 | |||
68 | this option will generate a DSA either using the specified or generated | ||
69 | parameters. | ||
70 | |||
71 | =item B<-rand file(s)> | ||
72 | |||
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)>). | ||
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 | ||
77 | all others. | ||
78 | |||
79 | =item B<numbits> | ||
80 | |||
81 | this option specifies that a parameter set should be generated of size | ||
82 | B<numbits>. It must be the last option. If this option is included then | ||
83 | the input file (if any) is ignored. | ||
84 | |||
85 | =back | ||
86 | |||
87 | =head1 NOTES | ||
88 | |||
89 | PEM format DSA parameters use the header and footer lines: | ||
90 | |||
91 | -----BEGIN DSA PARAMETERS----- | ||
92 | -----END DSA PARAMETERS----- | ||
93 | |||
94 | DSA parameter generation is a slow process and as a result the same set of | ||
95 | DSA parameters is often used to generate several distinct keys. | ||
96 | |||
97 | =head1 SEE ALSO | ||
98 | |||
99 | L<gendsa(1)|gendsa(1)>, L<dsa(1)|dsa(1)>, L<genrsa(1)|genrsa(1)>, | ||
100 | L<rsa(1)|rsa(1)> | ||
101 | |||
102 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/enc.pod b/src/lib/libssl/src/doc/apps/enc.pod new file mode 100644 index 0000000000..e436ccc37e --- /dev/null +++ b/src/lib/libssl/src/doc/apps/enc.pod | |||
@@ -0,0 +1,257 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | enc - symmetric cipher routines | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<openssl enc -ciphername> | ||
10 | [B<-in filename>] | ||
11 | [B<-out filename>] | ||
12 | [B<-pass arg>] | ||
13 | [B<-e>] | ||
14 | [B<-d>] | ||
15 | [B<-a>] | ||
16 | [B<-A>] | ||
17 | [B<-k password>] | ||
18 | [B<-kfile filename>] | ||
19 | [B<-K key>] | ||
20 | [B<-iv IV>] | ||
21 | [B<-p>] | ||
22 | [B<-P>] | ||
23 | [B<-bufsize number>] | ||
24 | [B<-debug>] | ||
25 | |||
26 | =head1 DESCRIPTION | ||
27 | |||
28 | The symmetric cipher commands allow data to be encrypted or decrypted | ||
29 | using various block and stream ciphers using keys based on passwords | ||
30 | or explicitly provided. Base64 encoding or decoding can also be performed | ||
31 | either by itself or in addition to the encryption or decryption. | ||
32 | |||
33 | =head1 OPTIONS | ||
34 | |||
35 | =over 4 | ||
36 | |||
37 | =item B<-in filename> | ||
38 | |||
39 | the input filename, standard input by default. | ||
40 | |||
41 | =item B<-out filename> | ||
42 | |||
43 | the output filename, standard output by default. | ||
44 | |||
45 | =item B<-pass arg> | ||
46 | |||
47 | the password source. For more information about the format of B<arg> | ||
48 | see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. | ||
49 | |||
50 | =item B<-salt> | ||
51 | |||
52 | use a salt in the key derivation routines. This option should B<ALWAYS> | ||
53 | be used unless compatibility with previous versions of OpenSSL or SSLeay | ||
54 | is required. This option is only present on OpenSSL versions 0.9.5 or | ||
55 | above. | ||
56 | |||
57 | =item B<-nosalt> | ||
58 | |||
59 | don't use a salt in the key derivation routines. This is the default for | ||
60 | compatibility with previous versions of OpenSSL and SSLeay. | ||
61 | |||
62 | =item B<-e> | ||
63 | |||
64 | encrypt the input data: this is the default. | ||
65 | |||
66 | =item B<-d> | ||
67 | |||
68 | decrypt the input data. | ||
69 | |||
70 | =item B<-a> | ||
71 | |||
72 | base64 process the data. This means that if encryption is taking place | ||
73 | the data is base64 encoded after encryption. If decryption is set then | ||
74 | the input data is base64 decoded before being decrypted. | ||
75 | |||
76 | =item B<-A> | ||
77 | |||
78 | if the B<-a> option is set then base64 process the data on one line. | ||
79 | |||
80 | =item B<-k password> | ||
81 | |||
82 | the password to derive the key from. This is for compatibility with previous | ||
83 | versions of OpenSSL. Superseded by the B<-pass> argument. | ||
84 | |||
85 | =item B<-kfile filename> | ||
86 | |||
87 | read the password to derive the key from the first line of B<filename>. | ||
88 | This is for computability with previous versions of OpenSSL. Superseded by | ||
89 | the B<-pass> argument. | ||
90 | |||
91 | =item B<-S salt> | ||
92 | |||
93 | the actual salt to use: this must be represented as a string comprised only | ||
94 | of hex digits. | ||
95 | |||
96 | =item B<-K key> | ||
97 | |||
98 | the actual key to use: this must be represented as a string comprised only | ||
99 | of hex digits. | ||
100 | |||
101 | =item B<-iv IV> | ||
102 | |||
103 | the actual IV to use: this must be represented as a string comprised only | ||
104 | of hex digits. | ||
105 | |||
106 | =item B<-p> | ||
107 | |||
108 | print out the key and IV used. | ||
109 | |||
110 | =item B<-P> | ||
111 | |||
112 | print out the key and IV used then immediately exit: don't do any encryption | ||
113 | or decryption. | ||
114 | |||
115 | =item B<-bufsize number> | ||
116 | |||
117 | set the buffer size for I/O | ||
118 | |||
119 | =item B<-debug> | ||
120 | |||
121 | debug the BIOs used for I/O. | ||
122 | |||
123 | =back | ||
124 | |||
125 | =head1 NOTES | ||
126 | |||
127 | The program can be called either as B<openssl ciphername> or | ||
128 | B<openssl enc -ciphername>. | ||
129 | |||
130 | A password will be prompted for to derive the key and IV if necessary. | ||
131 | |||
132 | The B<-salt> option should B<ALWAYS> be used if the key is being derived | ||
133 | from a password unless you want compatibility with previous versions of | ||
134 | OpenSSL and SSLeay. | ||
135 | |||
136 | Without the B<-salt> option it is possible to perform efficient dictionary | ||
137 | attacks on the password and to attack stream cipher encrypted data. The reason | ||
138 | for this is that without the salt the same password always generates the same | ||
139 | encryption key. When the salt is being used the first eight bytes of the | ||
140 | encrypted data are reserved for the salt: it is generated at random when | ||
141 | encrypting a file and read from the encrypted file when it is decrypted. | ||
142 | |||
143 | Some of the ciphers do not have large keys and others have security | ||
144 | implications if not used correctly. A beginner is advised to just use | ||
145 | a strong block cipher in CBC mode such as bf or des3. | ||
146 | |||
147 | All the block ciphers use PKCS#5 padding also known as standard block | ||
148 | padding: this allows a rudimentary integrity or password check to be | ||
149 | performed. However since the chance of random data passing the test is | ||
150 | better than 1 in 256 it isn't a very good test. | ||
151 | |||
152 | All RC2 ciphers have the same key and effective key length. | ||
153 | |||
154 | Blowfish and RC5 algorithms use a 128 bit key. | ||
155 | |||
156 | =head1 SUPPORTED CIPHERS | ||
157 | |||
158 | base64 Base 64 | ||
159 | |||
160 | bf-cbc Blowfish in CBC mode | ||
161 | bf Alias for bf-cbc | ||
162 | bf-cfb Blowfish in CFB mode | ||
163 | bf-ecb Blowfish in ECB mode | ||
164 | bf-ofb Blowfish in OFB mode | ||
165 | |||
166 | cast-cbc CAST in CBC mode | ||
167 | cast Alias for cast-cbc | ||
168 | cast5-cbc CAST5 in CBC mode | ||
169 | cast5-cfb CAST5 in CFB mode | ||
170 | cast5-ecb CAST5 in ECB mode | ||
171 | cast5-ofb CAST5 in OFB mode | ||
172 | |||
173 | des-cbc DES in CBC mode | ||
174 | des Alias for des-cbc | ||
175 | des-cfb DES in CBC mode | ||
176 | des-ofb DES in OFB mode | ||
177 | des-ecb DES in ECB mode | ||
178 | |||
179 | des-ede-cbc Two key triple DES EDE in CBC mode | ||
180 | des-ede Alias for des-ede | ||
181 | des-ede-cfb Two key triple DES EDE in CFB mode | ||
182 | des-ede-ofb Two key triple DES EDE in OFB mode | ||
183 | |||
184 | des-ede3-cbc Three key triple DES EDE in CBC mode | ||
185 | des-ede3 Alias for des-ede3-cbc | ||
186 | des3 Alias for des-ede3-cbc | ||
187 | des-ede3-cfb Three key triple DES EDE CFB mode | ||
188 | des-ede3-ofb Three key triple DES EDE in OFB mode | ||
189 | |||
190 | desx DESX algorithm. | ||
191 | |||
192 | idea-cbc IDEA algorithm in CBC mode | ||
193 | idea same as idea-cbc | ||
194 | idea-cfb IDEA in CFB mode | ||
195 | idea-ecb IDEA in ECB mode | ||
196 | idea-ofb IDEA in OFB mode | ||
197 | |||
198 | rc2-cbc 128 bit RC2 in CBC mode | ||
199 | rc2 Alias for rc2-cbc | ||
200 | rc2-cfb 128 bit RC2 in CBC mode | ||
201 | rc2-ecb 128 bit RC2 in CBC mode | ||
202 | rc2-ofb 128 bit RC2 in CBC mode | ||
203 | rc2-64-cbc 64 bit RC2 in CBC mode | ||
204 | rc2-40-cbc 40 bit RC2 in CBC mode | ||
205 | |||
206 | rc4 128 bit RC4 | ||
207 | rc4-64 64 bit RC4 | ||
208 | rc4-40 40 bit RC4 | ||
209 | |||
210 | rc5-cbc RC5 cipher in CBC mode | ||
211 | rc5 Alias for rc5-cbc | ||
212 | rc5-cfb RC5 cipher in CBC mode | ||
213 | rc5-ecb RC5 cipher in CBC mode | ||
214 | rc5-ofb RC5 cipher in CBC mode | ||
215 | |||
216 | =head1 EXAMPLES | ||
217 | |||
218 | Just base64 encode a binary file: | ||
219 | |||
220 | openssl base64 -in file.bin -out file.b64 | ||
221 | |||
222 | Decode the same file | ||
223 | |||
224 | openssl base64 -d -in file.b64 -out file.bin | ||
225 | |||
226 | Encrypt a file using triple DES in CBC mode using a prompted password: | ||
227 | |||
228 | openssl des3 -salt -in file.txt -out file.des3 | ||
229 | |||
230 | Decrypt a file using a supplied password: | ||
231 | |||
232 | openssl des3 -d -salt -in file.des3 -out file.txt -k mypassword | ||
233 | |||
234 | Encrypt a file then base64 encode it (so it can be sent via mail for example) | ||
235 | using Blowfish in CBC mode: | ||
236 | |||
237 | openssl bf -a -salt -in file.txt -out file.bf | ||
238 | |||
239 | Base64 decode a file then decrypt it: | ||
240 | |||
241 | openssl bf -d -salt -a -in file.bf -out file.txt | ||
242 | |||
243 | Decrypt some data using a supplied 40 bit RC4 key: | ||
244 | |||
245 | openssl rc4-40 -in file.rc4 -out file.txt -K 0102030405 | ||
246 | |||
247 | =head1 BUGS | ||
248 | |||
249 | The B<-A> option when used with large files doesn't work properly. | ||
250 | |||
251 | There should be an option to allow an iteration count to be included. | ||
252 | |||
253 | Like the EVP library the B<enc> program only supports a fixed number of | ||
254 | algorithms with certain parameters. So if, for example, you want to use RC2 | ||
255 | with a 76 bit key or RC4 with an 84 bit key you can't use this program. | ||
256 | |||
257 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/gendsa.pod b/src/lib/libssl/src/doc/apps/gendsa.pod new file mode 100644 index 0000000000..3314ace517 --- /dev/null +++ b/src/lib/libssl/src/doc/apps/gendsa.pod | |||
@@ -0,0 +1,58 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | gendsa - generate a DSA private key from a set of parameters | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<openssl> B<gendsa> | ||
10 | [B<-out filename>] | ||
11 | [B<-des>] | ||
12 | [B<-des3>] | ||
13 | [B<-idea>] | ||
14 | [B<-rand file(s)>] | ||
15 | [B<paramfile>] | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | The B<gendsa> command generates a DSA private key from a DSA parameter file | ||
20 | (which will be typically generated by the B<openssl dsaparam> command). | ||
21 | |||
22 | =head1 OPTIONS | ||
23 | |||
24 | =over 4 | ||
25 | |||
26 | =item B<-des|-des3|-idea> | ||
27 | |||
28 | These options encrypt the private key with the DES, triple DES, or the | ||
29 | IDEA ciphers respectively before outputting it. A pass phrase is prompted for. | ||
30 | If none of these options is specified no encryption is used. | ||
31 | |||
32 | =item B<-rand file(s)> | ||
33 | |||
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)>). | ||
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 | ||
38 | all others. | ||
39 | |||
40 | =item B<paramfile> | ||
41 | |||
42 | This option specifies the DSA parameter file to use. The parameters in this | ||
43 | file determine the size of the private key. DSA parameters can be generated | ||
44 | and examined using the B<openssl dsaparam> command. | ||
45 | |||
46 | =back | ||
47 | |||
48 | =head1 NOTES | ||
49 | |||
50 | DSA key generation is little more than random number generation so it is | ||
51 | much quicker that RSA key generation for example. | ||
52 | |||
53 | =head1 SEE ALSO | ||
54 | |||
55 | L<dsaparam(1)|dsaparam(1)>, L<dsa(1)|dsa(1)>, L<genrsa(1)|genrsa(1)>, | ||
56 | L<rsa(1)|rsa(1)> | ||
57 | |||
58 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/genrsa.pod b/src/lib/libssl/src/doc/apps/genrsa.pod new file mode 100644 index 0000000000..a2d878410b --- /dev/null +++ b/src/lib/libssl/src/doc/apps/genrsa.pod | |||
@@ -0,0 +1,85 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | genrsa - generate an RSA private key | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<openssl> B<genrsa> | ||
10 | [B<-out filename>] | ||
11 | [B<-passout arg>] | ||
12 | [B<-des>] | ||
13 | [B<-des3>] | ||
14 | [B<-idea>] | ||
15 | [B<-f4>] | ||
16 | [B<-3>] | ||
17 | [B<-rand file(s)>] | ||
18 | [B<numbits>] | ||
19 | |||
20 | =head1 DESCRIPTION | ||
21 | |||
22 | The B<genrsa> command generates an RSA private key. | ||
23 | |||
24 | =head1 OPTIONS | ||
25 | |||
26 | =over 4 | ||
27 | |||
28 | =item B<-out filename> | ||
29 | |||
30 | the output filename. If this argument is not specified then standard output is | ||
31 | used. | ||
32 | |||
33 | =item B<-passout arg> | ||
34 | |||
35 | the output file password source. For more information about the format of B<arg> | ||
36 | see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. | ||
37 | |||
38 | =item B<-des|-des3|-idea> | ||
39 | |||
40 | These options encrypt the private key with the DES, triple DES, or the | ||
41 | IDEA ciphers respectively before outputting it. If none of these options is | ||
42 | specified no encryption is used. If encryption is used a pass phrase is prompted | ||
43 | for if it is not supplied via the B<-passout> argument. | ||
44 | |||
45 | =item B<-F4|-3> | ||
46 | |||
47 | the public exponent to use, either 65537 or 3. The default is 65537. | ||
48 | |||
49 | =item B<-rand file(s)> | ||
50 | |||
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)>). | ||
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 | ||
55 | all others. | ||
56 | |||
57 | =item B<numbits> | ||
58 | |||
59 | the size of the private key to generate in bits. This must be the last option | ||
60 | specified. The default is 512. | ||
61 | |||
62 | =back | ||
63 | |||
64 | =head1 NOTES | ||
65 | |||
66 | RSA private key generation essentially involves the generation of two prime | ||
67 | numbers. When generating a private key various symbols will be output to | ||
68 | indicate the progress of the generation. A B<.> represents each number which | ||
69 | has passed an initial sieve test, B<+> means a number has passed a single | ||
70 | round of the Miller-Rabin primality test. A newline means that the number has | ||
71 | passed all the prime tests (the actual number depends on the key size). | ||
72 | |||
73 | Because key generation is a random process the time taken to generate a key | ||
74 | may vary somewhat. | ||
75 | |||
76 | =head1 BUGS | ||
77 | |||
78 | A quirk of the prime generation algorithm is that it cannot generate small | ||
79 | primes. Therefore the number of bits should not be less that 64. For typical | ||
80 | private keys this will not matter because for security reasons they will | ||
81 | be much larger (typically 1024 bits). | ||
82 | |||
83 | =head1 SEE ALSO | ||
84 | |||
85 | L<gendsa(1)|gendsa(1)> | ||
diff --git a/src/lib/libssl/src/doc/apps/nseq.pod b/src/lib/libssl/src/doc/apps/nseq.pod new file mode 100644 index 0000000000..989c3108fb --- /dev/null +++ b/src/lib/libssl/src/doc/apps/nseq.pod | |||
@@ -0,0 +1,70 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | nseq - create or examine a netscape certificate sequence | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<openssl> B<nseq> | ||
10 | [B<-in filename>] | ||
11 | [B<-out filename>] | ||
12 | [B<-toseq>] | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | The B<nseq> command takes a file containing a Netscape certificate | ||
17 | sequence and prints out the certificates contained in it or takes a | ||
18 | file of certificates and converts it into a Netscape certificate | ||
19 | sequence. | ||
20 | |||
21 | =head1 COMMAND OPTIONS | ||
22 | |||
23 | =over 4 | ||
24 | |||
25 | =item B<-in filename> | ||
26 | |||
27 | This specifies the input filename to read or standard input if this | ||
28 | option is not specified. | ||
29 | |||
30 | =item B<-out filename> | ||
31 | |||
32 | specifies the output filename or standard output by default. | ||
33 | |||
34 | =item B<-toseq> | ||
35 | |||
36 | normally a Netscape certificate sequence will be input and the output | ||
37 | is the certificates contained in it. With the B<-toseq> option the | ||
38 | situation is reversed: a Netscape certificate sequence is created from | ||
39 | a file of certificates. | ||
40 | |||
41 | =back | ||
42 | |||
43 | =head1 EXAMPLES | ||
44 | |||
45 | Output the certificates in a Netscape certificate sequence | ||
46 | |||
47 | openssl nseq -in nseq.pem -out certs.pem | ||
48 | |||
49 | Create a Netscape certificate sequence | ||
50 | |||
51 | openssl nseq -in certs.pem -toseq -out nseq.pem | ||
52 | |||
53 | =head1 NOTES | ||
54 | |||
55 | The B<PEM> encoded form uses the same headers and footers as a certificate: | ||
56 | |||
57 | -----BEGIN CERTIFICATE----- | ||
58 | -----END CERTIFICATE----- | ||
59 | |||
60 | A Netscape certificate sequence is a Netscape specific form that can be sent | ||
61 | to browsers as an alternative to the standard PKCS#7 format when several | ||
62 | certificates are sent to the browser: for example during certificate enrollment. | ||
63 | It is used by Netscape certificate server for example. | ||
64 | |||
65 | =head1 BUGS | ||
66 | |||
67 | This program needs a few more options: like allowing DER or PEM input and | ||
68 | output files and allowing multiple certificate files to be used. | ||
69 | |||
70 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/openssl.pod b/src/lib/libssl/src/doc/apps/openssl.pod new file mode 100644 index 0000000000..9b1320606b --- /dev/null +++ b/src/lib/libssl/src/doc/apps/openssl.pod | |||
@@ -0,0 +1,298 @@ | |||
1 | |||
2 | =pod | ||
3 | |||
4 | =head1 NAME | ||
5 | |||
6 | openssl - OpenSSL command line tool | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | B<openssl> | ||
11 | I<command> | ||
12 | [ I<command_opts> ] | ||
13 | [ I<command_args> ] | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL | ||
18 | v2/v3) and Transport Layer Security (TLS v1) network protocols and related | ||
19 | cryptography standards required by them. | ||
20 | |||
21 | The B<openssl> program is a command line tool for using the various | ||
22 | cryptography functions of OpenSSL's B<crypto> library from the shell. | ||
23 | It can be used for | ||
24 | |||
25 | o Creation of RSA, DH and DSA key parameters | ||
26 | o Creation of X.509 certificates, CSRs and CRLs | ||
27 | o Calculation of Message Digests | ||
28 | o Encryption and Decryption with Ciphers | ||
29 | o SSL/TLS Client and Server Tests | ||
30 | o Handling of S/MIME signed or encrypted mail | ||
31 | |||
32 | =head1 COMMAND SUMMARY | ||
33 | |||
34 | The B<openssl> program provides a rich variety of commands (I<command> in the | ||
35 | SYNOPSIS above), each of which often has a wealth of options and arguments | ||
36 | (I<command_opts> and I<command_args> in the SYNOPSIS). | ||
37 | |||
38 | =head2 STANDARD COMMANDS | ||
39 | |||
40 | =over 10 | ||
41 | |||
42 | =item L<B<asn1parse>|asn1parse(1)> | ||
43 | |||
44 | Parse an ASN.1 sequence. | ||
45 | |||
46 | =item L<B<ca>|ca(1)> | ||
47 | |||
48 | Certificate Authority (CA) Management. | ||
49 | |||
50 | =item L<B<ciphers>|ciphers(1)> | ||
51 | |||
52 | Cipher Suite Description Determination. | ||
53 | |||
54 | =item L<B<crl>|crl(1)> | ||
55 | |||
56 | Certificate Revocation List (CRL) Management. | ||
57 | |||
58 | =item L<B<crl2pkcs7>|crl2pkcs7(1)> | ||
59 | |||
60 | CRL to PKCS#7 Conversion. | ||
61 | |||
62 | =item L<B<dgst>|dgst(1)> | ||
63 | |||
64 | Message Digest Calculation. | ||
65 | |||
66 | =item L<B<dh>|dh(1)> | ||
67 | |||
68 | Diffie-Hellman Data Management. | ||
69 | |||
70 | =item L<B<dsa>|dsa(1)> | ||
71 | |||
72 | DSA Data Management. | ||
73 | |||
74 | =item L<B<dsaparam>|dsaparam(1)> | ||
75 | |||
76 | DSA Parameter Generation. | ||
77 | |||
78 | =item L<B<enc>|enc(1)> | ||
79 | |||
80 | Encoding with Ciphers. | ||
81 | |||
82 | =item L<B<errstr>|errstr(1)> | ||
83 | |||
84 | Error Number to Error String Conversion. | ||
85 | |||
86 | =item L<B<gendh>|gendh(1)> | ||
87 | |||
88 | Generation of Diffie-Hellman Parameters. | ||
89 | |||
90 | =item L<B<gendsa>|gendsa(1)> | ||
91 | |||
92 | Generation of DSA Parameters. | ||
93 | |||
94 | =item L<B<genrsa>|genrsa(1)> | ||
95 | |||
96 | Generation of RSA Parameters. | ||
97 | |||
98 | =item L<B<passwd>|passwd(1)> | ||
99 | |||
100 | Generation of hashed passwords. | ||
101 | |||
102 | =item L<B<pkcs7>|pkcs7(1)> | ||
103 | |||
104 | PKCS#7 Data Management. | ||
105 | |||
106 | =item L<B<req>|req(1)> | ||
107 | |||
108 | X.509 Certificate Signing Request (CSR) Management. | ||
109 | |||
110 | =item L<B<rsa>|rsa(1)> | ||
111 | |||
112 | RSA Data Management. | ||
113 | |||
114 | =item L<B<s_client>|s_client(1)> | ||
115 | |||
116 | This implements a generic SSL/TLS client which can establish a transparent | ||
117 | connection to a remote server speaking SSL/TLS. It's intended for testing | ||
118 | purposes only and provides only rudimentary interface functionality but | ||
119 | internally uses mostly all functionality of the OpenSSL B<ssl> library. | ||
120 | |||
121 | =item L<B<s_server>|s_server(1)> | ||
122 | |||
123 | This implements a generic SSL/TLS server which accepts connections from remote | ||
124 | clients speaking SSL/TLS. It's intended for testing purposes only and provides | ||
125 | only rudimentary interface functionality but internally uses mostly all | ||
126 | functionality of the OpenSSL B<ssl> library. It provides both an own command | ||
127 | line oriented protocol for testing SSL functions and a simple HTTP response | ||
128 | facility to emulate an SSL/TLS-aware webserver. | ||
129 | |||
130 | =item L<B<s_time>|s_time(1)> | ||
131 | |||
132 | SSL Connection Timer. | ||
133 | |||
134 | =item L<B<sess_id>|sess_id(1)> | ||
135 | |||
136 | SSL Session Data Management. | ||
137 | |||
138 | =item L<B<smime>|smime(1)> | ||
139 | |||
140 | S/MIME mail processing. | ||
141 | |||
142 | =item L<B<speed>|speed(1)> | ||
143 | |||
144 | Algorithm Speed Measurement. | ||
145 | |||
146 | =item L<B<verify>|verify(1)> | ||
147 | |||
148 | X.509 Certificate Verification. | ||
149 | |||
150 | =item L<B<version>|version(1)> | ||
151 | |||
152 | OpenSSL Version Information. | ||
153 | |||
154 | =item L<B<x509>|x509(1)> | ||
155 | |||
156 | X.509 Certificate Data Management. | ||
157 | |||
158 | =back | ||
159 | |||
160 | =head2 MESSAGE DIGEST COMMANDS | ||
161 | |||
162 | =over 10 | ||
163 | |||
164 | =item B<md2> | ||
165 | |||
166 | MD2 Digest | ||
167 | |||
168 | =item B<md5> | ||
169 | |||
170 | MD5 Digest | ||
171 | |||
172 | =item B<mdc2> | ||
173 | |||
174 | MDC2 Digest | ||
175 | |||
176 | =item B<rmd160> | ||
177 | |||
178 | RMD-160 Digest | ||
179 | |||
180 | =item B<sha> | ||
181 | |||
182 | SHA Digest | ||
183 | |||
184 | =item B<sha1> | ||
185 | |||
186 | SHA-1 Digest | ||
187 | |||
188 | =back | ||
189 | |||
190 | =head2 ENCODING AND CIPHER COMMANDS | ||
191 | |||
192 | =over 10 | ||
193 | |||
194 | =item B<base64> | ||
195 | |||
196 | Base64 Encoding | ||
197 | |||
198 | =item B<bf bf-cbc bf-cfb bf-ecb bf-ofb> | ||
199 | |||
200 | Blowfish Cipher | ||
201 | |||
202 | =item B<cast cast-cbc> | ||
203 | |||
204 | CAST Cipher | ||
205 | |||
206 | =item B<cast5-cbc cast5-cfb cast5-ecb cast5-ofb> | ||
207 | |||
208 | CAST5 Cipher | ||
209 | |||
210 | =item B<des des-cbc des-cfb des-ecb des-ede des-ede-cbc des-ede-cfb des-ede-ofb des-ofb> | ||
211 | |||
212 | DES Cipher | ||
213 | |||
214 | =item B<des3 desx des-ede3 des-ede3-cbc des-ede3-cfb des-ede3-ofb> | ||
215 | |||
216 | Triple-DES Cipher | ||
217 | |||
218 | =item B<idea idea-cbc idea-cfb idea-ecb idea-ofb> | ||
219 | |||
220 | IDEA Cipher | ||
221 | |||
222 | =item B<rc2 rc2-cbc rc2-cfb rc2-ecb rc2-ofb> | ||
223 | |||
224 | RC2 Cipher | ||
225 | |||
226 | =item B<rc4> | ||
227 | |||
228 | RC4 Cipher | ||
229 | |||
230 | =item B<rc5 rc5-cbc rc5-cfb rc5-ecb rc5-ofb> | ||
231 | |||
232 | RC5 Cipher | ||
233 | |||
234 | =back | ||
235 | |||
236 | =head1 PASS PHRASE ARGUMENTS | ||
237 | |||
238 | Several commands accept password arguments, typically using B<-passin> | ||
239 | and B<-passout> for input and output passwords respectively. These allow | ||
240 | the password to be obtained from a variety of sources. Both of these | ||
241 | options take a single argument whose format is described below. If no | ||
242 | password argument is given and a password is required then the user is | ||
243 | prompted to enter one: this will typically be read from the current | ||
244 | terminal with echoing turned off. | ||
245 | |||
246 | =over 10 | ||
247 | |||
248 | =item B<pass:password> | ||
249 | |||
250 | the actual password is B<password>. Since the password is visible | ||
251 | to utilities (like 'ps' under Unix) this form should only be used | ||
252 | where security is not important. | ||
253 | |||
254 | =item B<env:var> | ||
255 | |||
256 | obtain the password from the environment variable B<var>. Since | ||
257 | the environment of other processes is visible on certain platforms | ||
258 | (e.g. ps under certain Unix OSes) this option should be used with caution. | ||
259 | |||
260 | =item B<file:pathname> | ||
261 | |||
262 | the first line of B<pathname> is the password. If the same B<pathname> | ||
263 | argument is supplied to B<-passin> and B<-passout> arguments then the first | ||
264 | line will be used for the input password and the next line for the output | ||
265 | password. B<pathname> need not refer to a regular file: it could for example | ||
266 | refer to a device or named pipe. | ||
267 | |||
268 | =item B<fd:number> | ||
269 | |||
270 | read the password from the file descriptor B<number>. This can be used to | ||
271 | send the data via a pipe for example. | ||
272 | |||
273 | =item B<stdin> | ||
274 | |||
275 | read the password from standard input. | ||
276 | |||
277 | =back | ||
278 | |||
279 | =head1 SEE ALSO | ||
280 | |||
281 | L<asn1parse(1)|asn1parse(1)>, L<ca(1)|ca(1)>, L<config(5)|config(5)>, | ||
282 | L<crl(1)|crl(1)>, L<crl2pkcs7(1)|crl2pkcs7(1)>, L<dgst(1)|dgst(1)>, | ||
283 | L<dhparam(1)|dhparam(1)>, L<dsa(1)|dsa(1)>, L<dsaparam(1)|dsaparam(1)>, | ||
284 | L<enc(1)|enc(1)>, L<gendsa(1)|gendsa(1)>, | ||
285 | L<genrsa(1)|genrsa(1)>, L<nseq(1)|nseq(1)>, L<openssl(1)|openssl(1)>, | ||
286 | L<passwd(1)|passwd(1)>, | ||
287 | L<pkcs12(1)|pkcs12(1)>, L<pkcs7(1)|pkcs7(1)>, L<pkcs8(1)|pkcs8(1)>, | ||
288 | L<req(1)|req(1)>, L<rsa(1)|rsa(1)>, L<s_client(1)|s_client(1)>, | ||
289 | L<s_server(1)|s_server(1)>, L<smime(1)|smime(1)>, L<spkac(1)|spkac(1)>, | ||
290 | L<verify(1)|verify(1)>, L<version(1)|version(1)>, L<x509(1)|x509(1)>, | ||
291 | L<crypto(3)|crypto(3)>, L<ssl(3)|ssl(3)> | ||
292 | |||
293 | =head1 HISTORY | ||
294 | |||
295 | The openssl(1) document appeared in OpenSSL 0.9.2 | ||
296 | |||
297 | =cut | ||
298 | |||
diff --git a/src/lib/libssl/src/doc/apps/passwd.pod b/src/lib/libssl/src/doc/apps/passwd.pod new file mode 100644 index 0000000000..cee6a2f172 --- /dev/null +++ b/src/lib/libssl/src/doc/apps/passwd.pod | |||
@@ -0,0 +1,69 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | passwd - compute password hashes | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<openssl passwd> | ||
10 | [B<-crypt>] | ||
11 | [B<-apr1>] | ||
12 | [B<-salt> I<string>] | ||
13 | [B<-in> I<file>] | ||
14 | [B<-stdin>] | ||
15 | [B<-quiet>] | ||
16 | [B<-table>] | ||
17 | {I<password>} | ||
18 | |||
19 | =head1 DESCRIPTION | ||
20 | |||
21 | 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 | taken from the named file for option B<-in file>, from stdin for | ||
24 | option B<-stdin>, and from the command line otherwise. | ||
25 | The Unix standard algorithm B<crypt> and the MD5-based B<apr1> algorithm | ||
26 | are available. | ||
27 | |||
28 | =head1 OPTIONS | ||
29 | |||
30 | =over 4 | ||
31 | |||
32 | =item B<-crypt> | ||
33 | |||
34 | Use the B<crypt> algorithm (default). | ||
35 | |||
36 | =item B<-apr1> | ||
37 | |||
38 | Use the B<apr1> algorithm. | ||
39 | |||
40 | =item B<-salt> I<string> | ||
41 | |||
42 | Use the specified salt. | ||
43 | |||
44 | =item B<-in> I<file> | ||
45 | |||
46 | Read passwords from I<file>. | ||
47 | |||
48 | =item B<-stdin> | ||
49 | |||
50 | Read passwords from B<stdin>. | ||
51 | |||
52 | =item B<-quiet> | ||
53 | |||
54 | Don't output warnings when passwords given at the command line are truncated. | ||
55 | |||
56 | =item B<-table> | ||
57 | |||
58 | In the output list, prepend the cleartext password and a TAB character | ||
59 | to each password hash. | ||
60 | |||
61 | =back | ||
62 | |||
63 | =head1 EXAMPLES | ||
64 | |||
65 | B<openssl passwd -crypt -salt xx password> prints B<xxj31ZMTZzkVA>. | ||
66 | |||
67 | B<openssl passwd -apr1 -salt xxxxxxxx password> prints B<$apr1$xxxxxxxx$dxHfLAsjHkDRmG83UXe8K0>. | ||
68 | |||
69 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/pkcs12.pod b/src/lib/libssl/src/doc/apps/pkcs12.pod new file mode 100644 index 0000000000..241f9c4a8b --- /dev/null +++ b/src/lib/libssl/src/doc/apps/pkcs12.pod | |||
@@ -0,0 +1,310 @@ | |||
1 | |||
2 | =pod | ||
3 | |||
4 | =head1 NAME | ||
5 | |||
6 | pkcs12 - PKCS#12 file utility | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | B<openssl> B<pkcs12> | ||
11 | [B<-export>] | ||
12 | [B<-chain>] | ||
13 | [B<-inkey filename>] | ||
14 | [B<-certfile filename>] | ||
15 | [B<-name name>] | ||
16 | [B<-caname name>] | ||
17 | [B<-in filename>] | ||
18 | [B<-out filename>] | ||
19 | [B<-noout>] | ||
20 | [B<-nomacver>] | ||
21 | [B<-nocerts>] | ||
22 | [B<-clcerts>] | ||
23 | [B<-cacerts>] | ||
24 | [B<-nokeys>] | ||
25 | [B<-info>] | ||
26 | [B<-des>] | ||
27 | [B<-des3>] | ||
28 | [B<-idea>] | ||
29 | [B<-nodes>] | ||
30 | [B<-noiter>] | ||
31 | [B<-maciter>] | ||
32 | [B<-twopass>] | ||
33 | [B<-descert>] | ||
34 | [B<-certpbe>] | ||
35 | [B<-keypbe>] | ||
36 | [B<-keyex>] | ||
37 | [B<-keysig>] | ||
38 | [B<-password arg>] | ||
39 | [B<-passin arg>] | ||
40 | [B<-passout arg>] | ||
41 | [B<-rand file(s)>] | ||
42 | |||
43 | =head1 DESCRIPTION | ||
44 | |||
45 | The B<pkcs12> command allows PKCS#12 files (sometimes referred to as | ||
46 | PFX files) to be created and parsed. PKCS#12 files are used by several | ||
47 | programs including Netscape, MSIE and MS Outlook. | ||
48 | |||
49 | =head1 COMMAND OPTIONS | ||
50 | |||
51 | There are a lot of options the meaning of some depends of whether a PKCS#12 file | ||
52 | is being created or parsed. By default a PKCS#12 file is parsed a PKCS#12 | ||
53 | file can be created by using the B<-export> option (see below). | ||
54 | |||
55 | =head1 PARSING OPTIONS | ||
56 | |||
57 | =over 4 | ||
58 | |||
59 | =item B<-in filename> | ||
60 | |||
61 | This specifies filename of the PKCS#12 file to be parsed. Standard input is used | ||
62 | by default. | ||
63 | |||
64 | =item B<-out filename> | ||
65 | |||
66 | The filename to write certificates and private keys to, standard output by default. | ||
67 | They are all written in PEM format. | ||
68 | |||
69 | =item B<-pass arg>, B<-passin arg> | ||
70 | |||
71 | the PKCS#12 file (i.e. input file) password source. For more information about the | ||
72 | format of B<arg> see the B<PASS PHRASE ARGUMENTS> section in | ||
73 | L<openssl(1)|openssl(1)>. | ||
74 | |||
75 | =item B<-passout arg> | ||
76 | |||
77 | pass phrase source to encrypt any outputed private keys with. For more information | ||
78 | about the format of B<arg> see the B<PASS PHRASE ARGUMENTS> section in | ||
79 | L<openssl(1)|openssl(1)>. | ||
80 | |||
81 | =item B<-noout> | ||
82 | |||
83 | this option inhibits output of the keys and certificates to the output file version | ||
84 | of the PKCS#12 file. | ||
85 | |||
86 | =item B<-clcerts> | ||
87 | |||
88 | only output client certificates (not CA certificates). | ||
89 | |||
90 | =item B<-cacerts> | ||
91 | |||
92 | only output CA certificates (not client certificates). | ||
93 | |||
94 | =item B<-nocerts> | ||
95 | |||
96 | no certificates at all will be output. | ||
97 | |||
98 | =item B<-nokeys> | ||
99 | |||
100 | no private keys will be output. | ||
101 | |||
102 | =item B<-info> | ||
103 | |||
104 | output additional information about the PKCS#12 file structure, algorithms used and | ||
105 | iteration counts. | ||
106 | |||
107 | =item B<-des> | ||
108 | |||
109 | use DES to encrypt private keys before outputting. | ||
110 | |||
111 | =item B<-des3> | ||
112 | |||
113 | use triple DES to encrypt private keys before outputting, this is the default. | ||
114 | |||
115 | =item B<-idea> | ||
116 | |||
117 | use IDEA to encrypt private keys before outputting. | ||
118 | |||
119 | =item B<-nodes> | ||
120 | |||
121 | don't encrypt the private keys at all. | ||
122 | |||
123 | =item B<-nomacver> | ||
124 | |||
125 | don't attempt to verify the integrity MAC before reading the file. | ||
126 | |||
127 | =item B<-twopass> | ||
128 | |||
129 | prompt for separate integrity and encryption passwords: most software | ||
130 | always assumes these are the same so this option will render such | ||
131 | PKCS#12 files unreadable. | ||
132 | |||
133 | =back | ||
134 | |||
135 | =head1 FILE CREATION OPTIONS | ||
136 | |||
137 | =over 4 | ||
138 | |||
139 | =item B<-export> | ||
140 | |||
141 | This option specifies that a PKCS#12 file will be created rather than | ||
142 | parsed. | ||
143 | |||
144 | =item B<-out filename> | ||
145 | |||
146 | This specifies filename to write the PKCS#12 file to. Standard output is used | ||
147 | by default. | ||
148 | |||
149 | =item B<-in filename> | ||
150 | |||
151 | The filename to read certificates and private keys from, standard input by default. | ||
152 | They must all be in PEM format. The order doesn't matter but one private key and | ||
153 | its corresponding certificate should be present. If additional certificates are | ||
154 | present they will also be included in the PKCS#12 file. | ||
155 | |||
156 | =item B<-inkey filename> | ||
157 | |||
158 | file to read private key from. If not present then a private key must be present | ||
159 | in the input file. | ||
160 | |||
161 | =item B<-name friendlyname> | ||
162 | |||
163 | This specifies the "friendly name" for the certificate and private key. This name | ||
164 | is typically displayed in list boxes by software importing the file. | ||
165 | |||
166 | =item B<-certfile filename> | ||
167 | |||
168 | A filename to read additional certificates from. | ||
169 | |||
170 | =item B<-caname friendlyname> | ||
171 | |||
172 | This specifies the "friendly name" for other certificates. This option may be | ||
173 | used multiple times to specify names for all certificates in the order they | ||
174 | appear. Netscape ignores friendly names on other certificates whereas MSIE | ||
175 | displays them. | ||
176 | |||
177 | =item B<-pass arg>, B<-passout arg> | ||
178 | |||
179 | the PKCS#12 file (i.e. output file) password source. For more information about | ||
180 | the format of B<arg> see the B<PASS PHRASE ARGUMENTS> section in | ||
181 | L<openssl(1)|openssl(1)>. | ||
182 | |||
183 | =item B<-passin password> | ||
184 | |||
185 | pass phrase source to decrypt any input private keys with. For more information | ||
186 | about the format of B<arg> see the B<PASS PHRASE ARGUMENTS> section in | ||
187 | L<openssl(1)|openssl(1)>. | ||
188 | |||
189 | =item B<-chain> | ||
190 | |||
191 | if this option is present then an attempt is made to include the entire | ||
192 | certificate chain of the user certificate. The standard CA store is used | ||
193 | for this search. If the search fails it is considered a fatal error. | ||
194 | |||
195 | =item B<-descert> | ||
196 | |||
197 | encrypt the certificate using triple DES, this may render the PKCS#12 | ||
198 | file unreadable by some "export grade" software. By default the private | ||
199 | key is encrypted using triple DES and the certificate using 40 bit RC2. | ||
200 | |||
201 | =item B<-keypbe alg>, B<-certpbe alg> | ||
202 | |||
203 | these options allow the algorithm used to encrypt the private key and | ||
204 | certificates to be selected. Although any PKCS#5 v1.5 or PKCS#12 algorithms | ||
205 | can be selected it is advisable only to use PKCS#12 algorithms. See the list | ||
206 | in the B<NOTES> section for more information. | ||
207 | |||
208 | =item B<-keyex|-keysig> | ||
209 | |||
210 | specifies that the private key is to be used for key exchange or just signing. | ||
211 | This option is only interpreted by MSIE and similar MS software. Normally | ||
212 | "export grade" software will only allow 512 bit RSA keys to be used for | ||
213 | encryption purposes but arbitrary length keys for signing. The B<-keysig> | ||
214 | option marks the key for signing only. Signing only keys can be used for | ||
215 | S/MIME signing, authenticode (ActiveX control signing) and SSL client | ||
216 | authentication, however due to a bug only MSIE 5.0 and later support | ||
217 | the use of signing only keys for SSL client authentication. | ||
218 | |||
219 | =item B<-nomaciter>, B<-noiter> | ||
220 | |||
221 | these options affect the iteration counts on the MAC and key algorithms. | ||
222 | Unless you wish to produce files compatible with MSIE 4.0 you should leave | ||
223 | these options alone. | ||
224 | |||
225 | To discourage attacks by using large dictionaries of common passwords the | ||
226 | algorithm that derives keys from passwords can have an iteration count applied | ||
227 | to it: this causes a certain part of the algorithm to be repeated and slows it | ||
228 | down. The MAC is used to check the file integrity but since it will normally | ||
229 | have the same password as the keys and certificates it could also be attacked. | ||
230 | By default both MAC and encryption iteration counts are set to 2048, using | ||
231 | these options the MAC and encryption iteration counts can be set to 1, since | ||
232 | this reduces the file security you should not use these options unless you | ||
233 | really have to. Most software supports both MAC and key iteration counts. | ||
234 | MSIE 4.0 doesn't support MAC iteration counts so it needs the B<-nomaciter> | ||
235 | option. | ||
236 | |||
237 | =item B<-maciter> | ||
238 | |||
239 | This option is included for compatibility with previous versions, it used | ||
240 | to be needed to use MAC iterations counts but they are now used by default. | ||
241 | |||
242 | =item B<-rand file(s)> | ||
243 | |||
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)>). | ||
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 | ||
248 | all others. | ||
249 | |||
250 | =back | ||
251 | |||
252 | =head1 NOTES | ||
253 | |||
254 | Although there are a large number of options most of them are very rarely | ||
255 | used. For PKCS#12 file parsing only B<-in> and B<-out> need to be used | ||
256 | for PKCS#12 file creation B<-export> and B<-name> are also used. | ||
257 | |||
258 | If none of the B<-clcerts>, B<-cacerts> or B<-nocerts> options are present | ||
259 | then all certificates will be output in the order they appear in the input | ||
260 | PKCS#12 files. There is no guarantee that the first certificate present is | ||
261 | the one corresponding to the private key. Certain software which requires | ||
262 | a private key and certificate and assumes the first certificate in the | ||
263 | file is the one corresponding to the private key: this may not always | ||
264 | be the case. Using the B<-clcerts> option will solve this problem by only | ||
265 | outputing the certificate corresponding to the private key. If the CA | ||
266 | certificates are required then they can be output to a separate file using | ||
267 | the B<-nokeys -cacerts> options to just output CA certificates. | ||
268 | |||
269 | The B<-keypbe> and B<-certpbe> algorithms allow the precise encryption | ||
270 | algorithms for private keys and certificates to be specified. Normally | ||
271 | the defaults are fine but occasionally software can't handle triple DES | ||
272 | encrypted private keys, then the option B<-keypbe PBE-SHA1-RC2-40> can | ||
273 | be used to reduce the private key encryption to 40 bit RC2. A complete | ||
274 | description of all algorithms is contained in the B<pkcs8> manual page. | ||
275 | |||
276 | =head1 EXAMPLES | ||
277 | |||
278 | Parse a PKCS#12 file and output it to a file: | ||
279 | |||
280 | openssl pkcs12 -in file.p12 -out file.pem | ||
281 | |||
282 | Output only client certificates to a file: | ||
283 | |||
284 | openssl pkcs12 -in file.p12 -clcerts -out file.pem | ||
285 | |||
286 | Don't encrypt the private key: | ||
287 | |||
288 | openssl pkcs12 -in file.p12 -out file.pem -nodes | ||
289 | |||
290 | Print some info about a PKCS#12 file: | ||
291 | |||
292 | openssl pkcs12 -in file.p12 -info -noout | ||
293 | |||
294 | Create a PKCS#12 file: | ||
295 | |||
296 | openssl pkcs12 -export -in file.pem -out file.p12 -name "My Certificate" | ||
297 | |||
298 | Include some extra certificates: | ||
299 | |||
300 | openssl pkcs12 -export -in file.pem -out file.p12 -name "My Certificate" \ | ||
301 | -certfile othercerts.pem | ||
302 | |||
303 | =head1 BUGS | ||
304 | |||
305 | Some would argue that the PKCS#12 standard is one big bug :-) | ||
306 | |||
307 | =head1 SEE ALSO | ||
308 | |||
309 | L<pkcs8(1)|pkcs8(1)> | ||
310 | |||
diff --git a/src/lib/libssl/src/doc/apps/pkcs7.pod b/src/lib/libssl/src/doc/apps/pkcs7.pod new file mode 100644 index 0000000000..4e9bd6e46b --- /dev/null +++ b/src/lib/libssl/src/doc/apps/pkcs7.pod | |||
@@ -0,0 +1,97 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | pkcs7 - PKCS#7 utility | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<openssl> B<pkcs7> | ||
10 | [B<-inform PEM|DER>] | ||
11 | [B<-outform PEM|DER>] | ||
12 | [B<-in filename>] | ||
13 | [B<-out filename>] | ||
14 | [B<-print_certs>] | ||
15 | [B<-text>] | ||
16 | [B<-noout>] | ||
17 | |||
18 | =head1 DESCRIPTION | ||
19 | |||
20 | The B<pkcs7> command processes PKCS#7 files in DER or PEM format. | ||
21 | |||
22 | =head1 COMMAND OPTIONS | ||
23 | |||
24 | =over 4 | ||
25 | |||
26 | =item B<-inform DER|PEM> | ||
27 | |||
28 | This specifies the input format. B<DER> format is DER encoded PKCS#7 | ||
29 | v1.5 structure.B<PEM> (the default) is a base64 encoded version of | ||
30 | the DER form with header and footer lines. | ||
31 | |||
32 | =item B<-outform DER|PEM> | ||
33 | |||
34 | This specifies the output format, the options have the same meaning as the | ||
35 | B<-inform> option. | ||
36 | |||
37 | =item B<-in filename> | ||
38 | |||
39 | This specifies the input filename to read from or standard input if this | ||
40 | option is not specified. | ||
41 | |||
42 | =item B<-out filename> | ||
43 | |||
44 | specifies the output filename to write to or standard output by | ||
45 | default. | ||
46 | |||
47 | =item B<-print_certs> | ||
48 | |||
49 | prints out any certificates or CRLs contained in the file. They are | ||
50 | preceded by their subject and issuer names in one line format. | ||
51 | |||
52 | =item B<-text> | ||
53 | |||
54 | prints out certificates details in full rather than just subject and | ||
55 | issuer names. | ||
56 | |||
57 | =item B<-noout> | ||
58 | |||
59 | don't output the encoded version of the PKCS#7 structure (or certificates | ||
60 | is B<-print_certs> is set). | ||
61 | |||
62 | =back | ||
63 | |||
64 | =head1 EXAMPLES | ||
65 | |||
66 | Convert a PKCS#7 file from PEM to DER: | ||
67 | |||
68 | openssl pkcs7 -in file.pem -outform DER -out file.der | ||
69 | |||
70 | Output all certificates in a file: | ||
71 | |||
72 | openssl pkcs7 -in file.pem -print_certs -out certs.pem | ||
73 | |||
74 | =head1 NOTES | ||
75 | |||
76 | The PEM PKCS#7 format uses the header and footer lines: | ||
77 | |||
78 | -----BEGIN PKCS7----- | ||
79 | -----END PKCS7----- | ||
80 | |||
81 | For compatability with some CAs it will also accept: | ||
82 | |||
83 | -----BEGIN CERTIFICATE----- | ||
84 | -----END CERTIFICATE----- | ||
85 | |||
86 | =head1 RESTRICTIONS | ||
87 | |||
88 | There is no option to print out all the fields of a PKCS#7 file. | ||
89 | |||
90 | This PKCS#7 routines only understand PKCS#7 v 1.5 as specified in RFC2315 they | ||
91 | cannot currently parse, for example, the new CMS as described in RFC2630. | ||
92 | |||
93 | =head1 SEE ALSO | ||
94 | |||
95 | L<crl2pkcs7(1)|crl2pkcs7(1)> | ||
96 | |||
97 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/pkcs8.pod b/src/lib/libssl/src/doc/apps/pkcs8.pod new file mode 100644 index 0000000000..a56b2dd002 --- /dev/null +++ b/src/lib/libssl/src/doc/apps/pkcs8.pod | |||
@@ -0,0 +1,235 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | pkcs8 - PKCS#8 format private key conversion tool | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<openssl> B<pkcs8> | ||
10 | [B<-topk8>] | ||
11 | [B<-inform PEM|DER>] | ||
12 | [B<-outform PEM|DER>] | ||
13 | [B<-in filename>] | ||
14 | [B<-passin arg>] | ||
15 | [B<-out filename>] | ||
16 | [B<-passout arg>] | ||
17 | [B<-noiter>] | ||
18 | [B<-nocrypt>] | ||
19 | [B<-nooct>] | ||
20 | [B<-embed>] | ||
21 | [B<-nsdb>] | ||
22 | [B<-v2 alg>] | ||
23 | [B<-v1 alg>] | ||
24 | |||
25 | =head1 DESCRIPTION | ||
26 | |||
27 | The B<pkcs8> command processes private keys in PKCS#8 format. It can handle | ||
28 | both unencrypted PKCS#8 PrivateKeyInfo format and EncryptedPrivateKeyInfo | ||
29 | format with a variety of PKCS#5 (v1.5 and v2.0) and PKCS#12 algorithms. | ||
30 | |||
31 | =head1 COMMAND OPTIONS | ||
32 | |||
33 | =over 4 | ||
34 | |||
35 | =item B<-topk8> | ||
36 | |||
37 | Normally a PKCS#8 private key is expected on input and a traditional format | ||
38 | private key will be written. With the B<-topk8> option the situation is | ||
39 | reversed: it reads a traditional format private key and writes a PKCS#8 | ||
40 | format key. | ||
41 | |||
42 | =item B<-inform DER|PEM> | ||
43 | |||
44 | This specifies the input format. If a PKCS#8 format key is expected on input | ||
45 | then either a B<DER> or B<PEM> encoded version of a PKCS#8 key will be | ||
46 | expected. Otherwise the B<DER> or B<PEM> format of the traditional format | ||
47 | private key is used. | ||
48 | |||
49 | =item B<-outform DER|PEM> | ||
50 | |||
51 | This specifies the output format, the options have the same meaning as the | ||
52 | B<-inform> option. | ||
53 | |||
54 | =item B<-in filename> | ||
55 | |||
56 | This specifies the input filename to read a key from or standard input if this | ||
57 | option is not specified. If the key is encrypted a pass phrase will be | ||
58 | prompted for. | ||
59 | |||
60 | =item B<-passin arg> | ||
61 | |||
62 | the input file password source. For more information about the format of B<arg> | ||
63 | see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. | ||
64 | |||
65 | =item B<-out filename> | ||
66 | |||
67 | This specifies the output filename to write a key to or standard output by | ||
68 | default. If any encryption options are set then a pass phrase will be | ||
69 | prompted for. The output filename should B<not> be the same as the input | ||
70 | filename. | ||
71 | |||
72 | =item B<-passout arg> | ||
73 | |||
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)>. | ||
76 | |||
77 | =item B<-nocrypt> | ||
78 | |||
79 | PKCS#8 keys generated or input are normally PKCS#8 EncryptedPrivateKeyInfo | ||
80 | structures using an appropriate password based encryption algorithm. With | ||
81 | this option an unencrypted PrivateKeyInfo structure is expected or output. | ||
82 | This option does not encrypt private keys at all and should only be used | ||
83 | when absolutely necessary. Certain software such as some versions of Java | ||
84 | code signing software used unencrypted private keys. | ||
85 | |||
86 | =item B<-nooct> | ||
87 | |||
88 | This option generates RSA private keys in a broken format that some software | ||
89 | uses. Specifically the private key should be enclosed in a OCTET STRING | ||
90 | but some software just includes the structure itself without the | ||
91 | surrounding OCTET STRING. | ||
92 | |||
93 | =item B<-embed> | ||
94 | |||
95 | This option generates DSA keys in a broken format. The DSA parameters are | ||
96 | embedded inside the PrivateKey structure. In this form the OCTET STRING | ||
97 | contains an ASN1 SEQUENCE consisting of two structures: a SEQUENCE containing | ||
98 | the parameters and an ASN1 INTEGER containing the private key. | ||
99 | |||
100 | =item B<-nsdb> | ||
101 | |||
102 | This option generates DSA keys in a broken format compatible with Netscape | ||
103 | private key databases. The PrivateKey contains a SEQUENCE consisting of | ||
104 | the public and private keys respectively. | ||
105 | |||
106 | =item B<-v2 alg> | ||
107 | |||
108 | This option enables the use of PKCS#5 v2.0 algorithms. Normally PKCS#8 | ||
109 | private keys are encrypted with the password based encryption algorithm | ||
110 | called B<pbeWithMD5AndDES-CBC> this uses 56 bit DES encryption but it | ||
111 | was the strongest encryption algorithm supported in PKCS#5 v1.5. Using | ||
112 | the B<-v2> option PKCS#5 v2.0 algorithms are used which can use any | ||
113 | encryption algorithm such as 168 bit triple DES or 128 bit RC2 however | ||
114 | not many implementations support PKCS#5 v2.0 yet. If you are just using | ||
115 | private keys with OpenSSL then this doesn't matter. | ||
116 | |||
117 | The B<alg> argument is the encryption algorithm to use, valid values include | ||
118 | B<des>, B<des3> and B<rc2>. It is recommended that B<des3> is used. | ||
119 | |||
120 | =item B<-v1 alg> | ||
121 | |||
122 | This option specifies a PKCS#5 v1.5 or PKCS#12 algorithm to use. A complete | ||
123 | list of possible algorithms is included below. | ||
124 | |||
125 | =back | ||
126 | |||
127 | =head1 NOTES | ||
128 | |||
129 | The encrypted form of a PEM encode PKCS#8 files uses the following | ||
130 | headers and footers: | ||
131 | |||
132 | -----BEGIN ENCRYPTED PRIVATE KEY----- | ||
133 | -----END ENCRYPTED PRIVATE KEY----- | ||
134 | |||
135 | The unencrypted form uses: | ||
136 | |||
137 | -----BEGIN PRIVATE KEY----- | ||
138 | -----END PRIVATE KEY----- | ||
139 | |||
140 | Private keys encrypted using PKCS#5 v2.0 algorithms and high iteration | ||
141 | counts are more secure that those encrypted using the traditional | ||
142 | SSLeay compatible formats. So if additional security is considered | ||
143 | important the keys should be converted. | ||
144 | |||
145 | The default encryption is only 56 bits because this is the encryption | ||
146 | that most current implementations of PKCS#8 will support. | ||
147 | |||
148 | Some software may use PKCS#12 password based encryption algorithms | ||
149 | with PKCS#8 format private keys: these are handled automatically | ||
150 | but there is no option to produce them. | ||
151 | |||
152 | It is possible to write out DER encoded encrypted private keys in | ||
153 | PKCS#8 format because the encryption details are included at an ASN1 | ||
154 | level whereas the traditional format includes them at a PEM level. | ||
155 | |||
156 | =head1 PKCS#5 v1.5 and PKCS#12 algorithms. | ||
157 | |||
158 | Various algorithms can be used with the B<-v1> command line option, | ||
159 | including PKCS#5 v1.5 and PKCS#12. These are described in more detail | ||
160 | below. | ||
161 | |||
162 | =over 4 | ||
163 | |||
164 | =item B<PBE-MD2-DES PBE-MD5-DES> | ||
165 | |||
166 | These algorithms were included in the original PKCS#5 v1.5 specification. | ||
167 | They only offer 56 bits of protection since they both use DES. | ||
168 | |||
169 | =item B<PBE-SHA1-RC2-64 PBE-MD2-RC2-64 PBE-MD5-RC2-64 PBE-SHA1-DES> | ||
170 | |||
171 | These algorithms are not mentioned in the original PKCS#5 v1.5 specification | ||
172 | but they use the same key derivation algorithm and are supported by some | ||
173 | software. They are mentioned in PKCS#5 v2.0. They use either 64 bit RC2 or | ||
174 | 56 bit DES. | ||
175 | |||
176 | =item B<PBE-SHA1-RC4-128 PBE-SHA1-RC4-40 PBE-SHA1-3DES PBE-SHA1-2DES PBE-SHA1-RC2-128 PBE-SHA1-RC2-40> | ||
177 | |||
178 | These algorithms use the PKCS#12 password based encryption algorithm and | ||
179 | allow strong encryption algorithms like triple DES or 128 bit RC2 to be used. | ||
180 | |||
181 | =back | ||
182 | |||
183 | =head1 EXAMPLES | ||
184 | |||
185 | Convert a private from traditional to PKCS#5 v2.0 format using triple | ||
186 | DES: | ||
187 | |||
188 | openssl pkcs8 -in key.pem -topk8 -v2 des3 -out enckey.pem | ||
189 | |||
190 | Convert a private key to PKCS#8 using a PKCS#5 1.5 compatible algorithm | ||
191 | (DES): | ||
192 | |||
193 | openssl pkcs8 -in key.pem -topk8 -out enckey.pem | ||
194 | |||
195 | Convert a private key to PKCS#8 using a PKCS#12 compatible algorithm | ||
196 | (3DES): | ||
197 | |||
198 | openssl pkcs8 -in key.pem -topk8 -out enckey.pem -v1 PBE-SHA1-3DES | ||
199 | |||
200 | Read a DER unencrypted PKCS#8 format private key: | ||
201 | |||
202 | openssl pkcs8 -inform DER -nocrypt -in key.der -out key.pem | ||
203 | |||
204 | Convert a private key from any PKCS#8 format to traditional format: | ||
205 | |||
206 | openssl pkcs8 -in pk8.pem -out key.pem | ||
207 | |||
208 | =head1 STANDARDS | ||
209 | |||
210 | Test vectors from this PKCS#5 v2.0 implementation were posted to the | ||
211 | pkcs-tng mailing list using triple DES, DES and RC2 with high iteration | ||
212 | counts, several people confirmed that they could decrypt the private | ||
213 | keys produced and Therefore it can be assumed that the PKCS#5 v2.0 | ||
214 | implementation is reasonably accurate at least as far as these | ||
215 | algorithms are concerned. | ||
216 | |||
217 | The format of PKCS#8 DSA (and other) private keys is not well documented: | ||
218 | it is hidden away in PKCS#11 v2.01, section 11.9. OpenSSL's default DSA | ||
219 | PKCS#8 private key format complies with this standard. | ||
220 | |||
221 | =head1 BUGS | ||
222 | |||
223 | There should be an option that prints out the encryption algorithm | ||
224 | in use and other details such as the iteration count. | ||
225 | |||
226 | PKCS#8 using triple DES and PKCS#5 v2.0 should be the default private | ||
227 | key format for OpenSSL: for compatibility several of the utilities use | ||
228 | the old format at present. | ||
229 | |||
230 | =head1 SEE ALSO | ||
231 | |||
232 | L<dsa(1)|dsa(1)>, L<rsa(1)|rsa(1)>, L<genrsa(1)|genrsa(1)>, | ||
233 | L<gendsa(1)|gendsa(1)> | ||
234 | |||
235 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/req.pod b/src/lib/libssl/src/doc/apps/req.pod new file mode 100644 index 0000000000..fde6ff2e9f --- /dev/null +++ b/src/lib/libssl/src/doc/apps/req.pod | |||
@@ -0,0 +1,528 @@ | |||
1 | |||
2 | =pod | ||
3 | |||
4 | =head1 NAME | ||
5 | |||
6 | req - PKCS#10 certificate and certificate generating utility. | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | B<openssl> B<req> | ||
11 | [B<-inform PEM|DER>] | ||
12 | [B<-outform PEM|DER>] | ||
13 | [B<-in filename>] | ||
14 | [B<-passin arg>] | ||
15 | [B<-out filename>] | ||
16 | [B<-passout arg>] | ||
17 | [B<-text>] | ||
18 | [B<-noout>] | ||
19 | [B<-verify>] | ||
20 | [B<-modulus>] | ||
21 | [B<-new>] | ||
22 | [B<-newkey rsa:bits>] | ||
23 | [B<-newkey dsa:file>] | ||
24 | [B<-nodes>] | ||
25 | [B<-key filename>] | ||
26 | [B<-keyform PEM|DER>] | ||
27 | [B<-keyout filename>] | ||
28 | [B<-[md5|sha1|md2|mdc2]>] | ||
29 | [B<-config filename>] | ||
30 | [B<-x509>] | ||
31 | [B<-days n>] | ||
32 | [B<-asn1-kludge>] | ||
33 | [B<-newhdr>] | ||
34 | [B<-extensions section>] | ||
35 | [B<-reqexts section>] | ||
36 | |||
37 | =head1 DESCRIPTION | ||
38 | |||
39 | The B<req> command primarily creates and processes certificate requests | ||
40 | in PKCS#10 format. It can additionally create self signed certificates | ||
41 | for use as root CAs for example. | ||
42 | |||
43 | =head1 COMMAND OPTIONS | ||
44 | |||
45 | =over 4 | ||
46 | |||
47 | =item B<-inform DER|PEM> | ||
48 | |||
49 | This specifies the input format. The B<DER> option uses an ASN1 DER encoded | ||
50 | form compatible with the PKCS#10. The B<PEM> form is the default format: it | ||
51 | consists of the B<DER> format base64 encoded with additional header and | ||
52 | footer lines. | ||
53 | |||
54 | =item B<-outform DER|PEM> | ||
55 | |||
56 | This specifies the output format, the options have the same meaning as the | ||
57 | B<-inform> option. | ||
58 | |||
59 | =item B<-in filename> | ||
60 | |||
61 | This specifies the input filename to read a request from or standard input | ||
62 | if this option is not specified. A request is only read if the creation | ||
63 | options (B<-new> and B<-newkey>) are not specified. | ||
64 | |||
65 | =item B<-passin arg> | ||
66 | |||
67 | the input file password source. For more information about the format of B<arg> | ||
68 | see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. | ||
69 | |||
70 | =item B<-out filename> | ||
71 | |||
72 | This specifies the output filename to write to or standard output by | ||
73 | default. | ||
74 | |||
75 | =item B<-passout arg> | ||
76 | |||
77 | the output file password source. For more information about the format of B<arg> | ||
78 | see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. | ||
79 | |||
80 | =item B<-text> | ||
81 | |||
82 | prints out the certificate request in text form. | ||
83 | |||
84 | =item B<-noout> | ||
85 | |||
86 | this option prevents output of the encoded version of the request. | ||
87 | |||
88 | =item B<-modulus> | ||
89 | |||
90 | this option prints out the value of the modulus of the public key | ||
91 | contained in the request. | ||
92 | |||
93 | =item B<-verify> | ||
94 | |||
95 | verifies the signature on the request. | ||
96 | |||
97 | =item B<-new> | ||
98 | |||
99 | this option generates a new certificate request. It will prompt | ||
100 | the user for the relevant field values. The actual fields | ||
101 | prompted for and their maximum and minimum sizes are specified | ||
102 | in the configuration file and any requested extensions. | ||
103 | |||
104 | 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 | |||
107 | =item B<-newkey arg> | ||
108 | |||
109 | this option creates a new certificate request and a new private | ||
110 | key. The argument takes one of two forms. B<rsa:nbits>, where | ||
111 | B<nbits> is the number of bits, generates an RSA key B<nbits> | ||
112 | in size. B<dsa:filename> generates a DSA key using the parameters | ||
113 | in the file B<filename>. | ||
114 | |||
115 | =item B<-key filename> | ||
116 | |||
117 | This specifies the file to read the private key from. It also | ||
118 | accepts PKCS#8 format private keys for PEM format files. | ||
119 | |||
120 | =item B<-keyform PEM|DER> | ||
121 | |||
122 | the format of the private key file specified in the B<-key> | ||
123 | argument. PEM is the default. | ||
124 | |||
125 | =item B<-keyout filename> | ||
126 | |||
127 | this gives the filename to write the newly created private key to. | ||
128 | If this option is not specified then the filename present in the | ||
129 | configuration file is used. | ||
130 | |||
131 | =item B<-nodes> | ||
132 | |||
133 | if this option is specified then if a private key is created it | ||
134 | will not be encrypted. | ||
135 | |||
136 | =item B<-[md5|sha1|md2|mdc2]> | ||
137 | |||
138 | this specifies the message digest to sign the request with. This | ||
139 | overrides the digest algorithm specified in the configuration file. | ||
140 | This option is ignored for DSA requests: they always use SHA1. | ||
141 | |||
142 | =item B<-config filename> | ||
143 | |||
144 | this allows an alternative configuration file to be specified, | ||
145 | this overrides the compile time filename or any specified in | ||
146 | the B<OPENSSL_CONF> environment variable. | ||
147 | |||
148 | =item B<-x509> | ||
149 | |||
150 | this option outputs a self signed certificate instead of a certificate | ||
151 | request. This is typically used to generate a test certificate or | ||
152 | a self signed root CA. The extensions added to the certificate | ||
153 | (if any) are specified in the configuration file. | ||
154 | |||
155 | =item B<-days n> | ||
156 | |||
157 | 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. | ||
159 | |||
160 | =item B<-extensions section> | ||
161 | =item B<-reqexts section> | ||
162 | |||
163 | these options specify alternative sections to include certificate | ||
164 | extensions (if the B<-x509> option is present) or certificate | ||
165 | request extensions. This allows several different sections to | ||
166 | be used in the same configuration file to specify requests for | ||
167 | a variety of purposes. | ||
168 | |||
169 | =item B<-asn1-kludge> | ||
170 | |||
171 | by default the B<req> command outputs certificate requests containing | ||
172 | no attributes in the correct PKCS#10 format. However certain CAs will only | ||
173 | accept requests containing no attributes in an invalid form: this | ||
174 | option produces this invalid format. | ||
175 | |||
176 | More precisely the B<Attributes> in a PKCS#10 certificate request | ||
177 | are defined as a B<SET OF Attribute>. They are B<not OPTIONAL> so | ||
178 | if no attributes are present then they should be encoded as an | ||
179 | empty B<SET OF>. The invalid form does not include the empty | ||
180 | B<SET OF> whereas the correct form does. | ||
181 | |||
182 | It should be noted that very few CAs still require the use of this option. | ||
183 | |||
184 | =item B<-newhdr> | ||
185 | |||
186 | Adds the word B<NEW> to the PEM file header and footer lines on the outputed | ||
187 | request. Some software (Netscape certificate server) and some CAs need this. | ||
188 | |||
189 | =back | ||
190 | |||
191 | =head1 CONFIGURATION FILE FORMAT | ||
192 | |||
193 | The configuration options are specified in the B<req> section of | ||
194 | the configuration file. As with all configuration files if no | ||
195 | value is specified in the specific section (i.e. B<req>) then | ||
196 | the initial unnamed or B<default> section is searched too. | ||
197 | |||
198 | The options available are described in detail below. | ||
199 | |||
200 | =over 4 | ||
201 | |||
202 | =item B<input_password output_password> | ||
203 | |||
204 | The passwords for the input private key file (if present) and | ||
205 | the output private key file (if one will be created). The | ||
206 | command line options B<passin> and B<passout> override the | ||
207 | configuration file values. | ||
208 | |||
209 | =item B<default_bits> | ||
210 | |||
211 | This specifies the default key size in bits. If not specified then | ||
212 | 512 is used. It is used if the B<-new> option is used. It can be | ||
213 | overridden by using the B<-newkey> option. | ||
214 | |||
215 | =item B<default_keyfile> | ||
216 | |||
217 | This is the default filename to write a private key to. If not | ||
218 | specified the key is written to standard output. This can be | ||
219 | overridden by the B<-keyout> option. | ||
220 | |||
221 | =item B<oid_file> | ||
222 | |||
223 | This specifies a file containing additional B<OBJECT IDENTIFIERS>. | ||
224 | Each line of the file should consist of the numerical form of the | ||
225 | object identifier followed by white space then the short name followed | ||
226 | by white space and finally the long name. | ||
227 | |||
228 | =item B<oid_section> | ||
229 | |||
230 | This specifies a section in the configuration file containing extra | ||
231 | object identifiers. Each line should consist of the short name of the | ||
232 | object identifier followed by B<=> and the numerical form. The short | ||
233 | and long names are the same when this option is used. | ||
234 | |||
235 | =item B<RANDFILE> | ||
236 | |||
237 | This specifies a filename in which random number seed information is | ||
238 | placed and read from, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). | ||
239 | It is used for private key generation. | ||
240 | |||
241 | =item B<encrypt_key> | ||
242 | |||
243 | If this is set to B<no> then if a private key is generated it is | ||
244 | B<not> encrypted. This is equivalent to the B<-nodes> command line | ||
245 | option. For compatibility B<encrypt_rsa_key> is an equivalent option. | ||
246 | |||
247 | =item B<default_md> | ||
248 | |||
249 | This option specifies the digest algorithm to use. Possible values | ||
250 | include B<md5 sha1 mdc2>. If not present then MD5 is used. This | ||
251 | option can be overridden on the command line. | ||
252 | |||
253 | =item B<string_mask> | ||
254 | |||
255 | This option masks out the use of certain string types in certain | ||
256 | fields. Most users will not need to change this option. | ||
257 | |||
258 | It can be set to several values B<default> which is also the default | ||
259 | option uses PrintableStrings, T61Strings and BMPStrings if the | ||
260 | B<pkix> value is used then only PrintableStrings and BMPStrings will | ||
261 | be used. This follows the PKIX recommendation in RFC2459. If the | ||
262 | B<utf8only> option is used then only UTF8Strings will be used: this | ||
263 | is the PKIX recommendation in RFC2459 after 2003. Finally the B<nombstr> | ||
264 | option just uses PrintableStrings and T61Strings: certain software has | ||
265 | problems with BMPStrings and UTF8Strings: in particular Netscape. | ||
266 | |||
267 | =item B<req_extensions> | ||
268 | |||
269 | this specifies the configuration file section containing a list of | ||
270 | extensions to add to the certificate request. It can be overridden | ||
271 | by the B<-reqexts> command line switch. | ||
272 | |||
273 | =item B<x509_extensions> | ||
274 | |||
275 | this specifies the configuration file section containing a list of | ||
276 | extensions to add to certificate generated when the B<-x509> switch | ||
277 | is used. It can be overridden by the B<-extensions> command line switch. | ||
278 | |||
279 | =item B<prompt> | ||
280 | |||
281 | if set to the value B<no> this disables prompting of certificate fields | ||
282 | and just takes values from the config file directly. It also changes the | ||
283 | expected format of the B<distinguished_name> and B<attributes> sections. | ||
284 | |||
285 | =item B<attributes> | ||
286 | |||
287 | this specifies the section containing any request attributes: its format | ||
288 | is the same as B<distinguished_name>. Typically these may contain the | ||
289 | challengePassword or unstructuredName types. They are currently ignored | ||
290 | by OpenSSL's request signing utilities but some CAs might want them. | ||
291 | |||
292 | =item B<distinguished_name> | ||
293 | |||
294 | This specifies the section containing the distinguished name fields to | ||
295 | prompt for when generating a certificate or certificate request. The format | ||
296 | is described in the next section. | ||
297 | |||
298 | =back | ||
299 | |||
300 | =head1 DISTINGUISHED NAME AND ATTRIBUTE SECTION FORMAT | ||
301 | |||
302 | There are two separate formats for the distinguished name and attribute | ||
303 | sections. If the B<prompt> option is set to B<no> then these sections | ||
304 | just consist of field names and values: for example, | ||
305 | |||
306 | CN=My Name | ||
307 | OU=My Organization | ||
308 | emailAddress=someone@somewhere.org | ||
309 | |||
310 | This allows external programs (e.g. GUI based) to generate a template file | ||
311 | with all the field names and values and just pass it to B<req>. An example | ||
312 | of this kind of configuration file is contained in the B<EXAMPLES> section. | ||
313 | |||
314 | Alternatively if the B<prompt> option is absent or not set to B<no> then the | ||
315 | file contains field prompting information. It consists of lines of the form: | ||
316 | |||
317 | fieldName="prompt" | ||
318 | fieldName_default="default field value" | ||
319 | fieldName_min= 2 | ||
320 | fieldName_max= 4 | ||
321 | |||
322 | "fieldName" is the field name being used, for example commonName (or CN). | ||
323 | The "prompt" string is used to ask the user to enter the relevant | ||
324 | details. If the user enters nothing then the default value is used if no | ||
325 | default value is present then the field is omitted. A field can | ||
326 | still be omitted if a default value is present if the user just | ||
327 | enters the '.' character. | ||
328 | |||
329 | The number of characters entered must be between the fieldName_min and | ||
330 | fieldName_max limits: there may be additional restrictions based | ||
331 | on the field being used (for example countryName can only ever be | ||
332 | two characters long and must fit in a PrintableString). | ||
333 | |||
334 | Some fields (such as organizationName) can be used more than once | ||
335 | in a DN. This presents a problem because configuration files will | ||
336 | not recognize the same name occurring twice. To avoid this problem | ||
337 | if the fieldName contains some characters followed by a full stop | ||
338 | they will be ignored. So for example a second organizationName can | ||
339 | be input by calling it "1.organizationName". | ||
340 | |||
341 | The actual permitted field names are any object identifier short or | ||
342 | long names. These are compiled into OpenSSL and include the usual | ||
343 | values such as commonName, countryName, localityName, organizationName, | ||
344 | organizationUnitName, stateOrPrivinceName. Additionally emailAddress | ||
345 | is include as well as name, surname, givenName initials and dnQualifier. | ||
346 | |||
347 | Additional object identifiers can be defined with the B<oid_file> or | ||
348 | B<oid_section> options in the configuration file. Any additional fields | ||
349 | will be treated as though they were a DirectoryString. | ||
350 | |||
351 | |||
352 | =head1 EXAMPLES | ||
353 | |||
354 | Examine and verify certificate request: | ||
355 | |||
356 | openssl req -in req.pem -text -verify -noout | ||
357 | |||
358 | Create a private key and then generate a certificate request from it: | ||
359 | |||
360 | openssl genrsa -out key.pem 1024 | ||
361 | openssl req -new -key key.pem -out req.pem | ||
362 | |||
363 | The same but just using req: | ||
364 | |||
365 | openssl req -newkey rsa:1024 -keyout key.pem -out req.pem | ||
366 | |||
367 | Generate a self signed root certificate: | ||
368 | |||
369 | openssl req -x509 -newkey rsa:1024 -keyout key.pem -out req.pem | ||
370 | |||
371 | Example of a file pointed to by the B<oid_file> option: | ||
372 | |||
373 | 1.2.3.4 shortName A longer Name | ||
374 | 1.2.3.6 otherName Other longer Name | ||
375 | |||
376 | Example of a section pointed to by B<oid_section> making use of variable | ||
377 | expansion: | ||
378 | |||
379 | testoid1=1.2.3.5 | ||
380 | testoid2=${testoid1}.6 | ||
381 | |||
382 | Sample configuration file prompting for field values: | ||
383 | |||
384 | [ req ] | ||
385 | default_bits = 1024 | ||
386 | default_keyfile = privkey.pem | ||
387 | distinguished_name = req_distinguished_name | ||
388 | attributes = req_attributes | ||
389 | x509_extensions = v3_ca | ||
390 | |||
391 | dirstring_type = nobmp | ||
392 | |||
393 | [ req_distinguished_name ] | ||
394 | countryName = Country Name (2 letter code) | ||
395 | countryName_default = AU | ||
396 | countryName_min = 2 | ||
397 | countryName_max = 2 | ||
398 | |||
399 | localityName = Locality Name (eg, city) | ||
400 | |||
401 | organizationalUnitName = Organizational Unit Name (eg, section) | ||
402 | |||
403 | commonName = Common Name (eg, YOUR name) | ||
404 | commonName_max = 64 | ||
405 | |||
406 | emailAddress = Email Address | ||
407 | emailAddress_max = 40 | ||
408 | |||
409 | [ req_attributes ] | ||
410 | challengePassword = A challenge password | ||
411 | challengePassword_min = 4 | ||
412 | challengePassword_max = 20 | ||
413 | |||
414 | [ v3_ca ] | ||
415 | |||
416 | subjectKeyIdentifier=hash | ||
417 | authorityKeyIdentifier=keyid:always,issuer:always | ||
418 | basicConstraints = CA:true | ||
419 | |||
420 | Sample configuration containing all field values: | ||
421 | |||
422 | |||
423 | RANDFILE = $ENV::HOME/.rnd | ||
424 | |||
425 | [ req ] | ||
426 | default_bits = 1024 | ||
427 | default_keyfile = keyfile.pem | ||
428 | distinguished_name = req_distinguished_name | ||
429 | attributes = req_attributes | ||
430 | prompt = no | ||
431 | output_password = mypass | ||
432 | |||
433 | [ req_distinguished_name ] | ||
434 | C = GB | ||
435 | ST = Test State or Province | ||
436 | L = Test Locality | ||
437 | O = Organization Name | ||
438 | OU = Organizational Unit Name | ||
439 | CN = Common Name | ||
440 | emailAddress = test@email.address | ||
441 | |||
442 | [ req_attributes ] | ||
443 | challengePassword = A challenge password | ||
444 | |||
445 | |||
446 | =head1 NOTES | ||
447 | |||
448 | The header and footer lines in the B<PEM> format are normally: | ||
449 | |||
450 | -----BEGIN CERTIFICATE REQUEST---- | ||
451 | -----END CERTIFICATE REQUEST---- | ||
452 | |||
453 | some software (some versions of Netscape certificate server) instead needs: | ||
454 | |||
455 | -----BEGIN NEW CERTIFICATE REQUEST---- | ||
456 | -----END NEW CERTIFICATE REQUEST---- | ||
457 | |||
458 | which is produced with the B<-newhdr> option but is otherwise compatible. | ||
459 | Either form is accepted transparently on input. | ||
460 | |||
461 | The certificate requests generated by B<Xenroll> with MSIE have extensions | ||
462 | added. It includes the B<keyUsage> extension which determines the type of | ||
463 | key (signature only or general purpose) and any additional OIDs entered | ||
464 | by the script in an extendedKeyUsage extension. | ||
465 | |||
466 | =head1 DIAGNOSTICS | ||
467 | |||
468 | The following messages are frequently asked about: | ||
469 | |||
470 | Using configuration from /some/path/openssl.cnf | ||
471 | Unable to load config info | ||
472 | |||
473 | This is followed some time later by... | ||
474 | |||
475 | unable to find 'distinguished_name' in config | ||
476 | problems making Certificate Request | ||
477 | |||
478 | The first error message is the clue: it can't find the configuration | ||
479 | file! Certain operations (like examining a certificate request) don't | ||
480 | need a configuration file so its use isn't enforced. Generation of | ||
481 | certificates or requests however does need a configuration file. This | ||
482 | could be regarded as a bug. | ||
483 | |||
484 | Another puzzling message is this: | ||
485 | |||
486 | Attributes: | ||
487 | a0:00 | ||
488 | |||
489 | this is displayed when no attributes are present and the request includes | ||
490 | the correct empty B<SET OF> structure (the DER encoding of which is 0xa0 | ||
491 | 0x00). If you just see: | ||
492 | |||
493 | Attributes: | ||
494 | |||
495 | then the B<SET OF> is missing and the encoding is technically invalid (but | ||
496 | it is tolerated). See the description of the command line option B<-asn1-kludge> | ||
497 | for more information. | ||
498 | |||
499 | =head1 ENVIRONMENT VARIABLES | ||
500 | |||
501 | The variable B<OPENSSL_CONF> if defined allows an alternative configuration | ||
502 | file location to be specified, it will be overridden by the B<-config> command | ||
503 | line switch if it is present. For compatibility reasons the B<SSLEAY_CONF> | ||
504 | environment variable serves the same purpose but its use is discouraged. | ||
505 | |||
506 | =head1 BUGS | ||
507 | |||
508 | OpenSSL's handling of T61Strings (aka TeletexStrings) is broken: it effectively | ||
509 | treats them as ISO-8859-1 (Latin 1), Netscape and MSIE have similar behaviour. | ||
510 | This can cause problems if you need characters that aren't available in | ||
511 | PrintableStrings and you don't want to or can't use BMPStrings. | ||
512 | |||
513 | As a consequence of the T61String handling the only correct way to represent | ||
514 | accented characters in OpenSSL is to use a BMPString: unfortunately Netscape | ||
515 | currently chokes on these. If you have to use accented characters with Netscape | ||
516 | and MSIE then you currently need to use the invalid T61String form. | ||
517 | |||
518 | The current prompting is not very friendly. It doesn't allow you to confirm what | ||
519 | you've just entered. Other things like extensions in certificate requests are | ||
520 | statically defined in the configuration file. Some of these: like an email | ||
521 | address in subjectAltName should be input by the user. | ||
522 | |||
523 | =head1 SEE ALSO | ||
524 | |||
525 | L<x509(1)|x509(1)>, L<ca(1)|ca(1)>, L<genrsa(1)|genrsa(1)>, | ||
526 | L<gendsa(1)|gendsa(1)>, L<config(5)|config(5)> | ||
527 | |||
528 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/rsa.pod b/src/lib/libssl/src/doc/apps/rsa.pod new file mode 100644 index 0000000000..62ad62e23d --- /dev/null +++ b/src/lib/libssl/src/doc/apps/rsa.pod | |||
@@ -0,0 +1,156 @@ | |||
1 | |||
2 | =pod | ||
3 | |||
4 | =head1 NAME | ||
5 | |||
6 | rsa - RSA key processing tool | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | B<openssl> B<rsa> | ||
11 | [B<-inform PEM|NET|DER>] | ||
12 | [B<-outform PEM|NET|DER>] | ||
13 | [B<-in filename>] | ||
14 | [B<-passin arg>] | ||
15 | [B<-out filename>] | ||
16 | [B<-passout arg>] | ||
17 | [B<-des>] | ||
18 | [B<-des3>] | ||
19 | [B<-idea>] | ||
20 | [B<-text>] | ||
21 | [B<-noout>] | ||
22 | [B<-modulus>] | ||
23 | [B<-check>] | ||
24 | [B<-pubin>] | ||
25 | [B<-pubout>] | ||
26 | |||
27 | =head1 DESCRIPTION | ||
28 | |||
29 | The B<rsa> command processes RSA keys. They can be converted between various | ||
30 | forms and their components printed out. B<Note> this command uses the | ||
31 | traditional SSLeay compatible format for private key encryption: newer | ||
32 | applications should use the more secure PKCS#8 format using the B<pkcs8> | ||
33 | utility. | ||
34 | |||
35 | =head1 COMMAND OPTIONS | ||
36 | |||
37 | =over 4 | ||
38 | |||
39 | =item B<-inform DER|NET|PEM> | ||
40 | |||
41 | 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 | 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 | keys are also accepted. The B<NET> form is a format compatible with older Netscape | ||
46 | servers and MS IIS, this uses unsalted RC4 for its encryption. It is not very | ||
47 | secure and so should only be used when necessary. | ||
48 | |||
49 | =item B<-outform DER|NET|PEM> | ||
50 | |||
51 | This specifies the output format, the options have the same meaning as the | ||
52 | B<-inform> option. | ||
53 | |||
54 | =item B<-in filename> | ||
55 | |||
56 | This specifies the input filename to read a key from or standard input if this | ||
57 | option is not specified. If the key is encrypted a pass phrase will be | ||
58 | prompted for. | ||
59 | |||
60 | =item B<-passin arg> | ||
61 | |||
62 | the input file password source. For more information about the format of B<arg> | ||
63 | see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. | ||
64 | |||
65 | =item B<-out filename> | ||
66 | |||
67 | This specifies the output filename to write a key to or standard output if this | ||
68 | option is not specified. If any encryption options are set then a pass phrase | ||
69 | will be prompted for. The output filename should B<not> be the same as the input | ||
70 | filename. | ||
71 | |||
72 | =item B<-passout password> | ||
73 | |||
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)>. | ||
76 | |||
77 | =item B<-des|-des3|-idea> | ||
78 | |||
79 | These options encrypt the private key with the DES, triple DES, or the | ||
80 | IDEA ciphers respectively before outputting it. A pass phrase is prompted for. | ||
81 | If none of these options is specified the key is written in plain text. This | ||
82 | means that using the B<rsa> utility to read in an encrypted key with no | ||
83 | encryption option can be used to remove the pass phrase from a key, or by | ||
84 | setting the encryption options it can be use to add or change the pass phrase. | ||
85 | These options can only be used with PEM format output files. | ||
86 | |||
87 | =item B<-text> | ||
88 | |||
89 | prints out the various public or private key components in | ||
90 | plain text in addition to the encoded version. | ||
91 | |||
92 | =item B<-noout> | ||
93 | |||
94 | this option prevents output of the encoded version of the key. | ||
95 | |||
96 | =item B<-modulus> | ||
97 | |||
98 | this option prints out the value of the modulus of the key. | ||
99 | |||
100 | =item B<-check> | ||
101 | |||
102 | this option checks the consistency of an RSA private key. | ||
103 | |||
104 | =item B<-pubin> | ||
105 | |||
106 | by default a private key is read from the input file: with this | ||
107 | option a public key is read instead. | ||
108 | |||
109 | =item B<-pubout> | ||
110 | |||
111 | by default a private key is output: with this option a public | ||
112 | key will be output instead. This option is automatically set if | ||
113 | the input is a public key. | ||
114 | |||
115 | =back | ||
116 | |||
117 | =head1 NOTES | ||
118 | |||
119 | The PEM private key format uses the header and footer lines: | ||
120 | |||
121 | -----BEGIN RSA PRIVATE KEY----- | ||
122 | -----END RSA PRIVATE KEY----- | ||
123 | |||
124 | The PEM public key format uses the header and footer lines: | ||
125 | |||
126 | -----BEGIN PUBLIC KEY----- | ||
127 | -----END PUBLIC KEY----- | ||
128 | |||
129 | =head1 EXAMPLES | ||
130 | |||
131 | To remove the pass phrase on an RSA private key: | ||
132 | |||
133 | openssl rsa -in key.pem -out keyout.pem | ||
134 | |||
135 | To encrypt a private key using triple DES: | ||
136 | |||
137 | openssl rsa -in key.pem -des3 -out keyout.pem | ||
138 | |||
139 | To convert a private key from PEM to DER format: | ||
140 | |||
141 | openssl rsa -in key.pem -outform DER -out keyout.der | ||
142 | |||
143 | To print out the components of a private key to standard output: | ||
144 | |||
145 | openssl rsa -in key.pem -text -noout | ||
146 | |||
147 | To just output the public part of a private key: | ||
148 | |||
149 | openssl rsa -in key.pem -pubout -out pubkey.pem | ||
150 | |||
151 | =head1 SEE ALSO | ||
152 | |||
153 | L<pkcs8(1)|pkcs8(1)>, L<dsa(1)|dsa(1)>, L<genrsa(1)|genrsa(1)>, | ||
154 | L<gendsa(1)|gendsa(1)> | ||
155 | |||
156 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/s_client.pod b/src/lib/libssl/src/doc/apps/s_client.pod new file mode 100644 index 0000000000..3ede134164 --- /dev/null +++ b/src/lib/libssl/src/doc/apps/s_client.pod | |||
@@ -0,0 +1,213 @@ | |||
1 | |||
2 | =pod | ||
3 | |||
4 | =head1 NAME | ||
5 | |||
6 | s_client - SSL/TLS client program | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | B<openssl> B<s_client> | ||
11 | [B<-connect> host:port>] | ||
12 | [B<-verify depth>] | ||
13 | [B<-cert filename>] | ||
14 | [B<-key filename>] | ||
15 | [B<-CApath directory>] | ||
16 | [B<-CAfile filename>] | ||
17 | [B<-reconnect>] | ||
18 | [B<-pause>] | ||
19 | [B<-showcerts>] | ||
20 | [B<-debug>] | ||
21 | [B<-nbio_test>] | ||
22 | [B<-state>] | ||
23 | [B<-nbio>] | ||
24 | [B<-crlf>] | ||
25 | [B<-quiet>] | ||
26 | [B<-ssl2>] | ||
27 | [B<-ssl3>] | ||
28 | [B<-tls1>] | ||
29 | [B<-no_ssl2>] | ||
30 | [B<-no_ssl3>] | ||
31 | [B<-no_tls1>] | ||
32 | [B<-bugs>] | ||
33 | [B<-cipher cipherlist>] | ||
34 | |||
35 | =head1 DESCRIPTION | ||
36 | |||
37 | The B<s_client> command implements a generic SSL/TLS client which connects | ||
38 | to a remote host using SSL/TLS. It is a I<very> useful diagnostic tool for | ||
39 | SSL servers. | ||
40 | |||
41 | =head1 OPTIONS | ||
42 | |||
43 | =over 4 | ||
44 | |||
45 | =item B<-connect host:port> | ||
46 | |||
47 | This specifies the host and optional port to connect to. If not specified | ||
48 | then an attempt is made to connect to the local host on port 4433. | ||
49 | |||
50 | =item B<-cert certname> | ||
51 | |||
52 | The certificate to use, if one is requested by the server. The default is | ||
53 | not to use a certificate. | ||
54 | |||
55 | =item B<-key keyfile> | ||
56 | |||
57 | The private key to use. If not specified then the certificate file will | ||
58 | be used. | ||
59 | |||
60 | =item B<-verify depth> | ||
61 | |||
62 | The verify depth to use. This specifies the maximum length of the | ||
63 | server certificate chain and turns on server certificate verification. | ||
64 | Currently the verify operation continues after errors so all the problems | ||
65 | with a certificate chain can be seen. As a side effect the connection | ||
66 | will never fail due to a server certificate verify failure. | ||
67 | |||
68 | =item B<-CApath directory> | ||
69 | |||
70 | The directory to use for server certificate verification. This directory | ||
71 | must be in "hash format", see B<verify> for more information. These are | ||
72 | also used when building the client certificate chain. | ||
73 | |||
74 | =item B<-CAfile file> | ||
75 | |||
76 | A file containing trusted certificates to use during server authentication | ||
77 | and to use when attempting to build the client certificate chain. | ||
78 | |||
79 | =item B<-reconnect> | ||
80 | |||
81 | reconnects to the same server 5 times using the same session ID, this can | ||
82 | be used as a test that session caching is working. | ||
83 | |||
84 | =item B<-pause> | ||
85 | |||
86 | pauses 1 second between each read and write call. | ||
87 | |||
88 | =item B<-showcerts> | ||
89 | |||
90 | display the whole server certificate chain: normally only the server | ||
91 | certificate itself is displayed. | ||
92 | |||
93 | =item B<-prexit> | ||
94 | |||
95 | print session information when the program exits. This will always attempt | ||
96 | to print out information even if the connection fails. Normally information | ||
97 | will only be printed out once if the connection succeeds. This option is useful | ||
98 | because the cipher in use may be renegotiated or the connection may fail | ||
99 | because a client certificate is required or is requested only after an | ||
100 | attempt is made to access a certain URL. Note: the output produced by this | ||
101 | option is not always accurate because a connection might never have been | ||
102 | established. | ||
103 | |||
104 | =item B<-state> | ||
105 | |||
106 | prints out the SSL session states. | ||
107 | |||
108 | =item B<-debug> | ||
109 | |||
110 | print extensive debugging information including a hex dump of all traffic. | ||
111 | |||
112 | =item B<-nbio_test> | ||
113 | |||
114 | tests non-blocking I/O | ||
115 | |||
116 | =item B<-nbio> | ||
117 | |||
118 | turns on non-blocking I/O | ||
119 | |||
120 | =item B<-crlf> | ||
121 | |||
122 | this option translated a line feed from the terminal into CR+LF as required | ||
123 | by some servers. | ||
124 | |||
125 | =item B<-quiet> | ||
126 | |||
127 | inhibit printing of session and certificate information. | ||
128 | |||
129 | =item B<-ssl2>, B<-ssl3>, B<-tls1>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1> | ||
130 | |||
131 | these options disable the use of certain SSL or TLS protocols. By default | ||
132 | the initial handshake uses a method which should be compatible with all | ||
133 | servers and permit them to use SSL v3, SSL v2 or TLS as appropriate. | ||
134 | |||
135 | Unfortunately there are a lot of ancient and broken servers in use which | ||
136 | cannot handle this technique and will fail to connect. Some servers only | ||
137 | work if TLS is turned off with the B<-no_tls> option others will only | ||
138 | support SSL v2 and may need the B<-ssl2> option. | ||
139 | |||
140 | =item B<-bugs> | ||
141 | |||
142 | there are several known bug in SSL and TLS implementations. Adding this | ||
143 | option enables various workarounds. | ||
144 | |||
145 | =item B<-cipher cipherlist> | ||
146 | |||
147 | this allows the cipher list sent by the client to be modified. Although | ||
148 | the server determines which cipher suite is used it should take the first | ||
149 | supported cipher in the list sent by the client. See the B<ciphers> | ||
150 | command for more information. | ||
151 | |||
152 | =back | ||
153 | |||
154 | =head1 CONNECTED COMMANDS | ||
155 | |||
156 | If a connection is established with an SSL server then any data received | ||
157 | from the server is displayed and any key presses will be sent to the | ||
158 | server. If the line begins with an B<R> then the session will be | ||
159 | renegotiated. If the line begins with a B<Q> the connection will be closed | ||
160 | down. | ||
161 | |||
162 | =head1 NOTES | ||
163 | |||
164 | B<s_client> can be used to debug SSL servers. To connect to an SSL HTTP | ||
165 | server the command: | ||
166 | |||
167 | openssl s_client -connect servername:443 | ||
168 | |||
169 | would typically be used (https uses port 443). If the connection succeeds | ||
170 | then an HTTP command can be given such as "GET /" to retrieve a web page. | ||
171 | |||
172 | If the handshake fails then there are several possible causes, if it is | ||
173 | nothing obvious like no client certificate then the B<-bugs>, B<-ssl2>, | ||
174 | B<-ssl3>, B<-tls1>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1> can be tried | ||
175 | in case it is a buggy server. In particular you should play with these | ||
176 | options B<before> submitting a bug report to an OpenSSL mailing list. | ||
177 | |||
178 | A frequent problem when attempting to get client certificates working | ||
179 | is that a web client complains it has no certificates or gives an empty | ||
180 | list to choose from. This is normally because the server is not sending | ||
181 | the clients certificate authority in its "acceptable CA list" when it | ||
182 | requests a certificate. By using B<s_client> the CA list can be viewed | ||
183 | and checked. However some servers only request client authentication | ||
184 | after a specific URL is requested. To obtain the list in this case it | ||
185 | is necessary to use the B<-prexit> command and send an HTTP request | ||
186 | for an appropriate page. | ||
187 | |||
188 | If a certificate is specified on the command line using the B<-cert> | ||
189 | option it will not be used unless the server specifically requests | ||
190 | a client certificate. Therefor merely including a client certificate | ||
191 | on the command line is no guarantee that the certificate works. | ||
192 | |||
193 | If there are problems verifying a server certificate then the | ||
194 | B<-showcerts> option can be used to show the whole chain. | ||
195 | |||
196 | =head1 BUGS | ||
197 | |||
198 | Because this program has a lot of options and also because some of | ||
199 | the techniques used are rather old, the C source of s_client is rather | ||
200 | hard to read and not a model of how things should be done. A typical | ||
201 | SSL client program would be much simpler. | ||
202 | |||
203 | The B<-verify> option should really exit if the server verification | ||
204 | fails. | ||
205 | |||
206 | The B<-prexit> option is a bit of a hack. We should really report | ||
207 | information whenever a session is renegotiated. | ||
208 | |||
209 | =head1 SEE ALSO | ||
210 | |||
211 | L<sess_id(1)|sess_id(1)>, L<s_server(1)|s_server(1)>, L<ciphers(1)|ciphers(1)> | ||
212 | |||
213 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/s_server.pod b/src/lib/libssl/src/doc/apps/s_server.pod new file mode 100644 index 0000000000..0f29c361d9 --- /dev/null +++ b/src/lib/libssl/src/doc/apps/s_server.pod | |||
@@ -0,0 +1,265 @@ | |||
1 | |||
2 | =pod | ||
3 | |||
4 | =head1 NAME | ||
5 | |||
6 | s_server - SSL/TLS server program | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | B<openssl> B<s_client> | ||
11 | [B<-accept port>] | ||
12 | [B<-context id>] | ||
13 | [B<-verify depth>] | ||
14 | [B<-Verify depth>] | ||
15 | [B<-cert filename>] | ||
16 | [B<-key keyfile>] | ||
17 | [B<-dcert filename>] | ||
18 | [B<-dkey keyfile>] | ||
19 | [B<-dhparam filename>] | ||
20 | [B<-nbio>] | ||
21 | [B<-nbio_test>] | ||
22 | [B<-crlf>] | ||
23 | [B<-debug>] | ||
24 | [B<-state>] | ||
25 | [B<-CApath directory>] | ||
26 | [B<-CAfile filename>] | ||
27 | [B<-nocert>] | ||
28 | [B<-cipher cipherlist>] | ||
29 | [B<-quiet>] | ||
30 | [B<-no_tmp_rsa>] | ||
31 | [B<-ssl2>] | ||
32 | [B<-ssl3>] | ||
33 | [B<-tls1>] | ||
34 | [B<-no_ssl2>] | ||
35 | [B<-no_ssl3>] | ||
36 | [B<-no_tls1>] | ||
37 | [B<-no_dhe>] | ||
38 | [B<-bugs>] | ||
39 | [B<-hack>] | ||
40 | [B<-www>] | ||
41 | [B<-WWW>] | ||
42 | |||
43 | =head1 DESCRIPTION | ||
44 | |||
45 | The B<s_server> command implements a generic SSL/TLS server which listens | ||
46 | for connections on a given port using SSL/TLS. | ||
47 | |||
48 | =head1 OPTIONS | ||
49 | |||
50 | =over 4 | ||
51 | |||
52 | =item B<-accept port> | ||
53 | |||
54 | the TCP port to listen on for connections. If not specified 4433 is used. | ||
55 | |||
56 | =item B<-context id> | ||
57 | |||
58 | sets the SSL context id. It can be given any string value. If this option | ||
59 | is not present a default value will be used. | ||
60 | |||
61 | =item B<-cert certname> | ||
62 | |||
63 | The certificate to use, most servers cipher suites require the use of a | ||
64 | certificate and some require a certificate with a certain public key type: | ||
65 | for example the DSS cipher suites require a certificate containing a DSS | ||
66 | (DSA) key. If not specified then the filename "server.pem" will be used. | ||
67 | |||
68 | =item B<-key keyfile> | ||
69 | |||
70 | The private key to use. If not specified then the certificate file will | ||
71 | be used. | ||
72 | |||
73 | =item B<-dcert filename>, B<-dkey keyname> | ||
74 | |||
75 | specify an additional certificate and private key, these behave in the | ||
76 | same manner as the B<-cert> and B<-key> options except there is no default | ||
77 | if they are not specified (no additional certificate and key is used). As | ||
78 | noted above some cipher suites require a certificate containing a key of | ||
79 | a certain type. Some cipher suites need a certificate carrying an RSA key | ||
80 | and some a DSS (DSA) key. By using RSA and DSS certificates and keys | ||
81 | a server can support clients which only support RSA or DSS cipher suites | ||
82 | by using an appropriate certificate. | ||
83 | |||
84 | =item B<-nocert> | ||
85 | |||
86 | if this option is set then no certificate is used. This restricts the | ||
87 | cipher suites available to the anonymous ones (currently just anonymous | ||
88 | DH). | ||
89 | |||
90 | =item B<-dhparam filename> | ||
91 | |||
92 | the DH parameter file to use. The ephemeral DH cipher suites generate keys | ||
93 | using a set of DH parameters. If not specified then an attempt is made to | ||
94 | load the parameters from the server certificate file. If this fails then | ||
95 | a static set of parameters hard coded into the s_server program will be used. | ||
96 | |||
97 | =item B<-nodhe> | ||
98 | |||
99 | if this option is set then no DH parameters will be loaded effectively | ||
100 | disabling the ephemeral DH cipher suites. | ||
101 | |||
102 | =item B<-no_tmp_rsa> | ||
103 | |||
104 | certain export cipher suites sometimes use a temporary RSA key, this option | ||
105 | disables temporary RSA key generation. | ||
106 | |||
107 | =item B<-verify depth>, B<-Verify depth> | ||
108 | |||
109 | The verify depth to use. This specifies the maximum length of the | ||
110 | client certificate chain and makes the server request a certificate from | ||
111 | the client. With the B<-verify> option a certificate is requested but the | ||
112 | client does not have to send one, with the B<-Verify> option the client | ||
113 | must supply a certificate or an error occurs. | ||
114 | |||
115 | =item B<-CApath directory> | ||
116 | |||
117 | The directory to use for client certificate verification. This directory | ||
118 | must be in "hash format", see B<verify> for more information. These are | ||
119 | also used when building the server certificate chain. | ||
120 | |||
121 | =item B<-CAfile file> | ||
122 | |||
123 | A file containing trusted certificates to use during client authentication | ||
124 | and to use when attempting to build the server certificate chain. The list | ||
125 | is also used in the list of acceptable client CAs passed to the client when | ||
126 | a certificate is requested. | ||
127 | |||
128 | =item B<-state> | ||
129 | |||
130 | prints out the SSL session states. | ||
131 | |||
132 | =item B<-debug> | ||
133 | |||
134 | print extensive debugging information including a hex dump of all traffic. | ||
135 | |||
136 | =item B<-nbio_test> | ||
137 | |||
138 | tests non blocking I/O | ||
139 | |||
140 | =item B<-nbio> | ||
141 | |||
142 | turns on non blocking I/O | ||
143 | |||
144 | =item B<-crlf> | ||
145 | |||
146 | this option translated a line feed from the terminal into CR+LF. | ||
147 | |||
148 | =item B<-quiet> | ||
149 | |||
150 | inhibit printing of session and certificate information. | ||
151 | |||
152 | =item B<-ssl2>, B<-ssl3>, B<-tls1>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1> | ||
153 | |||
154 | these options disable the use of certain SSL or TLS protocols. By default | ||
155 | the initial handshake uses a method which should be compatible with all | ||
156 | servers and permit them to use SSL v3, SSL v2 or TLS as appropriate. | ||
157 | |||
158 | =item B<-bugs> | ||
159 | |||
160 | there are several known bug in SSL and TLS implementations. Adding this | ||
161 | option enables various workarounds. | ||
162 | |||
163 | =item B<-hack> | ||
164 | |||
165 | this option enables a further workaround for some some early Netscape | ||
166 | SSL code (?). | ||
167 | |||
168 | =item B<-cipher cipherlist> | ||
169 | |||
170 | this allows the cipher list used by the server to be modified. When | ||
171 | the client sends a list of supported ciphers the first client cipher | ||
172 | also included in the server list is used. Because the client specifies | ||
173 | the preference order, the order of the server cipherlist irrelevant. See | ||
174 | the B<ciphers> command for more information. | ||
175 | |||
176 | =item B<-www> | ||
177 | |||
178 | sends a status message back to the client when it connects. This includes | ||
179 | lots of information about the ciphers used and various session parameters. | ||
180 | The output is in HTML format so this option will normally be used with a | ||
181 | web browser. | ||
182 | |||
183 | =item B<-WWW> | ||
184 | |||
185 | 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 | requested the file ./page.html will be loaded. | ||
188 | |||
189 | =back | ||
190 | |||
191 | =head1 CONNECTED COMMANDS | ||
192 | |||
193 | If a connection request is established with an SSL client and neither the | ||
194 | B<-www> nor the B<-WWW> option has been used then normally any data received | ||
195 | from the client is displayed and any key presses will be sent to the client. | ||
196 | |||
197 | Certain single letter commands are also recognized which perform special | ||
198 | operations: these are listed below. | ||
199 | |||
200 | =over 4 | ||
201 | |||
202 | =item B<q> | ||
203 | |||
204 | end the current SSL connection but still accept new connections. | ||
205 | |||
206 | =item B<Q> | ||
207 | |||
208 | end the current SSL connection and exit. | ||
209 | |||
210 | =item B<r> | ||
211 | |||
212 | renegotiate the SSL session. | ||
213 | |||
214 | =item B<R> | ||
215 | |||
216 | renegotiate the SSL session and request a client certificate. | ||
217 | |||
218 | =item B<P> | ||
219 | |||
220 | send some plain text down the underlying TCP connection: this should | ||
221 | cause the client to disconnect due to a protocol violation. | ||
222 | |||
223 | =item B<S> | ||
224 | |||
225 | print out some session cache status information. | ||
226 | |||
227 | =back | ||
228 | |||
229 | =head1 NOTES | ||
230 | |||
231 | B<s_server> can be used to debug SSL clients. To accept connections from | ||
232 | a web browser the command: | ||
233 | |||
234 | openssl s_server -accept 443 -www | ||
235 | |||
236 | can be used for example. | ||
237 | |||
238 | Most web browsers (in particular Netscape and MSIE) only support RSA cipher | ||
239 | suites, so they cannot connect to servers which don't use a certificate | ||
240 | carrying an RSA key or a version of OpenSSL with RSA disabled. | ||
241 | |||
242 | Although specifying an empty list of CAs when requesting a client certificate | ||
243 | is strictly speaking a protocol violation, some SSL clients interpret this to | ||
244 | mean any CA is acceptable. This is useful for debugging purposes. | ||
245 | |||
246 | The session parameters can printed out using the B<sess_id> program. | ||
247 | |||
248 | =head1 BUGS | ||
249 | |||
250 | Because this program has a lot of options and also because some of | ||
251 | the techniques used are rather old, the C source of s_server is rather | ||
252 | hard to read and not a model of how things should be done. A typical | ||
253 | SSL server program would be much simpler. | ||
254 | |||
255 | The output of common ciphers is wrong: it just gives the list of ciphers that | ||
256 | OpenSSL recognizes and the client supports. | ||
257 | |||
258 | There should be a way for the B<s_server> program to print out details of any | ||
259 | unknown cipher suites a client says it supports. | ||
260 | |||
261 | =head1 SEE ALSO | ||
262 | |||
263 | L<sess_id(1)|sess_id(1)>, L<s_client(1)|s_client(1)>, L<ciphers(1)|ciphers(1)> | ||
264 | |||
265 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/sess_id.pod b/src/lib/libssl/src/doc/apps/sess_id.pod new file mode 100644 index 0000000000..9988d2cd3d --- /dev/null +++ b/src/lib/libssl/src/doc/apps/sess_id.pod | |||
@@ -0,0 +1,151 @@ | |||
1 | |||
2 | =pod | ||
3 | |||
4 | =head1 NAME | ||
5 | |||
6 | sess_id - SSL/TLS session handling utility | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | B<openssl> B<sess_id> | ||
11 | [B<-inform PEM|DER>] | ||
12 | [B<-outform PEM|DER>] | ||
13 | [B<-in filename>] | ||
14 | [B<-out filename>] | ||
15 | [B<-text>] | ||
16 | [B<-noout>] | ||
17 | [B<-context ID>] | ||
18 | |||
19 | =head1 DESCRIPTION | ||
20 | |||
21 | The B<sess_id> process the encoded version of the SSL session structure | ||
22 | and optionally prints out SSL session details (for example the SSL session | ||
23 | master key) in human readable format. Since this is a diagnostic tool that | ||
24 | needs some knowledge of the SSL protocol to use properly, most users will | ||
25 | not need to use it. | ||
26 | |||
27 | =over 4 | ||
28 | |||
29 | =item B<-inform DER|PEM> | ||
30 | |||
31 | This specifies the input format. The B<DER> option uses an ASN1 DER encoded | ||
32 | format containing session details. The precise format can vary from one version | ||
33 | to the next. The B<PEM> form is the default format: it consists of the B<DER> | ||
34 | format base64 encoded with additional header and footer lines. | ||
35 | |||
36 | =item B<-outform DER|PEM> | ||
37 | |||
38 | This specifies the output format, the options have the same meaning as the | ||
39 | B<-inform> option. | ||
40 | |||
41 | =item B<-in filename> | ||
42 | |||
43 | This specifies the input filename to read session information from or standard | ||
44 | input by default. | ||
45 | |||
46 | =item B<-out filename> | ||
47 | |||
48 | This specifies the output filename to write session information to or standard | ||
49 | output if this option is not specified. | ||
50 | |||
51 | =item B<-text> | ||
52 | |||
53 | prints out the various public or private key components in | ||
54 | plain text in addition to the encoded version. | ||
55 | |||
56 | =item B<-cert> | ||
57 | |||
58 | if a certificate is present in the session it will be output using this option, | ||
59 | if the B<-text> option is also present then it will be printed out in text form. | ||
60 | |||
61 | =item B<-noout> | ||
62 | |||
63 | this option prevents output of the encoded version of the session. | ||
64 | |||
65 | =item B<-context ID> | ||
66 | |||
67 | this option can set the session id so the output session information uses the | ||
68 | supplied ID. The ID can be any string of characters. This option wont normally | ||
69 | be used. | ||
70 | |||
71 | =back | ||
72 | |||
73 | =head1 OUTPUT | ||
74 | |||
75 | Typical output: | ||
76 | |||
77 | SSL-Session: | ||
78 | Protocol : TLSv1 | ||
79 | Cipher : 0016 | ||
80 | Session-ID: 871E62626C554CE95488823752CBD5F3673A3EF3DCE9C67BD916C809914B40ED | ||
81 | Session-ID-ctx: 01000000 | ||
82 | Master-Key: A7CEFC571974BE02CAC305269DC59F76EA9F0B180CB6642697A68251F2D2BB57E51DBBB4C7885573192AE9AEE220FACD | ||
83 | Key-Arg : None | ||
84 | Start Time: 948459261 | ||
85 | Timeout : 300 (sec) | ||
86 | Verify return code 0 (ok) | ||
87 | |||
88 | Theses are described below in more detail. | ||
89 | |||
90 | =over 4 | ||
91 | |||
92 | =item B<Protocol> | ||
93 | |||
94 | this is the protocol in use TLSv1, SSLv3 or SSLv2. | ||
95 | |||
96 | =item B<Cipher> | ||
97 | |||
98 | the cipher used this is the actual raw SSL or TLS cipher code, see the SSL | ||
99 | or TLS specifications for more information. | ||
100 | |||
101 | =item B<Session-ID> | ||
102 | |||
103 | the SSL session ID in hex format. | ||
104 | |||
105 | =item B<Session-ID-ctx> | ||
106 | |||
107 | the session ID context in hex format. | ||
108 | |||
109 | =item B<Master-Key> | ||
110 | |||
111 | this is the SSL session master key. | ||
112 | |||
113 | =item B<Key-Arg> | ||
114 | |||
115 | the key argument, this is only used in SSL v2. | ||
116 | |||
117 | =item B<Start Time> | ||
118 | |||
119 | this is the session start time represented as an integer in standard Unix format. | ||
120 | |||
121 | =item B<Timeout> | ||
122 | |||
123 | the timeout in seconds. | ||
124 | |||
125 | =item B<Verify return code> | ||
126 | |||
127 | this is the return code when an SSL client certificate is verified. | ||
128 | |||
129 | =back | ||
130 | |||
131 | =head1 NOTES | ||
132 | |||
133 | The PEM encoded session format uses the header and footer lines: | ||
134 | |||
135 | -----BEGIN SSL SESSION PARAMETERS----- | ||
136 | -----END SSL SESSION PARAMETERS----- | ||
137 | |||
138 | Since the SSL session output contains the master key it is possible to read the contents | ||
139 | of an encrypted session using this information. Therefore appropriate security precautions | ||
140 | should be taken if the information is being output by a "real" application. This is | ||
141 | however strongly discouraged and should only be used for debugging purposes. | ||
142 | |||
143 | =head1 BUGS | ||
144 | |||
145 | The cipher and start time should be printed out in human readable form. | ||
146 | |||
147 | =head1 SEE ALSO | ||
148 | |||
149 | L<ciphers(1)|ciphers(1)>, L<s_server(1)|s_server(1)> | ||
150 | |||
151 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/smime.pod b/src/lib/libssl/src/doc/apps/smime.pod new file mode 100644 index 0000000000..631ecdc241 --- /dev/null +++ b/src/lib/libssl/src/doc/apps/smime.pod | |||
@@ -0,0 +1,325 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | smime - S/MIME utility | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<openssl> B<smime> | ||
10 | [B<-encrypt>] | ||
11 | [B<-decrypt>] | ||
12 | [B<-sign>] | ||
13 | [B<-verify>] | ||
14 | [B<-pk7out>] | ||
15 | [B<-des>] | ||
16 | [B<-des3>] | ||
17 | [B<-rc2-40>] | ||
18 | [B<-rc2-64>] | ||
19 | [B<-rc2-128>] | ||
20 | [B<-in file>] | ||
21 | [B<-certfile file>] | ||
22 | [B<-signer file>] | ||
23 | [B<-recip file>] | ||
24 | [B<-in file>] | ||
25 | [B<-inkey file>] | ||
26 | [B<-out file>] | ||
27 | [B<-to addr>] | ||
28 | [B<-from ad>] | ||
29 | [B<-subject s>] | ||
30 | [B<-text>] | ||
31 | [B<-rand file(s)>] | ||
32 | [cert.pem]... | ||
33 | |||
34 | =head1 DESCRIPTION | ||
35 | |||
36 | The B<smime> command handles S/MIME mail. It can encrypt, decrypt, sign and | ||
37 | verify S/MIME messages. | ||
38 | |||
39 | =head1 COMMAND OPTIONS | ||
40 | |||
41 | There are five operation options that set the type of operation to be performed. | ||
42 | The meaning of the other options varies according to the operation type. | ||
43 | |||
44 | =over 4 | ||
45 | |||
46 | =item B<-encrypt> | ||
47 | |||
48 | encrypt mail for the given recipient certificates. Input file is the message | ||
49 | to be encrypted. The output file is the encrypted mail in MIME format. | ||
50 | |||
51 | =item B<-decrypt> | ||
52 | |||
53 | decrypt mail using the supplied certificate and private key. Expects an | ||
54 | encrypted mail message in MIME format for the input file. The decrypted mail | ||
55 | is written to the output file. | ||
56 | |||
57 | =item B<-sign> | ||
58 | |||
59 | sign mail using the supplied certificate and private key. Input file is | ||
60 | the message to be signed. The signed message in MIME format is written | ||
61 | to the output file. | ||
62 | |||
63 | =item B<-verify> | ||
64 | |||
65 | verify signed mail. Expects a signed mail message on input and outputs | ||
66 | the signed data. Both clear text and opaque signing is supported. | ||
67 | |||
68 | =item B<-pk7out> | ||
69 | |||
70 | takes an input message and writes out a PEM encoded PKCS#7 structure. | ||
71 | |||
72 | =item B<-in filename> | ||
73 | |||
74 | the input message to be encrypted or signed or the MIME message to | ||
75 | be decrypted or verified. | ||
76 | |||
77 | =item B<-out filename> | ||
78 | |||
79 | the message text that has been decrypted or verified or the output MIME | ||
80 | format message that has been signed or verified. | ||
81 | |||
82 | =item B<-text> | ||
83 | |||
84 | this option adds plain text (text/plain) MIME headers to the supplied | ||
85 | message if encrypting or signing. If decrypting or verifying it strips | ||
86 | off text headers: if the decrypted or verified message is not of MIME | ||
87 | type text/plain then an error occurs. | ||
88 | |||
89 | =item B<-CAfile file> | ||
90 | |||
91 | a file containing trusted CA certificates, only used with B<-verify>. | ||
92 | |||
93 | =item B<-CApath dir> | ||
94 | |||
95 | a directory containing trusted CA certificates, only used with | ||
96 | B<-verify>. This directory must be a standard certificate directory: that | ||
97 | is a hash of each subject name (using B<x509 -hash>) should be linked | ||
98 | to each certificate. | ||
99 | |||
100 | =item B<-des -des3 -rc2-40 -rc2-64 -rc2-128> | ||
101 | |||
102 | the encryption algorithm to use. DES (56 bits), triple DES (168 bits) | ||
103 | or 40, 64 or 128 bit RC2 respectively if not specified 40 bit RC2 is | ||
104 | used. Only used with B<-encrypt>. | ||
105 | |||
106 | =item B<-nointern> | ||
107 | |||
108 | when verifying a message normally certificates (if any) included in | ||
109 | the message are searched for the signing certificate. With this option | ||
110 | only the certificates specified in the B<-certfile> option are used. | ||
111 | The supplied certificates can still be used as untrusted CAs however. | ||
112 | |||
113 | =item B<-noverify> | ||
114 | |||
115 | do not verify the signers certificate of a signed message. | ||
116 | |||
117 | =item B<-nochain> | ||
118 | |||
119 | do not do chain verification of signers certificates: that is don't | ||
120 | use the certificates in the signed message as untrusted CAs. | ||
121 | |||
122 | =item B<-nosigs> | ||
123 | |||
124 | don't try to verify the signatures on the message. | ||
125 | |||
126 | =item B<-nocerts> | ||
127 | |||
128 | when signing a message the signer's certificate is normally included | ||
129 | with this option it is excluded. This will reduce the size of the | ||
130 | signed message but the verifier must have a copy of the signers certificate | ||
131 | available locally (passed using the B<-certfile> option for example). | ||
132 | |||
133 | =item B<-noattr> | ||
134 | |||
135 | normally when a message is signed a set of attributes are included which | ||
136 | include the signing time and supported symmetric algorithms. With this | ||
137 | option they are not included. | ||
138 | |||
139 | =item B<-binary> | ||
140 | |||
141 | normally the input message is converted to "canonical" format which is | ||
142 | effectively using CR and LF as end of line: as required by the S/MIME | ||
143 | specification. When this option is present no translation occurs. This | ||
144 | is useful when handling binary data which may not be in MIME format. | ||
145 | |||
146 | =item B<-nodetach> | ||
147 | |||
148 | when signing a message use opaque signing: this form is more resistant | ||
149 | to translation by mail relays but it cannot be read by mail agents that | ||
150 | do not support S/MIME. Without this option cleartext signing with | ||
151 | the MIME type multipart/signed is used. | ||
152 | |||
153 | =item B<-certfile file> | ||
154 | |||
155 | allows additional certificates to be specified. When signing these will | ||
156 | be included with the message. When verifying these will be searched for | ||
157 | the signers certificates. The certificates should be in PEM format. | ||
158 | |||
159 | =item B<-signer file> | ||
160 | |||
161 | the signers certificate when signing a message. If a message is | ||
162 | being verified then the signers certificates will be written to this | ||
163 | file if the verification was successful. | ||
164 | |||
165 | =item B<-recip file> | ||
166 | |||
167 | the recipients certificate when decrypting a message. This certificate | ||
168 | must match one of the recipients of the message or an error occurs. | ||
169 | |||
170 | =item B<-inkey file> | ||
171 | |||
172 | the private key to use when signing or decrypting. This must match the | ||
173 | corresponding certificate. If this option is not specified then the | ||
174 | private key must be included in the certificate file specified with | ||
175 | the B<-recip> or B<-signer> file. | ||
176 | |||
177 | =item B<-rand file(s)> | ||
178 | |||
179 | 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)>). | ||
181 | 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 | ||
183 | all others. | ||
184 | |||
185 | =item B<cert.pem...> | ||
186 | |||
187 | one or more certificates of message recipients: used when encrypting | ||
188 | a message. | ||
189 | |||
190 | =item B<-to, -from, -subject> | ||
191 | |||
192 | the relevant mail headers. These are included outside the signed | ||
193 | portion of a message so they may be included manually. If signing | ||
194 | then many S/MIME mail clients check the signers certificate's email | ||
195 | address matches that specified in the From: address. | ||
196 | |||
197 | =back | ||
198 | |||
199 | =head1 NOTES | ||
200 | |||
201 | The MIME message must be sent without any blank lines between the | ||
202 | headers and the output. Some mail programs will automatically add | ||
203 | a blank line. Piping the mail directly to sendmail is one way to | ||
204 | achieve the correct format. | ||
205 | |||
206 | The supplied message to be signed or encrypted must include the | ||
207 | 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 | ||
209 | add plain text headers. | ||
210 | |||
211 | A "signed and encrypted" message is one where a signed message is | ||
212 | then encrypted. This can be produced by encrypting an already signed | ||
213 | message: see the examples section. | ||
214 | |||
215 | This version of the program only allows one signer per message but it | ||
216 | will verify multiple signers on received messages. Some S/MIME clients | ||
217 | choke if a message contains multiple signers. It is possible to sign | ||
218 | messages "in parallel" by signing an already signed message. | ||
219 | |||
220 | The options B<-encrypt> and B<-decrypt> reflect common usage in S/MIME | ||
221 | clients. Strictly speaking these process PKCS#7 enveloped data: PKCS#7 | ||
222 | encrypted data is used for other purposes. | ||
223 | |||
224 | =head1 EXIT CODES | ||
225 | |||
226 | =over 4 | ||
227 | |||
228 | =item 0 | ||
229 | |||
230 | the operation was completely successfully. | ||
231 | |||
232 | =item 1 | ||
233 | |||
234 | an error occurred parsing the command options. | ||
235 | |||
236 | =item 2 | ||
237 | |||
238 | one of the input files could not be read. | ||
239 | |||
240 | =item 3 | ||
241 | |||
242 | an error occurred creating the PKCS#7 file or when reading the MIME | ||
243 | message. | ||
244 | |||
245 | =item 4 | ||
246 | |||
247 | an error occurred decrypting or verifying the message. | ||
248 | |||
249 | =item 5 | ||
250 | |||
251 | the message was verified correctly but an error occurred writing out | ||
252 | the signers certificates. | ||
253 | |||
254 | =back | ||
255 | |||
256 | =head1 EXAMPLES | ||
257 | |||
258 | Create a cleartext signed message: | ||
259 | |||
260 | openssl smime -sign -in message.txt -text -out mail.msg \ | ||
261 | -signer mycert.pem | ||
262 | |||
263 | Create and opaque signed message | ||
264 | |||
265 | openssl smime -sign -in message.txt -text -out mail.msg -nodetach \ | ||
266 | -signer mycert.pem | ||
267 | |||
268 | Create a signed message, include some additional certificates and | ||
269 | read the private key from another file: | ||
270 | |||
271 | openssl smime -sign -in in.txt -text -out mail.msg \ | ||
272 | -signer mycert.pem -inkey mykey.pem -certfile mycerts.pem | ||
273 | |||
274 | Send a signed message under Unix directly to sendmail, including headers: | ||
275 | |||
276 | openssl smime -sign -in in.txt -text -signer mycert.pem \ | ||
277 | -from steve@openssl.org -to someone@somewhere \ | ||
278 | -subject "Signed message" | sendmail someone@somewhere | ||
279 | |||
280 | Verify a message and extract the signer's certificate if successful: | ||
281 | |||
282 | openssl smime -verify -in mail.msg -signer user.pem -out signedtext.txt | ||
283 | |||
284 | Send encrypted mail using triple DES: | ||
285 | |||
286 | openssl smime -encrypt -in in.txt -from steve@openssl.org \ | ||
287 | -to someone@somewhere -subject "Encrypted message" \ | ||
288 | -des3 user.pem -out mail.msg | ||
289 | |||
290 | Sign and encrypt mail: | ||
291 | |||
292 | openssl smime -sign -in ml.txt -signer my.pem -text \ | ||
293 | | openssl -encrypt -out mail.msg \ | ||
294 | -from steve@openssl.org -to someone@somewhere \ | ||
295 | -subject "Signed and Encrypted message" -des3 user.pem | ||
296 | |||
297 | Note: the encryption command does not include the B<-text> option because the message | ||
298 | being encrypted already has MIME headers. | ||
299 | |||
300 | Decrypt mail: | ||
301 | |||
302 | openssl smime -decrypt -in mail.msg -recip mycert.pem -inkey key.pem | ||
303 | |||
304 | =head1 BUGS | ||
305 | |||
306 | The MIME parser isn't very clever: it seems to handle most messages that I've thrown | ||
307 | at it but it may choke on others. | ||
308 | |||
309 | The code currently will only write out the signer's certificate to a file: if the | ||
310 | signer has a separate encryption certificate this must be manually extracted. There | ||
311 | should be some heuristic that determines the correct encryption certificate. | ||
312 | |||
313 | Ideally a database should be maintained of a certificates for each email address. | ||
314 | |||
315 | The code doesn't currently take note of the permitted symmetric encryption | ||
316 | algorithms as supplied in the SMIMECapabilities signed attribute. this means the | ||
317 | user has to manually include the correct encryption algorithm. It should store | ||
318 | the list of permitted ciphers in a database and only use those. | ||
319 | |||
320 | No revocation checking is done on the signer's certificate. | ||
321 | |||
322 | The current code can only handle S/MIME v2 messages, the more complex S/MIME v3 | ||
323 | structures may cause parsing errors. | ||
324 | |||
325 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/speed.pod b/src/lib/libssl/src/doc/apps/speed.pod new file mode 100644 index 0000000000..fecd9a994d --- /dev/null +++ b/src/lib/libssl/src/doc/apps/speed.pod | |||
@@ -0,0 +1,45 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | speed - test library performance | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<openssl speed> | ||
10 | [B<md2>] | ||
11 | [B<mdc2>] | ||
12 | [B<md5>] | ||
13 | [B<hmac>] | ||
14 | [B<sha1>] | ||
15 | [B<rmd160>] | ||
16 | [B<idea-cbc>] | ||
17 | [B<rc2-cbc>] | ||
18 | [B<rc5-cbc>] | ||
19 | [B<bf-cbc>] | ||
20 | [B<des-cbc>] | ||
21 | [B<des-ede3>] | ||
22 | [B<rc4>] | ||
23 | [B<rsa512>] | ||
24 | [B<rsa1024>] | ||
25 | [B<rsa2048>] | ||
26 | [B<rsa4096>] | ||
27 | [B<dsa512>] | ||
28 | [B<dsa1024>] | ||
29 | [B<dsa2048>] | ||
30 | [B<idea>] | ||
31 | [B<rc2>] | ||
32 | [B<des>] | ||
33 | [B<rsa>] | ||
34 | [B<blowfish>] | ||
35 | |||
36 | =head1 DESCRIPTION | ||
37 | |||
38 | This command is used to test the performance of cryptographic algorithms. | ||
39 | |||
40 | =head1 OPTIONS | ||
41 | |||
42 | If an option is given, B<speed> test that algorithm, otherwise all of | ||
43 | the above are tested. | ||
44 | |||
45 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/spkac.pod b/src/lib/libssl/src/doc/apps/spkac.pod new file mode 100644 index 0000000000..bb84dfbe33 --- /dev/null +++ b/src/lib/libssl/src/doc/apps/spkac.pod | |||
@@ -0,0 +1,127 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | spkac - SPKAC printing and generating utility | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<openssl> B<spkac> | ||
10 | [B<-in filename>] | ||
11 | [B<-out filename>] | ||
12 | [B<-key keyfile>] | ||
13 | [B<-passin arg>] | ||
14 | [B<-challenge string>] | ||
15 | [B<-pubkey>] | ||
16 | [B<-spkac spkacname>] | ||
17 | [B<-spksect section>] | ||
18 | [B<-noout>] | ||
19 | [B<-verify>] | ||
20 | |||
21 | |||
22 | =head1 DESCRIPTION | ||
23 | |||
24 | The B<spkac> command processes Netscape signed public key and challenge | ||
25 | (SPKAC) files. It can print out their contents, verify the signature and | ||
26 | produce its own SPKACs from a supplied private key. | ||
27 | |||
28 | =head1 COMMAND OPTIONS | ||
29 | |||
30 | =over 4 | ||
31 | |||
32 | =item B<-in filename> | ||
33 | |||
34 | This specifies the input filename to read from or standard input if this | ||
35 | option is not specified. Ignored if the B<-key> option is used. | ||
36 | |||
37 | =item B<-out filename> | ||
38 | |||
39 | specifies the output filename to write to or standard output by | ||
40 | default. | ||
41 | |||
42 | =item B<-key keyfile> | ||
43 | |||
44 | create an SPKAC file using the private key in B<keyfile>. The | ||
45 | B<-in>, B<-noout>, B<-spksect> and B<-verify> options are ignored if | ||
46 | present. | ||
47 | |||
48 | =item B<-passin password> | ||
49 | |||
50 | the input file password source. For more information about the format of B<arg> | ||
51 | see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. | ||
52 | |||
53 | =item B<-challenge string> | ||
54 | |||
55 | specifies the challenge string if an SPKAC is being created. | ||
56 | |||
57 | =item B<-spkac spkacname> | ||
58 | |||
59 | allows an alternative name form the variable containing the | ||
60 | SPKAC. The default is "SPKAC". This option affects both | ||
61 | generated and input SPKAC files. | ||
62 | |||
63 | =item B<-spksect section> | ||
64 | |||
65 | allows an alternative name form the section containing the | ||
66 | SPKAC. The default is the default section. | ||
67 | |||
68 | =item B<-noout> | ||
69 | |||
70 | don't output the text version of the SPKAC (not used if an | ||
71 | SPKAC is being created). | ||
72 | |||
73 | =item B<-pubkey> | ||
74 | |||
75 | output the public key of an SPKAC (not used if an SPKAC is | ||
76 | being created). | ||
77 | |||
78 | =item B<-verify> | ||
79 | |||
80 | verifies the digital signature on the supplied SPKAC. | ||
81 | |||
82 | |||
83 | =back | ||
84 | |||
85 | =head1 EXAMPLES | ||
86 | |||
87 | Print out the contents of an SPKAC: | ||
88 | |||
89 | openssl spkac -in spkac.cnf | ||
90 | |||
91 | Verify the signature of an SPKAC: | ||
92 | |||
93 | openssl spkac -in spkac.cnf -noout -verify | ||
94 | |||
95 | Create an SPKAC using the challenge string "hello": | ||
96 | |||
97 | openssl spkac -key key.pem -challenge hello -out spkac.cnf | ||
98 | |||
99 | Example of an SPKAC, (long lines split up for clarity): | ||
100 | |||
101 | SPKAC=MIG5MGUwXDANBgkqhkiG9w0BAQEFAANLADBIAkEA1cCoq2Wa3Ixs47uI7F\ | ||
102 | PVwHVIPDx5yso105Y6zpozam135a8R0CpoRvkkigIyXfcCjiVi5oWk+6FfPaD03u\ | ||
103 | PFoQIDAQABFgVoZWxsbzANBgkqhkiG9w0BAQQFAANBAFpQtY/FojdwkJh1bEIYuc\ | ||
104 | 2EeM2KHTWPEepWYeawvHD0gQ3DngSC75YCWnnDdq+NQ3F+X4deMx9AaEglZtULwV\ | ||
105 | 4= | ||
106 | |||
107 | =head1 NOTES | ||
108 | |||
109 | A created SPKAC with suitable DN components appended can be fed into | ||
110 | the B<ca> utility. | ||
111 | |||
112 | SPKACs are typically generated by Netscape when a form is submitted | ||
113 | containing the B<KEYGEN> tag as part of the certificate enrollment | ||
114 | process. | ||
115 | |||
116 | The challenge string permits a primitive form of proof of possession | ||
117 | of private key. By checking the SPKAC signature and a random challenge | ||
118 | string some guarantee is given that the user knows the private key | ||
119 | corresponding to the public key being certified. This is important in | ||
120 | some applications. Without this it is possible for a previous SPKAC | ||
121 | to be used in a "replay attack". | ||
122 | |||
123 | =head1 SEE ALSO | ||
124 | |||
125 | L<ca(1)|ca(1)> | ||
126 | |||
127 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/verify.pod b/src/lib/libssl/src/doc/apps/verify.pod new file mode 100644 index 0000000000..4a6572d3b8 --- /dev/null +++ b/src/lib/libssl/src/doc/apps/verify.pod | |||
@@ -0,0 +1,273 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | pkcs7 - PKCS#7 utility | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<openssl> B<verify> | ||
10 | [B<-CApath directory>] | ||
11 | [B<-CAfile file>] | ||
12 | [B<-purpose purpose>] | ||
13 | [B<-untrusted file>] | ||
14 | [B<-help>] | ||
15 | [B<-verbose>] | ||
16 | [B<->] | ||
17 | [certificates] | ||
18 | |||
19 | |||
20 | =head1 DESCRIPTION | ||
21 | |||
22 | The B<verify> command verifies certificate chains. | ||
23 | |||
24 | =head1 COMMAND OPTIONS | ||
25 | |||
26 | =over 4 | ||
27 | |||
28 | =item B<-CApath directory> | ||
29 | |||
30 | A directory of trusted certificates. The certificates should have names | ||
31 | of the form: hash.0 or have symbolic links to them of this | ||
32 | form ("hash" is the hashed certificate subject name: see the B<-hash> option | ||
33 | of the B<x509> utility). Under Unix the B<c_rehash> script will automatically | ||
34 | create symbolic links to a directory of certificates. | ||
35 | |||
36 | =item B<-CAfile file> | ||
37 | |||
38 | A file of trusted certificates. The file should contain multiple certificates | ||
39 | in PEM format concatenated together. | ||
40 | |||
41 | =item B<-untrusted file> | ||
42 | |||
43 | A file of untrusted certificates. The file should contain multiple certificates | ||
44 | |||
45 | =item B<-purpose purpose> | ||
46 | |||
47 | the intended use for the certificate. Without this option no chain verification | ||
48 | will be done. Currently accepted uses are B<sslclient>, B<sslserver>, | ||
49 | B<nssslserver>, B<smimesign>, B<smimeencrypt>. See the B<VERIFY OPERATION> | ||
50 | section for more information. | ||
51 | |||
52 | =item B<-help> | ||
53 | |||
54 | prints out a usage message. | ||
55 | |||
56 | =item B<-verbose> | ||
57 | |||
58 | print extra information about the operations being performed. | ||
59 | |||
60 | =item B<-> | ||
61 | |||
62 | marks the last option. All arguments following this are assumed to be | ||
63 | certificate files. This is useful if the first certificate filename begins | ||
64 | with a B<->. | ||
65 | |||
66 | =item B<certificates> | ||
67 | |||
68 | one or more certificates to verify. If no certificate filenames are included | ||
69 | then an attempt is made to read a certificate from standard input. They should | ||
70 | all be in PEM format. | ||
71 | |||
72 | |||
73 | =back | ||
74 | |||
75 | =head1 VERIFY OPERATION | ||
76 | |||
77 | The B<verify> program uses the same functions as the internal SSL and S/MIME | ||
78 | verification, therefore this description applies to these verify operations | ||
79 | too. | ||
80 | |||
81 | There is one crucial difference between the verify operations performed | ||
82 | by the B<verify> program: wherever possible an attempt is made to continue | ||
83 | after an error whereas normally the verify operation would halt on the | ||
84 | first error. This allows all the problems with a certificate chain to be | ||
85 | determined. | ||
86 | |||
87 | The verify operation consists of a number of separate steps. | ||
88 | |||
89 | 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 | ||
91 | up. The chain is built up by looking up a certificate whose subject name | ||
92 | matches the issuer name of the current certificate. If a certificate is found | ||
93 | whose subject and issuer names are identical it is assumed to be the root CA. | ||
94 | 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 | ||
96 | is always looked up in the trusted certificate list: if the certificate to | ||
97 | verify is a root certificate then an exact match must be found in the trusted | ||
98 | list. | ||
99 | |||
100 | The second operation is to check every untrusted certificate's extensions for | ||
101 | consistency with the supplied purpose. If the B<-purpose> option is not included | ||
102 | then no checks are done. The supplied or "leaf" certificate must have extensions | ||
103 | compatible with the supplied purpose and all other certificates must also be valid | ||
104 | CA certificates. The precise extensions required are described in more detail in | ||
105 | the B<CERTIFICATE EXTENSIONS> section of the B<x509> utility. | ||
106 | |||
107 | The third operation is to check the trust settings on the root CA. The root | ||
108 | CA should be trusted for the supplied purpose. For compatibility with previous | ||
109 | versions of SSLeay and OpenSSL a certificate with no trust settings is considered | ||
110 | to be valid for all purposes. | ||
111 | |||
112 | The final operation is to check the validity of the certificate chain. The validity | ||
113 | period is checked against the current system time and the notBefore and notAfter | ||
114 | dates in the certificate. The certificate signatures are also checked at this | ||
115 | point. | ||
116 | |||
117 | If all operations complete successfully then certificate is considered valid. If | ||
118 | any operation fails then the certificate is not valid. | ||
119 | |||
120 | =head1 DIAGNOSTICS | ||
121 | |||
122 | When a verify operation fails the output messages can be somewhat cryptic. The | ||
123 | general form of the error message is: | ||
124 | |||
125 | server.pem: /C=AU/ST=Queensland/O=CryptSoft Pty Ltd/CN=Test CA (1024 bit) | ||
126 | error 24 at 1 depth lookup:invalid CA certificate | ||
127 | |||
128 | The first line contains the name of the certificate being verified followed by | ||
129 | the subject name of the certificate. The second line contains the error number | ||
130 | and the depth. The depth is number of the certificate being verified when a | ||
131 | problem was detected starting with zero for the certificate being verified itself | ||
132 | then 1 for the CA that signed the certificate and so on. Finally a text version | ||
133 | of the error number is presented. | ||
134 | |||
135 | An exhaustive list of the error codes and messages is shown below, this also | ||
136 | includes the name of the error code as defined in the header file x509_vfy.h | ||
137 | Some of the error codes are defined but never returned: these are described | ||
138 | as "unused". | ||
139 | |||
140 | =over 4 | ||
141 | |||
142 | =item B<0 X509_V_OK: ok> | ||
143 | |||
144 | the operation was successful. | ||
145 | |||
146 | =item B<2 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certificate> | ||
147 | |||
148 | the issuer certificate could not be found: this occurs if the issuer certificate | ||
149 | of an untrusted certificate cannot be found. | ||
150 | |||
151 | =item B<3 X509_V_ERR_UNABLE_TO_GET_CRL unable to get certificate CRL> | ||
152 | |||
153 | the CRL of a certificate could not be found. Unused. | ||
154 | |||
155 | =item B<4 X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: unable to decrypt certificate's signature> | ||
156 | |||
157 | the certificate signature could not be decrypted. This means that the actual signature value | ||
158 | could not be determined rather than it not matching the expected value, this is only | ||
159 | meaningful for RSA keys. | ||
160 | |||
161 | =item B<5 X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE: unable to decrypt CRL's signature> | ||
162 | |||
163 | the CRL signature could not be decrypted: this means that the actual signature value | ||
164 | could not be determined rather than it not matching the expected value. Unused. | ||
165 | |||
166 | =item B<6 X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY: unable to decode issuer public key> | ||
167 | |||
168 | the public key in the certificate SubjectPublicKeyInfo could not be read. | ||
169 | |||
170 | =item B<7 X509_V_ERR_CERT_SIGNATURE_FAILURE: certificate signature failure> | ||
171 | |||
172 | the signature of the certificate is invalid. | ||
173 | |||
174 | =item B<8 X509_V_ERR_CRL_SIGNATURE_FAILURE: CRL signature failure> | ||
175 | |||
176 | the signature of the certificate is invalid. Unused. | ||
177 | |||
178 | =item B<9 X509_V_ERR_CERT_NOT_YET_VALID: certificate is not yet valid> | ||
179 | |||
180 | the certificate is not yet valid: the notBefore date is after the current time. | ||
181 | |||
182 | =item B<10 X509_V_ERR_CRL_NOT_YET_VALID: CRL is not yet valid> | ||
183 | |||
184 | the CRL is not yet valid. Unused. | ||
185 | |||
186 | =item B<11 X509_V_ERR_CERT_HAS_EXPIRED: Certificate has expired> | ||
187 | |||
188 | the certificate has expired: that is the notAfter date is before the current time. | ||
189 | |||
190 | =item B<12 X509_V_ERR_CRL_HAS_EXPIRED: CRL has expired> | ||
191 | |||
192 | the CRL has expired. Unused. | ||
193 | |||
194 | =item B<13 X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: format error in certificate's notBefore field> | ||
195 | |||
196 | the certificate notBefore field contains an invalid time. | ||
197 | |||
198 | =item B<14 X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: format error in certificate's notAfter field> | ||
199 | |||
200 | the certificate notAfter field contains an invalid time. | ||
201 | |||
202 | =item B<15 X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: format error in CRL's lastUpdate field> | ||
203 | |||
204 | the CRL lastUpdate field contains an invalid time. Unused. | ||
205 | |||
206 | =item B<16 X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: format error in CRL's nextUpdate field> | ||
207 | |||
208 | the CRL nextUpdate field contains an invalid time. Unused. | ||
209 | |||
210 | =item B<17 X509_V_ERR_OUT_OF_MEM: out of memory> | ||
211 | |||
212 | an error occurred trying to allocate memory. This should never happen. | ||
213 | |||
214 | =item B<18 X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: self signed certificate> | ||
215 | |||
216 | the passed certificate is self signed and the same certificate cannot be found in the list of | ||
217 | trusted certificates. | ||
218 | |||
219 | =item B<19 X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: self signed certificate in certificate chain> | ||
220 | |||
221 | the certificate chain could be built up using the untrusted certificates but the root could not | ||
222 | be found locally. | ||
223 | |||
224 | =item B<20 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: unable to get local issuer certificate> | ||
225 | |||
226 | the issuer certificate of a locally looked up certificate could not be found. This normally means | ||
227 | the list of trusted certificates is not complete. | ||
228 | |||
229 | =item B<21 X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: unable to verify the first certificate> | ||
230 | |||
231 | no signatures could be verified because the chain contains only one certificate and it is not | ||
232 | self signed. | ||
233 | |||
234 | =item B<22 X509_V_ERR_CERT_CHAIN_TOO_LONG: certificate chain too long> | ||
235 | |||
236 | the certificate chain length is greater than the supplied maximum depth. Unused. | ||
237 | |||
238 | =item B<23 X509_V_ERR_CERT_REVOKED: certificate revoked> | ||
239 | |||
240 | the certificate has been revoked. Unused. | ||
241 | |||
242 | =item B<24 X509_V_ERR_INVALID_CA: invalid CA certificate> | ||
243 | |||
244 | a CA certificate is invalid. Either it is not a CA or its extensions are not consistent | ||
245 | with the supplied purpose. | ||
246 | |||
247 | =item B<25 X509_V_ERR_PATH_LENGTH_EXCEEDED: path length constraint exceeded> | ||
248 | |||
249 | the basicConstraints pathlength parameter has been exceeded. | ||
250 | |||
251 | =item B<26 X509_V_ERR_INVALID_PURPOSE: unsupported certificate purpose> | ||
252 | |||
253 | the supplied certificate cannot be used for the specified purpose. | ||
254 | |||
255 | =item B<27 X509_V_ERR_CERT_UNTRUSTED: certificate not trusted> | ||
256 | |||
257 | the root CA is not marked as trusted for the specified purpose. | ||
258 | |||
259 | =item B<28 X509_V_ERR_CERT_REJECTED: certificate rejected> | ||
260 | |||
261 | the root CA is marked to reject the specified purpose. | ||
262 | |||
263 | =item B<50 X509_V_ERR_APPLICATION_VERIFICATION: application verification failure> | ||
264 | |||
265 | an application specific error. Unused. | ||
266 | |||
267 | =back | ||
268 | |||
269 | =head1 SEE ALSO | ||
270 | |||
271 | L<x509(1)|x509(1)> | ||
272 | |||
273 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/version.pod b/src/lib/libssl/src/doc/apps/version.pod new file mode 100644 index 0000000000..5d261a6405 --- /dev/null +++ b/src/lib/libssl/src/doc/apps/version.pod | |||
@@ -0,0 +1,56 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | version - print OpenSSL version information | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | B<openssl version> | ||
10 | [B<-a>] | ||
11 | [B<-v>] | ||
12 | [B<-b>] | ||
13 | [B<-o>] | ||
14 | [B<-f>] | ||
15 | [B<-p>] | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | This command is used to print out version information about OpenSSL. | ||
20 | |||
21 | =head1 OPTIONS | ||
22 | |||
23 | =over 4 | ||
24 | |||
25 | =item B<-a> | ||
26 | |||
27 | all information, this is the same as setting all the other flags. | ||
28 | |||
29 | =item B<-v> | ||
30 | |||
31 | the current OpenSSL version. | ||
32 | |||
33 | =item B<-b> | ||
34 | |||
35 | the date the current version of OpenSSL was built. | ||
36 | |||
37 | =item B<-o> | ||
38 | |||
39 | option information: various options set when the library was built. | ||
40 | |||
41 | =item B<-c> | ||
42 | |||
43 | compilation flags. | ||
44 | |||
45 | =item B<-p> | ||
46 | |||
47 | platform setting. | ||
48 | |||
49 | =back | ||
50 | |||
51 | =head1 NOTES | ||
52 | |||
53 | The output of B<openssl version -a> would typically be used when sending | ||
54 | in a bug report. | ||
55 | |||
56 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/x509.pod b/src/lib/libssl/src/doc/apps/x509.pod new file mode 100644 index 0000000000..b127182bbb --- /dev/null +++ b/src/lib/libssl/src/doc/apps/x509.pod | |||
@@ -0,0 +1,543 @@ | |||
1 | |||
2 | =pod | ||
3 | |||
4 | =head1 NAME | ||
5 | |||
6 | x509 - Certificate display and signing utility | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | B<openssl> B<x509> | ||
11 | [B<-inform DER|PEM|NET>] | ||
12 | [B<-outform DER|PEM|NET>] | ||
13 | [B<-keyform DER|PEM>] | ||
14 | [B<-CAform DER|PEM>] | ||
15 | [B<-CAkeyform DER|PEM>] | ||
16 | [B<-in filename>] | ||
17 | [B<-out filename>] | ||
18 | [B<-serial>] | ||
19 | [B<-hash>] | ||
20 | [B<-subject>] | ||
21 | [B<-issuer>] | ||
22 | [B<-startdate>] | ||
23 | [B<-enddate>] | ||
24 | [B<-purpose>] | ||
25 | [B<-dates>] | ||
26 | [B<-modulus>] | ||
27 | [B<-fingerprint>] | ||
28 | [B<-alias>] | ||
29 | [B<-noout>] | ||
30 | [B<-trustout>] | ||
31 | [B<-clrtrust>] | ||
32 | [B<-clrreject>] | ||
33 | [B<-addtrust arg>] | ||
34 | [B<-addreject arg>] | ||
35 | [B<-setalias arg>] | ||
36 | [B<-days arg>] | ||
37 | [B<-signkey filename>] | ||
38 | [B<-x509toreq>] | ||
39 | [B<-req>] | ||
40 | [B<-CA filename>] | ||
41 | [B<-CAkey filename>] | ||
42 | [B<-CAcreateserial>] | ||
43 | [B<-CAserial filename>] | ||
44 | [B<-text>] | ||
45 | [B<-C>] | ||
46 | [B<-md2|-md5|-sha1|-mdc2>] | ||
47 | [B<-clrext>] | ||
48 | [B<-extfile filename>] | ||
49 | [B<-extensions section>] | ||
50 | |||
51 | =head1 DESCRIPTION | ||
52 | |||
53 | The B<x509> command is a multi purpose certificate utility. It can be | ||
54 | used to display certificate information, convert certificates to | ||
55 | various forms, sign certificate requests like a "mini CA" or edit | ||
56 | certificate trust settings. | ||
57 | |||
58 | Since there are a large number of options they will split up into | ||
59 | various sections. | ||
60 | |||
61 | |||
62 | =head1 INPUT, OUTPUT AND GENERAL PURPOSE OPTIONS | ||
63 | |||
64 | =over 4 | ||
65 | |||
66 | =item B<-inform DER|PEM|NET> | ||
67 | |||
68 | This specifies the input format normally the command will expect an X509 | ||
69 | certificate but this can change if other options such as B<-req> are | ||
70 | present. The DER format is the DER encoding of the certificate and PEM | ||
71 | is the base64 encoding of the DER encoding with header and footer lines | ||
72 | added. The NET option is an obscure Netscape server format that is now | ||
73 | obsolete. | ||
74 | |||
75 | =item B<-outform DER|PEM|NET> | ||
76 | |||
77 | This specifies the output format, the options have the same meaning as the | ||
78 | B<-inform> option. | ||
79 | |||
80 | =item B<-in filename> | ||
81 | |||
82 | This specifies the input filename to read a certificate from or standard input | ||
83 | if this option is not specified. | ||
84 | |||
85 | =item B<-out filename> | ||
86 | |||
87 | This specifies the output filename to write to or standard output by | ||
88 | default. | ||
89 | |||
90 | =item B<-md2|-md5|-sha1|-mdc2> | ||
91 | |||
92 | the digest to use. This affects any signing or display option that uses a message | ||
93 | digest, such as the B<-fingerprint>, B<-signkey> and B<-CA> options. If not | ||
94 | specified then MD5 is used. If the key being used to sign with is a DSA key then | ||
95 | this option has no effect: SHA1 is always used with DSA keys. | ||
96 | |||
97 | |||
98 | =back | ||
99 | |||
100 | =head1 DISPLAY OPTIONS | ||
101 | |||
102 | Note: the B<-alias> and B<-purpose> options are also display options | ||
103 | but are described in the B<TRUST OPTIONS> section. | ||
104 | |||
105 | =over 4 | ||
106 | |||
107 | =item B<-text> | ||
108 | |||
109 | prints out the certificate in text form. Full details are output including the | ||
110 | public key, signature algorithms, issuer and subject names, serial number | ||
111 | any extensions present and any trust settings. | ||
112 | |||
113 | =item B<-noout> | ||
114 | |||
115 | this option prevents output of the encoded version of the request. | ||
116 | |||
117 | =item B<-modulus> | ||
118 | |||
119 | this option prints out the value of the modulus of the public key | ||
120 | contained in the certificate. | ||
121 | |||
122 | =item B<-serial> | ||
123 | |||
124 | outputs the certificate serial number. | ||
125 | |||
126 | =item B<-hash> | ||
127 | |||
128 | outputs the "hash" of the certificate subject name. This is used in OpenSSL to | ||
129 | form an index to allow certificates in a directory to be looked up by subject | ||
130 | name. | ||
131 | |||
132 | =item B<-subject> | ||
133 | |||
134 | outputs the subject name. | ||
135 | |||
136 | =item B<-issuer> | ||
137 | |||
138 | outputs the issuer name. | ||
139 | |||
140 | =item B<-startdate> | ||
141 | |||
142 | prints out the start date of the certificate, that is the notBefore date. | ||
143 | |||
144 | =item B<-enddate> | ||
145 | |||
146 | prints out the expiry date of the certificate, that is the notAfter date. | ||
147 | |||
148 | =item B<-dates> | ||
149 | |||
150 | prints out the start and expiry dates of a certificate. | ||
151 | |||
152 | =item B<-fingerprint> | ||
153 | |||
154 | prints out the digest of the DER encoded version of the whole certificate. | ||
155 | |||
156 | =item B<-C> | ||
157 | |||
158 | this outputs the certificate in the form of a C source file. | ||
159 | |||
160 | =back | ||
161 | |||
162 | =head1 TRUST SETTINGS | ||
163 | |||
164 | Please note these options are currently experimental and may well change. | ||
165 | |||
166 | A B<trusted certificate> is an ordinary certificate which has several | ||
167 | additional pieces of information attached to it such as the permitted | ||
168 | and prohibited uses of the certificate and an "alias". | ||
169 | |||
170 | Normally when a certificate is being verified at least one certificate | ||
171 | must be "trusted". By default a trusted certificate must be stored | ||
172 | locally and must be a root CA: any certificate chain ending in this CA | ||
173 | is then usable for any purpose. | ||
174 | |||
175 | Trust settings currently are only used with a root CA. They allow a finer | ||
176 | control over the purposes the root CA can be used for. For example a CA | ||
177 | may be trusted for SSL client but not SSL server use. | ||
178 | |||
179 | See the description of the B<verify> utility for more information on the | ||
180 | meaning of trust settings. | ||
181 | |||
182 | Future versions of OpenSSL will recognize trust settings on any | ||
183 | certificate: not just root CAs. | ||
184 | |||
185 | |||
186 | =over 4 | ||
187 | |||
188 | =item B<-trustout> | ||
189 | |||
190 | this causes B<x509> to output a B<trusted> certificate. An ordinary | ||
191 | or trusted certificate can be input but by default an ordinary | ||
192 | certificate is output and any trust settings are discarded. With the | ||
193 | B<-trustout> option a trusted certificate is output. A trusted | ||
194 | certificate is automatically output if any trust settings are modified. | ||
195 | |||
196 | =item B<-setalias arg> | ||
197 | |||
198 | sets the alias of the certificate. This will allow the certificate | ||
199 | to be referred to using a nickname for example "Steve's Certificate". | ||
200 | |||
201 | =item B<-alias> | ||
202 | |||
203 | outputs the certificate alias, if any. | ||
204 | |||
205 | =item B<-clrtrust> | ||
206 | |||
207 | clears all the permitted or trusted uses of the certificate. | ||
208 | |||
209 | =item B<-clrreject> | ||
210 | |||
211 | clears all the prohibited or rejected uses of the certificate. | ||
212 | |||
213 | =item B<-addtrust arg> | ||
214 | |||
215 | adds a trusted certificate use. Currently acceptable values | ||
216 | are B<all> (any purpose), B<sslclient> (SSL client use), B<sslserver> | ||
217 | (SSL server use) B<email> (S/MIME email) and B<objsign> (Object signing). | ||
218 | |||
219 | =item B<-addreject arg> | ||
220 | |||
221 | adds a prohibited use. It accepts the same values as the B<-addtrust> | ||
222 | option. | ||
223 | |||
224 | =item B<-purpose> | ||
225 | |||
226 | this option performs tests on the certificate extensions and outputs | ||
227 | the results. For a more complete description see the B<CERTIFICATE | ||
228 | EXTENSIONS> section. | ||
229 | |||
230 | =back | ||
231 | |||
232 | =head1 SIGNING OPTIONS | ||
233 | |||
234 | The B<x509> utility can be used to sign certificates and requests: it | ||
235 | can thus behave like a "mini CA". | ||
236 | |||
237 | =over 4 | ||
238 | |||
239 | =item B<-signkey filename> | ||
240 | |||
241 | this option causes the input file to be self signed using the supplied | ||
242 | private key. | ||
243 | |||
244 | If the input file is a certificate it sets the issuer name to the | ||
245 | subject name (i.e. makes it self signed) changes the public key to the | ||
246 | supplied value and changes the start and end dates. The start date is | ||
247 | set to the current time and the end date is set to a value determined | ||
248 | by the B<-days> option. Any certificate extensions are retained unless | ||
249 | the B<-clrext> option is supplied. | ||
250 | |||
251 | If the input is a certificate request then a self signed certificate | ||
252 | is created using the supplied private key using the subject name in | ||
253 | the request. | ||
254 | |||
255 | =item B<-clrext> | ||
256 | |||
257 | delete any extensions from a certificate. This option is used when a | ||
258 | certificate is being created from another certificate (for example with | ||
259 | the B<-signkey> or the B<-CA> options). Normally all extensions are | ||
260 | retained. | ||
261 | |||
262 | =item B<-keyform PEM|DER> | ||
263 | |||
264 | specifies the format (DER or PEM) of the private key file used in the | ||
265 | B<-signkey> option. | ||
266 | |||
267 | =item B<-days arg> | ||
268 | |||
269 | specifies the number of days to make a certificate valid for. The default | ||
270 | is 30 days. | ||
271 | |||
272 | =item B<-x509toreq> | ||
273 | |||
274 | converts a certificate into a certificate request. The B<-signkey> option | ||
275 | is used to pass the required private key. | ||
276 | |||
277 | =item B<-req> | ||
278 | |||
279 | by default a certificate is expected on input. With this option a | ||
280 | certificate request is expected instead. | ||
281 | |||
282 | =item B<-CA filename> | ||
283 | |||
284 | specifies the CA certificate to be used for signing. When this option is | ||
285 | present B<x509> behaves like a "mini CA". The input file is signed by this | ||
286 | CA using this option: that is its issuer name is set to the subject name | ||
287 | of the CA and it is digitally signed using the CAs private key. | ||
288 | |||
289 | This option is normally combined with the B<-req> option. Without the | ||
290 | B<-req> option the input is a certificate which must be self signed. | ||
291 | |||
292 | =item B<-CAkey filename> | ||
293 | |||
294 | sets the CA private key to sign a certificate with. If this option is | ||
295 | not specified then it is assumed that the CA private key is present in | ||
296 | the CA certificate file. | ||
297 | |||
298 | =item B<-CAserial filename> | ||
299 | |||
300 | sets the CA serial number file to use. | ||
301 | |||
302 | When the B<-CA> option is used to sign a certificate it uses a serial | ||
303 | number specified in a file. This file consist of one line containing | ||
304 | an even number of hex digits with the serial number to use. After each | ||
305 | use the serial number is incremented and written out to the file again. | ||
306 | |||
307 | The default filename consists of the CA certificate file base name with | ||
308 | ".srl" appended. For example if the CA certificate file is called | ||
309 | "mycacert.pem" it expects to find a serial number file called "mycacert.srl". | ||
310 | |||
311 | =item B<-CAcreateserial filename> | ||
312 | |||
313 | with this option the CA serial number file is created if it does not exist: | ||
314 | it will contain the serial number "02" and the certificate being signed will | ||
315 | have the 1 as its serial number. Normally if the B<-CA> option is specified | ||
316 | and the serial number file does not exist it is an error. | ||
317 | |||
318 | =item B<-extfile filename> | ||
319 | |||
320 | file containing certificate extensions to use. If not specified then | ||
321 | no extensions are added to the certificate. | ||
322 | |||
323 | =item B<-extensions section> | ||
324 | |||
325 | the section to add certificate extensions from. If this option is not | ||
326 | specified then the extensions should either be contained in the unnamed | ||
327 | (default) section or the default section should contain a variable called | ||
328 | "extensions" which contains the section to use. | ||
329 | |||
330 | =back | ||
331 | |||
332 | =head1 EXAMPLES | ||
333 | |||
334 | Note: in these examples the '\' means the example should be all on one | ||
335 | line. | ||
336 | |||
337 | Display the contents of a certificate: | ||
338 | |||
339 | openssl x509 -in cert.pem -noout -text | ||
340 | |||
341 | Display the certificate serial number: | ||
342 | |||
343 | openssl x509 -in cert.pem -noout -serial | ||
344 | |||
345 | Display the certificate MD5 fingerprint: | ||
346 | |||
347 | openssl x509 -in cert.pem -noout -fingerprint | ||
348 | |||
349 | Display the certificate SHA1 fingerprint: | ||
350 | |||
351 | openssl x509 -sha1 -in cert.pem -noout -fingerprint | ||
352 | |||
353 | Convert a certificate from PEM to DER format: | ||
354 | |||
355 | openssl x509 -in cert.pem -inform PEM -out cert.der -outform DER | ||
356 | |||
357 | Convert a certificate to a certificate request: | ||
358 | |||
359 | openssl x509 -x509toreq -in cert.pem -out req.pem -signkey key.pem | ||
360 | |||
361 | Convert a certificate request into a self signed certificate using | ||
362 | extensions for a CA: | ||
363 | |||
364 | openssl x509 -req -in careq.pem -config openssl.cnf -extensions v3_ca \ | ||
365 | -signkey key.pem -out cacert.pem | ||
366 | |||
367 | Sign a certificate request using the CA certificate above and add user | ||
368 | certificate extensions: | ||
369 | |||
370 | openssl x509 -req -in req.pem -config openssl.cnf -extensions v3_usr \ | ||
371 | -CA cacert.pem -CAkey key.pem -CAcreateserial | ||
372 | |||
373 | |||
374 | Set a certificate to be trusted for SSL client use and change set its alias to | ||
375 | "Steve's Class 1 CA" | ||
376 | |||
377 | openssl x509 -in cert.pem -addtrust sslclient \ | ||
378 | -alias "Steve's Class 1 CA" -out trust.pem | ||
379 | |||
380 | =head1 NOTES | ||
381 | |||
382 | The PEM format uses the header and footer lines: | ||
383 | |||
384 | -----BEGIN CERTIFICATE---- | ||
385 | -----END CERTIFICATE---- | ||
386 | |||
387 | it will also handle files containing: | ||
388 | |||
389 | -----BEGIN X509 CERTIFICATE---- | ||
390 | -----END X509 CERTIFICATE---- | ||
391 | |||
392 | Trusted certificates have the lines | ||
393 | |||
394 | -----BEGIN TRUSTED CERTIFICATE---- | ||
395 | -----END TRUSTED CERTIFICATE---- | ||
396 | |||
397 | The B<-fingerprint> option takes the digest of the DER encoded certificate. | ||
398 | This is commonly called a "fingerprint". Because of the nature of message | ||
399 | digests the fingerprint of a certificate is unique to that certificate and | ||
400 | two certificates with the same fingerprint can be considered to be the same. | ||
401 | |||
402 | The Netscape fingerprint uses MD5 whereas MSIE uses SHA1. | ||
403 | |||
404 | =head1 CERTIFICATE EXTENSIONS | ||
405 | |||
406 | The B<-purpose> option checks the certificate extensions and determines | ||
407 | what the certificate can be used for. The actual checks done are rather | ||
408 | complex and include various hacks and workarounds to handle broken | ||
409 | certificates and software. | ||
410 | |||
411 | The same code is used when verifying untrusted certificates in chains | ||
412 | so this section is useful if a chain is rejected by the verify code. | ||
413 | |||
414 | The basicConstraints extension CA flag is used to determine whether the | ||
415 | certificate can be used as a CA. If the CA flag is true then it is a CA, | ||
416 | if the CA flag is false then it is not a CA. B<All> CAs should have the | ||
417 | CA flag set to true. | ||
418 | |||
419 | If the basicConstraints extension is absent then the certificate is | ||
420 | considered to be a "possible CA" other extensions are checked according | ||
421 | to the intended use of the certificate. A warning is given in this case | ||
422 | because the certificate should really not be regarded as a CA: however | ||
423 | it is allowed to be a CA to work around some broken software. | ||
424 | |||
425 | If the certificate is a V1 certificate (and thus has no extensions) and | ||
426 | it is self signed it is also assumed to be a CA but a warning is again | ||
427 | given: this is to work around the problem of Verisign roots which are V1 | ||
428 | self signed certificates. | ||
429 | |||
430 | If the keyUsage extension is present then additional restraints are | ||
431 | made on the uses of the certificate. A CA certificate B<must> have the | ||
432 | keyCertSign bit set if the keyUsage extension is present. | ||
433 | |||
434 | The extended key usage extension places additional restrictions on the | ||
435 | certificate uses. If this extension is present (whether critical or not) | ||
436 | the key can only be used for the purposes specified. | ||
437 | |||
438 | A complete description of each test is given below. The comments about | ||
439 | basicConstraints and keyUsage and V1 certificates above apply to B<all> | ||
440 | CA certificates. | ||
441 | |||
442 | |||
443 | =over 4 | ||
444 | |||
445 | =item B<SSL Client> | ||
446 | |||
447 | The extended key usage extension must be absent or include the "web client | ||
448 | authentication" OID. keyUsage must be absent or it must have the | ||
449 | digitalSignature bit set. Netscape certificate type must be absent or it must | ||
450 | have the SSL client bit set. | ||
451 | |||
452 | =item B<SSL Client CA> | ||
453 | |||
454 | The extended key usage extension must be absent or include the "web client | ||
455 | authentication" OID. Netscape certificate type must be absent or it must have | ||
456 | the SSL CA bit set: this is used as a work around if the basicConstraints | ||
457 | extension is absent. | ||
458 | |||
459 | =item B<SSL Server> | ||
460 | |||
461 | The extended key usage extension must be absent or include the "web server | ||
462 | authentication" and/or one of the SGC OIDs. keyUsage must be absent or it | ||
463 | must have the digitalSignature, the keyEncipherment set or both bits set. | ||
464 | Netscape certificate type must be absent or have the SSL server bit set. | ||
465 | |||
466 | =item B<SSL Server CA> | ||
467 | |||
468 | The extended key usage extension must be absent or include the "web server | ||
469 | authentication" and/or one of the SGC OIDs. Netscape certificate type must | ||
470 | be absent or the SSL CA bit must be set: this is used as a work around if the | ||
471 | basicConstraints extension is absent. | ||
472 | |||
473 | =item B<Netscape SSL Server> | ||
474 | |||
475 | For Netscape SSL clients to connect to an SSL server it must have the | ||
476 | keyEncipherment bit set if the keyUsage extension is present. This isn't | ||
477 | always valid because some cipher suites use the key for digital signing. | ||
478 | Otherwise it is the same as a normal SSL server. | ||
479 | |||
480 | =item B<Common S/MIME Client Tests> | ||
481 | |||
482 | The extended key usage extension must be absent or include the "email | ||
483 | protection" OID. Netscape certificate type must be absent or should have the | ||
484 | S/MIME bit set. If the S/MIME bit is not set in netscape certificate type | ||
485 | then the SSL client bit is tolerated as an alternative but a warning is shown: | ||
486 | this is because some Verisign certificates don't set the S/MIME bit. | ||
487 | |||
488 | =item B<S/MIME Signing> | ||
489 | |||
490 | In addition to the common S/MIME client tests the digitalSignature bit must | ||
491 | be set if the keyUsage extension is present. | ||
492 | |||
493 | =item B<S/MIME Encryption> | ||
494 | |||
495 | In addition to the common S/MIME tests the keyEncipherment bit must be set | ||
496 | if the keyUsage extension is present. | ||
497 | |||
498 | =item B<S/MIME CA> | ||
499 | |||
500 | The extended key usage extension must be absent or include the "email | ||
501 | protection" OID. Netscape certificate type must be absent or must have the | ||
502 | S/MIME CA bit set: this is used as a work around if the basicConstraints | ||
503 | extension is absent. | ||
504 | |||
505 | =item B<CRL Signing> | ||
506 | |||
507 | The keyUsage extension must be absent or it must have the CRL signing bit | ||
508 | set. | ||
509 | |||
510 | =item B<CRL Signing CA> | ||
511 | |||
512 | The normal CA tests apply. Except in this case the basicConstraints extension | ||
513 | must be present. | ||
514 | |||
515 | =back | ||
516 | |||
517 | =head1 BUGS | ||
518 | |||
519 | The way DNs are printed is in a "historical SSLeay" format which doesn't | ||
520 | follow any published standard. It should follow some standard like RFC2253 | ||
521 | or RFC1779 with options to make the stuff more readable. | ||
522 | |||
523 | Extensions in certificates are not transferred to certificate requests and | ||
524 | vice versa. | ||
525 | |||
526 | It is possible to produce invalid certificates or requests by specifying the | ||
527 | wrong private key or using inconsistent options in some cases: these should | ||
528 | be checked. | ||
529 | |||
530 | There should be options to explicitly set such things as start and end | ||
531 | dates rather than an offset from the current time. | ||
532 | |||
533 | The code to implement the verify behaviour described in the B<TRUST SETTINGS> | ||
534 | is currently being developed. It thus describes the intended behavior rather | ||
535 | than the current behaviour. It is hoped that it will represent reality in | ||
536 | OpenSSL 0.9.5 and later. | ||
537 | |||
538 | =head1 SEE ALSO | ||
539 | |||
540 | L<req(1)|req(1)>, L<ca(1)|ca(1)>, L<genrsa(1)|genrsa(1)>, | ||
541 | L<gendsa(1)|gendsa(1)>, L<verify(1)|verify(1)> | ||
542 | |||
543 | =cut | ||
diff --git a/src/lib/libssl/src/doc/c-indentation.el b/src/lib/libssl/src/doc/c-indentation.el index 9a4a0be598..9111450915 100644 --- a/src/lib/libssl/src/doc/c-indentation.el +++ b/src/lib/libssl/src/doc/c-indentation.el | |||
@@ -26,11 +26,20 @@ | |||
26 | (c-hanging-braces-alist) | 26 | (c-hanging-braces-alist) |
27 | (c-offsets-alist . ((defun-open . +) | 27 | (c-offsets-alist . ((defun-open . +) |
28 | (defun-block-intro . 0) | 28 | (defun-block-intro . 0) |
29 | (class-open . +) | ||
30 | (class-close . +) | ||
29 | (block-open . 0) | 31 | (block-open . 0) |
32 | (block-close . 0) | ||
30 | (substatement-open . +) | 33 | (substatement-open . +) |
34 | (statement . 0) | ||
31 | (statement-block-intro . 0) | 35 | (statement-block-intro . 0) |
32 | (statement-case-open . +) | 36 | (statement-case-open . +) |
33 | (statement-case-intro . +) | 37 | (statement-case-intro . +) |
34 | (case-label . -) | 38 | (case-label . -) |
35 | (label . -) | 39 | (label . -) |
36 | (arglist-cont-nonempty . +))))) | 40 | (arglist-cont-nonempty . +) |
41 | (topmost-intro . -) | ||
42 | (brace-list-close . +) | ||
43 | (brace-list-intro . +) | ||
44 | )))) | ||
45 | |||
diff --git a/src/lib/libssl/src/doc/crypto.pod b/src/lib/libssl/src/doc/crypto.pod index 9c8a143b09..e69de29bb2 100644 --- a/src/lib/libssl/src/doc/crypto.pod +++ b/src/lib/libssl/src/doc/crypto.pod | |||
@@ -1,27 +0,0 @@ | |||
1 | |||
2 | =pod | ||
3 | |||
4 | =head1 NAME | ||
5 | |||
6 | Crypto - OpenSSL Cryptography library | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | =head1 DESCRIPTION | ||
11 | |||
12 | The OpenSSL B<crypto> library implements various cryptography standards | ||
13 | related to the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security | ||
14 | (TLS v1) protocols. It provides a rich API which is documented here. | ||
15 | |||
16 | ... | ||
17 | |||
18 | =head1 SEE ALSO | ||
19 | |||
20 | openssl(1), ssl(3) | ||
21 | |||
22 | =head1 HISTORY | ||
23 | |||
24 | The crypto(3) document appeared in OpenSSL 0.9.2 | ||
25 | |||
26 | =cut | ||
27 | |||
diff --git a/src/lib/libssl/src/doc/crypto/BN_CTX_new.pod b/src/lib/libssl/src/doc/crypto/BN_CTX_new.pod new file mode 100644 index 0000000000..c94d8c610d --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BN_CTX_new.pod | |||
@@ -0,0 +1,53 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_CTX_new, BN_CTX_init, BN_CTX_free - allocate and free BN_CTX structures | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bn.h> | ||
10 | |||
11 | BN_CTX *BN_CTX_new(void); | ||
12 | |||
13 | void BN_CTX_init(BN_CTX *c); | ||
14 | |||
15 | void BN_CTX_free(BN_CTX *c); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | A B<BN_CTX> is a structure that holds B<BIGNUM> temporary variables used by | ||
20 | library functions. Since dynamic memory allocation to create B<BIGNUM>s | ||
21 | is rather expensive when used in conjunction with repeated subroutine | ||
22 | calls, the B<BN_CTX> structure is used. | ||
23 | |||
24 | BN_CTX_new() allocates and initializes a B<BN_CTX> | ||
25 | structure. BN_CTX_init() initializes an existing uninitialized | ||
26 | B<BN_CTX>. | ||
27 | |||
28 | BN_CTX_free() frees the components of the B<BN_CTX>, and if it was | ||
29 | created by BN_CTX_new(), also the structure itself. | ||
30 | If L<BN_CTX_start(3)|BN_CTX_start(3)> has been used on the B<BN_CTX>, | ||
31 | L<BN_CTX_end(3)|BN_CTX_end(3)> must be called before the B<BN_CTX> | ||
32 | may be freed by BN_CTX_free(). | ||
33 | |||
34 | |||
35 | =head1 RETURN VALUES | ||
36 | |||
37 | BN_CTX_new() returns a pointer to the B<BN_CTX>. If the allocation fails, | ||
38 | it returns B<NULL> and sets an error code that can be obtained by | ||
39 | L<ERR_get_error(3)|ERR_get_error(3)>. | ||
40 | |||
41 | BN_CTX_init() and BN_CTX_free() have no return values. | ||
42 | |||
43 | =head1 SEE ALSO | ||
44 | |||
45 | L<bn(3)|bn(3)>, L<err(3)|err(3)>, L<BN_add(3)|BN_add(3)>, | ||
46 | L<BN_CTX_start(3)|BN_CTX_start(3)> | ||
47 | |||
48 | =head1 HISTORY | ||
49 | |||
50 | BN_CTX_new() and BN_CTX_free() are available in all versions on SSLeay | ||
51 | and OpenSSL. BN_CTX_init() was added in SSLeay 0.9.1b. | ||
52 | |||
53 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_CTX_start.pod b/src/lib/libssl/src/doc/crypto/BN_CTX_start.pod new file mode 100644 index 0000000000..c30552b122 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BN_CTX_start.pod | |||
@@ -0,0 +1,51 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_CTX_start, BN_CTX_get, BN_CTX_end - use temporary BIGNUM variables | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bn.h> | ||
10 | |||
11 | void BN_CTX_start(BN_CTX *ctx); | ||
12 | |||
13 | BIGNUM *BN_CTX_get(BN_CTX *ctx); | ||
14 | |||
15 | void BN_CTX_end(BN_CTX *ctx); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
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 | ||
21 | freeing B<BIGNUM>s in functions that are called from inside a loop. | ||
22 | |||
23 | A function must call BN_CTX_start() first. Then, BN_CTX_get() may be | ||
24 | called repeatedly to obtain temporary B<BIGNUM>s. All BN_CTX_get() | ||
25 | calls must be made before calling any other functions that use the | ||
26 | B<ctx> as an argument. | ||
27 | |||
28 | Finally, BN_CTX_end() must be called before returning from the function. | ||
29 | When BN_CTX_end() is called, the B<BIGNUM> pointers obtained from | ||
30 | BN_CTX_get() become invalid. | ||
31 | |||
32 | =head1 RETURN VALUES | ||
33 | |||
34 | BN_CTX_start() and BN_CTX_end() return no values. | ||
35 | |||
36 | BN_CTX_get() returns a pointer to the B<BIGNUM>, or B<NULL> on error. | ||
37 | Once BN_CTX_get() has failed, the subsequent calls will return B<NULL> | ||
38 | as well, so it is sufficient to check the return value of the last | ||
39 | BN_CTX_get() call. In case of an error, an error code is set, which | ||
40 | can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
41 | |||
42 | |||
43 | =head1 SEE ALSO | ||
44 | |||
45 | L<BN_CTX_new(3)|BN_CTX_new(3)> | ||
46 | |||
47 | =head1 HISTORY | ||
48 | |||
49 | BN_CTX_start(), BN_CTX_get() and BN_CTX_end() were added in OpenSSL 0.9.5. | ||
50 | |||
51 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_add.pod b/src/lib/libssl/src/doc/crypto/BN_add.pod new file mode 100644 index 0000000000..0541d45643 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BN_add.pod | |||
@@ -0,0 +1,99 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_add, BN_sub, BN_mul, BN_div, BN_sqr, BN_mod, BN_mod_mul, BN_exp, | ||
6 | BN_mod_exp, BN_gcd - arithmetic operations on BIGNUMs | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/bn.h> | ||
11 | |||
12 | int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); | ||
13 | |||
14 | int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); | ||
15 | |||
16 | int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); | ||
17 | |||
18 | int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *a, const BIGNUM *d, | ||
19 | BN_CTX *ctx); | ||
20 | |||
21 | int BN_sqr(BIGNUM *r, BIGNUM *a, BN_CTX *ctx); | ||
22 | |||
23 | int BN_mod(BIGNUM *rem, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); | ||
24 | |||
25 | int BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, | ||
26 | BN_CTX *ctx); | ||
27 | |||
28 | int BN_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BN_CTX *ctx); | ||
29 | |||
30 | int BN_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p, | ||
31 | const BIGNUM *m, BN_CTX *ctx); | ||
32 | |||
33 | int BN_gcd(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); | ||
34 | |||
35 | =head1 DESCRIPTION | ||
36 | |||
37 | BN_add() adds B<a> and B<b> and places the result in B<r> (C<r=a+b>). | ||
38 | B<r> may be the same B<BIGNUM> as B<a> or B<b>. | ||
39 | |||
40 | BN_sub() subtracts B<b> from B<a> and places the result in B<r> (C<r=a-b>). | ||
41 | |||
42 | BN_mul() multiplies B<a> and B<b> and places the result in B<r> (C<r=a*b>). | ||
43 | B<r> may be the same B<BIGNUM> as B<a> or B<b>. | ||
44 | For multiplication by powers of 2, use L<BN_lshift(3)|BN_lshift(3)>. | ||
45 | |||
46 | BN_div() divides B<a> by B<d> and places the result in B<dv> and the | ||
47 | remainder in B<rem> (C<dv=a/d, rem=a%d>). Either of B<dv> and B<rem> may | ||
48 | be NULL, in which case the respective value is not returned. | ||
49 | For division by powers of 2, use BN_rshift(3). | ||
50 | |||
51 | BN_sqr() takes the square of B<a> and places the result in B<r> | ||
52 | (C<r=a^2>). B<r> and B<a> may be the same B<BIGNUM>. | ||
53 | This function is faster than BN_mul(r,a,a). | ||
54 | |||
55 | BN_mod() find the remainder of B<a> divided by B<m> and places it in | ||
56 | B<rem> (C<rem=a%m>). | ||
57 | |||
58 | BN_mod_mul() multiplies B<a> by B<b> and finds the remainder when | ||
59 | divided by B<m> (C<r=(a*b)%m>). B<r> may be the same B<BIGNUM> as B<a> | ||
60 | or B<b>. For a more efficient algorithm, see | ||
61 | L<BN_mod_mul_montgomery(3)|BN_mod_mul_montgomery(3)>; for repeated | ||
62 | computations using the same modulus, see L<BN_mod_mul_reciprocal(3)|BN_mod_mul_reciprocal(3)>. | ||
63 | |||
64 | BN_exp() raises B<a> to the B<p>-th power and places the result in B<r> | ||
65 | (C<r=a^p>). This function is faster than repeated applications of | ||
66 | BN_mul(). | ||
67 | |||
68 | BN_mod_exp() computes B<a> to the B<p>-th power modulo B<m> (C<r=a^p % | ||
69 | m>). This function uses less time and space than BN_exp(). | ||
70 | |||
71 | BN_gcd() computes the greatest common divisor of B<a> and B<b> and | ||
72 | places the result in B<r>. B<r> may be the same B<BIGNUM> as B<a> or | ||
73 | B<b>. | ||
74 | |||
75 | For all functions, B<ctx> is a previously allocated B<BN_CTX> used for | ||
76 | temporary variables; see L<BN_CTX_new(3)|BN_CTX_new(3)>. | ||
77 | |||
78 | Unless noted otherwise, the result B<BIGNUM> must be different from | ||
79 | the arguments. | ||
80 | |||
81 | =head1 RETURN VALUES | ||
82 | |||
83 | For all functions, 1 is returned for success, 0 on error. The return | ||
84 | value should always be checked (e.g., C<if (!BN_add(r,a,b)) goto err;>). | ||
85 | The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
86 | |||
87 | =head1 SEE ALSO | ||
88 | |||
89 | L<bn(3)|bn(3)>, L<err(3)|err(3)>, L<BN_CTX_new(3)|BN_CTX_new(3)>, | ||
90 | L<BN_add_word(3)|BN_add_word(3)>, L<BN_set_bit(3)|BN_set_bit(3)> | ||
91 | |||
92 | =head1 HISTORY | ||
93 | |||
94 | BN_add(), BN_sub(), BN_div(), BN_sqr(), BN_mod(), BN_mod_mul(), | ||
95 | BN_mod_exp() and BN_gcd() are available in all versions of SSLeay and | ||
96 | OpenSSL. The B<ctx> argument to BN_mul() was added in SSLeay | ||
97 | 0.9.1b. BN_exp() appeared in SSLeay 0.9.0. | ||
98 | |||
99 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_add_word.pod b/src/lib/libssl/src/doc/crypto/BN_add_word.pod new file mode 100644 index 0000000000..66bedfb924 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BN_add_word.pod | |||
@@ -0,0 +1,57 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_add_word, BN_sub_word, BN_mul_word, BN_div_word, BN_mod_word - arithmetic | ||
6 | functions on BIGNUMs with integers | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/bn.h> | ||
11 | |||
12 | int BN_add_word(BIGNUM *a, BN_ULONG w); | ||
13 | |||
14 | int BN_sub_word(BIGNUM *a, BN_ULONG w); | ||
15 | |||
16 | int BN_mul_word(BIGNUM *a, BN_ULONG w); | ||
17 | |||
18 | BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); | ||
19 | |||
20 | BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w); | ||
21 | |||
22 | =head1 DESCRIPTION | ||
23 | |||
24 | These functions perform arithmetic operations on BIGNUMs with unsigned | ||
25 | integers. They are much more efficient than the normal BIGNUM | ||
26 | arithmetic operations. | ||
27 | |||
28 | BN_add_word() adds B<w> to B<a> (C<a+=w>). | ||
29 | |||
30 | BN_sub_word() subtracts B<w> from B<a> (C<a-=w>). | ||
31 | |||
32 | BN_mul_word() multiplies B<a> and B<w> (C<a*=b>). | ||
33 | |||
34 | BN_div_word() divides B<a> by B<w> (C<a/=w>) and returns the remainder. | ||
35 | |||
36 | BN_mod_word() returns the remainder of B<a> divided by B<w> (C<a%m>). | ||
37 | |||
38 | For BN_div_word() and BN_mod_word(), B<w> must not be 0. | ||
39 | |||
40 | =head1 RETURN VALUES | ||
41 | |||
42 | BN_add_word(), BN_sub_word() and BN_mul_word() return 1 for success, 0 | ||
43 | on error. The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
44 | |||
45 | BN_mod_word() and BN_div_word() return B<a>%B<w>. | ||
46 | |||
47 | =head1 SEE ALSO | ||
48 | |||
49 | L<bn(3)|bn(3)>, L<err(3)|err(3)>, L<BN_add(3)|BN_add(3)> | ||
50 | |||
51 | =head1 HISTORY | ||
52 | |||
53 | BN_add_word() and BN_mod_word() are available in all versions of | ||
54 | SSLeay and OpenSSL. BN_div_word() was added in SSLeay 0.8, and | ||
55 | BN_sub_word() and BN_mul_word() in SSLeay 0.9.0. | ||
56 | |||
57 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_bn2bin.pod b/src/lib/libssl/src/doc/crypto/BN_bn2bin.pod new file mode 100644 index 0000000000..05f9e628cc --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BN_bn2bin.pod | |||
@@ -0,0 +1,95 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_bn2bin, BN_bin2bn, BN_bn2hex, BN_bn2dec, BN_hex2bn, BN_dec2bn, | ||
6 | BN_print, BN_print_fp, BN_bn2mpi, BN_mpi2bn - format conversions | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/bn.h> | ||
11 | |||
12 | int BN_bn2bin(const BIGNUM *a, unsigned char *to); | ||
13 | BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret); | ||
14 | |||
15 | char *BN_bn2hex(const BIGNUM *a); | ||
16 | char *BN_bn2dec(const BIGNUM *a); | ||
17 | int BN_hex2bn(BIGNUM **a, const char *str); | ||
18 | int BN_dec2bn(BIGNUM **a, const char *str); | ||
19 | |||
20 | int BN_print(BIO *fp, const BIGNUM *a); | ||
21 | int BN_print_fp(FILE *fp, const BIGNUM *a); | ||
22 | |||
23 | int BN_bn2mpi(const BIGNUM *a, unsigned char *to); | ||
24 | BIGNUM *BN_mpi2bn(unsigned char *s, int len, BIGNUM *ret); | ||
25 | |||
26 | =head1 DESCRIPTION | ||
27 | |||
28 | BN_bn2bin() converts the absolute value of B<a> into big-endian form | ||
29 | and stores it at B<to>. B<to> must point to BN_num_bytes(B<a>) bytes of | ||
30 | memory. | ||
31 | |||
32 | BN_bin2bn() converts the positive integer in big-endian form of length | ||
33 | B<len> at B<s> into a B<BIGNUM> and places it in B<ret>. If B<ret> is | ||
34 | NULL, a new B<BIGNUM> is created. | ||
35 | |||
36 | BN_bn2hex() and BN_bn2dec() return printable strings containing the | ||
37 | hexadecimal and decimal encoding of B<a> respectively. For negative | ||
38 | numbers, the string is prefaced with a leading '-'. The string must be | ||
39 | Free()d later. | ||
40 | |||
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 | ||
43 | B<BIGNUM> is created. If B<bn> is NULL, it only computes the number's | ||
44 | length in hexadecimal digits. If the string starts with '-', the | ||
45 | number is negative. BN_dec2bn() is the same using the decimal system. | ||
46 | |||
47 | BN_print() and BN_print_fp() write the hexadecimal encoding of B<a>, | ||
48 | with a leading '-' for negative numbers, to the B<BIO> or B<FILE> | ||
49 | B<fp>. | ||
50 | |||
51 | BN_bn2mpi() and BN_mpi2bn() convert B<BIGNUM>s from and to a format | ||
52 | that consists of the number's length in bytes represented as a 3-byte | ||
53 | big-endian number, and the number itself in big-endian format, where | ||
54 | the most significant bit signals a negative number (the representation | ||
55 | of numbers with the MSB set is prefixed with null byte). | ||
56 | |||
57 | BN_bn2mpi() stores the representation of B<a> at B<to>, where B<to> | ||
58 | must be large enough to hold the result. The size can be determined by | ||
59 | calling BN_bn2mpi(B<a>, NULL). | ||
60 | |||
61 | BN_mpi2bn() converts the B<len> bytes long representation at B<s> to | ||
62 | a B<BIGNUM> and stores it at B<ret>, or in a newly allocated B<BIGNUM> | ||
63 | if B<ret> is NULL. | ||
64 | |||
65 | =head1 RETURN VALUES | ||
66 | |||
67 | BN_bn2bin() returns the length of the big-endian number placed at B<to>. | ||
68 | BN_bin2bn() returns the B<BIGNUM>, NULL on error. | ||
69 | |||
70 | BN_bn2hex() and BN_bn2dec() return a null-terminated string, or NULL | ||
71 | on error. BN_hex2bn() and BN_dec2bn() return the number's length in | ||
72 | hexadecimal or decimal digits, and 0 on error. | ||
73 | |||
74 | BN_print_fp() and BN_print() return 1 on success, 0 on write errors. | ||
75 | |||
76 | BN_bn2mpi() returns the length of the representation. BN_mpi2bn() | ||
77 | returns the B<BIGNUM>, and NULL on error. | ||
78 | |||
79 | The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
80 | |||
81 | =head1 SEE ALSO | ||
82 | |||
83 | L<bn(3)|bn(3)>, L<err(3)|err(3)>, L<BN_zero(3)|BN_zero(3)>, | ||
84 | L<ASN1_INTEGER_to_BN(3)|ASN1_INTEGER_to_BN(3)>, | ||
85 | L<BN_num_bytes(3)|BN_num_bytes(3)> | ||
86 | |||
87 | =head1 HISTORY | ||
88 | |||
89 | BN_bn2bin(), BN_bin2bn(), BN_print_fp() and BN_print() are available | ||
90 | in all versions of SSLeay and OpenSSL. | ||
91 | |||
92 | BN_bn2hex(), BN_bn2dec(), BN_hex2bn(), BN_dec2bn(), BN_bn2mpi() and | ||
93 | BN_mpi2bn() were added in SSLeay 0.9.0. | ||
94 | |||
95 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_cmp.pod b/src/lib/libssl/src/doc/crypto/BN_cmp.pod new file mode 100644 index 0000000000..23e9ed0b4f --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BN_cmp.pod | |||
@@ -0,0 +1,48 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_cmp, BN_ucmp, BN_is_zero, BN_is_one, BN_is_word, BN_is_odd - BIGNUM comparison and test functions | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bn.h> | ||
10 | |||
11 | int BN_cmp(BIGNUM *a, BIGNUM *b); | ||
12 | int BN_ucmp(BIGNUM *a, BIGNUM *b); | ||
13 | |||
14 | int BN_is_zero(BIGNUM *a); | ||
15 | int BN_is_one(BIGNUM *a); | ||
16 | int BN_is_word(BIGNUM *a, BN_ULONG w); | ||
17 | int BN_is_odd(BIGNUM *a); | ||
18 | |||
19 | =head1 DESCRIPTION | ||
20 | |||
21 | BN_cmp() compares the numbers B<a> and B<b>. BN_ucmp() compares their | ||
22 | absolute values. | ||
23 | |||
24 | BN_is_zero(), BN_is_one() and BN_is_word() test if B<a> equals 0, 1, | ||
25 | or B<w> respectively. BN_is_odd() tests if a is odd. | ||
26 | |||
27 | BN_is_zero(), BN_is_one(), BN_is_word() and BN_is_odd() are macros. | ||
28 | |||
29 | =head1 RETURN VALUES | ||
30 | |||
31 | BN_cmp() returns -1 if B<a> E<lt> B<b>, 0 if B<a> == B<b> and 1 if | ||
32 | B<a> E<gt> B<b>. BN_ucmp() is the same using the absolute values | ||
33 | of B<a> and B<b>. | ||
34 | |||
35 | BN_is_zero(), BN_is_one() BN_is_word() and BN_is_odd() return 1 if | ||
36 | the condition is true, 0 otherwise. | ||
37 | |||
38 | =head1 SEE ALSO | ||
39 | |||
40 | L<bn(3)|bn(3)> | ||
41 | |||
42 | =head1 HISTORY | ||
43 | |||
44 | BN_cmp(), BN_ucmp(), BN_is_zero(), BN_is_one() and BN_is_word() are | ||
45 | available in all versions of SSLeay and OpenSSL. | ||
46 | BN_is_odd() was added in SSLeay 0.8. | ||
47 | |||
48 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_copy.pod b/src/lib/libssl/src/doc/crypto/BN_copy.pod new file mode 100644 index 0000000000..8ad25e7834 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BN_copy.pod | |||
@@ -0,0 +1,34 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_copy, BN_dup - copy BIGNUMs | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bn.h> | ||
10 | |||
11 | BIGNUM *BN_copy(BIGNUM *to, const BIGNUM *from); | ||
12 | |||
13 | BIGNUM *BN_dup(const BIGNUM *from); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | BN_copy() copies B<from> to B<to>. BN_dup() creates a new B<BIGNUM> | ||
18 | containing the value B<from>. | ||
19 | |||
20 | =head1 RETURN VALUES | ||
21 | |||
22 | BN_copy() returns B<to> on success, NULL on error. BN_dup() returns | ||
23 | the new B<BIGNUM>, and NULL on error. The error codes can be obtained | ||
24 | by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
25 | |||
26 | =head1 SEE ALSO | ||
27 | |||
28 | L<bn(3)|bn(3)>, L<err(3)|err(3)> | ||
29 | |||
30 | =head1 HISTORY | ||
31 | |||
32 | BN_copy() and BN_dup() are available in all versions of SSLeay and OpenSSL. | ||
33 | |||
34 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_generate_prime.pod b/src/lib/libssl/src/doc/crypto/BN_generate_prime.pod new file mode 100644 index 0000000000..638f6514ee --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BN_generate_prime.pod | |||
@@ -0,0 +1,102 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_generate_prime, BN_is_prime, BN_is_prime_fasttest - generate primes and test for primality | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bn.h> | ||
10 | |||
11 | BIGNUM *BN_generate_prime(BIGNUM *ret, int num, int safe, BIGNUM *add, | ||
12 | BIGNUM *rem, void (*callback)(int, int, void *), void *cb_arg); | ||
13 | |||
14 | int BN_is_prime(const BIGNUM *a, int checks, void (*callback)(int, int, | ||
15 | void *), BN_CTX *ctx, void *cb_arg); | ||
16 | |||
17 | int BN_is_prime_fasttest(const BIGNUM *a, int checks, | ||
18 | void (*callback)(int, int, void *), BN_CTX *ctx, void *cb_arg, | ||
19 | int do_trial_division); | ||
20 | |||
21 | =head1 DESCRIPTION | ||
22 | |||
23 | BN_generate_prime() generates a pseudo-random prime number of B<num> | ||
24 | bits. | ||
25 | If B<ret> is not B<NULL>, it will be used to store the number. | ||
26 | |||
27 | If B<callback> is not B<NULL>, it is called as follows: | ||
28 | |||
29 | =over 4 | ||
30 | |||
31 | =item * | ||
32 | |||
33 | B<callback(0, i, cb_arg)> is called after generating the i-th | ||
34 | potential prime number. | ||
35 | |||
36 | =item * | ||
37 | |||
38 | While the number is being tested for primality, B<callback(1, j, | ||
39 | cb_arg)> is called as described below. | ||
40 | |||
41 | =item * | ||
42 | |||
43 | When a prime has been found, B<callback(2, i, cb_arg)> is called. | ||
44 | |||
45 | =back | ||
46 | |||
47 | The prime may have to fulfill additional requirements for use in | ||
48 | Diffie-Hellman key exchange: | ||
49 | |||
50 | If B<add> is not B<NULL>, the prime will fulfill the condition p % B<add> | ||
51 | == B<rem> (p % B<add> == 1 if B<rem> == B<NULL>) in order to suit a given | ||
52 | generator. | ||
53 | |||
54 | If B<safe> is true, it will be a safe prime (i.e. a prime p so | ||
55 | that (p-1)/2 is also prime). | ||
56 | |||
57 | The PRNG must be seeded prior to calling BN_generate_prime(). | ||
58 | The prime number generation has a negligible error probability. | ||
59 | |||
60 | BN_is_prime() and BN_is_prime_fasttest() test if the number B<a> is | ||
61 | prime. The following tests are performed until one of them shows that | ||
62 | B<a> is composite; if B<a> passes all these tests, it is considered | ||
63 | prime. | ||
64 | |||
65 | BN_is_prime_fasttest(), when called with B<do_trial_division == 1>, | ||
66 | first attempts trial division by a number of small primes; | ||
67 | if no divisors are found by this test and B<callback> is not B<NULL>, | ||
68 | B<callback(1, -1, cb_arg)> is called. | ||
69 | If B<do_trial_division == 0>, this test is skipped. | ||
70 | |||
71 | Both BN_is_prime() and BN_is_prime_fasttest() perform a Miller-Rabin | ||
72 | probabilistic primality test with B<checks> iterations. If | ||
73 | B<checks == BN_prime_check>, a number of iterations is used that | ||
74 | yields a false positive rate of at most 2^-80 for random input. | ||
75 | |||
76 | If B<callback> is not B<NULL>, B<callback(1, j, cb_arg)> is called | ||
77 | after the j-th iteration (j = 0, 1, ...). B<ctx> is a | ||
78 | pre-allocated B<BN_CTX> (to save the overhead of allocating and | ||
79 | freeing the structure in a loop), or B<NULL>. | ||
80 | |||
81 | =head1 RETURN VALUES | ||
82 | |||
83 | BN_generate_prime() returns the prime number on success, B<NULL> otherwise. | ||
84 | |||
85 | BN_is_prime() returns 0 if the number is composite, 1 if it is | ||
86 | prime with an error probability of less than 0.25^B<checks>, and | ||
87 | -1 on error. | ||
88 | |||
89 | The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
90 | |||
91 | =head1 SEE ALSO | ||
92 | |||
93 | L<bn(3)|bn(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)> | ||
94 | |||
95 | =head1 HISTORY | ||
96 | |||
97 | The B<cb_arg> arguments to BN_generate_prime() and to BN_is_prime() | ||
98 | were added in SSLeay 0.9.0. The B<ret> argument to BN_generate_prime() | ||
99 | was added in SSLeay 0.9.1. | ||
100 | BN_is_prime_fasttest() was added in OpenSSL 0.9.5. | ||
101 | |||
102 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_mod_inverse.pod b/src/lib/libssl/src/doc/crypto/BN_mod_inverse.pod new file mode 100644 index 0000000000..49e62daf9f --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BN_mod_inverse.pod | |||
@@ -0,0 +1,36 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_mod_inverse - compute inverse modulo n | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bn.h> | ||
10 | |||
11 | BIGNUM *BN_mod_inverse(BIGNUM *r, BIGNUM *a, const BIGNUM *n, | ||
12 | BN_CTX *ctx); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | BN_mod_inverse() computes the inverse of B<a> modulo B<n> | ||
17 | places the result in B<r> (C<(a*r)%n==1>). If B<r> is NULL, | ||
18 | a new B<BIGNUM> is created. | ||
19 | |||
20 | B<ctx> is a previously allocated B<BN_CTX> used for temporary | ||
21 | variables. B<r> may be the same B<BIGNUM> as B<a> or B<n>. | ||
22 | |||
23 | =head1 RETURN VALUES | ||
24 | |||
25 | BN_mod_inverse() returns the B<BIGNUM> containing the inverse, and | ||
26 | NULL on error. The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
27 | |||
28 | =head1 SEE ALSO | ||
29 | |||
30 | L<bn(3)|bn(3)>, L<err(3)|err(3)>, L<BN_add(3)|BN_add(3)> | ||
31 | |||
32 | =head1 HISTORY | ||
33 | |||
34 | BN_mod_inverse() is available in all versions of SSLeay and OpenSSL. | ||
35 | |||
36 | =cut | ||
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 new file mode 100644 index 0000000000..0f0c1375af --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BN_mod_mul_montgomery.pod | |||
@@ -0,0 +1,95 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_mod_mul_montgomery, BN_MONT_CTX_new, BN_MONT_CTX_init, | ||
6 | BN_MONT_CTX_free, BN_MONT_CTX_set, BN_MONT_CTX_copy, | ||
7 | BN_from_montgomery, BN_to_montgomery - Montgomery multiplication | ||
8 | |||
9 | =head1 SYNOPSIS | ||
10 | |||
11 | #include <openssl/bn.h> | ||
12 | |||
13 | BN_MONT_CTX *BN_MONT_CTX_new(void); | ||
14 | void BN_MONT_CTX_init(BN_MONT_CTX *ctx); | ||
15 | void BN_MONT_CTX_free(BN_MONT_CTX *mont); | ||
16 | |||
17 | int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *m, BN_CTX *ctx); | ||
18 | BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from); | ||
19 | |||
20 | int BN_mod_mul_montgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b, | ||
21 | BN_MONT_CTX *mont, BN_CTX *ctx); | ||
22 | |||
23 | int BN_from_montgomery(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mont, | ||
24 | BN_CTX *ctx); | ||
25 | |||
26 | int BN_to_montgomery(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mont, | ||
27 | BN_CTX *ctx); | ||
28 | |||
29 | =head1 DESCRIPTION | ||
30 | |||
31 | These functions implement Montgomery multiplication. They are used | ||
32 | automatically when L<BN_mod_exp(3)|BN_mod_exp(3)> is called with suitable input, | ||
33 | but they may be useful when several operations are to be performed | ||
34 | using the same modulus. | ||
35 | |||
36 | BN_MONT_CTX_new() allocates and initializes a B<BN_MONT_CTX> structure. | ||
37 | BN_MONT_CTX_init() initializes an existing uninitialized B<BN_MONT_CTX>. | ||
38 | |||
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. | ||
41 | |||
42 | BN_MONT_CTX_copy() copies the B<N_MONT_CTX> B<from> to B<to>. | ||
43 | |||
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. | ||
46 | |||
47 | BN_mod_mul_montgomery() computes Mont(B<a>,B<b>):=B<a>*B<b>*R^-1 and places | ||
48 | the result in B<r>. | ||
49 | |||
50 | BN_from_montgomery() performs the Montgomery reduction B<r> = B<a>*R^-1. | ||
51 | |||
52 | BN_to_montgomery() computes Mont(B<a>,R^2). | ||
53 | |||
54 | For all functions, B<ctx> is a previously allocated B<BN_CTX> used for | ||
55 | temporary variables. | ||
56 | |||
57 | The B<BN_MONT_CTX> structure is defined as follows: | ||
58 | |||
59 | typedef struct bn_mont_ctx_st | ||
60 | { | ||
61 | int ri; /* number of bits in R */ | ||
62 | BIGNUM RR; /* R^2 (used to convert to Montgomery form) */ | ||
63 | BIGNUM N; /* The modulus */ | ||
64 | BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1 | ||
65 | * (Ni is only stored for bignum algorithm) */ | ||
66 | BN_ULONG n0; /* least significant word of Ni */ | ||
67 | int flags; | ||
68 | } BN_MONT_CTX; | ||
69 | |||
70 | BN_to_montgomery() is a macro. | ||
71 | |||
72 | =head1 RETURN VALUES | ||
73 | |||
74 | BN_MONT_CTX_new() returns the newly allocated B<BN_MONT_CTX>, and NULL | ||
75 | on error. | ||
76 | |||
77 | BN_MONT_CTX_init() and BN_MONT_CTX_free() have no return values. | ||
78 | |||
79 | For the other functions, 1 is returned for success, 0 on error. | ||
80 | The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
81 | |||
82 | =head1 SEE ALSO | ||
83 | |||
84 | L<bn(3)|bn(3)>, L<err(3)|err(3)>, L<BN_add(3)|BN_add(3)>, | ||
85 | L<BN_CTX_new(3)|BN_CTX_new(3)> | ||
86 | |||
87 | =head1 HISTORY | ||
88 | |||
89 | BN_MONT_CTX_new(), BN_MONT_CTX_free(), BN_MONT_CTX_set(), | ||
90 | BN_mod_mul_montgomery(), BN_from_montgomery() and BN_to_montgomery() | ||
91 | are available in all versions of SSLeay and OpenSSL. | ||
92 | |||
93 | BN_MONT_CTX_init() and BN_MONT_CTX_copy() were added in SSLeay 0.9.1b. | ||
94 | |||
95 | =cut | ||
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 new file mode 100644 index 0000000000..32432ce4e6 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BN_mod_mul_reciprocal.pod | |||
@@ -0,0 +1,81 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_mod_mul_reciprocal, BN_RECP_CTX_new, BN_RECP_CTX_init, | ||
6 | BN_RECP_CTX_free, BN_RECP_CTX_set - modular multiplication using | ||
7 | reciprocal | ||
8 | |||
9 | =head1 SYNOPSIS | ||
10 | |||
11 | #include <openssl/bn.h> | ||
12 | |||
13 | BN_RECP_CTX *BN_RECP_CTX_new(void); | ||
14 | void BN_RECP_CTX_init(BN_RECP_CTX *recp); | ||
15 | void BN_RECP_CTX_free(BN_RECP_CTX *recp); | ||
16 | |||
17 | int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *m, BN_CTX *ctx); | ||
18 | |||
19 | int BN_div_recp(BIGNUM *dv, BIGNUM *rem, BIGNUM *a, BN_RECP_CTX *recp, | ||
20 | BN_CTX *ctx); | ||
21 | |||
22 | int BN_mod_mul_reciprocal(BIGNUM *r, BIGNUM *a, BIGNUM *b, | ||
23 | BN_RECP_CTX *recp, BN_CTX *ctx); | ||
24 | |||
25 | =head1 DESCRIPTION | ||
26 | |||
27 | BN_mod_mul_reciprocal() can be used to perform an efficient | ||
28 | L<BN_mod_mul(3)|BN_mod_mul(3)> operation when the operation will be performed | ||
29 | repeatedly with the same modulus. It computes B<r>=(B<a>*B<b>)%B<m> | ||
30 | using B<recp>=1/B<m>, which is set as described below. B<ctx> is a | ||
31 | previously allocated B<BN_CTX> used for temporary variables. | ||
32 | |||
33 | BN_RECP_CTX_new() allocates and initializes a B<BN_RECP> structure. | ||
34 | BN_RECP_CTX_init() initializes an existing uninitialized B<BN_RECP>. | ||
35 | |||
36 | BN_RECP_CTX_free() frees the components of the B<BN_RECP>, and, if it | ||
37 | was created by BN_RECP_CTX_new(), also the structure itself. | ||
38 | |||
39 | BN_RECP_CTX_set() stores B<m> in B<recp> and sets it up for computing | ||
40 | 1/B<m> and shifting it left by BN_num_bits(B<m>)+1 to make it an | ||
41 | integer. The result and the number of bits it was shifted left will | ||
42 | later be stored in B<recp>. | ||
43 | |||
44 | BN_div_recp() divides B<a> by B<m> using B<recp>. It places the quotient | ||
45 | in B<dv> and the remainder in B<rem>. | ||
46 | |||
47 | The B<BN_RECP_CTX> structure is defined as follows: | ||
48 | |||
49 | typedef struct bn_recp_ctx_st | ||
50 | { | ||
51 | BIGNUM N; /* the divisor */ | ||
52 | BIGNUM Nr; /* the reciprocal */ | ||
53 | int num_bits; | ||
54 | int shift; | ||
55 | int flags; | ||
56 | } BN_RECP_CTX; | ||
57 | |||
58 | It cannot be shared between threads. | ||
59 | |||
60 | =head1 RETURN VALUES | ||
61 | |||
62 | BN_RECP_CTX_new() returns the newly allocated B<BN_RECP_CTX>, and NULL | ||
63 | on error. | ||
64 | |||
65 | BN_RECP_CTX_init() and BN_RECP_CTX_free() have no return values. | ||
66 | |||
67 | For the other functions, 1 is returned for success, 0 on error. | ||
68 | The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
69 | |||
70 | =head1 SEE ALSO | ||
71 | |||
72 | L<bn(3)|bn(3)>, L<err(3)|err(3)>, L<BN_add(3)|BN_add(3)>, | ||
73 | L<BN_CTX_new(3)|BN_CTX_new(3)> | ||
74 | |||
75 | =head1 HISTORY | ||
76 | |||
77 | B<BN_RECP_CTX> was added in SSLeay 0.9.0. Before that, the function | ||
78 | BN_reciprocal() was used instead, and the BN_mod_mul_reciprocal() | ||
79 | arguments were different. | ||
80 | |||
81 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_new.pod b/src/lib/libssl/src/doc/crypto/BN_new.pod new file mode 100644 index 0000000000..c1394ff2a3 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BN_new.pod | |||
@@ -0,0 +1,53 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_new, BN_init, BN_clear, BN_free, BN_clear_free - allocate and free BIGNUMs | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bn.h> | ||
10 | |||
11 | BIGNUM *BN_new(void); | ||
12 | |||
13 | void BN_init(BIGNUM *); | ||
14 | |||
15 | void BN_clear(BIGNUM *a); | ||
16 | |||
17 | void BN_free(BIGNUM *a); | ||
18 | |||
19 | void BN_clear_free(BIGNUM *a); | ||
20 | |||
21 | =head1 DESCRIPTION | ||
22 | |||
23 | BN_new() allocated and initializes a B<BIGNUM> structure. BN_init() | ||
24 | initializes an existing uninitialized B<BIGNUM>. | ||
25 | |||
26 | BN_clear() is used to destroy sensitive data such as keys when they | ||
27 | are no longer needed. It erases the memory used by B<a> and sets it | ||
28 | to the value 0. | ||
29 | |||
30 | BN_free() frees the components of the B<BIGNUM>, and if it was created | ||
31 | by BN_new(), also the structure itself. BN_clear_free() additionally | ||
32 | overwrites the data before the memory is returned to the system. | ||
33 | |||
34 | =head1 RETURN VALUES | ||
35 | |||
36 | BN_new() returns a pointer to the B<BIGNUM>. If the allocation fails, | ||
37 | it returns B<NULL> and sets an error code that can be obtained | ||
38 | by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
39 | |||
40 | BN_init(), BN_clear(), BN_free() and BN_clear_free() have no return | ||
41 | values. | ||
42 | |||
43 | =head1 SEE ALSO | ||
44 | |||
45 | L<bn(3)|bn(3)>, L<err(3)|err(3)> | ||
46 | |||
47 | =head1 HISTORY | ||
48 | |||
49 | BN_new(), BN_clear(), BN_free() and BN_clear_free() are available in | ||
50 | all versions on SSLeay and OpenSSL. BN_init() was added in SSLeay | ||
51 | 0.9.1b. | ||
52 | |||
53 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_num_bytes.pod b/src/lib/libssl/src/doc/crypto/BN_num_bytes.pod new file mode 100644 index 0000000000..61589fb9ac --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BN_num_bytes.pod | |||
@@ -0,0 +1,37 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_num_bits, BN_num_bytes, BN_num_bits_word - get BIGNUM size | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bn.h> | ||
10 | |||
11 | int BN_num_bytes(const BIGNUM *a); | ||
12 | |||
13 | int BN_num_bits(const BIGNUM *a); | ||
14 | |||
15 | int BN_num_bits_word(BN_ULONG w); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | These functions return the size of a B<BIGNUM> in bytes or bits, | ||
20 | and the size of an unsigned integer in bits. | ||
21 | |||
22 | BN_num_bytes() is a macro. | ||
23 | |||
24 | =head1 RETURN VALUES | ||
25 | |||
26 | The size. | ||
27 | |||
28 | =head1 SEE ALSO | ||
29 | |||
30 | L<bn(3)|bn(3)> | ||
31 | |||
32 | =head1 HISTORY | ||
33 | |||
34 | BN_num_bytes(), BN_num_bits() and BN_num_bits_word() are available in | ||
35 | all versions of SSLeay and OpenSSL. | ||
36 | |||
37 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_rand.pod b/src/lib/libssl/src/doc/crypto/BN_rand.pod new file mode 100644 index 0000000000..33363c981f --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BN_rand.pod | |||
@@ -0,0 +1,45 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_rand, BN_pseudo_rand - generate pseudo-random number | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bn.h> | ||
10 | |||
11 | int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); | ||
12 | |||
13 | int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | BN_rand() generates a cryptographically strong pseudo-random number of | ||
18 | B<bits> bits in length and stores it in B<rnd>. If B<top> is true, the | ||
19 | two most significant bits of the number will be set to 1, so that the | ||
20 | product of two such random numbers will always have 2*B<bits> length. | ||
21 | If B<bottom> is true, the number will be odd. | ||
22 | |||
23 | BN_pseudo_rand() does the same, but pseudo-random numbers generated by | ||
24 | this function are not necessarily unpredictable. They can be used for | ||
25 | non-cryptographic purposes and for certain purposes in cryptographic | ||
26 | protocols, but usually not for key generation etc. | ||
27 | |||
28 | The PRNG must be seeded prior to calling BN_rand(). | ||
29 | |||
30 | =head1 RETURN VALUES | ||
31 | |||
32 | BN_rand() and BN_pseudo_rand() return 1 on success, 0 on error. | ||
33 | The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
34 | |||
35 | =head1 SEE ALSO | ||
36 | |||
37 | L<bn(3)|bn(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>, | ||
38 | L<RAND_add(3)|RAND_add(3)>, L<RAND_bytes(3)|RAND_bytes(3)> | ||
39 | |||
40 | =head1 HISTORY | ||
41 | |||
42 | BN_rand() is available in all versions of SSLeay and OpenSSL. | ||
43 | BN_pseudo_rand() was added in OpenSSL 0.9.5. | ||
44 | |||
45 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_set_bit.pod b/src/lib/libssl/src/doc/crypto/BN_set_bit.pod new file mode 100644 index 0000000000..b7c47b9b01 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BN_set_bit.pod | |||
@@ -0,0 +1,66 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_set_bit, BN_clear_bit, BN_is_bit_set, BN_mask_bits, BN_lshift, | ||
6 | BN_lshift1, BN_rshift, BN_rshift1 - bit operations on BIGNUMs | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/bn.h> | ||
11 | |||
12 | int BN_set_bit(BIGNUM *a, int n); | ||
13 | int BN_clear_bit(BIGNUM *a, int n); | ||
14 | |||
15 | int BN_is_bit_set(const BIGNUM *a, int n); | ||
16 | |||
17 | int BN_mask_bits(BIGNUM *a, int n); | ||
18 | |||
19 | int BN_lshift(BIGNUM *r, const BIGNUM *a, int n); | ||
20 | int BN_lshift1(BIGNUM *r, BIGNUM *a); | ||
21 | |||
22 | int BN_rshift(BIGNUM *r, BIGNUM *a, int n); | ||
23 | int BN_rshift1(BIGNUM *r, BIGNUM *a); | ||
24 | |||
25 | =head1 DESCRIPTION | ||
26 | |||
27 | BN_set_bit() sets bit B<n> in B<a> to 1 (C<a|=(1E<lt>E<lt>n)>). The | ||
28 | number is expanded if necessary. | ||
29 | |||
30 | BN_clear_bit() sets bit B<n> in B<a> to 0 (C<a&=~(1E<lt>E<lt>n)>). An | ||
31 | error occurs if B<a> is shorter than B<n> bits. | ||
32 | |||
33 | BN_is_bit_set() tests if bit B<n> in B<a> is set. | ||
34 | |||
35 | BN_mask_bits() truncates B<a> to an B<n> bit number | ||
36 | (C<a&=~((~0)E<gt>E<gt>n)>). An error occurs if B<a> already is | ||
37 | shorter than B<n> bits. | ||
38 | |||
39 | BN_lshift() shifts B<a> left by B<n> bits and places the result in | ||
40 | B<r> (C<r=a*2^n>). BN_lshift1() shifts B<a> left by one and places | ||
41 | the result in B<r> (C<r=2*a>). | ||
42 | |||
43 | BN_rshift() shifts B<a> right by B<n> bits and places the result in | ||
44 | B<r> (C<r=a/2^n>). BN_rshift1() shifts B<a> right by one and places | ||
45 | the result in B<r> (C<r=a/2>). | ||
46 | |||
47 | For the shift functions, B<r> and B<a> may be the same variable. | ||
48 | |||
49 | =head1 RETURN VALUES | ||
50 | |||
51 | BN_is_bit_set() returns 1 if the bit is set, 0 otherwise. | ||
52 | |||
53 | All other functions return 1 for success, 0 on error. The error codes | ||
54 | can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
55 | |||
56 | =head1 SEE ALSO | ||
57 | |||
58 | L<bn(3)|bn(3)>, L<BN_num_bytes(3)|BN_num_bytes(3)>, L<BN_add(3)|BN_add(3)> | ||
59 | |||
60 | =head1 HISTORY | ||
61 | |||
62 | BN_set_bit(), BN_clear_bit(), BN_is_bit_set(), BN_mask_bits(), | ||
63 | BN_lshift(), BN_lshift1(), BN_rshift(), and BN_rshift1() are available | ||
64 | in all versions of SSLeay and OpenSSL. | ||
65 | |||
66 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_zero.pod b/src/lib/libssl/src/doc/crypto/BN_zero.pod new file mode 100644 index 0000000000..165fd9a228 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BN_zero.pod | |||
@@ -0,0 +1,55 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_zero, BN_one, BN_set_word, BN_get_word - BIGNUM assignment operations | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bn.h> | ||
10 | |||
11 | int BN_zero(BIGNUM *a); | ||
12 | int BN_one(BIGNUM *a); | ||
13 | |||
14 | BIGNUM *BN_value_one(void); | ||
15 | |||
16 | int BN_set_word(BIGNUM *a, unsigned long w); | ||
17 | unsigned long BN_get_word(BIGNUM *a); | ||
18 | |||
19 | =head1 DESCRIPTION | ||
20 | |||
21 | BN_zero(), BN_one() and BN_set_word() set B<a> to the values 0, 1 and | ||
22 | B<w> respectively. BN_zero() and BN_one() are macros. | ||
23 | |||
24 | BN_value_one() returns a B<BIGNUM> constant of value 1. This constant | ||
25 | is useful for use in comparisons and assignment. | ||
26 | |||
27 | BN_get_word() returns B<a>, if it can be represented as an unsigned | ||
28 | long. | ||
29 | |||
30 | =head1 RETURN VALUES | ||
31 | |||
32 | BN_get_word() returns the value B<a>, and 0xffffffffL if B<a> cannot | ||
33 | be represented as an unsigned long. | ||
34 | |||
35 | BN_zero(), BN_one() and BN_set_word() return 1 on success, 0 otherwise. | ||
36 | BN_value_one() returns the constant. | ||
37 | |||
38 | =head1 BUGS | ||
39 | |||
40 | Someone might change the constant. | ||
41 | |||
42 | If a B<BIGNUM> is equal to 0xffffffffL it can be represented as an | ||
43 | unsigned long but this value is also returned on error. | ||
44 | |||
45 | =head1 SEE ALSO | ||
46 | |||
47 | L<bn(3)|bn(3)>, L<BN_bn2bin(3)|BN_bn2bin(3)> | ||
48 | |||
49 | =head1 HISTORY | ||
50 | |||
51 | BN_zero(), BN_one() and BN_set_word() are available in all versions of | ||
52 | SSLeay and OpenSSL. BN_value_one() and BN_get_word() were added in | ||
53 | SSLeay 0.8. | ||
54 | |||
55 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/CRYPTO_set_ex_data.pod b/src/lib/libssl/src/doc/crypto/CRYPTO_set_ex_data.pod new file mode 100644 index 0000000000..1bd5bed67d --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/CRYPTO_set_ex_data.pod | |||
@@ -0,0 +1,51 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | CRYPTO_set_ex_data, CRYPTO_get_ex_data - internal application specific data functions | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | int CRYPTO_set_ex_data(CRYPTO_EX_DATA *r, int idx, void *arg); | ||
10 | |||
11 | void *CRYPTO_get_ex_data(CRYPTO_EX_DATA *r, int idx); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | Several OpenSSL structures can have application specific data attached to them. | ||
16 | These functions are used internally by OpenSSL to manipulate application | ||
17 | specific data attached to a specific structure. | ||
18 | |||
19 | These functions should only be used by applications to manipulate | ||
20 | B<CRYPTO_EX_DATA> structures passed to the B<new_func()>, B<free_func()> and | ||
21 | B<dup_func()> callbacks: as passed to B<RSA_get_ex_new_index()> for example. | ||
22 | |||
23 | B<CRYPTO_set_ex_data()> is used to set application specific data, the data is | ||
24 | supplied in the B<arg> parameter and its precise meaning is up to the | ||
25 | application. | ||
26 | |||
27 | B<CRYPTO_get_ex_data()> is used to retrieve application specific data. The data | ||
28 | is returned to the application, this will be the same value as supplied to | ||
29 | a previous B<CRYPTO_set_ex_data()> call. | ||
30 | |||
31 | =head1 RETURN VALUES | ||
32 | |||
33 | B<CRYPTO_set_ex_data()> returns 1 on success or 0 on failure. | ||
34 | |||
35 | B<CRYPTO_get_ex_data()> returns the application data or 0 on failure. 0 may also | ||
36 | be valid application data but currently it can only fail if given an invalid B<idx> | ||
37 | parameter. | ||
38 | |||
39 | On failure an error code can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>. | ||
40 | |||
41 | =head1 SEE ALSO | ||
42 | |||
43 | L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>, | ||
44 | L<DSA_get_ex_new_index(3)|DSA_get_ex_new_index(3)>, | ||
45 | L<DH_get_ex_new_index(3)|DH_get_ex_new_index(3)> | ||
46 | |||
47 | =head1 HISTORY | ||
48 | |||
49 | CRYPTO_set_ex_data() and CRYPTO_get_ex_data() have been available since SSLeay 0.9.0. | ||
50 | |||
51 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/DH_generate_key.pod b/src/lib/libssl/src/doc/crypto/DH_generate_key.pod new file mode 100644 index 0000000000..920995b2e5 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/DH_generate_key.pod | |||
@@ -0,0 +1,50 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DH_generate_key, DH_compute_key - perform Diffie-Hellman key exchange | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dh.h> | ||
10 | |||
11 | int DH_generate_key(DH *dh); | ||
12 | |||
13 | int DH_compute_key(unsigned char *key, BIGNUM *pub_key, DH *dh); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | DH_generate_key() performs the first step of a Diffie-Hellman key | ||
18 | exchange by generating private and public DH values. By calling | ||
19 | DH_compute_key(), these are combined with the other party's public | ||
20 | value to compute the shared key. | ||
21 | |||
22 | DH_generate_key() expects B<dh> to contain the shared parameters | ||
23 | B<dh-E<gt>p> and B<dh-E<gt>g>. It generates a random private DH value | ||
24 | unless B<dh-E<gt>priv_key> is already set, and computes the | ||
25 | corresponding public value B<dh-E<gt>pub_key>, which can then be | ||
26 | published. | ||
27 | |||
28 | DH_compute_key() computes the shared secret from the private DH value | ||
29 | in B<dh> and the other party's public value in B<pub_key> and stores | ||
30 | it in B<key>. B<key> must point to B<DH_size(dh)> bytes of memory. | ||
31 | |||
32 | =head1 RETURN VALUES | ||
33 | |||
34 | DH_generate_key() returns 1 on success, 0 otherwise. | ||
35 | |||
36 | DH_compute_key() returns the size of the shared secret on success, -1 | ||
37 | on error. | ||
38 | |||
39 | The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
40 | |||
41 | =head1 SEE ALSO | ||
42 | |||
43 | L<dh(3)|dh(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>, L<DH_size(3)|DH_size(3)> | ||
44 | |||
45 | =head1 HISTORY | ||
46 | |||
47 | DH_generate_key() and DH_compute_key() are available in all versions | ||
48 | of SSLeay and OpenSSL. | ||
49 | |||
50 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/DH_generate_parameters.pod b/src/lib/libssl/src/doc/crypto/DH_generate_parameters.pod new file mode 100644 index 0000000000..a7d0c75f0c --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/DH_generate_parameters.pod | |||
@@ -0,0 +1,72 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DH_generate_parameters, DH_check - generate and check Diffie-Hellman parameters | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dh.h> | ||
10 | |||
11 | DH *DH_generate_parameters(int prime_len, int generator, | ||
12 | void (*callback)(int, int, void *), void *cb_arg); | ||
13 | |||
14 | int DH_check(DH *dh, int *codes); | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | DH_generate_parameters() generates Diffie-Hellman parameters that can | ||
19 | be shared among a group of users, and returns them in a newly | ||
20 | allocated B<DH> structure. The pseudo-random number generator must be | ||
21 | seeded prior to calling DH_generate_parameters(). | ||
22 | |||
23 | B<prime_len> is the length in bits of the safe prime to be generated. | ||
24 | B<generator> is a small number E<gt> 1, typically 2 or 5. | ||
25 | |||
26 | A callback function may be used to provide feedback about the progress | ||
27 | of the key generation. If B<callback> is not B<NULL>, it will be | ||
28 | called as described in L<BN_generate_prime(3)|BN_generate_prime(3)> while a random prime | ||
29 | number is generated, and when a prime has been found, B<callback(3, | ||
30 | 0, cb_arg)> is called. | ||
31 | |||
32 | DH_check() validates Diffie-Hellman parameters. It checks that B<p> is | ||
33 | a safe prime, and that B<g> is a suitable generator. In the case of an | ||
34 | error, the bit flags DH_CHECK_P_NOT_SAFE_PRIME or | ||
35 | DH_NOT_SUITABLE_GENERATOR are set in B<*codes>. | ||
36 | DH_UNABLE_TO_CHECK_GENERATOR is set if the generator cannot be | ||
37 | checked, i.e. it does not equal 2 or 5. | ||
38 | |||
39 | =head1 RETURN VALUES | ||
40 | |||
41 | DH_generate_parameters() returns a pointer to the DH structure, or | ||
42 | NULL if the parameter generation fails. The error codes can be | ||
43 | obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
44 | |||
45 | DH_check() returns 1 if the check could be performed, 0 otherwise. | ||
46 | |||
47 | =head1 NOTES | ||
48 | |||
49 | DH_generate_parameters() may run for several hours before finding a | ||
50 | suitable prime. | ||
51 | |||
52 | The parameters generated by DH_generate_parameters() are not to be | ||
53 | used in signature schemes. | ||
54 | |||
55 | =head1 BUGS | ||
56 | |||
57 | If B<generator> is not 2 or 5, B<dh-E<gt>g>=B<generator> is not | ||
58 | a usable generator. | ||
59 | |||
60 | =head1 SEE ALSO | ||
61 | |||
62 | L<dh(3)|dh(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>, L<DH_free(3)|DH_free(3)> | ||
63 | |||
64 | =head1 HISTORY | ||
65 | |||
66 | DH_check() is available in all versions of SSLeay and OpenSSL. | ||
67 | The B<cb_arg> argument to DH_generate_parameters() was added in SSLeay 0.9.0. | ||
68 | |||
69 | In versions before OpenSSL 0.9.5, DH_CHECK_P_NOT_STRONG_PRIME is used | ||
70 | instead of DH_CHECK_P_NOT_SAFE_PRIME. | ||
71 | |||
72 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/DH_get_ex_new_index.pod b/src/lib/libssl/src/doc/crypto/DH_get_ex_new_index.pod new file mode 100644 index 0000000000..82e2548bcd --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/DH_get_ex_new_index.pod | |||
@@ -0,0 +1,36 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DH_get_ex_new_index, DH_set_ex_data, DH_get_ex_data - add application specific data to DH structures | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dh.h> | ||
10 | |||
11 | int DH_get_ex_new_index(long argl, void *argp, | ||
12 | CRYPTO_EX_new *new_func, | ||
13 | CRYPTO_EX_dup *dup_func, | ||
14 | CRYPTO_EX_free *free_func); | ||
15 | |||
16 | int DH_set_ex_data(DH *d, int idx, void *arg); | ||
17 | |||
18 | char *DH_get_ex_data(DH *d, int idx); | ||
19 | |||
20 | =head1 DESCRIPTION | ||
21 | |||
22 | These functions handle application specific data in DH | ||
23 | structures. Their usage is identical to that of | ||
24 | RSA_get_ex_new_index(), RSA_set_ex_data() and RSA_get_ex_data() | ||
25 | as described in L<RSA_get_ex_new_index(3)>. | ||
26 | |||
27 | =head1 SEE ALSO | ||
28 | |||
29 | L<RSA_get_ex_new_index()|RSA_get_ex_new_index()>, L<dh(3)|dh(3)> | ||
30 | |||
31 | =head1 HISTORY | ||
32 | |||
33 | DH_get_ex_new_index(), DH_set_ex_data() and DH_get_ex_data() are | ||
34 | available since OpenSSL 0.9.5. | ||
35 | |||
36 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/DH_new.pod b/src/lib/libssl/src/doc/crypto/DH_new.pod new file mode 100644 index 0000000000..64624b9d15 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/DH_new.pod | |||
@@ -0,0 +1,40 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DH_new, DH_free - allocate and free DH objects | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dh.h> | ||
10 | |||
11 | DH* DH_new(void); | ||
12 | |||
13 | void DH_free(DH *dh); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | DH_new() allocates and initializes a B<DH> structure. | ||
18 | |||
19 | DH_free() frees the B<DH> structure and its components. The values are | ||
20 | erased before the memory is returned to the system. | ||
21 | |||
22 | =head1 RETURN VALUES | ||
23 | |||
24 | If the allocation fails, DH_new() returns B<NULL> and sets an error | ||
25 | code that can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. Otherwise it returns | ||
26 | a pointer to the newly allocated structure. | ||
27 | |||
28 | DH_free() returns no value. | ||
29 | |||
30 | =head1 SEE ALSO | ||
31 | |||
32 | L<dh(3)|dh(3)>, L<err(3)|err(3)>, | ||
33 | L<DH_generate_parameters(3)|DH_generate_parameters(3)>, | ||
34 | L<DH_generate_key(3)|DH_generate_key(3)> | ||
35 | |||
36 | =head1 HISTORY | ||
37 | |||
38 | DH_new() and DH_free() are available in all versions of SSLeay and OpenSSL. | ||
39 | |||
40 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/DH_set_method.pod b/src/lib/libssl/src/doc/crypto/DH_set_method.pod new file mode 100644 index 0000000000..dca41d8dbc --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/DH_set_method.pod | |||
@@ -0,0 +1,99 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DH_set_default_method, DH_get_default_method, DH_set_method, | ||
6 | DH_new_method, DH_OpenSSL - select DH method | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/dh.h> | ||
11 | |||
12 | void DH_set_default_method(DH_METHOD *meth); | ||
13 | |||
14 | DH_METHOD *DH_get_default_method(void); | ||
15 | |||
16 | DH_METHOD *DH_set_method(DH *dh, DH_METHOD *meth); | ||
17 | |||
18 | DH *DH_new_method(DH_METHOD *meth); | ||
19 | |||
20 | DH_METHOD *DH_OpenSSL(void); | ||
21 | |||
22 | =head1 DESCRIPTION | ||
23 | |||
24 | A B<DH_METHOD> specifies the functions that OpenSSL uses for Diffie-Hellman | ||
25 | operations. By modifying the method, alternative implementations | ||
26 | such as hardware accelerators may be used. | ||
27 | |||
28 | Initially, the default is to use the OpenSSL internal implementation. | ||
29 | DH_OpenSSL() returns a pointer to that method. | ||
30 | |||
31 | DH_set_default_method() makes B<meth> the default method for all B<DH> | ||
32 | structures created later. | ||
33 | |||
34 | DH_get_default_method() returns a pointer to the current default | ||
35 | method. | ||
36 | |||
37 | DH_set_method() selects B<meth> for all operations using the structure B<dh>. | ||
38 | |||
39 | DH_get_method() returns a pointer to the method currently selected | ||
40 | for B<dh>. | ||
41 | |||
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 | |||
46 | =head1 THE DH_METHOD STRUCTURE | ||
47 | |||
48 | typedef struct dh_meth_st | ||
49 | { | ||
50 | /* name of the implementation */ | ||
51 | const char *name; | ||
52 | |||
53 | /* generate private and public DH values for key agreement */ | ||
54 | int (*generate_key)(DH *dh); | ||
55 | |||
56 | /* compute shared secret */ | ||
57 | int (*compute_key)(unsigned char *key, BIGNUM *pub_key, DH *dh); | ||
58 | |||
59 | /* compute r = a ^ p mod m. May be NULL */ | ||
60 | int (*bn_mod_exp)(DH *dh, BIGNUM *r, BIGNUM *a, const BIGNUM *p, | ||
61 | const BIGNUM *m, BN_CTX *ctx, | ||
62 | BN_MONT_CTX *m_ctx); | ||
63 | |||
64 | /* called at DH_new */ | ||
65 | int (*init)(DH *dh); | ||
66 | |||
67 | /* called at DH_free */ | ||
68 | int (*finish)(DH *dh); | ||
69 | |||
70 | int flags; | ||
71 | |||
72 | char *app_data; /* ?? */ | ||
73 | |||
74 | } DH_METHOD; | ||
75 | |||
76 | =head1 RETURN VALUES | ||
77 | |||
78 | DH_OpenSSL(), DH_get_default_method() and DH_get_method() return | ||
79 | pointers to the respective B<DH_METHOD>s. | ||
80 | |||
81 | DH_set_default_method() returns no value. | ||
82 | |||
83 | DH_set_method() returns a pointer to the B<DH_METHOD> previously | ||
84 | associated with B<dh>. | ||
85 | |||
86 | DH_new_method() returns B<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 | ||
88 | returns a pointer to the newly allocated structure. | ||
89 | |||
90 | =head1 SEE ALSO | ||
91 | |||
92 | L<dh(3)|dh(3)>, L<DH_new(3)|DH_new(3)> | ||
93 | |||
94 | =head1 HISTORY | ||
95 | |||
96 | 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. | ||
98 | |||
99 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/DH_size.pod b/src/lib/libssl/src/doc/crypto/DH_size.pod new file mode 100644 index 0000000000..97f26fda78 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/DH_size.pod | |||
@@ -0,0 +1,33 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DH_size - get Diffie-Hellman prime size | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dh.h> | ||
10 | |||
11 | int DH_size(DH *dh); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | This function returns the Diffie-Hellman size in bytes. It can be used | ||
16 | to determine how much memory must be allocated for the shared secret | ||
17 | computed by DH_compute_key(). | ||
18 | |||
19 | B<dh-E<gt>p> must not be B<NULL>. | ||
20 | |||
21 | =head1 RETURN VALUE | ||
22 | |||
23 | The size in bytes. | ||
24 | |||
25 | =head1 SEE ALSO | ||
26 | |||
27 | L<dh(3)|dh(3)>, L<DH_generate_key(3)|DH_generate_key(3)> | ||
28 | |||
29 | =head1 HISTORY | ||
30 | |||
31 | DH_size() is available in all versions of SSLeay and OpenSSL. | ||
32 | |||
33 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/DSA_SIG_new.pod b/src/lib/libssl/src/doc/crypto/DSA_SIG_new.pod new file mode 100644 index 0000000000..671655554a --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/DSA_SIG_new.pod | |||
@@ -0,0 +1,39 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DSA_SIG_new, DSA_SIG_free - allocate and free DSA signature objects | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dsa.h> | ||
10 | |||
11 | DSA_SIG *DSA_SIG_new(void); | ||
12 | |||
13 | void DSA_SIG_free(DSA_SIG *a); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | DSA_SIG_new() allocates and initializes a B<DSA_SIG> structure. | ||
18 | |||
19 | DSA_SIG_free() frees the B<DSA_SIG> structure and its components. The | ||
20 | values are erased before the memory is returned to the system. | ||
21 | |||
22 | =head1 RETURN VALUES | ||
23 | |||
24 | If the allocation fails, DSA_SIG_new() returns B<NULL> and sets an | ||
25 | error code that can be obtained by | ||
26 | L<ERR_get_error(3)|ERR_get_error(3)>. Otherwise it returns a pointer | ||
27 | to the newly allocated structure. | ||
28 | |||
29 | DSA_SIG_free() returns no value. | ||
30 | |||
31 | =head1 SEE ALSO | ||
32 | |||
33 | L<dsa(3)|dsa(3)>, L<err(3)|err(3)>, L<DSA_do_sign(3)|DSA_do_sign(3)> | ||
34 | |||
35 | =head1 HISTORY | ||
36 | |||
37 | DSA_SIG_new() and DSA_SIG_free() were added in OpenSSL 0.9.3. | ||
38 | |||
39 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/DSA_do_sign.pod b/src/lib/libssl/src/doc/crypto/DSA_do_sign.pod new file mode 100644 index 0000000000..a24fd5714e --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/DSA_do_sign.pod | |||
@@ -0,0 +1,47 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DSA_do_sign, DSA_do_verify - raw DSA signature operations | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dsa.h> | ||
10 | |||
11 | DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); | ||
12 | |||
13 | int DSA_do_verify(const unsigned char *dgst, int dgst_len, | ||
14 | DSA_SIG *sig, DSA *dsa); | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | DSA_do_sign() computes a digital signature on the B<len> byte message | ||
19 | digest B<dgst> using the private key B<dsa> and returns it in a | ||
20 | newly allocated B<DSA_SIG> structure. | ||
21 | |||
22 | L<DSA_sign_setup(3)|DSA_sign_setup(3)> may be used to precompute part | ||
23 | of the signing operation in case signature generation is | ||
24 | time-critical. | ||
25 | |||
26 | DSA_do_verify() verifies that the signature B<sig> matches a given | ||
27 | message digest B<dgst> of size B<len>. B<dsa> is the signer's public | ||
28 | key. | ||
29 | |||
30 | =head1 RETURN VALUES | ||
31 | |||
32 | DSA_do_sign() returns the signature, NULL on error. DSA_do_verify() | ||
33 | returns 1 for a valid signature, 0 for an incorrect signature and -1 | ||
34 | on error. The error codes can be obtained by | ||
35 | L<ERR_get_error(3)|ERR_get_error(3)>. | ||
36 | |||
37 | =head1 SEE ALSO | ||
38 | |||
39 | L<dsa(3)|dsa(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>, | ||
40 | L<DSA_SIG_new(3)|DSA_SIG_new(3)>, | ||
41 | L<DSA_sign(3)|DSA_sign(3)> | ||
42 | |||
43 | =head1 HISTORY | ||
44 | |||
45 | DSA_do_sign() and DSA_do_verify() were added in OpenSSL 0.9.3. | ||
46 | |||
47 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/DSA_dup_DH.pod b/src/lib/libssl/src/doc/crypto/DSA_dup_DH.pod new file mode 100644 index 0000000000..29cb1075d1 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/DSA_dup_DH.pod | |||
@@ -0,0 +1,36 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DSA_dup_DH - create a DH structure out of DSA structure | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dsa.h> | ||
10 | |||
11 | DH * DSA_dup_DH(DSA *r); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | DSA_dup_DH() duplicates DSA parameters/keys as DH parameters/keys. q | ||
16 | is lost during that conversion, but the resulting DH parameters | ||
17 | contain its length. | ||
18 | |||
19 | =head1 RETURN VALUE | ||
20 | |||
21 | DSA_dup_DH() returns the new B<DH> structure, and NULL on error. The | ||
22 | error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
23 | |||
24 | =head1 NOTE | ||
25 | |||
26 | Be careful to avoid small subgroup attacks when using this. | ||
27 | |||
28 | =head1 SEE ALSO | ||
29 | |||
30 | L<dh(3)|dh(3)>, L<dsa(3)|dsa(3)>, L<err(3)|err(3)> | ||
31 | |||
32 | =head1 HISTORY | ||
33 | |||
34 | DSA_dup_DH() was added in OpenSSL 0.9.4. | ||
35 | |||
36 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/DSA_generate_key.pod b/src/lib/libssl/src/doc/crypto/DSA_generate_key.pod new file mode 100644 index 0000000000..52890db5be --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/DSA_generate_key.pod | |||
@@ -0,0 +1,33 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DSA_generate_key - generate DSA key pair | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dsa.h> | ||
10 | |||
11 | int DSA_generate_key(DSA *a); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | DSA_generate_key() expects B<a> to contain DSA parameters. It generates | ||
16 | a new key pair and stores it in B<a-E<gt>pub_key> and B<a-E<gt>priv_key>. | ||
17 | |||
18 | The PRNG must be seeded prior to calling DSA_generate_key(). | ||
19 | |||
20 | =head1 RETURN VALUE | ||
21 | |||
22 | DSA_generate_key() returns 1 on success, 0 otherwise. | ||
23 | The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
24 | |||
25 | =head1 SEE ALSO | ||
26 | |||
27 | L<dsa(3)|dsa(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>, L<DSA_generate_parameters(3)|DSA_generate_parameters(3)> | ||
28 | |||
29 | =head1 HISTORY | ||
30 | |||
31 | DSA_generate_key() is available since SSLeay 0.8. | ||
32 | |||
33 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/DSA_generate_parameters.pod b/src/lib/libssl/src/doc/crypto/DSA_generate_parameters.pod new file mode 100644 index 0000000000..43f60b0eb9 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/DSA_generate_parameters.pod | |||
@@ -0,0 +1,105 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DSA_generate_parameters - generate DSA parameters | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dsa.h> | ||
10 | |||
11 | DSA *DSA_generate_parameters(int bits, unsigned char *seed, | ||
12 | int seed_len, int *counter_ret, unsigned long *h_ret, | ||
13 | void (*callback)(int, int, void *), void *cb_arg); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | DSA_generate_parameters() generates primes p and q and a generator g | ||
18 | for use in the DSA. | ||
19 | |||
20 | B<bits> is the length of the prime to be generated; the DSS allows a | ||
21 | maximum of 1024 bits. | ||
22 | |||
23 | If B<seed> is B<NULL> or B<seed_len> E<lt> 20, the primes will be | ||
24 | generated at random. Otherwise, the seed is used to generate | ||
25 | them. If the given seed does not yield a prime q, a new random | ||
26 | seed is chosen and placed at B<seed>. | ||
27 | |||
28 | DSA_generate_parameters() places the iteration count in | ||
29 | *B<counter_ret> and a counter used for finding a generator in | ||
30 | *B<h_ret>, unless these are B<NULL>. | ||
31 | |||
32 | A callback function may be used to provide feedback about the progress | ||
33 | of the key generation. If B<callback> is not B<NULL>, it will be | ||
34 | called as follows: | ||
35 | |||
36 | =over 4 | ||
37 | |||
38 | =item * | ||
39 | |||
40 | When a candidate for q is generated, B<callback(0, m++, cb_arg)> is called | ||
41 | (m is 0 for the first candidate). | ||
42 | |||
43 | =item * | ||
44 | |||
45 | When a candidate for q has passed a test by trial division, | ||
46 | B<callback(1, -1, cb_arg)> is called. | ||
47 | While a candidate for q is tested by Miller-Rabin primality tests, | ||
48 | B<callback(1, i, cb_arg)> is called in the outer loop | ||
49 | (once for each witness that confirms that the candidate may be prime); | ||
50 | i is the loop counter (starting at 0). | ||
51 | |||
52 | =item * | ||
53 | |||
54 | When a prime q has been found, B<callback(2, 0, cb_arg)> and | ||
55 | B<callback(3, 0, cb_arg)> are called. | ||
56 | |||
57 | =item * | ||
58 | |||
59 | Before a candidate for p (other than the first) is generated and tested, | ||
60 | B<callback(0, counter, cb_arg)> is called. | ||
61 | |||
62 | =item * | ||
63 | |||
64 | When a candidate for p has passed the test by trial division, | ||
65 | B<callback(1, -1, cb_arg)> is called. | ||
66 | While it is tested by the Miller-Rabin primality test, | ||
67 | B<callback(1, i, cb_arg)> is called in the outer loop | ||
68 | (once for each witness that confirms that the candidate may be prime). | ||
69 | i is the loop counter (starting at 0). | ||
70 | |||
71 | =item * | ||
72 | |||
73 | When p has been found, B<callback(2, 1, cb_arg)> is called. | ||
74 | |||
75 | =item * | ||
76 | |||
77 | When the generator has been found, B<callback(3, 1, cb_arg)> is called. | ||
78 | |||
79 | =back | ||
80 | |||
81 | =head1 RETURN VALUE | ||
82 | |||
83 | DSA_generate_parameters() returns a pointer to the DSA structure, or | ||
84 | B<NULL> if the parameter generation fails. The error codes can be | ||
85 | obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
86 | |||
87 | =head1 BUGS | ||
88 | |||
89 | Seed lengths E<gt> 20 are not supported. | ||
90 | |||
91 | =head1 SEE ALSO | ||
92 | |||
93 | L<dsa(3)|dsa(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>, | ||
94 | L<DSA_free(3)|DSA_free(3)> | ||
95 | |||
96 | =head1 HISTORY | ||
97 | |||
98 | DSA_generate_parameters() appeared in SSLeay 0.8. The B<cb_arg> | ||
99 | argument was added in SSLeay 0.9.0. | ||
100 | In versions up to OpenSSL 0.9.4, B<callback(1, ...)> was called | ||
101 | in the inner loop of the Miller-Rabin test whenever it reached the | ||
102 | squaring step (the parameters to B<callback> did not reveal how many | ||
103 | witnesses had been tested); since OpenSSL 0.9.5, B<callback(1, ...)> | ||
104 | is called as in BN_is_prime(3), i.e. once for each witness. | ||
105 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/DSA_get_ex_new_index.pod b/src/lib/libssl/src/doc/crypto/DSA_get_ex_new_index.pod new file mode 100644 index 0000000000..4612e708ec --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/DSA_get_ex_new_index.pod | |||
@@ -0,0 +1,36 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DSA_get_ex_new_index, DSA_set_ex_data, DSA_get_ex_data - add application specific data to DSA structures | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/DSA.h> | ||
10 | |||
11 | int DSA_get_ex_new_index(long argl, void *argp, | ||
12 | CRYPTO_EX_new *new_func, | ||
13 | CRYPTO_EX_dup *dup_func, | ||
14 | CRYPTO_EX_free *free_func); | ||
15 | |||
16 | int DSA_set_ex_data(DSA *d, int idx, void *arg); | ||
17 | |||
18 | char *DSA_get_ex_data(DSA *d, int idx); | ||
19 | |||
20 | =head1 DESCRIPTION | ||
21 | |||
22 | These functions handle application specific data in DSA | ||
23 | structures. Their usage is identical to that of | ||
24 | RSA_get_ex_new_index(), RSA_set_ex_data() and RSA_get_ex_data() | ||
25 | as described in L<RSA_get_ex_new_index(3)>. | ||
26 | |||
27 | =head1 SEE ALSO | ||
28 | |||
29 | L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>, L<dsa(3)|dsa(3)> | ||
30 | |||
31 | =head1 HISTORY | ||
32 | |||
33 | DSA_get_ex_new_index(), DSA_set_ex_data() and DSA_get_ex_data() are | ||
34 | available since OpenSSL 0.9.5. | ||
35 | |||
36 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/DSA_new.pod b/src/lib/libssl/src/doc/crypto/DSA_new.pod new file mode 100644 index 0000000000..7dde54445b --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/DSA_new.pod | |||
@@ -0,0 +1,41 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DSA_new, DSA_free - allocate and free DSA objects | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dsa.h> | ||
10 | |||
11 | DSA* DSA_new(void); | ||
12 | |||
13 | void DSA_free(DSA *dsa); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | DSA_new() allocates and initializes a B<DSA> structure. | ||
18 | |||
19 | DSA_free() frees the B<DSA> structure and its components. The values are | ||
20 | erased before the memory is returned to the system. | ||
21 | |||
22 | =head1 RETURN VALUES | ||
23 | |||
24 | If the allocation fails, DSA_new() returns B<NULL> and sets an error | ||
25 | code that can be obtained by | ||
26 | L<ERR_get_error(3)|ERR_get_error(3)>. Otherwise it returns a pointer | ||
27 | to the newly allocated structure. | ||
28 | |||
29 | DSA_free() returns no value. | ||
30 | |||
31 | =head1 SEE ALSO | ||
32 | |||
33 | L<dsa(3)|dsa(3)>, L<err(3)|err(3)>, | ||
34 | L<DSA_generate_parameters(3)|DSA_generate_parameters(3)>, | ||
35 | L<DSA_generate_key(3)|DSA_generate_key(3)> | ||
36 | |||
37 | =head1 HISTORY | ||
38 | |||
39 | DSA_new() and DSA_free() are available in all versions of SSLeay and OpenSSL. | ||
40 | |||
41 | =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 new file mode 100644 index 0000000000..0b13ec9237 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/DSA_set_method.pod | |||
@@ -0,0 +1,111 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DSA_set_default_method, DSA_get_default_method, DSA_set_method, | ||
6 | DSA_new_method, DSA_OpenSSL - select RSA method | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/DSA.h> | ||
11 | |||
12 | void DSA_set_default_method(DSA_METHOD *meth); | ||
13 | |||
14 | DSA_METHOD *DSA_get_default_method(void); | ||
15 | |||
16 | DSA_METHOD *DSA_set_method(DSA *dsa, DSA_METHOD *meth); | ||
17 | |||
18 | DSA *DSA_new_method(DSA_METHOD *meth); | ||
19 | |||
20 | DSA_METHOD *DSA_OpenSSL(void); | ||
21 | |||
22 | =head1 DESCRIPTION | ||
23 | |||
24 | A B<DSA_METHOD> specifies the functions that OpenSSL uses for DSA | ||
25 | operations. By modifying the method, alternative implementations | ||
26 | such as hardware accelerators may be used. | ||
27 | |||
28 | Initially, the default is to use the OpenSSL internal implementation. | ||
29 | DSA_OpenSSL() returns a pointer to that method. | ||
30 | |||
31 | DSA_set_default_method() makes B<meth> the default method for all B<DSA> | ||
32 | structures created later. | ||
33 | |||
34 | DSA_get_default_method() returns a pointer to the current default | ||
35 | method. | ||
36 | |||
37 | DSA_set_method() selects B<meth> for all operations using the structure B<DSA>. | ||
38 | |||
39 | DSA_get_method() returns a pointer to the method currently selected | ||
40 | for B<DSA>. | ||
41 | |||
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 | |||
46 | =head1 THE DSA_METHOD STRUCTURE | ||
47 | |||
48 | struct | ||
49 | { | ||
50 | /* name of the implementation */ | ||
51 | const char *name; | ||
52 | |||
53 | /* sign */ | ||
54 | DSA_SIG *(*dsa_do_sign)(const unsigned char *dgst, int dlen, | ||
55 | DSA *dsa); | ||
56 | |||
57 | /* pre-compute k^-1 and r */ | ||
58 | int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, | ||
59 | BIGNUM **rp); | ||
60 | |||
61 | /* verify */ | ||
62 | int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len, | ||
63 | DSA_SIG *sig, DSA *dsa); | ||
64 | |||
65 | /* compute rr = a1^p1 * a2^p2 mod m. May be NULL */ | ||
66 | int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1, | ||
67 | BIGNUM *a2, BIGNUM *p2, BIGNUM *m, | ||
68 | BN_CTX *ctx, BN_MONT_CTX *in_mont); | ||
69 | |||
70 | /* compute r = a ^ p mod m. May be NULL */ | ||
71 | int (*bn_mod_exp)(DSA *dsa, BIGNUM *r, BIGNUM *a, | ||
72 | const BIGNUM *p, const BIGNUM *m, | ||
73 | BN_CTX *ctx, BN_MONT_CTX *m_ctx); | ||
74 | |||
75 | /* called at DSA_new */ | ||
76 | int (*init)(DSA *DSA); | ||
77 | |||
78 | /* called at DSA_free */ | ||
79 | int (*finish)(DSA *DSA); | ||
80 | |||
81 | int flags; | ||
82 | |||
83 | char *app_data; /* ?? */ | ||
84 | |||
85 | } DSA_METHOD; | ||
86 | |||
87 | =head1 RETURN VALUES | ||
88 | |||
89 | DSA_OpenSSL(), DSA_get_default_method() and DSA_get_method() return | ||
90 | pointers to the respective B<DSA_METHOD>s. | ||
91 | |||
92 | DSA_set_default_method() returns no value. | ||
93 | |||
94 | DSA_set_method() returns a pointer to the B<DSA_METHOD> previously | ||
95 | associated with B<dsa>. | ||
96 | |||
97 | DSA_new_method() returns B<NULL> and sets an error code that can be | ||
98 | obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation | ||
99 | fails. Otherwise it returns a pointer to the newly allocated | ||
100 | structure. | ||
101 | |||
102 | =head1 SEE ALSO | ||
103 | |||
104 | L<dsa(3)|dsa(3)>, L<DSA_new(3)|DSA_new(3)> | ||
105 | |||
106 | =head1 HISTORY | ||
107 | |||
108 | DSA_set_default_method(), DSA_get_default_method(), DSA_set_method(), | ||
109 | DSA_new_method() and DSA_OpenSSL() were added in OpenSSL 0.9.4. | ||
110 | |||
111 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/DSA_sign.pod b/src/lib/libssl/src/doc/crypto/DSA_sign.pod new file mode 100644 index 0000000000..f6e60a8ca3 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/DSA_sign.pod | |||
@@ -0,0 +1,66 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DSA_sign, DSA_sign_setup, DSA_verify - DSA signatures | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dsa.h> | ||
10 | |||
11 | int DSA_sign(int type, const unsigned char *dgst, int len, | ||
12 | unsigned char *sigret, unsigned int *siglen, DSA *dsa); | ||
13 | |||
14 | int DSA_sign_setup(DSA *dsa, BN_CTX *ctx, BIGNUM **kinvp, | ||
15 | BIGNUM **rp); | ||
16 | |||
17 | int DSA_verify(int type, const unsigned char *dgst, int len, | ||
18 | unsigned char *sigbuf, int siglen, DSA *dsa); | ||
19 | |||
20 | =head1 DESCRIPTION | ||
21 | |||
22 | DSA_sign() computes a digital signature on the B<len> byte message | ||
23 | digest B<dgst> using the private key B<dsa> and places its ASN.1 DER | ||
24 | encoding at B<sigret>. The length of the signature is places in | ||
25 | *B<siglen>. B<sigret> must point to DSA_size(B<dsa>) bytes of memory. | ||
26 | |||
27 | DSA_sign_setup() may be used to precompute part of the signing | ||
28 | operation in case signature generation is time-critical. It expects | ||
29 | B<dsa> to contain DSA parameters. It places the precomputed values | ||
30 | in newly allocated B<BIGNUM>s at *B<kinvp> and *B<rp>, after freeing | ||
31 | the old ones unless *B<kinvp> and *B<rp> are NULL. These values may | ||
32 | be passed to DSA_sign() in B<dsa-E<gt>kinv> and B<dsa-E<gt>r>. | ||
33 | B<ctx> is a pre-allocated B<BN_CTX> or NULL. | ||
34 | |||
35 | DSA_verify() verifies that the signature B<sigbuf> of size B<siglen> | ||
36 | matches a given message digest B<dgst> of size B<len>. | ||
37 | B<dsa> is the signer's public key. | ||
38 | |||
39 | The B<type> parameter is ignored. | ||
40 | |||
41 | The PRNG must be seeded before DSA_sign() (or DSA_sign_setup()) | ||
42 | is called. | ||
43 | |||
44 | =head1 RETURN VALUES | ||
45 | |||
46 | DSA_sign() and DSA_sign_setup() return 1 on success, 0 on error. | ||
47 | DSA_verify() returns 1 for a valid signature, 0 for an incorrect | ||
48 | signature and -1 on error. The error codes can be obtained by | ||
49 | L<ERR_get_error(3)|ERR_get_error(3)>. | ||
50 | |||
51 | =head1 CONFORMING TO | ||
52 | |||
53 | US Federal Information Processing Standard FIPS 186 (Digital Signature | ||
54 | Standard, DSS), ANSI X9.30 | ||
55 | |||
56 | =head1 SEE ALSO | ||
57 | |||
58 | L<dsa(3)|dsa(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>, | ||
59 | L<DSA_do_sign(3)|DSA_do_sign(3)> | ||
60 | |||
61 | =head1 HISTORY | ||
62 | |||
63 | DSA_sign() and DSA_verify() are available in all versions of SSLeay. | ||
64 | DSA_sign_setup() was added in SSLeay 0.8. | ||
65 | |||
66 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/DSA_size.pod b/src/lib/libssl/src/doc/crypto/DSA_size.pod new file mode 100644 index 0000000000..23b6320a4d --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/DSA_size.pod | |||
@@ -0,0 +1,33 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DSA_size - get DSA signature size | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dsa.h> | ||
10 | |||
11 | int DSA_size(DSA *dsa); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | This function returns the size of an ASN.1 encoded DSA signature in | ||
16 | bytes. It can be used to determine how much memory must be allocated | ||
17 | for a DSA signature. | ||
18 | |||
19 | B<dsa-E<gt>q> must not be B<NULL>. | ||
20 | |||
21 | =head1 RETURN VALUE | ||
22 | |||
23 | The size in bytes. | ||
24 | |||
25 | =head1 SEE ALSO | ||
26 | |||
27 | L<dsa(3)|dsa(3)>, L<DSA_sign(3)|DSA_sign(3)> | ||
28 | |||
29 | =head1 HISTORY | ||
30 | |||
31 | DSA_size() is available in all versions of SSLeay and OpenSSL. | ||
32 | |||
33 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/ERR_GET_LIB.pod b/src/lib/libssl/src/doc/crypto/ERR_GET_LIB.pod new file mode 100644 index 0000000000..2a129da036 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/ERR_GET_LIB.pod | |||
@@ -0,0 +1,51 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | ERR_GET_LIB, ERR_GET_FUNC, ERR_GET_REASON - get library, function and | ||
6 | reason code | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/err.h> | ||
11 | |||
12 | int ERR_GET_LIB(unsigned long e); | ||
13 | |||
14 | int ERR_GET_FUNC(unsigned long e); | ||
15 | |||
16 | int ERR_GET_REASON(unsigned long e); | ||
17 | |||
18 | =head1 DESCRIPTION | ||
19 | |||
20 | The error code returned by ERR_get_error() consists of a library | ||
21 | number, function code and reason code. ERR_GET_LIB(), ERR_GET_FUNC() | ||
22 | and ERR_GET_REASON() can be used to extract these. | ||
23 | |||
24 | The library number and function code describe where the error | ||
25 | occurred, the reason code is the information about what went wrong. | ||
26 | |||
27 | Each sub-library of OpenSSL has a unique library number; function and | ||
28 | reason codes are unique within each sub-library. Note that different | ||
29 | libraries may use the same value to signal different functions and | ||
30 | reasons. | ||
31 | |||
32 | B<ERR_R_...> reason codes such as B<ERR_R_MALLOC_FAILURE> are globally | ||
33 | unique. However, when checking for sub-library specific reason codes, | ||
34 | be sure to also compare the library number. | ||
35 | |||
36 | ERR_GET_LIB(), ERR_GET_FUNC() and ERR_GET_REASON() are macros. | ||
37 | |||
38 | =head1 RETURN VALUES | ||
39 | |||
40 | The library number, function code and reason code respectively. | ||
41 | |||
42 | =head1 SEE ALSO | ||
43 | |||
44 | L<err(3)|err(3)>, L<ERR_get_error(3)|ERR_get_error(3)> | ||
45 | |||
46 | =head1 HISTORY | ||
47 | |||
48 | ERR_GET_LIB(), ERR_GET_FUNC() and ERR_GET_REASON() are available in | ||
49 | all versions of SSLeay and OpenSSL. | ||
50 | |||
51 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/ERR_clear_error.pod b/src/lib/libssl/src/doc/crypto/ERR_clear_error.pod new file mode 100644 index 0000000000..566e1f4e31 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/ERR_clear_error.pod | |||
@@ -0,0 +1,29 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | ERR_clear_error - clear the error queue | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/err.h> | ||
10 | |||
11 | void ERR_clear_error(void); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | ERR_clear_error() empties the current thread's error queue. | ||
16 | |||
17 | =head1 RETURN VALUES | ||
18 | |||
19 | ERR_clear_error() has no return value. | ||
20 | |||
21 | =head1 SEE ALSO | ||
22 | |||
23 | L<err(3)|err(3)>, L<ERR_get_error(3)|ERR_get_error(3)> | ||
24 | |||
25 | =head1 HISTORY | ||
26 | |||
27 | ERR_clear_error() is available in all versions of SSLeay and OpenSSL. | ||
28 | |||
29 | =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 new file mode 100644 index 0000000000..0d2417599c --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/ERR_error_string.pod | |||
@@ -0,0 +1,65 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | ERR_error_string - obtain human-readable error message | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/err.h> | ||
10 | |||
11 | char *ERR_error_string(unsigned long e, char *buf); | ||
12 | |||
13 | const char *ERR_lib_error_string(unsigned long e); | ||
14 | const char *ERR_func_error_string(unsigned long e); | ||
15 | const char *ERR_reason_error_string(unsigned long e); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | 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 | ||
21 | bytes long. If B<buf> is B<NULL>, the error string is placed in a | ||
22 | static buffer. | ||
23 | |||
24 | The string will have the following format: | ||
25 | |||
26 | error:[error code]:[library name]:[function name]:[reason string] | ||
27 | |||
28 | I<error code> is an 8 digit hexadecimal number, I<library name>, | ||
29 | I<function name> and I<reason string> are ASCII text. | ||
30 | |||
31 | ERR_lib_error_string(), ERR_func_error_string() and | ||
32 | ERR_reason_error_string() return the library name, function | ||
33 | name and reason string respectively. | ||
34 | |||
35 | The OpenSSL error strings should be loaded by calling | ||
36 | L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)> or, for SSL | ||
37 | applications, L<SSL_load_error_strings(3)|SSL_load_error_strings(3)> | ||
38 | first. | ||
39 | If there is no text string registered for the given error code, | ||
40 | the error string will contain the numeric code. | ||
41 | |||
42 | L<ERR_print_errors(3)|ERR_print_errors(3)> can be used to print | ||
43 | all error codes currently in the queue. | ||
44 | |||
45 | =head1 RETURN VALUES | ||
46 | |||
47 | ERR_error_string() returns a pointer to a static buffer containing the | ||
48 | string if B<buf == NULL>, B<buf> otherwise. | ||
49 | |||
50 | ERR_lib_error_string(), ERR_func_error_string() and | ||
51 | ERR_reason_error_string() return the strings, and B<NULL> if | ||
52 | none is registered for the error code. | ||
53 | |||
54 | =head1 SEE ALSO | ||
55 | |||
56 | L<err(3)|err(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, | ||
57 | L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)>, | ||
58 | L<SSL_load_error_strings(3)|SSL_load_error_strings(3)> | ||
59 | L<ERR_print_errors(3)|ERR_print_errors(3)> | ||
60 | |||
61 | =head1 HISTORY | ||
62 | |||
63 | ERR_error_string() is available in all versions of SSLeay and OpenSSL. | ||
64 | |||
65 | =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 new file mode 100644 index 0000000000..75ece00d97 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/ERR_get_error.pod | |||
@@ -0,0 +1,62 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | ERR_get_error, ERR_peek_error - obtain error code | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/err.h> | ||
10 | |||
11 | unsigned long ERR_get_error(void); | ||
12 | unsigned long ERR_peek_error(void); | ||
13 | |||
14 | unsigned long ERR_get_error_line(const char **file, int *line); | ||
15 | unsigned long ERR_peek_error_line(const char **file, int *line); | ||
16 | |||
17 | unsigned long ERR_get_error_line_data(const char **file, int *line, | ||
18 | const char **data, int *flags); | ||
19 | unsigned long ERR_peek_error_line_data(const char **file, int *line, | ||
20 | const char **data, int *flags); | ||
21 | |||
22 | =head1 DESCRIPTION | ||
23 | |||
24 | ERR_get_error() returns the last error code from the thread's error | ||
25 | queue and removes the entry. This function can be called repeatedly | ||
26 | until there are no more error codes to return. | ||
27 | |||
28 | ERR_peek_error() returns the last error code from the thread's | ||
29 | error queue without modifying it. | ||
30 | |||
31 | See L<ERR_GET_LIB(3)|ERR_GET_LIB(3)> for obtaining information about | ||
32 | location and reason of the error, and | ||
33 | L<ERR_error_string(3)|ERR_error_string(3)> for human-readable error | ||
34 | messages. | ||
35 | |||
36 | ERR_get_error_line() and ERR_peek_error_line() are the same as the | ||
37 | above, but they additionally store the file name and line number where | ||
38 | the error occurred in *B<file> and *B<line>, unless these are B<NULL>. | ||
39 | |||
40 | 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 | 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 | *B<flags>&B<ERR_TXT_MALLOCED> is true. | ||
45 | |||
46 | =head1 RETURN VALUES | ||
47 | |||
48 | The error code, or 0 if there is no error in the queue. | ||
49 | |||
50 | =head1 SEE ALSO | ||
51 | |||
52 | L<err(3)|err(3)>, L<ERR_error_string(3)|ERR_error_string(3)>, | ||
53 | L<ERR_GET_LIB(3)|ERR_GET_LIB(3)> | ||
54 | |||
55 | =head1 HISTORY | ||
56 | |||
57 | ERR_get_error(), ERR_peek_error(), ERR_get_error_line() and | ||
58 | ERR_peek_error_line() are available in all versions of SSLeay and | ||
59 | OpenSSL. ERR_get_error_line_data() and ERR_peek_error_line_data() | ||
60 | were added in SSLeay 0.9.0. | ||
61 | |||
62 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/ERR_load_crypto_strings.pod b/src/lib/libssl/src/doc/crypto/ERR_load_crypto_strings.pod new file mode 100644 index 0000000000..9bdec75a46 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/ERR_load_crypto_strings.pod | |||
@@ -0,0 +1,46 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | ERR_load_crypto_strings, SSL_load_error_strings, ERR_free_strings - | ||
6 | load and free error strings | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/err.h> | ||
11 | |||
12 | void ERR_load_crypto_strings(void); | ||
13 | void ERR_free_strings(void); | ||
14 | |||
15 | #include <openssl/ssl.h> | ||
16 | |||
17 | void SSL_load_error_strings(void); | ||
18 | |||
19 | =head1 DESCRIPTION | ||
20 | |||
21 | ERR_load_crypto_strings() registers the error strings for all | ||
22 | B<libcrypto> functions. SSL_load_error_strings() does the same, | ||
23 | but also registers the B<libssl> error strings. | ||
24 | |||
25 | One of these functions should be called before generating | ||
26 | textual error messages. However, this is not required when memory | ||
27 | usage is an issue. | ||
28 | |||
29 | ERR_free_strings() frees all previously loaded error strings. | ||
30 | |||
31 | =head1 RETURN VALUES | ||
32 | |||
33 | ERR_load_crypto_strings(), SSL_load_error_strings() and | ||
34 | ERR_free_strings() return no values. | ||
35 | |||
36 | =head1 SEE ALSO | ||
37 | |||
38 | L<err(3)|err(3)>, L<ERR_error_string(3)|ERR_error_string(3)> | ||
39 | |||
40 | =head1 HISTORY | ||
41 | |||
42 | ERR_load_error_strings(), SSL_load_error_strings() and | ||
43 | ERR_free_strings() are available in all versions of SSLeay and | ||
44 | OpenSSL. | ||
45 | |||
46 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/ERR_load_strings.pod b/src/lib/libssl/src/doc/crypto/ERR_load_strings.pod new file mode 100644 index 0000000000..5acdd0edbc --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/ERR_load_strings.pod | |||
@@ -0,0 +1,54 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | ERR_load_strings, ERR_PACK, ERR_get_next_error_library - load | ||
6 | arbitrary error strings | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/err.h> | ||
11 | |||
12 | void ERR_load_strings(int lib, ERR_STRING_DATA str[]); | ||
13 | |||
14 | int ERR_get_next_error_library(void); | ||
15 | |||
16 | unsigned long ERR_PACK(int lib, int func, int reason); | ||
17 | |||
18 | =head1 DESCRIPTION | ||
19 | |||
20 | ERR_load_strings() registers error strings for library number B<lib>. | ||
21 | |||
22 | B<str> is an array of error string data: | ||
23 | |||
24 | typedef struct ERR_string_data_st | ||
25 | { | ||
26 | unsigned long error; | ||
27 | char *string; | ||
28 | } ERR_STRING_DATA; | ||
29 | |||
30 | The error code is generated from the library number and a function and | ||
31 | reason code: B<error> = ERR_PACK(B<lib>, B<func>, B<reason>). | ||
32 | ERR_PACK() is a macro. | ||
33 | |||
34 | The last entry in the array is {0,0}. | ||
35 | |||
36 | ERR_get_next_error_library() can be used to assign library numbers | ||
37 | to user libraries at runtime. | ||
38 | |||
39 | =head1 RETURN VALUE | ||
40 | |||
41 | ERR_load_strings() returns no value. ERR_PACK() return the error code. | ||
42 | ERR_get_next_error_library() returns a new library number. | ||
43 | |||
44 | =head1 SEE ALSO | ||
45 | |||
46 | L<err(3)|err(3)>, L<ERR_load_strings(3)|ERR_load_strings(3)> | ||
47 | |||
48 | =head1 HISTORY | ||
49 | |||
50 | ERR_load_error_strings() and ERR_PACK() are available in all versions | ||
51 | of SSLeay and OpenSSL. ERR_get_next_error_library() was added in | ||
52 | SSLeay 0.9.0. | ||
53 | |||
54 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/ERR_print_errors.pod b/src/lib/libssl/src/doc/crypto/ERR_print_errors.pod new file mode 100644 index 0000000000..b100a5fa2b --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/ERR_print_errors.pod | |||
@@ -0,0 +1,51 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | ERR_print_errors, ERR_print_errors_fp - print error messages | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/err.h> | ||
10 | |||
11 | void ERR_print_errors(BIO *bp); | ||
12 | void ERR_print_errors_fp(FILE *fp); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | ERR_print_errors() is a convenience function that prints the error | ||
17 | strings for all errors that OpenSSL has recorded to B<bp>, thus | ||
18 | emptying the error queue. | ||
19 | |||
20 | ERR_print_errors_fp() is the same, except that the output goes to a | ||
21 | B<FILE>. | ||
22 | |||
23 | |||
24 | The error strings will have the following format: | ||
25 | |||
26 | [pid]:error:[error code]:[library name]:[function name]:[reason string]:[file name]:[line]:[optional text message] | ||
27 | |||
28 | I<error code> is an 8 digit hexadecimal number. I<library name>, | ||
29 | I<function name> and I<reason string> are ASCII text, as is I<optional | ||
30 | text message> if one was set for the respective error code. | ||
31 | |||
32 | If there is no text string registered for the given error code, | ||
33 | the error string will contain the numeric code. | ||
34 | |||
35 | =head1 RETURN VALUES | ||
36 | |||
37 | ERR_print_errors() and ERR_print_errors_fp() return no values. | ||
38 | |||
39 | =head1 SEE ALSO | ||
40 | |||
41 | L<err(3)|err(3)>, L<ERR_error_string(3)|ERR_error_string(3)>, | ||
42 | L<ERR_get_error(3)|ERR_get_error(3)>, | ||
43 | L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)>, | ||
44 | L<SSL_load_error_strings(3)|SSL_load_error_strings(3)> | ||
45 | |||
46 | =head1 HISTORY | ||
47 | |||
48 | ERR_print_errors() and ERR_print_errors_fp() | ||
49 | are available in all versions of SSLeay and OpenSSL. | ||
50 | |||
51 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/ERR_put_error.pod b/src/lib/libssl/src/doc/crypto/ERR_put_error.pod new file mode 100644 index 0000000000..acd241fbe4 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/ERR_put_error.pod | |||
@@ -0,0 +1,44 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | ERR_put_error, ERR_add_error_data - record an error | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/err.h> | ||
10 | |||
11 | void ERR_put_error(int lib, int func, int reason, const char *file, | ||
12 | int line); | ||
13 | |||
14 | void ERR_add_error_data(int num, ...); | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | ERR_put_error() adds an error code to the thread's error queue. It | ||
19 | signals that the error of reason code B<reason> occurred in function | ||
20 | B<func> of library B<lib>, in line number B<line> of B<file>. | ||
21 | This function is usually called by a macro. | ||
22 | |||
23 | ERR_add_error_data() associates the concatenation of its B<num> string | ||
24 | arguments with the error code added last. | ||
25 | |||
26 | L<ERR_load_strings(3)|ERR_load_strings(3)> can be used to register | ||
27 | error strings so that the application can a generate human-readable | ||
28 | error messages for the error code. | ||
29 | |||
30 | =head1 RETURN VALUES | ||
31 | |||
32 | ERR_put_error() and ERR_add_error_data() return | ||
33 | no values. | ||
34 | |||
35 | =head1 SEE ALSO | ||
36 | |||
37 | L<err(3)|err(3)>, L<ERR_load_strings(3)|ERR_load_strings(3)> | ||
38 | |||
39 | =head1 HISTORY | ||
40 | |||
41 | ERR_put_error() is available in all versions of SSLeay and OpenSSL. | ||
42 | ERR_add_error_data() was added in SSLeay 0.9.0. | ||
43 | |||
44 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/ERR_remove_state.pod b/src/lib/libssl/src/doc/crypto/ERR_remove_state.pod new file mode 100644 index 0000000000..ebcdc0f5a5 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/ERR_remove_state.pod | |||
@@ -0,0 +1,34 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | ERR_remove_state - free a thread's error queue | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/err.h> | ||
10 | |||
11 | void ERR_remove_state(unsigned long pid); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | 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. | ||
17 | |||
18 | Since error queue data structures are allocated automatically for new | ||
19 | threads, they must be freed when threads are terminated in oder to | ||
20 | avoid memory leaks. | ||
21 | |||
22 | =head1 RETURN VALUE | ||
23 | |||
24 | ERR_remove_state() returns no value. | ||
25 | |||
26 | =head1 SEE ALSO | ||
27 | |||
28 | L<err(3)|err(3)> | ||
29 | |||
30 | =head1 HISTORY | ||
31 | |||
32 | ERR_remove_state() is available in all versions of SSLeay and OpenSSL. | ||
33 | |||
34 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_DigestInit.pod b/src/lib/libssl/src/doc/crypto/EVP_DigestInit.pod new file mode 100644 index 0000000000..345b1ddfa7 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/EVP_DigestInit.pod | |||
@@ -0,0 +1,197 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EVP_DigestInit, EVP_DigestUpdate, EVP_DigestFinal - EVP digest routines | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/evp.h> | ||
10 | |||
11 | void EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type); | ||
12 | void EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt); | ||
13 | void EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, | ||
14 | unsigned int *s); | ||
15 | |||
16 | #define EVP_MAX_MD_SIZE (16+20) /* The SSLv3 md5+sha1 type */ | ||
17 | |||
18 | int EVP_MD_CTX_copy(EVP_MD_CTX *out,EVP_MD_CTX *in); | ||
19 | |||
20 | #define EVP_MD_type(e) ((e)->type) | ||
21 | #define EVP_MD_pkey_type(e) ((e)->pkey_type) | ||
22 | #define EVP_MD_size(e) ((e)->md_size) | ||
23 | #define EVP_MD_block_size(e) ((e)->block_size) | ||
24 | |||
25 | #define EVP_MD_CTX_md(e) (e)->digest) | ||
26 | #define EVP_MD_CTX_size(e) EVP_MD_size((e)->digest) | ||
27 | #define EVP_MD_CTX_block_size(e) EVP_MD_block_size((e)->digest) | ||
28 | #define EVP_MD_CTX_type(e) EVP_MD_type((e)->digest) | ||
29 | |||
30 | EVP_MD *EVP_md_null(void); | ||
31 | EVP_MD *EVP_md2(void); | ||
32 | EVP_MD *EVP_md5(void); | ||
33 | EVP_MD *EVP_sha(void); | ||
34 | EVP_MD *EVP_sha1(void); | ||
35 | EVP_MD *EVP_dss(void); | ||
36 | EVP_MD *EVP_dss1(void); | ||
37 | EVP_MD *EVP_mdc2(void); | ||
38 | EVP_MD *EVP_ripemd160(void); | ||
39 | |||
40 | const EVP_MD *EVP_get_digestbyname(const char *name); | ||
41 | #define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a)) | ||
42 | #define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a)) | ||
43 | |||
44 | =head1 DESCRIPTION | ||
45 | |||
46 | The EVP digest routines are a high level interface to message digests. | ||
47 | |||
48 | EVP_DigestInit() initialises a digest context B<ctx> to use a digest | ||
49 | B<type>: this will typically be supplied by a function such as | ||
50 | EVP_sha1(). | ||
51 | |||
52 | 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 | ||
54 | same B<ctx> to hash additional data. | ||
55 | |||
56 | EVP_DigestFinal() retrieves the digest value from B<ctx> and places | ||
57 | 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 | ||
59 | 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() | ||
61 | can be made, but EVP_DigestInit() can be called to initialiase a new | ||
62 | digest operation. | ||
63 | |||
64 | EVP_MD_CTX_copy() can be used to copy the message digest state from | ||
65 | B<in> to B<out>. This is useful if large amounts of data are to be | ||
66 | hashed which only differ in the last few bytes. | ||
67 | |||
68 | EVP_MD_size() and EVP_MD_CTX_size() return the size of the message digest | ||
69 | when passed an B<EVP_MD> or an B<EVP_MD_CTX> structure, i.e. the size of the | ||
70 | hash. | ||
71 | |||
72 | EVP_MD_block_size() and EVP_MD_CTX_block_size() return the block size of the | ||
73 | message digest when passed an B<EVP_MD> or an B<EVP_MD_CTX> structure. | ||
74 | |||
75 | EVP_MD_type() and EVP_MD_CTX_type() return the NID of the OBJECT IDENTIFIER | ||
76 | representing the given message digest when passed an B<EVP_MD> structure. | ||
77 | For example EVP_MD_type(EVP_sha1()) returns B<NID_sha1>. This function is | ||
78 | normally used when setting ASN1 OIDs. | ||
79 | |||
80 | EVP_MD_CTX_md() returns the B<EVP_MD> structure corresponding to the passed | ||
81 | B<EVP_MD_CTX>. | ||
82 | |||
83 | EVP_MD_pkey_type() returns the NID of the public key signing algorithm associated | ||
84 | with this digest. For example EVP_sha1() is associated with RSA so this will | ||
85 | return B<NID_sha1WithRSAEncryption>. This "link" between digests and signature | ||
86 | algorithms may not be retained in future versions of OpenSSL. | ||
87 | |||
88 | EVP_md2(), EVP_md5(), EVP_sha(), EVP_sha1(), EVP_mdc2() and EVP_ripemd160() | ||
89 | return B<EVP_MD> structures for the MD2, MD5, SHA, SHA1, MDC2 and RIPEMD160 digest | ||
90 | algorithms respectively. The associated signature algorithm is RSA in each case. | ||
91 | |||
92 | EVP_dss() and EVP_dss1() return B<EVP_MD> structures for SHA and SHA1 digest | ||
93 | algorithms but using DSS (DSA) for the signature algorithm. | ||
94 | |||
95 | EVP_md_null() is a "null" message digest that does nothing: i.e. the hash it | ||
96 | returns is of zero length. | ||
97 | |||
98 | 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 | ||
100 | an ASN1_OBJECT structure respectively. The digest table must be initialised | ||
101 | using, for example, OpenSSL_add_all_digests() for these functions to work. | ||
102 | |||
103 | =head1 RETURN VALUES | ||
104 | |||
105 | EVP_DigestInit(), EVP_DigestUpdate() and EVP_DigestFinal() do not return values. | ||
106 | |||
107 | EVP_MD_CTX_copy() returns 1 if successful or 0 for failure. | ||
108 | |||
109 | EVP_MD_type(), EVP_MD_pkey_type() and EVP_MD_type() return the NID of the | ||
110 | corresponding OBJECT IDENTIFIER or NID_undef if none exists. | ||
111 | |||
112 | EVP_MD_size(), EVP_MD_block_size(), EVP_MD_CTX_size(e), EVP_MD_size(), | ||
113 | EVP_MD_CTX_block_size() and EVP_MD_block_size() return the digest or block | ||
114 | size in bytes. | ||
115 | |||
116 | EVP_md_null(), EVP_md2(), EVP_md5(), EVP_sha(), EVP_sha1(), EVP_dss(), | ||
117 | EVP_dss1(), EVP_mdc2() and EVP_ripemd160() return pointers to the | ||
118 | corresponding EVP_MD structures. | ||
119 | |||
120 | EVP_get_digestbyname(), EVP_get_digestbynid() and EVP_get_digestbyobj() | ||
121 | return either an B<EVP_MD> structure or NULL if an error occurs. | ||
122 | |||
123 | =head1 NOTES | ||
124 | |||
125 | The B<EVP> interface to message digests should almost always be used in | ||
126 | preference to the low level interfaces. This is because the code then becomes | ||
127 | transparent to the digest used and much more flexible. | ||
128 | |||
129 | SHA1 is the digest of choice for new applications. The other digest algorithms | ||
130 | are still in common use. | ||
131 | |||
132 | =head1 EXAMPLE | ||
133 | |||
134 | This example digests the data "Test Message\n" and "Hello World\n", using the | ||
135 | digest name passed on the command line. | ||
136 | |||
137 | #include <stdio.h> | ||
138 | #include <openssl/evp.h> | ||
139 | |||
140 | main(int argc, char *argv[]) | ||
141 | { | ||
142 | EVP_MD_CTX mdctx; | ||
143 | const EVP_MD *md; | ||
144 | char mess1[] = "Test Message\n"; | ||
145 | char mess2[] = "Hello World\n"; | ||
146 | unsigned char md_value[EVP_MAX_MD_SIZE]; | ||
147 | int md_len, i; | ||
148 | |||
149 | OpenSSL_add_all_digests(); | ||
150 | |||
151 | if(!argv[1]) { | ||
152 | printf("Usage: mdtest digestname\n"); | ||
153 | exit(1); | ||
154 | } | ||
155 | |||
156 | md = EVP_get_digestbyname(argv[1]); | ||
157 | |||
158 | if(!md) { | ||
159 | printf("Unknown message digest %s\n", argv[1]); | ||
160 | exit(1); | ||
161 | } | ||
162 | |||
163 | EVP_DigestInit(&mdctx, md); | ||
164 | EVP_DigestUpdate(&mdctx, mess1, strlen(mess1)); | ||
165 | EVP_DigestUpdate(&mdctx, mess2, strlen(mess2)); | ||
166 | EVP_DigestFinal(&mdctx, md_value, &md_len); | ||
167 | |||
168 | printf("Digest is: "); | ||
169 | for(i = 0; i < md_len; i++) printf("%02x", md_value[i]); | ||
170 | printf("\n"); | ||
171 | } | ||
172 | |||
173 | =head1 BUGS | ||
174 | |||
175 | Several of the functions do not return values: maybe they should. Although the | ||
176 | internal digest operations will never fail some future hardware based operations | ||
177 | might. | ||
178 | |||
179 | The link between digests and signing algorithms results in a situation where | ||
180 | EVP_sha1() must be used with RSA and EVP_dss1() must be used with DSS | ||
181 | even though they are identical digests. | ||
182 | |||
183 | The size of an B<EVP_MD_CTX> structure is determined at compile time: this results | ||
184 | in code that must be recompiled if the size of B<EVP_MD_CTX> increases. | ||
185 | |||
186 | =head1 SEE ALSO | ||
187 | |||
188 | L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, | ||
189 | L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, | ||
190 | L<sha(3)|sha(3)>, L<digest(1)|digest(1)> | ||
191 | |||
192 | =head1 HISTORY | ||
193 | |||
194 | EVP_DigestInit(), EVP_DigestUpdate() and EVP_DigestFinal() are | ||
195 | available in all versions of SSLeay and OpenSSL. | ||
196 | |||
197 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_EncryptInit.pod b/src/lib/libssl/src/doc/crypto/EVP_EncryptInit.pod new file mode 100644 index 0000000000..77ed4ccdba --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/EVP_EncryptInit.pod | |||
@@ -0,0 +1,224 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EVP_EncryptInit, EVP_EncryptUpdate, EVP_EncryptFinal - EVP cipher routines | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/evp.h> | ||
10 | |||
11 | void EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | ||
12 | unsigned char *key, unsigned char *iv); | ||
13 | void EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
14 | int *outl, unsigned char *in, int inl); | ||
15 | void EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
16 | int *outl); | ||
17 | |||
18 | void EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | ||
19 | unsigned char *key, unsigned char *iv); | ||
20 | void EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
21 | int *outl, unsigned char *in, int inl); | ||
22 | int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, | ||
23 | int *outl); | ||
24 | |||
25 | void EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | ||
26 | unsigned char *key, unsigned char *iv, int enc); | ||
27 | void EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
28 | int *outl, unsigned char *in, int inl); | ||
29 | int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, | ||
30 | int *outl); | ||
31 | |||
32 | void EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); | ||
33 | |||
34 | const EVP_CIPHER *EVP_get_cipherbyname(const char *name); | ||
35 | #define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) | ||
36 | #define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a)) | ||
37 | |||
38 | #define EVP_CIPHER_nid(e) ((e)->nid) | ||
39 | #define EVP_CIPHER_block_size(e) ((e)->block_size) | ||
40 | #define EVP_CIPHER_key_length(e) ((e)->key_len) | ||
41 | #define EVP_CIPHER_iv_length(e) ((e)->iv_len) | ||
42 | |||
43 | int EVP_CIPHER_type(const EVP_CIPHER *ctx); | ||
44 | #define EVP_CIPHER_CTX_cipher(e) ((e)->cipher) | ||
45 | #define EVP_CIPHER_CTX_nid(e) ((e)->cipher->nid) | ||
46 | #define EVP_CIPHER_CTX_block_size(e) ((e)->cipher->block_size) | ||
47 | #define EVP_CIPHER_CTX_key_length(e) ((e)->cipher->key_len) | ||
48 | #define EVP_CIPHER_CTX_iv_length(e) ((e)->cipher->iv_len) | ||
49 | #define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) | ||
50 | |||
51 | 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); | ||
53 | |||
54 | =head1 DESCRIPTION | ||
55 | |||
56 | The EVP cipher routines are a high level interface to certain | ||
57 | symmetric ciphers. | ||
58 | |||
59 | EVP_EncryptInit() initialises a cipher context B<ctx> for encryption | ||
60 | 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 | ||
62 | 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 | ||
64 | to NULL except B<type> in an initial call and supply the remaining | ||
65 | parameters in subsequent calls. This is normally done when the | ||
66 | EVP_CIPHER_asn1_to_param() function is called to set the cipher | ||
67 | parameters from an ASN1 AlgorithmIdentifier and the key from a | ||
68 | different source. | ||
69 | |||
70 | 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 | ||
72 | multiple times to encrypt successive blocks of data. The amount | ||
73 | of data written depends on the block alignment of the encrypted data: | ||
74 | as a result the amount of data written may be anything from zero bytes | ||
75 | to (inl + cipher_block_size - 1) so B<outl> should contain sufficient | ||
76 | room. The actual number of bytes written is placed in B<outl>. | ||
77 | |||
78 | EVP_EncryptFinal() encrypts the "final" data, that is any data that | ||
79 | remains in a partial block. It uses L<standard block padding|/NOTES> (aka PKCS | ||
80 | padding). The encrypted final data is written to B<out> which should | ||
81 | have sufficient space for one cipher block. The number of bytes written | ||
82 | is placed in B<outl>. After this function is called the encryption operation | ||
83 | is finished and no further calls to EVP_EncryptUpdate() should be made. | ||
84 | |||
85 | EVP_DecryptInit(), EVP_DecryptUpdate() and EVP_DecryptFinal() are the | ||
86 | corresponding decryption operations. EVP_DecryptFinal() will return an | ||
87 | error code if the final block is not correctly formatted. The parameters | ||
88 | and restrictions are identical to the encryption operations except that | ||
89 | the decrypted data buffer B<out> passed to EVP_DecryptUpdate() should | ||
90 | have sufficient room for (B<inl> + cipher_block_size) bytes unless the | ||
91 | cipher block size is 1 in which case B<inl> bytes is sufficient. | ||
92 | |||
93 | EVP_CipherInit(), EVP_CipherUpdate() and EVP_CipherFinal() are functions | ||
94 | 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 | ||
96 | encryption and 0 for decryption. | ||
97 | |||
98 | EVP_CIPHER_CTX_cleanup() clears all information from a cipher context. | ||
99 | It should be called after all operations using a cipher are complete | ||
100 | so sensitive information does not remain in memory. | ||
101 | |||
102 | EVP_get_cipherbyname(), EVP_get_cipherbynid() and EVP_get_cipherbyobj() | ||
103 | return an EVP_CIPHER structure when passed a cipher name, a NID or an | ||
104 | ASN1_OBJECT structure. | ||
105 | |||
106 | EVP_CIPHER_nid() and EVP_CIPHER_CTX_nid() return the NID of a cipher when | ||
107 | passed an B<EVP_CIPHER> or B<EVP_CIPHER_CTX> structure. The actual NID | ||
108 | value is an internal value which may not have a corresponding OBJECT | ||
109 | IDENTIFIER. | ||
110 | |||
111 | 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> | ||
113 | structure. The constant B<EVP_MAX_KEY_LENGTH> is the maximum key length | ||
114 | for all ciphers. | ||
115 | |||
116 | 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>. | ||
118 | It will return zero if the cipher does not use an IV. The constant | ||
119 | B<EVP_MAX_IV_LENGTH> is the maximum IV length for all ciphers. | ||
120 | |||
121 | EVP_CIPHER_block_size() and EVP_CIPHER_CTX_block_size() return the block | ||
122 | size of a cipher when passed an B<EVP_CIPHER> or B<EVP_CIPHER_CTX> | ||
123 | structure. The constant B<EVP_MAX_IV_LENGTH> is also the maximum block | ||
124 | length for all ciphers. | ||
125 | |||
126 | EVP_CIPHER_type() and EVP_CIPHER_CTX_type() return the type of the passed | ||
127 | cipher or context. This "type" is the actual NID of the cipher OBJECT | ||
128 | IDENTIFIER as such it ignores the cipher parameters and 40 bit RC2 and | ||
129 | 128 bit RC2 have the same NID. If the cipher does not have an object | ||
130 | identifier or does not have ASN1 support this function will return | ||
131 | B<NID_undef>. | ||
132 | |||
133 | EVP_CIPHER_CTX_cipher() returns the B<EVP_CIPHER> structure when passed | ||
134 | an B<EVP_CIPHER_CTX> structure. | ||
135 | |||
136 | EVP_CIPHER_param_to_asn1() sets the AlgorithmIdentifier "parameter" based | ||
137 | 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 | ||
139 | should be made before the cipher is actually "used" (before any | ||
140 | EVP_EncryptUpdate(), EVP_DecryptUpdate() calls for example). This function | ||
141 | may fail if the cipher does not have any ASN1 support. | ||
142 | |||
143 | EVP_CIPHER_asn1_to_param() sets the cipher parameters based on an ASN1 | ||
144 | AlgorithmIdentifier "parameter". The precise effect depends on the cipher | ||
145 | In the case of RC2, for example, it will set the IV and effective key length. | ||
146 | This function should be called after the base cipher type is set but before | ||
147 | the key is set. For example EVP_CipherInit() will be called with the IV and | ||
148 | 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 | ||
150 | 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 | ||
152 | does not have an B<EVP_CIPHER> structure). | ||
153 | |||
154 | =head1 RETURN VALUES | ||
155 | |||
156 | EVP_EncryptInit(), EVP_EncryptUpdate() and EVP_EncryptFinal() do not return | ||
157 | values. | ||
158 | |||
159 | EVP_DecryptInit() and EVP_DecryptUpdate() do not return values. | ||
160 | EVP_DecryptFinal() returns 0 if the decrypt failed or 1 for success. | ||
161 | |||
162 | EVP_CipherInit() and EVP_CipherUpdate() do not return values. | ||
163 | EVP_CipherFinal() returns 1 for a decryption failure or 1 for success, if | ||
164 | the operation is encryption then it always returns 1. | ||
165 | |||
166 | EVP_CIPHER_CTX_cleanup() does not return a value. | ||
167 | |||
168 | EVP_get_cipherbyname(), EVP_get_cipherbynid() and EVP_get_cipherbyobj() | ||
169 | return an B<EVP_CIPHER> structure or NULL on error. | ||
170 | |||
171 | EVP_CIPHER_nid() and EVP_CIPHER_CTX_nid() return a NID. | ||
172 | |||
173 | EVP_CIPHER_block_size() and EVP_CIPHER_CTX_block_size() return the block | ||
174 | size. | ||
175 | |||
176 | EVP_CIPHER_key_length() and EVP_CIPHER_CTX_key_length() return the key | ||
177 | length. | ||
178 | |||
179 | EVP_CIPHER_iv_length() and EVP_CIPHER_CTX_iv_length() return the IV | ||
180 | length or zero if the cipher does not use an IV. | ||
181 | |||
182 | EVP_CIPHER_type() and EVP_CIPHER_CTX_type() return the NID of the cipher's | ||
183 | OBJECT IDENTIFIER or NID_undef if it has no defined OBJECT IDENTIFIER. | ||
184 | |||
185 | EVP_CIPHER_CTX_cipher() returns an B<EVP_CIPHER> structure. | ||
186 | |||
187 | EVP_CIPHER_param_to_asn1() and EVP_CIPHER_asn1_to_param() return 1 for | ||
188 | success or zero for failure. | ||
189 | |||
190 | =head1 NOTES | ||
191 | |||
192 | Where possible the B<EVP> interface to symmetric ciphers should be used in | ||
193 | preference to the low level interfaces. This is because the code then becomes | ||
194 | transparent to the cipher used and much more flexible. | ||
195 | |||
196 | PKCS padding works by adding B<n> padding bytes of value B<n> to make the total | ||
197 | length of the encrypted data a multiple of the block size. Padding is always | ||
198 | added so if the data is already a multiple of the block size B<n> will equal | ||
199 | the block size. For example if the block size is 8 and 11 bytes are to be | ||
200 | encrypted then 5 padding bytes of value 5 will be added. | ||
201 | |||
202 | When decrypting the final block is checked to see if it has the correct form. | ||
203 | |||
204 | Although the decryption operation can produce an error, it is not a strong | ||
205 | 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 | ||
207 | input data earlier on will not produce a final decrypt error. | ||
208 | |||
209 | =head1 BUGS | ||
210 | |||
211 | The current B<EVP> cipher interface is not as flexible as it should be. Only | ||
212 | certain "spot" encryption algorithms can be used for ciphers which have various | ||
213 | parameters associated with them (RC2, RC5 for example) this is inadequate. | ||
214 | |||
215 | Several of the functions do not return error codes because the software versions | ||
216 | can never fail. This is not true of hardware versions. | ||
217 | |||
218 | =head1 SEE ALSO | ||
219 | |||
220 | L<evp(3)|evp(3)> | ||
221 | |||
222 | =head1 HISTORY | ||
223 | |||
224 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/OPENSSL_VERSION_NUMBER.pod b/src/lib/libssl/src/doc/crypto/OPENSSL_VERSION_NUMBER.pod new file mode 100644 index 0000000000..b0b1058d19 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/OPENSSL_VERSION_NUMBER.pod | |||
@@ -0,0 +1,46 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | OPENSSL_VERSION_NUMBER, SSLeay - get OpenSSL version number | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/opensslv.h> | ||
10 | #define OPENSSL_VERSION_NUMBER 0xnnnnnnnnnL | ||
11 | |||
12 | #include <openssl/crypto.h> | ||
13 | long SSLeay(void); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | OPENSSL_VERSION_NUMBER is a numeric release version identifier: | ||
18 | |||
19 | MMNNFFRBB major minor fix final beta/patch | ||
20 | |||
21 | for example | ||
22 | |||
23 | 0x000904100 == 0.9.4 release | ||
24 | 0x000905000 == 0.9.5 dev | ||
25 | |||
26 | Versions prior to 0.9.3 have identifiers E<lt> 0x0930. | ||
27 | For backward compatibility, SSLEAY_VERSION_NUMBER is also defined. | ||
28 | |||
29 | 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 | ||
31 | loaded, especially when using DLLs on Windows systems. | ||
32 | |||
33 | =head1 RETURN VALUE | ||
34 | |||
35 | The version number. | ||
36 | |||
37 | =head1 SEE ALSO | ||
38 | |||
39 | L<crypto(3)|crypto(3)> | ||
40 | |||
41 | =head1 HISTORY | ||
42 | |||
43 | SSLeay() and SSLEAY_VERSION_NUMBER are available in all versions of SSLeay and OpenSSL. | ||
44 | OPENSSL_VERSION_NUMBER is available in all versions of OpenSSL. | ||
45 | |||
46 | =cut | ||
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 new file mode 100644 index 0000000000..1300fe190c --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/OpenSSL_add_all_algorithms.pod | |||
@@ -0,0 +1,65 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | OpenSSL_add_all_algorithms() - add algorithms to internal table | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/evp.h> | ||
10 | |||
11 | void OpenSSL_add_all_algorithms(void); | ||
12 | void OpenSSL_add_all_ciphers(void); | ||
13 | void OpenSSL_add_all_digests(void); | ||
14 | |||
15 | void EVP_cleanup(void); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | OpenSSL keeps an internal table of digest algorithms and ciphers. It uses | ||
20 | this table to lookup ciphers via functions such as EVP_get_cipher_byname(). | ||
21 | |||
22 | OpenSSL_add_all_digests() adds all digest algorithms to the table. | ||
23 | |||
24 | OpenSSL_add_all_algorithms() adds all algorithms to the table (digests and | ||
25 | ciphers). | ||
26 | |||
27 | OpenSSL_add_all_ciphers() adds all encryption algorithms to the table including | ||
28 | password based encryption algorithms. | ||
29 | |||
30 | EVP_cleanup() removes all ciphers and digests from the table. | ||
31 | |||
32 | =head1 RETURN VALUES | ||
33 | |||
34 | None of the functions return a value. | ||
35 | |||
36 | =head1 NOTES | ||
37 | |||
38 | A typical application will will call OpenSSL_add_all_algorithms() initially and | ||
39 | EVP_cleanup() before exiting. | ||
40 | |||
41 | An application does not need to add algorithms to use them explicitly, for example | ||
42 | by EVP_sha1(). It just needs to add them if it (or any of the functions it calls) | ||
43 | needs to lookup algorithms. | ||
44 | |||
45 | 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 | 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 | |||
50 | Calling OpenSSL_add_all_algorithms() links in all algorithms: as a result a | ||
51 | statically linked executable can be quite large. If this is important it is possible | ||
52 | to just add the required ciphers and digests. | ||
53 | |||
54 | =head1 BUGS | ||
55 | |||
56 | Although the functions do not return error codes it is possible for them to fail. | ||
57 | This will only happen as a result of a memory allocation failure so this is not | ||
58 | too much of a problem in practice. | ||
59 | |||
60 | =head1 SEE ALSO | ||
61 | |||
62 | L<evp(3)|evp(3)>, L<EVP_DigestInit(3)|EVP_DigestInit(3)>, | ||
63 | L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> | ||
64 | |||
65 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/RAND_add.pod b/src/lib/libssl/src/doc/crypto/RAND_add.pod new file mode 100644 index 0000000000..0a13ec2a92 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/RAND_add.pod | |||
@@ -0,0 +1,68 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | RAND_add, RAND_seed, RAND_screen - add entropy to the PRNG | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/rand.h> | ||
10 | |||
11 | void RAND_seed(const void *buf, int num); | ||
12 | |||
13 | void RAND_add(const void *buf, int num, double entropy); | ||
14 | |||
15 | int RAND_status(void); | ||
16 | |||
17 | void RAND_screen(void); | ||
18 | |||
19 | =head1 DESCRIPTION | ||
20 | |||
21 | RAND_add() mixes the B<num> bytes at B<buf> into the PRNG state. Thus, | ||
22 | if the data at B<buf> are unpredictable to an adversary, this | ||
23 | increases the uncertainty about the state and makes the PRNG output | ||
24 | less predictable. Suitable input comes from user interaction (random | ||
25 | key presses, mouse movements) and certain hardware events. The | ||
26 | B<entropy> argument is (the lower bound of) an estimate of how much | ||
27 | randomness is contained in B<buf>, measured in bytes. Details about | ||
28 | sources of randomness and how to estimate their entropy can be found | ||
29 | in the literature, e.g. RFC 1750. | ||
30 | |||
31 | RAND_add() may be called with sensitive data such as user entered | ||
32 | passwords. The seed values cannot be recovered from the PRNG output. | ||
33 | |||
34 | OpenSSL makes sure that the PRNG state is unique for each thread. On | ||
35 | systems that provide C</dev/urandom>, the randomness device is used | ||
36 | to seed the PRNG transparently. However, on all other systems, the | ||
37 | application is responsible for seeding the PRNG by calling RAND_add(), | ||
38 | L<RAND_egd(3)|RAND_egd(3)> | ||
39 | or L<RAND_load_file(3)|RAND_load_file(3)>. | ||
40 | |||
41 | RAND_seed() is equivalent to RAND_add() when B<num == entropy>. | ||
42 | |||
43 | The RAND_screen() function is available for the convenience of Windows | ||
44 | programmers. It adds the current contents of the screen to the PRNG. | ||
45 | For applications that can catch Windows events, seeding the PRNG with | ||
46 | the parameters of B<WM_MOUSEMOVE> events is a significantly better | ||
47 | source of randomness. It should be noted that both methods cannot be | ||
48 | used on servers that run without user interaction. | ||
49 | |||
50 | =head1 RETURN VALUES | ||
51 | |||
52 | RAND_status() returns 1 if the PRNG has been seeded with enough data, | ||
53 | 0 otherwise. | ||
54 | |||
55 | The other functions do not return values. | ||
56 | |||
57 | =head1 SEE ALSO | ||
58 | |||
59 | L<rand(3)|rand(3)>, L<RAND_egd(3)|RAND_egd(3)>, | ||
60 | L<RAND_load_file(3)|RAND_load_file(3)>, L<RAND_cleanup(3)|RAND_cleanup(3)> | ||
61 | |||
62 | =head1 HISTORY | ||
63 | |||
64 | RAND_seed() and RAND_screen() are available in all versions of SSLeay | ||
65 | and OpenSSL. RAND_add() and RAND_status() have been added in OpenSSL | ||
66 | 0.9.5. | ||
67 | |||
68 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/RAND_bytes.pod b/src/lib/libssl/src/doc/crypto/RAND_bytes.pod new file mode 100644 index 0000000000..b6ebd50527 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/RAND_bytes.pod | |||
@@ -0,0 +1,46 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | RAND_bytes, RAND_pseudo_bytes - generate random data | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/rand.h> | ||
10 | |||
11 | int RAND_bytes(unsigned char *buf, int num); | ||
12 | |||
13 | int RAND_pseudo_bytes(unsigned char *buf, int num); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | RAND_bytes() puts B<num> cryptographically strong pseudo-random bytes | ||
18 | into B<buf>. An error occurs if the PRNG has not been seeded with | ||
19 | enough randomness to ensure an unpredictable byte sequence. | ||
20 | |||
21 | RAND_pseudo_bytes() puts B<num> pseudo-random bytes into B<buf>. | ||
22 | Pseudo-random byte sequences generated by RAND_pseudo_bytes() will be | ||
23 | unique if they are of sufficient length, but are not necessarily | ||
24 | unpredictable. They can be used for non-cryptographic purposes and for | ||
25 | certain purposes in cryptographic protocols, but usually not for key | ||
26 | generation etc. | ||
27 | |||
28 | =head1 RETURN VALUES | ||
29 | |||
30 | RAND_bytes() returns 1 on success, 0 otherwise. The error code can be | ||
31 | obtained by L<ERR_get_error(3)|ERR_get_error(3)>. RAND_pseudo_bytes() returns 1 if the | ||
32 | bytes generated are cryptographically strong, 0 otherwise. Both | ||
33 | functions return -1 if they are not supported by the current RAND | ||
34 | method. | ||
35 | |||
36 | =head1 SEE ALSO | ||
37 | |||
38 | L<rand(3)|rand(3)>, L<err(3)|err(3)>, L<RAND_add(3)|RAND_add(3)> | ||
39 | |||
40 | =head1 HISTORY | ||
41 | |||
42 | RAND_bytes() is available in all versions of SSLeay and OpenSSL. It | ||
43 | has a return value since OpenSSL 0.9.5. RAND_pseudo_bytes() was added | ||
44 | in OpenSSL 0.9.5. | ||
45 | |||
46 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/RAND_cleanup.pod b/src/lib/libssl/src/doc/crypto/RAND_cleanup.pod new file mode 100644 index 0000000000..3a8f0749a8 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/RAND_cleanup.pod | |||
@@ -0,0 +1,29 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | RAND_cleanup - erase the PRNG state | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/rand.h> | ||
10 | |||
11 | void RAND_cleanup(void); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | RAND_cleanup() erases the memory used by the PRNG. | ||
16 | |||
17 | =head1 RETURN VALUE | ||
18 | |||
19 | RAND_cleanup() returns no value. | ||
20 | |||
21 | =head1 SEE ALSO | ||
22 | |||
23 | L<rand(3)|rand(3)> | ||
24 | |||
25 | =head1 HISTORY | ||
26 | |||
27 | RAND_cleanup() is available in all versions of SSLeay and OpenSSL. | ||
28 | |||
29 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/RAND_egd.pod b/src/lib/libssl/src/doc/crypto/RAND_egd.pod new file mode 100644 index 0000000000..a40bd96198 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/RAND_egd.pod | |||
@@ -0,0 +1,38 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | RAND_egd - query entropy gathering daemon | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/rand.h> | ||
10 | |||
11 | int RAND_egd(const char *path); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | RAND_egd() queries the entropy gathering daemon EGD on socket B<path>. | ||
16 | |||
17 | EGD is available from http://www.lothar.com/tech/crypto/ (C<perl | ||
18 | Makefile.PL; make; make install> to install). It is run as B<egd> | ||
19 | I<path>, where I<path> is an absolute path designating a socket. When | ||
20 | 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 | ||
22 | non-blocking mode. | ||
23 | |||
24 | =head1 RETURN VALUE | ||
25 | |||
26 | RAND_egd() returns the number of bytes read from the daemon on | ||
27 | success, and -1 if the connection failed or the daemon did not return | ||
28 | enough data to fully seed the PRNG. | ||
29 | |||
30 | =head1 SEE ALSO | ||
31 | |||
32 | L<rand(3)|rand(3)>, L<RAND_add(3)|RAND_add(3)>, L<RAND_cleanup(3)|RAND_cleanup(3)> | ||
33 | |||
34 | =head1 HISTORY | ||
35 | |||
36 | RAND_egd() is available since OpenSSL 0.9.5. | ||
37 | |||
38 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/RAND_load_file.pod b/src/lib/libssl/src/doc/crypto/RAND_load_file.pod new file mode 100644 index 0000000000..8dd700ca3d --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/RAND_load_file.pod | |||
@@ -0,0 +1,53 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | RAND_load_file, RAND_write_file, RAND_file_name - PRNG seed file | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/rand.h> | ||
10 | |||
11 | const char *RAND_file_name(char *buf, int num); | ||
12 | |||
13 | int RAND_load_file(const char *filename, long max_bytes); | ||
14 | |||
15 | int RAND_write_file(const char *filename); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | RAND_file_name() generates a default path for the random seed | ||
20 | file. B<buf> points to a buffer of size B<num> in which to store the | ||
21 | filename. The seed file is $RANDFILE if that environment variable is | ||
22 | set, $HOME/.rnd otherwise. If $HOME is not set either, or B<num> is | ||
23 | too small for the path name, an error occurs. | ||
24 | |||
25 | RAND_load_file() reads a number of bytes from file B<filename> and | ||
26 | adds them to the PRNG. If B<max_bytes> is non-negative, | ||
27 | up to to B<max_bytes> are read; starting with OpenSSL 0.9.5, | ||
28 | if B<max_bytes> is -1, the complete file is read. | ||
29 | |||
30 | RAND_write_file() writes a number of random bytes (currently 1024) to | ||
31 | file B<filename> which can be used to initialize the PRNG by calling | ||
32 | RAND_load_file() in a later session. | ||
33 | |||
34 | =head1 RETURN VALUES | ||
35 | |||
36 | RAND_load_file() returns the number of bytes read. | ||
37 | |||
38 | RAND_write_file() returns the number of bytes written, and -1 if the | ||
39 | bytes written were generated without appropriate seed. | ||
40 | |||
41 | RAND_file_name() returns a pointer to B<buf> on success, and NULL on | ||
42 | error. | ||
43 | |||
44 | =head1 SEE ALSO | ||
45 | |||
46 | L<rand(3)|rand(3)>, L<RAND_add(3)|RAND_add(3)>, L<RAND_cleanup(3)|RAND_cleanup(3)> | ||
47 | |||
48 | =head1 HISTORY | ||
49 | |||
50 | RAND_load_file(), RAND_write_file() and RAND_file_name() are available in | ||
51 | all versions of SSLeay and OpenSSL. | ||
52 | |||
53 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/RAND_set_rand_method.pod b/src/lib/libssl/src/doc/crypto/RAND_set_rand_method.pod new file mode 100644 index 0000000000..466e9b8767 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/RAND_set_rand_method.pod | |||
@@ -0,0 +1,57 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | RAND_set_rand_method, RAND_get_rand_method, RAND_SSLeay - select RAND method | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/rand.h> | ||
10 | |||
11 | void RAND_set_rand_method(RAND_METHOD *meth); | ||
12 | |||
13 | RAND_METHOD *RAND_get_rand_method(void); | ||
14 | |||
15 | RAND_METHOD *RAND_SSLeay(void); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | A B<RAND_METHOD> specifies the functions that OpenSSL uses for random | ||
20 | number generation. By modifying the method, alternative | ||
21 | implementations such as hardware RNGs may be used. Initially, the | ||
22 | default is to use the OpenSSL internal implementation. RAND_SSLeay() | ||
23 | returns a pointer to that method. | ||
24 | |||
25 | RAND_set_rand_method() sets the RAND method to B<meth>. | ||
26 | RAND_get_rand_method() returns a pointer to the current method. | ||
27 | |||
28 | =head1 THE RAND_METHOD STRUCTURE | ||
29 | |||
30 | typedef struct rand_meth_st | ||
31 | { | ||
32 | void (*seed)(const void *buf, int num); | ||
33 | int (*bytes)(unsigned char *buf, int num); | ||
34 | void (*cleanup)(void); | ||
35 | void (*add)(const void *buf, int num, int entropy); | ||
36 | int (*pseudorand)(unsigned char *buf, int num); | ||
37 | } RAND_METHOD; | ||
38 | |||
39 | The components point to the implementation of RAND_seed(), | ||
40 | RAND_bytes(), RAND_cleanup(), RAND_add() and RAND_pseudo_rand(). | ||
41 | Each component may be NULL if the function is not implemented. | ||
42 | |||
43 | =head1 RETURN VALUES | ||
44 | |||
45 | RAND_set_rand_method() returns no value. RAND_get_rand_method() and | ||
46 | RAND_SSLeay() return pointers to the respective methods. | ||
47 | |||
48 | =head1 SEE ALSO | ||
49 | |||
50 | L<rand(3)|rand(3)> | ||
51 | |||
52 | =head1 HISTORY | ||
53 | |||
54 | RAND_set_rand_method(), RAND_get_rand_method() and RAND_SSLeay() are | ||
55 | available in all versions of OpenSSL. | ||
56 | |||
57 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/RSA_blinding_on.pod b/src/lib/libssl/src/doc/crypto/RSA_blinding_on.pod new file mode 100644 index 0000000000..fd2c69abd8 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/RSA_blinding_on.pod | |||
@@ -0,0 +1,43 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | RSA_blinding_on, RSA_blinding_off - protect the RSA operation from timing attacks | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/rsa.h> | ||
10 | |||
11 | int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); | ||
12 | |||
13 | void RSA_blinding_off(RSA *rsa); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | RSA is vulnerable to timing attacks. In a setup where attackers can | ||
18 | measure the time of RSA decryption or signature operations, blinding | ||
19 | must be used to protect the RSA operation from that attack. | ||
20 | |||
21 | RSA_blinding_on() turns blinding on for key B<rsa> and generates a | ||
22 | random blinding factor. B<ctx> is B<NULL> or a pre-allocated and | ||
23 | initialized B<BN_CTX>. The random number generator must be seeded | ||
24 | prior to calling RSA_blinding_on(). | ||
25 | |||
26 | RSA_blinding_off() turns blinding off and frees the memory used for | ||
27 | the blinding factor. | ||
28 | |||
29 | =head1 RETURN VALUES | ||
30 | |||
31 | RSA_blinding_on() returns 1 on success, and 0 if an error occurred. | ||
32 | |||
33 | RSA_blinding_off() returns no value. | ||
34 | |||
35 | =head1 SEE ALSO | ||
36 | |||
37 | L<rsa(3)|rsa(3)>, L<rand(3)|rand(3)> | ||
38 | |||
39 | =head1 HISTORY | ||
40 | |||
41 | RSA_blinding_on() and RSA_blinding_off() appeared in SSLeay 0.9.0. | ||
42 | |||
43 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/RSA_check_key.pod b/src/lib/libssl/src/doc/crypto/RSA_check_key.pod new file mode 100644 index 0000000000..79fed753ad --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/RSA_check_key.pod | |||
@@ -0,0 +1,39 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | RSA_check_key - validate private RSA keys | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/rsa.h> | ||
10 | |||
11 | int RSA_check_key(RSA *rsa); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | This function validates RSA keys. It checks that B<p> and B<q> are | ||
16 | in fact prime, and that B<n = p*q>. | ||
17 | |||
18 | It also checks that B<d*e = 1 mod (p-1*q-1)>, | ||
19 | and that B<dmp1>, B<dmq1> and B<iqmp> are set correctly or are B<NULL>. | ||
20 | |||
21 | The key's public components may not be B<NULL>. | ||
22 | |||
23 | =head1 RETURN VALUE | ||
24 | |||
25 | RSA_check_key() returns 1 if B<rsa> is a valid RSA key, and 0 otherwise. | ||
26 | -1 is returned if an error occurs while checking the key. | ||
27 | |||
28 | If the key is invalid or an error occurred, the reason code can be | ||
29 | obtained using L<ERR_get_error(3)|ERR_get_error(3)>. | ||
30 | |||
31 | =head1 SEE ALSO | ||
32 | |||
33 | L<rsa(3)|rsa(3)>, L<err(3)|err(3)> | ||
34 | |||
35 | =head1 HISTORY | ||
36 | |||
37 | RSA_check() appeared in OpenSSL 0.9.4. | ||
38 | |||
39 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/RSA_generate_key.pod b/src/lib/libssl/src/doc/crypto/RSA_generate_key.pod new file mode 100644 index 0000000000..fdaddbcb13 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/RSA_generate_key.pod | |||
@@ -0,0 +1,68 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | RSA_generate_key - generate RSA key pair | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/rsa.h> | ||
10 | |||
11 | RSA *RSA_generate_key(int num, unsigned long e, | ||
12 | void (*callback)(int,int,void *), void *cb_arg); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | RSA_generate_key() generates a key pair and returns it in a newly | ||
17 | allocated B<RSA> structure. The pseudo-random number generator must | ||
18 | be seeded prior to calling RSA_generate_key(). | ||
19 | |||
20 | The modulus size will be B<num> bits, and the public exponent will be | ||
21 | B<e>. Key sizes with B<num> E<lt> 1024 should be considered insecure. | ||
22 | The exponent is an odd number, typically 3 or 65535. | ||
23 | |||
24 | A callback function may be used to provide feedback about the | ||
25 | progress of the key generation. If B<callback> is not B<NULL>, it | ||
26 | will be called as follows: | ||
27 | |||
28 | =over 4 | ||
29 | |||
30 | =item * | ||
31 | |||
32 | While a random prime number is generated, it is called as | ||
33 | described in L<BN_generate_prime(3)|BN_generate_prime(3)>. | ||
34 | |||
35 | =item * | ||
36 | |||
37 | When the n-th randomly generated prime is rejected as not | ||
38 | suitable for the key, B<callback(2, n, cb_arg)> is called. | ||
39 | |||
40 | =item * | ||
41 | |||
42 | When a random p has been found with p-1 relatively prime to B<e>, | ||
43 | it is called as B<callback(3, 0, cb_arg)>. | ||
44 | |||
45 | =back | ||
46 | |||
47 | The process is then repeated for prime q with B<callback(3, 1, cb_arg)>. | ||
48 | |||
49 | =head1 RETURN VALUE | ||
50 | |||
51 | If key generation fails, RSA_generate_key() returns B<NULL>; the | ||
52 | error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
53 | |||
54 | =head1 BUGS | ||
55 | |||
56 | B<callback(2, x, cb_arg)> is used with two different meanings. | ||
57 | |||
58 | RSA_generate_key() goes into an infinite loop for illegal input values. | ||
59 | |||
60 | =head1 SEE ALSO | ||
61 | |||
62 | L<err(3)|err(3)>, L<rand(3)|rand(3)>, L<rsa(3)|rsa(3)>, L<RSA_free(3)|RSA_free(3)> | ||
63 | |||
64 | =head1 HISTORY | ||
65 | |||
66 | The B<cb_arg> argument was added in SSLeay 0.9.0. | ||
67 | |||
68 | =cut | ||
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 new file mode 100644 index 0000000000..920dc76325 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/RSA_get_ex_new_index.pod | |||
@@ -0,0 +1,122 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | RSA_get_ex_new_index, RSA_set_ex_data, RSA_get_ex_data - add application specific data to RSA structures | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/rsa.h> | ||
10 | |||
11 | int RSA_get_ex_new_index(long argl, void *argp, | ||
12 | CRYPTO_EX_new *new_func, | ||
13 | CRYPTO_EX_dup *dup_func, | ||
14 | CRYPTO_EX_free *free_func); | ||
15 | |||
16 | int RSA_set_ex_data(RSA *r, int idx, void *arg); | ||
17 | |||
18 | void *RSA_get_ex_data(RSA *r, int idx); | ||
19 | |||
20 | int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
21 | int idx, long argl, void *argp); | ||
22 | |||
23 | void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
24 | int idx, long argl, void *argp); | ||
25 | |||
26 | int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, | ||
27 | int idx, long argl, void *argp); | ||
28 | |||
29 | =head1 DESCRIPTION | ||
30 | |||
31 | Several OpenSSL structures can have application specific data attached to them. | ||
32 | This has several potential uses, it can be used to cache data associated with | ||
33 | a structure (for example the hash of some part of the structure) or some | ||
34 | additional data (for example a handle to the data in an external library). | ||
35 | |||
36 | Since the application data can be anything at all it is passed and retrieved | ||
37 | as a B<void *> type. | ||
38 | |||
39 | The B<RSA_get_ex_new_index()> function is initially called to "register" some | ||
40 | new application specific data. It takes three optional function pointers which | ||
41 | are called when the parent structure (in this case an RSA structure) is | ||
42 | initially created, when it is copied and when it is freed up. If any or all of | ||
43 | these function pointer arguments are not used they should be set to NULL. The | ||
44 | precise manner in which these function pointers are called is described in more | ||
45 | detail below. B<RSA_get_ex_new_index()> also takes additional long and pointer | ||
46 | parameters which will be passed to the supplied functions but which otherwise | ||
47 | have no special meaning. It returns an B<index> which should be stored | ||
48 | (typically in a static variable) and passed used in the B<idx> parameter in | ||
49 | the remaining functions. Each successful call to B<RSA_get_ex_new_index()> | ||
50 | will return an index greater than any previously returned, this is important | ||
51 | because the optional functions are called in order of increasing index value. | ||
52 | |||
53 | B<RSA_set_ex_data()> is used to set application specific data, the data is | ||
54 | supplied in the B<arg> parameter and its precise meaning is up to the | ||
55 | application. | ||
56 | |||
57 | B<RSA_get_ex_data()> is used to retrieve application specific data. The data | ||
58 | is returned to the application, this will be the same value as supplied to | ||
59 | a previous B<RSA_set_ex_data()> call. | ||
60 | |||
61 | B<new_func()> is called when a structure is initially allocated (for example | ||
62 | with B<RSA_new()>. The parent structure members will not have any meaningful | ||
63 | values at this point. This function will typically be used to allocate any | ||
64 | application specific structure. | ||
65 | |||
66 | B<free_func()> is called when a structure is being freed up. The dynamic parent | ||
67 | structure members should not be accessed because they will be freed up when | ||
68 | this function is called. | ||
69 | |||
70 | B<new_func()> and B<free_func()> take the same parameters. B<parent> is a | ||
71 | pointer to the parent RSA structure. B<ptr> is a the application specific data | ||
72 | (this wont be of much use in B<new_func()>. B<ad> is a pointer to the | ||
73 | B<CRYPTO_EX_DATA> structure from the parent RSA structure: the functions | ||
74 | B<CRYPTO_get_ex_data()> and B<CRYPTO_set_ex_data()> can be called to manipulate | ||
75 | it. The B<idx> parameter is the index: this will be the same value returned by | ||
76 | B<RSA_get_ex_new_index()> when the functions were initially registered. Finally | ||
77 | the B<argl> and B<argp> parameters are the values originally passed to the same | ||
78 | corresponding parameters when B<RSA_get_ex_new_index()> was called. | ||
79 | |||
80 | B<dup_func()> is called when a structure is being copied. Pointers to the | ||
81 | destination and source B<CRYPTO_EX_DATA> structures are passed in the B<to> and | ||
82 | B<from> parameters respectively. The B<from_d> parameter is passed a pointer to | ||
83 | the source application data when the function is called, when the function returns | ||
84 | the value is copied to the destination: the application can thus modify the data | ||
85 | pointed to by B<from_d> and have different values in the source and destination. | ||
86 | The B<idx>, B<argl> and B<argp> parameters are the same as those in B<new_func()> | ||
87 | and B<free_func()>. | ||
88 | |||
89 | =head1 RETURN VALUES | ||
90 | |||
91 | B<RSA_get_ex_new_index()> returns a new index or -1 on failure (note 0 is a valid | ||
92 | index value). | ||
93 | |||
94 | B<RSA_set_ex_data()> returns 1 on success or 0 on failure. | ||
95 | |||
96 | B<RSA_get_ex_data()> returns the application data or 0 on failure. 0 may also | ||
97 | be valid application data but currently it can only fail if given an invalid B<idx> | ||
98 | parameter. | ||
99 | |||
100 | B<new_func()> and B<dup_func()> should return 0 for failure and 1 for success. | ||
101 | |||
102 | On failure an error code can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>. | ||
103 | |||
104 | =head1 BUGS | ||
105 | |||
106 | B<dup_func()> is currently never called. | ||
107 | |||
108 | The return value of B<new_func()> is ignored. | ||
109 | |||
110 | The B<new_func()> function isn't very useful because no meaningful values are | ||
111 | present in the parent RSA structure when it is called. | ||
112 | |||
113 | =head1 SEE ALSO | ||
114 | |||
115 | L<rsa(3)|rsa(3)>, L<CRYPTO_set_ex_data(3)|CRYPTO_set_ex_data(3)> | ||
116 | |||
117 | =head1 HISTORY | ||
118 | |||
119 | RSA_get_ex_new_index(), RSA_set_ex_data() and RSA_get_ex_data() are | ||
120 | available since SSLeay 0.9.0. | ||
121 | |||
122 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/RSA_new.pod b/src/lib/libssl/src/doc/crypto/RSA_new.pod new file mode 100644 index 0000000000..f16490ea6a --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/RSA_new.pod | |||
@@ -0,0 +1,38 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | RSA_new, RSA_free - allocate and free RSA objects | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/rsa.h> | ||
10 | |||
11 | RSA * RSA_new(void); | ||
12 | |||
13 | void RSA_free(RSA *rsa); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | RSA_new() allocates and initializes an B<RSA> structure. | ||
18 | |||
19 | RSA_free() frees the B<RSA> structure and its components. The key is | ||
20 | erased before the memory is returned to the system. | ||
21 | |||
22 | =head1 RETURN VALUES | ||
23 | |||
24 | If the allocation fails, RSA_new() returns B<NULL> and sets an error | ||
25 | code that can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. Otherwise it returns | ||
26 | a pointer to the newly allocated structure. | ||
27 | |||
28 | RSA_free() returns no value. | ||
29 | |||
30 | =head1 SEE ALSO | ||
31 | |||
32 | L<err(3)|err(3)>, L<rsa(3)|rsa(3)>, L<RSA_generate_key(3)|RSA_generate_key(3)> | ||
33 | |||
34 | =head1 HISTORY | ||
35 | |||
36 | RSA_new() and RSA_free() are available in all versions of SSLeay and OpenSSL. | ||
37 | |||
38 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/RSA_padding_add_PKCS1_type_1.pod b/src/lib/libssl/src/doc/crypto/RSA_padding_add_PKCS1_type_1.pod new file mode 100644 index 0000000000..b8f678fe72 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/RSA_padding_add_PKCS1_type_1.pod | |||
@@ -0,0 +1,124 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | RSA_padding_add_PKCS1_type_1, RSA_padding_check_PKCS1_type_1, | ||
6 | RSA_padding_add_PKCS1_type_2, RSA_padding_check_PKCS1_type_2, | ||
7 | RSA_padding_add_PKCS1_OAEP, RSA_padding_check_PKCS1_OAEP, | ||
8 | RSA_padding_add_SSLv23, RSA_padding_check_SSLv23, | ||
9 | RSA_padding_add_none, RSA_padding_check_none - asymmetric encryption | ||
10 | padding | ||
11 | |||
12 | =head1 SYNOPSIS | ||
13 | |||
14 | #include <openssl/rsa.h> | ||
15 | |||
16 | int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, | ||
17 | unsigned char *f, int fl); | ||
18 | |||
19 | int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen, | ||
20 | unsigned char *f, int fl, int rsa_len); | ||
21 | |||
22 | int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, | ||
23 | unsigned char *f, int fl); | ||
24 | |||
25 | int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, | ||
26 | unsigned char *f, int fl, int rsa_len); | ||
27 | |||
28 | int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, | ||
29 | unsigned char *f, int fl, unsigned char *p, int pl); | ||
30 | |||
31 | int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, | ||
32 | unsigned char *f, int fl, int rsa_len, unsigned char *p, int pl); | ||
33 | |||
34 | int RSA_padding_add_SSLv23(unsigned char *to, int tlen, | ||
35 | unsigned char *f, int fl); | ||
36 | |||
37 | int RSA_padding_check_SSLv23(unsigned char *to, int tlen, | ||
38 | unsigned char *f, int fl, int rsa_len); | ||
39 | |||
40 | int RSA_padding_add_none(unsigned char *to, int tlen, | ||
41 | unsigned char *f, int fl); | ||
42 | |||
43 | int RSA_padding_check_none(unsigned char *to, int tlen, | ||
44 | unsigned char *f, int fl, int rsa_len); | ||
45 | |||
46 | =head1 DESCRIPTION | ||
47 | |||
48 | The RSA_padding_xxx_xxx() functions are called from the RSA encrypt, | ||
49 | decrypt, sign and verify functions. Normally they should not be called | ||
50 | from application programs. | ||
51 | |||
52 | However, they can also be called directly to implement padding for other | ||
53 | asymmetric ciphers. RSA_padding_add_PKCS1_OAEP() and | ||
54 | RSA_padding_check_PKCS1_OAEP() may be used in an application combined | ||
55 | with B<RSA_NO_PADDING> in order to implement OAEP with an encoding | ||
56 | parameter. | ||
57 | |||
58 | RSA_padding_add_xxx() encodes B<fl> bytes from B<f> so as to fit into | ||
59 | B<tlen> bytes and stores the result at B<to>. An error occurs if B<fl> | ||
60 | does not meet the size requirements of the encoding method. | ||
61 | |||
62 | The following encoding methods are implemented: | ||
63 | |||
64 | =over 4 | ||
65 | |||
66 | =item PKCS1_type_1 | ||
67 | |||
68 | PKCS #1 v2.0 EMSA-PKCS1-v1_5 (PKCS #1 v1.5 block type 1); used for signatures | ||
69 | |||
70 | =item PKCS1_type_2 | ||
71 | |||
72 | PKCS #1 v2.0 EME-PKCS1-v1_5 (PKCS #1 v1.5 block type 2) | ||
73 | |||
74 | =item PKCS1_OAEP | ||
75 | |||
76 | PKCS #1 v2.0 EME-OAEP | ||
77 | |||
78 | =item SSLv23 | ||
79 | |||
80 | PKCS #1 EME-PKCS1-v1_5 with SSL-specific modification | ||
81 | |||
82 | =item none | ||
83 | |||
84 | simply copy the data | ||
85 | |||
86 | =back | ||
87 | |||
88 | The random number generator must be seeded prior to calling | ||
89 | RSA_padding_add_xxx(). | ||
90 | |||
91 | RSA_padding_check_xxx() verifies that the B<fl> bytes at B<f> contain | ||
92 | a valid encoding for a B<rsa_len> byte RSA key in the respective | ||
93 | encoding method and stores the recovered data of at most B<tlen> bytes | ||
94 | (for B<RSA_NO_PADDING>: of size B<tlen>) | ||
95 | at B<to>. | ||
96 | |||
97 | For RSA_padding_xxx_OAEP(), B<p> points to the encoding parameter | ||
98 | of length B<pl>. B<p> may be B<NULL> if B<pl> is 0. | ||
99 | |||
100 | =head1 RETURN VALUES | ||
101 | |||
102 | The RSA_padding_add_xxx() functions return 1 on success, 0 on error. | ||
103 | The RSA_padding_check_xxx() functions return the length of the | ||
104 | recovered data, -1 on error. Error codes can be obtained by calling | ||
105 | L<ERR_get_error(3)|ERR_get_error(3)>. | ||
106 | |||
107 | =head1 SEE ALSO | ||
108 | |||
109 | L<RSA_public_encrypt(3)|RSA_public_encrypt(3)>, | ||
110 | L<RSA_private_decrypt(3)|RSA_private_decrypt(3)>, | ||
111 | L<RSA_sign(3)|RSA_sign(3)>, L<RSA_verify(3)|RSA_verify(3)> | ||
112 | |||
113 | =head1 HISTORY | ||
114 | |||
115 | RSA_padding_add_PKCS1_type_1(), RSA_padding_check_PKCS1_type_1(), | ||
116 | RSA_padding_add_PKCS1_type_2(), RSA_padding_check_PKCS1_type_2(), | ||
117 | RSA_padding_add_SSLv23(), RSA_padding_check_SSLv23(), | ||
118 | RSA_padding_add_none() and RSA_padding_check_none() appeared in | ||
119 | SSLeay 0.9.0. | ||
120 | |||
121 | RSA_padding_add_PKCS1_OAEP() and RSA_padding_check_PKCS1_OAEP() were | ||
122 | added in OpenSSL 0.9.2b. | ||
123 | |||
124 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/RSA_print.pod b/src/lib/libssl/src/doc/crypto/RSA_print.pod new file mode 100644 index 0000000000..dd968a5274 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/RSA_print.pod | |||
@@ -0,0 +1,48 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | RSA_print, RSA_print_fp, DHparams_print, DHparams_print_fp - print | ||
6 | cryptographic parameters | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/rsa.h> | ||
11 | |||
12 | int RSA_print(BIO *bp, RSA *x, int offset); | ||
13 | int RSA_print_fp(FILE *fp, RSA *x, int offset); | ||
14 | |||
15 | #include <openssl/dsa.h> | ||
16 | |||
17 | int DSAparams_print(BIO *bp, DSA *x); | ||
18 | int DSAparams_print_fp(FILE *fp, DSA *x); | ||
19 | int DSA_print(BIO *bp, DSA *x, int offset); | ||
20 | int DSA_print_fp(FILE *fp, DSA *x, int offset); | ||
21 | |||
22 | #include <openssl/dh.h> | ||
23 | |||
24 | int DHparams_print(BIO *bp, DH *x); | ||
25 | int DHparams_print_fp(FILE *fp, DH *x); | ||
26 | |||
27 | =head1 DESCRIPTION | ||
28 | |||
29 | A human-readable hexadecimal output of the components of the RSA | ||
30 | key, DSA parameters or key or DH parameters is printed to B<bp> or B<fp>. | ||
31 | |||
32 | The output lines are indented by B<offset> spaces. | ||
33 | |||
34 | =head1 RETURN VALUES | ||
35 | |||
36 | These functions return 1 on success, 0 on error. | ||
37 | |||
38 | =head1 SEE ALSO | ||
39 | |||
40 | L<dh(3)|dh(3)>, L<dsa(3)|dsa(3)>, L<rsa(3)|rsa(3)>, L<BN_bn2bin(3)|BN_bn2bin(3)> | ||
41 | |||
42 | =head1 HISTORY | ||
43 | |||
44 | RSA_print(), RSA_print_fp(), DSA_print(), DSA_print_fp(), DH_print(), | ||
45 | DH_print_fp() are available in all versions of SSLeay and OpenSSL. | ||
46 | DSAparams_print() and DSAparams_print_pf() were added in SSLeay 0.8. | ||
47 | |||
48 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/RSA_private_encrypt.pod b/src/lib/libssl/src/doc/crypto/RSA_private_encrypt.pod new file mode 100644 index 0000000000..6861a98a10 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/RSA_private_encrypt.pod | |||
@@ -0,0 +1,69 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | RSA_private_encrypt, RSA_public_decrypt - low level signature operations | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/rsa.h> | ||
10 | |||
11 | int RSA_private_encrypt(int flen, unsigned char *from, | ||
12 | unsigned char *to, RSA *rsa, int padding); | ||
13 | |||
14 | int RSA_public_decrypt(int flen, unsigned char *from, | ||
15 | unsigned char *to, RSA *rsa, int padding); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | These functions handle RSA signatures at a low level. | ||
20 | |||
21 | RSA_private_encrypt() signs the B<flen> bytes at B<from> (usually a | ||
22 | message digest with an algorithm identifier) using the private key | ||
23 | B<rsa> and stores the signature in B<to>. B<to> must point to | ||
24 | B<RSA_size(rsa)> bytes of memory. | ||
25 | |||
26 | B<padding> denotes one of the following modes: | ||
27 | |||
28 | =over 4 | ||
29 | |||
30 | =item RSA_PKCS1_PADDING | ||
31 | |||
32 | PKCS #1 v1.5 padding. This function does not handle the | ||
33 | B<algorithmIdentifier> specified in PKCS #1. When generating or | ||
34 | verifying PKCS #1 signatures, L<RSA_sign(3)|RSA_sign(3)> and L<RSA_verify(3)|RSA_verify(3)> should be | ||
35 | used. | ||
36 | |||
37 | =item RSA_NO_PADDING | ||
38 | |||
39 | Raw RSA signature. This mode should I<only> be used to implement | ||
40 | cryptographically sound padding modes in the application code. | ||
41 | Signing user data directly with RSA is insecure. | ||
42 | |||
43 | =back | ||
44 | |||
45 | RSA_public_decrypt() recovers the message digest from the B<flen> | ||
46 | bytes long signature at B<from> using the signer's public key | ||
47 | B<rsa>. B<to> must point to a memory section large enough to hold the | ||
48 | message digest (which is smaller than B<RSA_size(rsa) - | ||
49 | 11>). B<padding> is the padding mode that was used to sign the data. | ||
50 | |||
51 | =head1 RETURN VALUES | ||
52 | |||
53 | RSA_private_encrypt() returns the size of the signature (i.e., | ||
54 | RSA_size(rsa)). RSA_public_decrypt() returns the size of the | ||
55 | recovered message digest. | ||
56 | |||
57 | On error, -1 is returned; the error codes can be | ||
58 | obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
59 | |||
60 | =head1 SEE ALSO | ||
61 | |||
62 | L<err(3)|err(3)>, L<rsa(3)|rsa(3)>, L<RSA_sign(3)|RSA_sign(3)>, L<RSA_verify(3)|RSA_verify(3)> | ||
63 | |||
64 | =head1 HISTORY | ||
65 | |||
66 | The B<padding> argument was added in SSLeay 0.8. RSA_NO_PADDING is | ||
67 | available since SSLeay 0.9.0. | ||
68 | |||
69 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/RSA_public_encrypt.pod b/src/lib/libssl/src/doc/crypto/RSA_public_encrypt.pod new file mode 100644 index 0000000000..910c4752b8 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/RSA_public_encrypt.pod | |||
@@ -0,0 +1,86 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | RSA_public_encrypt, RSA_private_decrypt - RSA public key cryptography | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/rsa.h> | ||
10 | |||
11 | int RSA_public_encrypt(int flen, unsigned char *from, | ||
12 | unsigned char *to, RSA *rsa, int padding); | ||
13 | |||
14 | int RSA_private_decrypt(int flen, unsigned char *from, | ||
15 | unsigned char *to, RSA *rsa, int padding); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | RSA_public_encrypt() encrypts the B<flen> bytes at B<from> (usually a | ||
20 | session key) using the public key B<rsa> and stores the ciphertext in | ||
21 | B<to>. B<to> must point to RSA_size(B<rsa>) bytes of memory. | ||
22 | |||
23 | B<padding> denotes one of the following modes: | ||
24 | |||
25 | =over 4 | ||
26 | |||
27 | =item RSA_PKCS1_PADDING | ||
28 | |||
29 | PKCS #1 v1.5 padding. This currently is the most widely used mode. | ||
30 | |||
31 | =item RSA_PKCS1_OAEP_PADDING | ||
32 | |||
33 | EME-OAEP as defined in PKCS #1 v2.0 with SHA-1, MGF1 and an empty | ||
34 | encoding parameter. This mode is recommended for all new applications. | ||
35 | |||
36 | =item RSA_SSLV23_PADDING | ||
37 | |||
38 | PKCS #1 v1.5 padding with an SSL-specific modification that denotes | ||
39 | that the server is SSL3 capable. | ||
40 | |||
41 | =item RSA_NO_PADDING | ||
42 | |||
43 | Raw RSA encryption. This mode should I<only> be used to implement | ||
44 | cryptographically sound padding modes in the application code. | ||
45 | Encrypting user data directly with RSA is insecure. | ||
46 | |||
47 | =back | ||
48 | |||
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 | ||
51 | RSA_PKCS1_OAEP_PADDING. The random number generator must be seeded | ||
52 | prior to calling RSA_public_encrypt(). | ||
53 | |||
54 | RSA_private_decrypt() decrypts the B<flen> bytes at B<from> using the | ||
55 | private key B<rsa> and stores the plaintext in B<to>. B<to> must point | ||
56 | to a memory section large enough to hold the decrypted data (which is | ||
57 | smaller than RSA_size(B<rsa>)). B<padding> is the padding mode that | ||
58 | was used to encrypt the data. | ||
59 | |||
60 | =head1 RETURN VALUES | ||
61 | |||
62 | RSA_public_encrypt() returns the size of the encrypted data (i.e., | ||
63 | RSA_size(B<rsa>)). RSA_private_decrypt() returns the size of the | ||
64 | recovered plaintext. | ||
65 | |||
66 | On error, -1 is returned; the error codes can be | ||
67 | obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
68 | |||
69 | =head1 CONFORMING TO | ||
70 | |||
71 | SSL, PKCS #1 v2.0 | ||
72 | |||
73 | =head1 SEE ALSO | ||
74 | |||
75 | L<err(3)|err(3)>, L<rand(3)|rand(3)>, L<rsa(3)|rsa(3)>, L<RSA_size(3)|RSA_size(3)> | ||
76 | |||
77 | =head1 NOTES | ||
78 | |||
79 | The L<RSA_PKCS1_RSAref(3)|RSA_PKCS1_RSAref(3)> method supports only the RSA_PKCS1_PADDING mode. | ||
80 | |||
81 | =head1 HISTORY | ||
82 | |||
83 | The B<padding> argument was added in SSLeay 0.8. RSA_NO_PADDING is | ||
84 | available since SSLeay 0.9.0, OAEP was added in OpenSSL 0.9.2b. | ||
85 | |||
86 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/RSA_set_method.pod b/src/lib/libssl/src/doc/crypto/RSA_set_method.pod new file mode 100644 index 0000000000..deb1183a23 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/RSA_set_method.pod | |||
@@ -0,0 +1,153 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | RSA_set_default_method, RSA_get_default_method, RSA_set_method, | ||
6 | RSA_get_method, RSA_PKCS1_SSLeay, RSA_PKCS1_RSAref, | ||
7 | RSA_PKCS1_null_method, RSA_flags, RSA_new_method - select RSA method | ||
8 | |||
9 | =head1 SYNOPSIS | ||
10 | |||
11 | #include <openssl/rsa.h> | ||
12 | |||
13 | void RSA_set_default_method(RSA_METHOD *meth); | ||
14 | |||
15 | RSA_METHOD *RSA_get_default_method(void); | ||
16 | |||
17 | RSA_METHOD *RSA_set_method(RSA *rsa, RSA_METHOD *meth); | ||
18 | |||
19 | RSA_METHOD *RSA_get_method(RSA *rsa); | ||
20 | |||
21 | RSA_METHOD *RSA_PKCS1_SSLeay(void); | ||
22 | |||
23 | RSA_METHOD *RSA_PKCS1_RSAref(void); | ||
24 | |||
25 | RSA_METHOD *RSA_null_method(void); | ||
26 | |||
27 | int RSA_flags(RSA *rsa); | ||
28 | |||
29 | RSA *RSA_new_method(RSA_METHOD *method); | ||
30 | |||
31 | =head1 DESCRIPTION | ||
32 | |||
33 | An B<RSA_METHOD> specifies the functions that OpenSSL uses for RSA | ||
34 | operations. By modifying the method, alternative implementations | ||
35 | such as hardware accelerators may be used. | ||
36 | |||
37 | Initially, the default is to use the OpenSSL internal implementation, | ||
38 | unless OpenSSL was configured with the C<rsaref> or C<-DRSA_NULL> | ||
39 | options. RSA_PKCS1_SSLeay() returns a pointer to that method. | ||
40 | |||
41 | RSA_PKCS1_RSAref() returns a pointer to a method that uses the RSAref | ||
42 | library. This is the default method in the C<rsaref> configuration; | ||
43 | the function is not available in other configurations. | ||
44 | RSA_null_method() returns a pointer to a method that does not support | ||
45 | 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 | patent on the RSA cryptosystem. | ||
48 | |||
49 | RSA_set_default_method() makes B<meth> the default method for all B<RSA> | ||
50 | structures created later. | ||
51 | |||
52 | RSA_get_default_method() returns a pointer to the current default | ||
53 | method. | ||
54 | |||
55 | RSA_set_method() selects B<meth> for all operations using the key | ||
56 | B<rsa>. | ||
57 | |||
58 | RSA_get_method() returns a pointer to the method currently selected | ||
59 | for B<rsa>. | ||
60 | |||
61 | RSA_flags() returns the B<flags> that are set for B<rsa>'s current method. | ||
62 | |||
63 | RSA_new_method() allocates and initializes an B<RSA> structure so that | ||
64 | B<method> will be used for the RSA operations. If B<method> is B<NULL>, | ||
65 | the default method is used. | ||
66 | |||
67 | =head1 THE RSA_METHOD STRUCTURE | ||
68 | |||
69 | typedef struct rsa_meth_st | ||
70 | { | ||
71 | /* name of the implementation */ | ||
72 | const char *name; | ||
73 | |||
74 | /* encrypt */ | ||
75 | int (*rsa_pub_enc)(int flen, unsigned char *from, | ||
76 | unsigned char *to, RSA *rsa, int padding); | ||
77 | |||
78 | /* verify arbitrary data */ | ||
79 | int (*rsa_pub_dec)(int flen, unsigned char *from, | ||
80 | unsigned char *to, RSA *rsa, int padding); | ||
81 | |||
82 | /* sign arbitrary data */ | ||
83 | int (*rsa_priv_enc)(int flen, unsigned char *from, | ||
84 | unsigned char *to, RSA *rsa, int padding); | ||
85 | |||
86 | /* decrypt */ | ||
87 | int (*rsa_priv_dec)(int flen, unsigned char *from, | ||
88 | unsigned char *to, RSA *rsa, int padding); | ||
89 | |||
90 | /* compute r0 = r0 ^ I mod rsa->n. May be NULL */ | ||
91 | int (*rsa_mod_exp)(BIGNUM *r0, BIGNUM *I, RSA *rsa); | ||
92 | |||
93 | /* compute r = a ^ p mod m. May be NULL */ | ||
94 | int (*bn_mod_exp)(BIGNUM *r, BIGNUM *a, const BIGNUM *p, | ||
95 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | ||
96 | |||
97 | /* called at RSA_new */ | ||
98 | int (*init)(RSA *rsa); | ||
99 | |||
100 | /* called at RSA_free */ | ||
101 | int (*finish)(RSA *rsa); | ||
102 | |||
103 | /* RSA_FLAG_EXT_PKEY - rsa_mod_exp is called for private key | ||
104 | * operations, even if p,q,dmp1,dmq1,iqmp | ||
105 | * are NULL | ||
106 | * RSA_FLAG_SIGN_VER - enable rsa_sign and rsa_verify | ||
107 | * RSA_METHOD_FLAG_NO_CHECK - don't check pub/private match | ||
108 | */ | ||
109 | int flags; | ||
110 | |||
111 | char *app_data; /* ?? */ | ||
112 | |||
113 | /* sign. For backward compatibility, this is used only | ||
114 | * if (flags & RSA_FLAG_SIGN_VER) | ||
115 | */ | ||
116 | int (*rsa_sign)(int type, unsigned char *m, unsigned int m_len, | ||
117 | unsigned char *sigret, unsigned int *siglen, RSA *rsa); | ||
118 | |||
119 | /* verify. For backward compatibility, this is used only | ||
120 | * if (flags & RSA_FLAG_SIGN_VER) | ||
121 | */ | ||
122 | int (*rsa_verify)(int type, unsigned char *m, unsigned int m_len, | ||
123 | unsigned char *sigbuf, unsigned int siglen, RSA *rsa); | ||
124 | |||
125 | } RSA_METHOD; | ||
126 | |||
127 | =head1 RETURN VALUES | ||
128 | |||
129 | RSA_PKCS1_SSLeay(), RSA_PKCS1_RSAref(), RSA_PKCS1_null_method(), | ||
130 | RSA_get_default_method() and RSA_get_method() return pointers to the | ||
131 | respective B<RSA_METHOD>s. | ||
132 | |||
133 | RSA_set_default_method() returns no value. | ||
134 | |||
135 | RSA_set_method() returns a pointer to the B<RSA_METHOD> previously | ||
136 | associated with B<rsa>. | ||
137 | |||
138 | RSA_new_method() returns B<NULL> and sets an error code that can be | ||
139 | obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation fails. Otherwise it | ||
140 | returns a pointer to the newly allocated structure. | ||
141 | |||
142 | =head1 SEE ALSO | ||
143 | |||
144 | L<rsa(3)|rsa(3)>, L<RSA_new(3)|RSA_new(3)> | ||
145 | |||
146 | =head1 HISTORY | ||
147 | |||
148 | RSA_new_method() and RSA_set_default_method() appeared in SSLeay 0.8. | ||
149 | RSA_get_default_method(), RSA_set_method() and RSA_get_method() as | ||
150 | well as the rsa_sign and rsa_verify components of RSA_METHOD were | ||
151 | added in OpenSSL 0.9.4. | ||
152 | |||
153 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/RSA_sign.pod b/src/lib/libssl/src/doc/crypto/RSA_sign.pod new file mode 100644 index 0000000000..f0bf6eea1b --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/RSA_sign.pod | |||
@@ -0,0 +1,62 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | RSA_sign, RSA_verify - RSA signatures | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/rsa.h> | ||
10 | |||
11 | int RSA_sign(int type, unsigned char *m, unsigned int m_len, | ||
12 | unsigned char *sigret, unsigned int *siglen, RSA *rsa); | ||
13 | |||
14 | int RSA_verify(int type, unsigned char *m, unsigned int m_len, | ||
15 | unsigned char *sigbuf, unsigned int siglen, RSA *rsa); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | RSA_sign() signs the message digest B<m> of size B<m_len> using the | ||
20 | private key B<rsa> as specified in PKCS #1 v2.0. It stores the | ||
21 | signature in B<sigret> and the signature size in B<siglen>. B<sigret> | ||
22 | must point to RSA_size(B<rsa>) bytes of memory. | ||
23 | |||
24 | B<type> denotes the message digest algorithm that was used to generate | ||
25 | B<m>. It usually is one of B<NID_sha1>, B<NID_ripemd160> and B<NID_md5>; | ||
26 | see L<objects(3)|objects(3)> for details. If B<type> is B<NID_md5_sha1>, | ||
27 | an SSL signature (MD5 and SHA1 message digests with PKCS #1 padding | ||
28 | and no algorithm identifier) is created. | ||
29 | |||
30 | RSA_verify() verifies that the signature B<sigbuf> of size B<siglen> | ||
31 | matches a given message digest B<m> of size B<m_len>. B<type> denotes | ||
32 | the message digest algorithm that was used to generate the signature. | ||
33 | B<rsa> is the signer's public key. | ||
34 | |||
35 | =head1 RETURN VALUES | ||
36 | |||
37 | RSA_sign() returns 1 on success, 0 otherwise. RSA_verify() returns 1 | ||
38 | on successful verification, 0 otherwise. | ||
39 | |||
40 | The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
41 | |||
42 | =head1 BUGS | ||
43 | |||
44 | Certain signatures with an improper algorithm identifier are accepted | ||
45 | for compatibility with SSLeay 0.4.5 :-) | ||
46 | |||
47 | =head1 CONFORMING TO | ||
48 | |||
49 | SSL, PKCS #1 v2.0 | ||
50 | |||
51 | =head1 SEE ALSO | ||
52 | |||
53 | L<err(3)|err(3)>, L<objects(3)|objects(3)>, L<rsa(3)|rsa(3)>, | ||
54 | L<RSA_private_encrypt(3)|RSA_private_encrypt(3)>, | ||
55 | L<RSA_public_decrypt(3)|RSA_public_decrypt(3)> | ||
56 | |||
57 | =head1 HISTORY | ||
58 | |||
59 | RSA_sign() and RSA_verify() are available in all versions of SSLeay | ||
60 | and OpenSSL. | ||
61 | |||
62 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/RSA_sign_ASN1_OCTET_STRING.pod b/src/lib/libssl/src/doc/crypto/RSA_sign_ASN1_OCTET_STRING.pod new file mode 100644 index 0000000000..df9ceb339a --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/RSA_sign_ASN1_OCTET_STRING.pod | |||
@@ -0,0 +1,59 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | RSA_sign_ASN1_OCTET_STRING, RSA_verify_ASN1_OCTET_STRING - RSA signatures | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/rsa.h> | ||
10 | |||
11 | int RSA_sign_ASN1_OCTET_STRING(int dummy, unsigned char *m, | ||
12 | unsigned int m_len, unsigned char *sigret, unsigned int *siglen, | ||
13 | RSA *rsa); | ||
14 | |||
15 | int RSA_verify_ASN1_OCTET_STRING(int dummy, unsigned char *m, | ||
16 | unsigned int m_len, unsigned char *sigbuf, unsigned int siglen, | ||
17 | RSA *rsa); | ||
18 | |||
19 | =head1 DESCRIPTION | ||
20 | |||
21 | RSA_sign_ASN1_OCTET_STRING() signs the octet string B<m> of size | ||
22 | B<m_len> using the private key B<rsa> represented in DER using PKCS #1 | ||
23 | padding. It stores the signature in B<sigret> and the signature size | ||
24 | in B<siglen>. B<sigret> must point to B<RSA_size(rsa)> bytes of | ||
25 | memory. | ||
26 | |||
27 | B<dummy> is ignored. | ||
28 | |||
29 | The random number generator must be seeded prior to calling RSA_sign_ASN1_OCTET_STRING(). | ||
30 | |||
31 | RSA_verify_ASN1_OCTET_STRING() verifies that the signature B<sigbuf> | ||
32 | of size B<siglen> is the DER representation of a given octet string | ||
33 | B<m> of size B<m_len>. B<dummy> is ignored. B<rsa> is the signer's | ||
34 | public key. | ||
35 | |||
36 | =head1 RETURN VALUES | ||
37 | |||
38 | RSA_sign_ASN1_OCTET_STRING() returns 1 on success, 0 otherwise. | ||
39 | RSA_verify_ASN1_OCTET_STRING() returns 1 on successful verification, 0 | ||
40 | otherwise. | ||
41 | |||
42 | The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
43 | |||
44 | =head1 BUGS | ||
45 | |||
46 | These functions serve no recognizable purpose. | ||
47 | |||
48 | =head1 SEE ALSO | ||
49 | |||
50 | L<err(3)|err(3)>, L<objects(3)|objects(3)>, L<rand(3)|rand(3)>, | ||
51 | L<rsa(3)|rsa(3)>, L<RSA_sign(3)|RSA_sign(3)>, | ||
52 | L<RSA_verify(3)|RSA_verify(3)> | ||
53 | |||
54 | =head1 HISTORY | ||
55 | |||
56 | RSA_sign_ASN1_OCTET_STRING() and RSA_verify_ASN1_OCTET_STRING() were | ||
57 | added in SSLeay 0.8. | ||
58 | |||
59 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/RSA_size.pod b/src/lib/libssl/src/doc/crypto/RSA_size.pod new file mode 100644 index 0000000000..b36b4d58d5 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/RSA_size.pod | |||
@@ -0,0 +1,33 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | RSA_size - get RSA modulus size | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/rsa.h> | ||
10 | |||
11 | int RSA_size(RSA *rsa); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | This function returns the RSA modulus size in bytes. It can be used to | ||
16 | determine how much memory must be allocated for an RSA encrypted | ||
17 | value. | ||
18 | |||
19 | B<rsa-E<gt>n> must not be B<NULL>. | ||
20 | |||
21 | =head1 RETURN VALUE | ||
22 | |||
23 | The size in bytes. | ||
24 | |||
25 | =head1 SEE ALSO | ||
26 | |||
27 | L<rsa(3)|rsa(3)> | ||
28 | |||
29 | =head1 HISTORY | ||
30 | |||
31 | RSA_size() is available in all versions of SSLeay and OpenSSL. | ||
32 | |||
33 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/blowfish.pod b/src/lib/libssl/src/doc/crypto/blowfish.pod new file mode 100644 index 0000000000..e8c7114311 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/blowfish.pod | |||
@@ -0,0 +1,106 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | blowfish, BF_set_key, BF_encrypt, BF_decrypt, BF_ecb_encrypt, BF_cbc_encrypt, | ||
6 | BF_cfb64_encrypt, BF_ofb64_encrypt, BF_options - Blowfish encryption | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/blowfish.h> | ||
11 | |||
12 | void BF_set_key(BF_KEY *key, int len, const unsigned char *data); | ||
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, | ||
18 | BF_KEY *key, int enc); | ||
19 | void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, | ||
20 | long length, BF_KEY *schedule, unsigned char *ivec, int enc); | ||
21 | void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, | ||
22 | long length, BF_KEY *schedule, unsigned char *ivec, int *num, | ||
23 | int enc); | ||
24 | void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, | ||
25 | long length, BF_KEY *schedule, unsigned char *ivec, int *num); | ||
26 | const char *BF_options(void); | ||
27 | |||
28 | =head1 DESCRIPTION | ||
29 | |||
30 | This library implements the Blowfish cipher, which is invented and described | ||
31 | by Counterpane (see http://www.counterpane.com/blowfish/ ). | ||
32 | |||
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 | ||
35 | a considered good for strong encryption. Blowfish can be used in the same | ||
36 | modes as DES (see L<des_modes(7)|des_modes(7)>). Blowfish is currently one | ||
37 | of the faster block ciphers. It is quite a bit faster than DES, and much | ||
38 | faster than IDEA or RC2. | ||
39 | |||
40 | Blowfish consists of a key setup phase and the actual encryption or decryption | ||
41 | phase. | ||
42 | |||
43 | BF_set_key() sets up the B<BF_KEY> B<key> using the B<len> bytes long key | ||
44 | at B<data>. | ||
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. | ||
52 | 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>) | ||
54 | or decryption (B<BF_DECRYPT>) shall be performed. The vector pointed at by | ||
55 | 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. | ||
57 | |||
58 | 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 | ||
60 | B<ivec> which must be initially filled with zeros, but then just need to be | ||
61 | passed along into the next call of the same function for the same message. | ||
62 | BF_cbc_encrypt() operates of data that is a multiple of 8 bytes long, while | ||
63 | BF_cfb64_encrypt() and BF_ofb64_encrypt() are used to encrypt an variable | ||
64 | number of bytes (the amount does not have to be an exact multiple of 8). The | ||
65 | purpose of the latter two is to simulate stream ciphers, and therefore, they | ||
66 | need the parameter B<num>, which is a pointer to an integer where the current | ||
67 | offset in B<ivec> is stored between calls. This integer must be initialised | ||
68 | to zero when B<ivec> is filled with zeros. | ||
69 | |||
70 | BF_cbc_encrypt() is the Cipher Block Chaining function for Blowfish. It | ||
71 | encrypts or decrypts the 64 bits chunks of B<in> using the key B<schedule>, | ||
72 | putting the result in B<out>. B<enc> decides if encryption (BF_ENCRYPT) or | ||
73 | decryption (BF_DECRYPT) shall be performed. B<ivec> must point at an 8 byte | ||
74 | long initialisation vector, which must be initially filled with zeros. | ||
75 | |||
76 | BF_cfb64_encrypt() is the CFB mode for Blowfish with 64 bit feedback. | ||
77 | It encrypts or decrypts the bytes in B<in> using the key B<schedule>, | ||
78 | putting the result in B<out>. B<enc> decides if encryption (B<BF_ENCRYPT>) | ||
79 | or decryption (B<BF_DECRYPT>) shall be performed. B<ivec> must point at an | ||
80 | 8 byte long initialisation vector, which must be initially filled with zeros. | ||
81 | B<num> must point at an integer which must be initially zero. | ||
82 | |||
83 | BF_ofb64_encrypt() is the OFB mode for Blowfish with 64 bit feedback. | ||
84 | It uses the same parameters as BF_cfb64_encrypt(), which must be initialised | ||
85 | the same way. | ||
86 | |||
87 | =head1 RETURN VALUES | ||
88 | |||
89 | None of the functions presented here return any value. | ||
90 | |||
91 | =head1 NOTE | ||
92 | |||
93 | Applications should use the higher level functions | ||
94 | L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> etc. instead of calling the | ||
95 | blowfish functions directly. | ||
96 | |||
97 | =head1 SEE ALSO | ||
98 | |||
99 | L<des_modes(7)|des_modes(7)> | ||
100 | |||
101 | =head1 HISTORY | ||
102 | |||
103 | The Blowfish functions are available in all versions of SSLeay and OpenSSL. | ||
104 | |||
105 | =cut | ||
106 | |||
diff --git a/src/lib/libssl/src/doc/crypto/bn.pod b/src/lib/libssl/src/doc/crypto/bn.pod new file mode 100644 index 0000000000..1504a1c92d --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/bn.pod | |||
@@ -0,0 +1,148 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | bn - multiprecision integer arithmetics | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bn.h> | ||
10 | |||
11 | BIGNUM *BN_new(void); | ||
12 | void BN_free(BIGNUM *a); | ||
13 | void BN_init(BIGNUM *); | ||
14 | void BN_clear(BIGNUM *a); | ||
15 | void BN_clear_free(BIGNUM *a); | ||
16 | |||
17 | BN_CTX *BN_CTX_new(void); | ||
18 | void BN_CTX_init(BN_CTX *c); | ||
19 | void BN_CTX_free(BN_CTX *c); | ||
20 | |||
21 | BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b); | ||
22 | BIGNUM *BN_dup(const BIGNUM *a); | ||
23 | |||
24 | int BN_num_bytes(const BIGNUM *a); | ||
25 | int BN_num_bits(const BIGNUM *a); | ||
26 | int BN_num_bits_word(BN_ULONG w); | ||
27 | |||
28 | int BN_add(BIGNUM *r, BIGNUM *a, BIGNUM *b); | ||
29 | int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); | ||
30 | int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); | ||
31 | int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *a, const BIGNUM *d, | ||
32 | BN_CTX *ctx); | ||
33 | int BN_sqr(BIGNUM *r, BIGNUM *a, BN_CTX *ctx); | ||
34 | int BN_mod(BIGNUM *rem, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); | ||
35 | int BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, | ||
36 | BN_CTX *ctx); | ||
37 | int BN_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BN_CTX *ctx); | ||
38 | int BN_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p, | ||
39 | const BIGNUM *m, BN_CTX *ctx); | ||
40 | int BN_gcd(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); | ||
41 | |||
42 | int BN_add_word(BIGNUM *a, BN_ULONG w); | ||
43 | int BN_sub_word(BIGNUM *a, BN_ULONG w); | ||
44 | int BN_mul_word(BIGNUM *a, BN_ULONG w); | ||
45 | BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); | ||
46 | BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w); | ||
47 | |||
48 | int BN_cmp(BIGNUM *a, BIGNUM *b); | ||
49 | int BN_ucmp(BIGNUM *a, BIGNUM *b); | ||
50 | int BN_is_zero(BIGNUM *a); | ||
51 | int BN_is_one(BIGNUM *a); | ||
52 | int BN_is_word(BIGNUM *a, BN_ULONG w); | ||
53 | int BN_is_odd(BIGNUM *a); | ||
54 | |||
55 | int BN_zero(BIGNUM *a); | ||
56 | int BN_one(BIGNUM *a); | ||
57 | BIGNUM *BN_value_one(void); | ||
58 | int BN_set_word(BIGNUM *a, unsigned long w); | ||
59 | unsigned long BN_get_word(BIGNUM *a); | ||
60 | |||
61 | int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); | ||
62 | int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom); | ||
63 | |||
64 | BIGNUM *BN_generate_prime(BIGNUM *ret, int bits,int safe, BIGNUM *add, | ||
65 | BIGNUM *rem, void (*callback)(int, int, void *), void *cb_arg); | ||
66 | int BN_is_prime(const BIGNUM *p, int nchecks, | ||
67 | void (*callback)(int, int, void *), BN_CTX *ctx, void *cb_arg); | ||
68 | |||
69 | int BN_set_bit(BIGNUM *a, int n); | ||
70 | int BN_clear_bit(BIGNUM *a, int n); | ||
71 | int BN_is_bit_set(const BIGNUM *a, int n); | ||
72 | int BN_mask_bits(BIGNUM *a, int n); | ||
73 | int BN_lshift(BIGNUM *r, const BIGNUM *a, int n); | ||
74 | int BN_lshift1(BIGNUM *r, BIGNUM *a); | ||
75 | int BN_rshift(BIGNUM *r, BIGNUM *a, int n); | ||
76 | int BN_rshift1(BIGNUM *r, BIGNUM *a); | ||
77 | |||
78 | int BN_bn2bin(const BIGNUM *a, unsigned char *to); | ||
79 | BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret); | ||
80 | char *BN_bn2hex(const BIGNUM *a); | ||
81 | char *BN_bn2dec(const BIGNUM *a); | ||
82 | int BN_hex2bn(BIGNUM **a, const char *str); | ||
83 | int BN_dec2bn(BIGNUM **a, const char *str); | ||
84 | int BN_print(BIO *fp, const BIGNUM *a); | ||
85 | int BN_print_fp(FILE *fp, const BIGNUM *a); | ||
86 | int BN_bn2mpi(const BIGNUM *a, unsigned char *to); | ||
87 | BIGNUM *BN_mpi2bn(unsigned char *s, int len, BIGNUM *ret); | ||
88 | |||
89 | BIGNUM *BN_mod_inverse(BIGNUM *r, BIGNUM *a, const BIGNUM *n, | ||
90 | BN_CTX *ctx); | ||
91 | |||
92 | BN_RECP_CTX *BN_RECP_CTX_new(void); | ||
93 | void BN_RECP_CTX_init(BN_RECP_CTX *recp); | ||
94 | void BN_RECP_CTX_free(BN_RECP_CTX *recp); | ||
95 | int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *m, BN_CTX *ctx); | ||
96 | int BN_mod_mul_reciprocal(BIGNUM *r, BIGNUM *a, BIGNUM *b, | ||
97 | BN_RECP_CTX *recp, BN_CTX *ctx); | ||
98 | |||
99 | BN_MONT_CTX *BN_MONT_CTX_new(void); | ||
100 | void BN_MONT_CTX_init(BN_MONT_CTX *ctx); | ||
101 | void BN_MONT_CTX_free(BN_MONT_CTX *mont); | ||
102 | int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *m, BN_CTX *ctx); | ||
103 | BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from); | ||
104 | int BN_mod_mul_montgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b, | ||
105 | BN_MONT_CTX *mont, BN_CTX *ctx); | ||
106 | int BN_from_montgomery(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mont, | ||
107 | BN_CTX *ctx); | ||
108 | int BN_to_montgomery(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mont, | ||
109 | BN_CTX *ctx); | ||
110 | |||
111 | |||
112 | =head1 DESCRIPTION | ||
113 | |||
114 | This library performs arithmetic operations on integers of arbitrary | ||
115 | size. It was written for use in public key cryptography, such as RSA | ||
116 | and Diffie-Hellman. | ||
117 | |||
118 | It uses dynamic memory allocation for storing its data structures. | ||
119 | That means that there is no limit on the size of the numbers | ||
120 | manipulated by these functions, but return values must always be | ||
121 | checked in case a memory allocation error has occurred. | ||
122 | |||
123 | The basic object in this library is a B<BIGNUM>. It is used to hold a | ||
124 | single large integer. This type should be considered opaque and fields | ||
125 | should not be modified or accessed directly. | ||
126 | |||
127 | The creation of B<BIGNUM> objects is described in L<BN_new(3)|BN_new(3)>; | ||
128 | L<BN_add(3)|BN_add(3)> describes most of the arithmetic operations. | ||
129 | Comparison is described in L<BN_cmp(3)|BN_cmp(3)>; L<BN_zero(3)|BN_zero(3)> | ||
130 | describes certain assignments, L<BN_rand(3)|BN_rand(3)> the generation of | ||
131 | random numbers, L<BN_generate_prime(3)|BN_generate_prime(3)> deals with prime | ||
132 | numbers and L<BN_set_bit(3)|BN_set_bit(3)> with bit operations. The conversion | ||
133 | of B<BIGNUM>s to external formats is described in L<BN_bn2bin(3)|BN_bn2bin(3)>. | ||
134 | |||
135 | =head1 SEE ALSO | ||
136 | |||
137 | L<bn_internal(3)|bn_internal(3)>, | ||
138 | L<dh(3)|dh(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>, L<rsa(3)|rsa(3)>, | ||
139 | L<BN_new(3)|BN_new(3)>, L<BN_CTX_new(3)|BN_CTX_new(3)>, | ||
140 | L<BN_copy(3)|BN_copy(3)>, L<BN_num_bytes(3)|BN_num_bytes(3)>, | ||
141 | L<BN_add(3)|BN_add(3)>, L<BN_add_word(3)|BN_add_word(3)>, | ||
142 | L<BN_cmp(3)|BN_cmp(3)>, L<BN_zero(3)|BN_zero(3)>, L<BN_rand(3)|BN_rand(3)>, | ||
143 | L<BN_generate_prime(3)|BN_generate_prime(3)>, L<BN_set_bit(3)|BN_set_bit(3)>, | ||
144 | L<BN_bn2bin(3)|BN_bn2bin(3)>, L<BN_mod_inverse(3)|BN_mod_inverse(3)>, | ||
145 | L<BN_mod_mul_reciprocal(3)|BN_mod_mul_reciprocal(3)>, | ||
146 | L<BN_mod_mul_montgomery(3)|BN_mod_mul_montgomery(3)> | ||
147 | |||
148 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/bn_internal.pod b/src/lib/libssl/src/doc/crypto/bn_internal.pod new file mode 100644 index 0000000000..5af0c791c8 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/bn_internal.pod | |||
@@ -0,0 +1,225 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | bn_mul_words, bn_mul_add_words, bn_sqr_words, bn_div_words, | ||
6 | bn_add_words, bn_sub_words, bn_mul_comba4, bn_mul_comba8, | ||
7 | bn_sqr_comba4, bn_sqr_comba8, bn_cmp_words, bn_mul_normal, | ||
8 | bn_mul_low_normal, bn_mul_recursive, bn_mul_part_recursive, | ||
9 | bn_mul_low_recursive, bn_mul_high, bn_sqr_normal, bn_sqr_recursive, | ||
10 | bn_expand, bn_wexpand, bn_expand2, bn_fix_top, bn_check_top, | ||
11 | bn_print, bn_dump, bn_set_max, bn_set_high, bn_set_low - BIGNUM | ||
12 | library internal functions | ||
13 | |||
14 | =head1 SYNOPSIS | ||
15 | |||
16 | BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w); | ||
17 | BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, | ||
18 | BN_ULONG w); | ||
19 | void bn_sqr_words(BN_ULONG *rp, BN_ULONG *ap, int num); | ||
20 | BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d); | ||
21 | BN_ULONG bn_add_words(BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp, | ||
22 | int num); | ||
23 | BN_ULONG bn_sub_words(BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp, | ||
24 | int num); | ||
25 | |||
26 | void bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b); | ||
27 | void bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b); | ||
28 | void bn_sqr_comba4(BN_ULONG *r, BN_ULONG *a); | ||
29 | void bn_sqr_comba8(BN_ULONG *r, BN_ULONG *a); | ||
30 | |||
31 | int bn_cmp_words(BN_ULONG *a, BN_ULONG *b, int n); | ||
32 | |||
33 | void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, | ||
34 | int nb); | ||
35 | void bn_mul_low_normal(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n); | ||
36 | void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2, | ||
37 | BN_ULONG *tmp); | ||
38 | void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, | ||
39 | int tn, int n, BN_ULONG *tmp); | ||
40 | void bn_mul_low_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, | ||
41 | int n2, BN_ULONG *tmp); | ||
42 | void bn_mul_high(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, BN_ULONG *l, | ||
43 | int n2, BN_ULONG *tmp); | ||
44 | |||
45 | void bn_sqr_normal(BN_ULONG *r, BN_ULONG *a, int n, BN_ULONG *tmp); | ||
46 | void bn_sqr_recursive(BN_ULONG *r, BN_ULONG *a, int n2, BN_ULONG *tmp); | ||
47 | |||
48 | void mul(BN_ULONG r, BN_ULONG a, BN_ULONG w, BN_ULONG c); | ||
49 | void mul_add(BN_ULONG r, BN_ULONG a, BN_ULONG w, BN_ULONG c); | ||
50 | void sqr(BN_ULONG r0, BN_ULONG r1, BN_ULONG a); | ||
51 | |||
52 | BIGNUM *bn_expand(BIGNUM *a, int bits); | ||
53 | BIGNUM *bn_wexpand(BIGNUM *a, int n); | ||
54 | BIGNUM *bn_expand2(BIGNUM *a, int n); | ||
55 | void bn_fix_top(BIGNUM *a); | ||
56 | |||
57 | void bn_check_top(BIGNUM *a); | ||
58 | void bn_print(BIGNUM *a); | ||
59 | void bn_dump(BN_ULONG *d, int n); | ||
60 | void bn_set_max(BIGNUM *a); | ||
61 | void bn_set_high(BIGNUM *r, BIGNUM *a, int n); | ||
62 | void bn_set_low(BIGNUM *r, BIGNUM *a, int n); | ||
63 | |||
64 | =head1 DESCRIPTION | ||
65 | |||
66 | This page documents the internal functions used by the OpenSSL | ||
67 | B<BIGNUM> implementation. They are described here to facilitate | ||
68 | debugging and extending the library. They are I<not> to be used by | ||
69 | applications. | ||
70 | |||
71 | =head2 The BIGNUM structure | ||
72 | |||
73 | typedef struct bignum_st | ||
74 | { | ||
75 | int top; /* index of last used d (most significant word) */ | ||
76 | BN_ULONG *d; /* pointer to an array of 'BITS2' bit chunks */ | ||
77 | int max; /* size of the d array */ | ||
78 | int neg; /* sign */ | ||
79 | } BIGNUM; | ||
80 | |||
81 | The big number is stored in B<d>, a malloc()ed array of B<BN_ULONG>s, | ||
82 | least significant first. A B<BN_ULONG> can be either 16, 32 or 64 bits | ||
83 | in size (B<BITS2>), depending on the 'number of bits' specified in | ||
84 | C<openssl/bn.h>. | ||
85 | |||
86 | B<max> is the size of the B<d> array that has been allocated. B<top> | ||
87 | is the 'last' entry being used, so for a value of 4, bn.d[0]=4 and | ||
88 | bn.top=1. B<neg> is 1 if the number is negative. When a B<BIGNUM> is | ||
89 | B<0>, the B<d> field can be B<NULL> and B<top> == B<0>. | ||
90 | |||
91 | Various routines in this library require the use of temporary | ||
92 | B<BIGNUM> variables during their execution. Since dynamic memory | ||
93 | allocation to create B<BIGNUM>s is rather expensive when used in | ||
94 | conjunction with repeated subroutine calls, the B<BN_CTX> structure is | ||
95 | used. This structure contains B<BN_CTX_NUM> B<BIGNUM>s, see | ||
96 | L<BN_CTX_start(3)|BN_CTX_start(3)>. | ||
97 | |||
98 | =head2 Low-level arithmetic operations | ||
99 | |||
100 | These functions are implemented in C and for several platforms in | ||
101 | assembly language: | ||
102 | |||
103 | bn_mul_words(B<rp>, B<ap>, B<num>, B<w>) operates on the B<num> word | ||
104 | arrays B<rp> and B<ap>. It computes B<ap> * B<w>, places the result | ||
105 | in B<rp>, and returns the high word (carry). | ||
106 | |||
107 | bn_mul_add_words(B<rp>, B<ap>, B<num>, B<w>) operates on the B<num> | ||
108 | word arrays B<rp> and B<ap>. It computes B<ap> * B<w> + B<rp>, places | ||
109 | the result in B<rp>, and returns the high word (carry). | ||
110 | |||
111 | bn_sqr_words(B<rp>, B<ap>, B<n>) operates on the B<num> word array | ||
112 | B<ap> and the 2*B<num> word array B<ap>. It computes B<ap> * B<ap> | ||
113 | word-wise, and places the low and high bytes of the result in B<rp>. | ||
114 | |||
115 | bn_div_words(B<h>, B<l>, B<d>) divides the two word number (B<h>,B<l>) | ||
116 | by B<d> and returns the result. | ||
117 | |||
118 | bn_add_words(B<rp>, B<ap>, B<bp>, B<num>) operates on the B<num> word | ||
119 | arrays B<ap>, B<bp> and B<rp>. It computes B<ap> + B<bp>, places the | ||
120 | result in B<rp>, and returns the high word (carry). | ||
121 | |||
122 | bn_sub_words(B<rp>, B<ap>, B<bp>, B<num>) operates on the B<num> word | ||
123 | arrays B<ap>, B<bp> and B<rp>. It computes B<ap> - B<bp>, places the | ||
124 | result in B<rp>, and returns the carry (1 if B<bp> E<gt> B<ap>, 0 | ||
125 | otherwise). | ||
126 | |||
127 | bn_mul_comba4(B<r>, B<a>, B<b>) operates on the 4 word arrays B<a> and | ||
128 | B<b> and the 8 word array B<r>. It computes B<a>*B<b> and places the | ||
129 | result in B<r>. | ||
130 | |||
131 | bn_mul_comba8(B<r>, B<a>, B<b>) operates on the 8 word arrays B<a> and | ||
132 | B<b> and the 16 word array B<r>. It computes B<a>*B<b> and places the | ||
133 | result in B<r>. | ||
134 | |||
135 | bn_sqr_comba4(B<r>, B<a>, B<b>) operates on the 4 word arrays B<a> and | ||
136 | B<b> and the 8 word array B<r>. | ||
137 | |||
138 | bn_sqr_comba8(B<r>, B<a>, B<b>) operates on the 8 word arrays B<a> and | ||
139 | B<b> and the 16 word array B<r>. | ||
140 | |||
141 | The following functions are implemented in C: | ||
142 | |||
143 | bn_cmp_words(B<a>, B<b>, B<n>) operates on the B<n> word arrays B<a> | ||
144 | and B<b>. It returns 1, 0 and -1 if B<a> is greater than, equal and | ||
145 | less than B<b>. | ||
146 | |||
147 | bn_mul_normal(B<r>, B<a>, B<na>, B<b>, B<nb>) operates on the B<na> | ||
148 | 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>. | ||
150 | |||
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 | ||
153 | B<a>*B<b> and places the result in B<r>. | ||
154 | |||
155 | bn_mul_recursive(B<r>, B<a>, B<b>, B<n2>, B<t>) operates on the B<n2> | ||
156 | word arrays B<a> and B<b> and the 2*B<n2> word arrays B<r> and B<t>. | ||
157 | B<n2> must be a power of 2. It computes B<a>*B<b> and places the | ||
158 | result in B<r>. | ||
159 | |||
160 | bn_mul_part_recursive(B<r>, B<a>, B<b>, B<tn>, B<n>, B<tmp>) operates | ||
161 | on the B<n>+B<tn> word arrays B<a> and B<b> and the 4*B<n> word arrays | ||
162 | B<r> and B<tmp>. | ||
163 | |||
164 | bn_mul_low_recursive(B<r>, B<a>, B<b>, B<n2>, B<tmp>) operates on the | ||
165 | B<n2> word arrays B<r> and B<tmp> and the B<n2>/2 word arrays B<a> | ||
166 | and B<b>. | ||
167 | |||
168 | bn_mul_high(B<r>, B<a>, B<b>, B<l>, B<n2>, B<tmp>) operates on the | ||
169 | B<n2> word arrays B<r>, B<a>, B<b> and B<l> (?) and the 3*B<n2> word | ||
170 | array B<tmp>. | ||
171 | |||
172 | BN_mul() calls bn_mul_normal(), or an optimized implementation if the | ||
173 | factors have the same size: bn_mul_comba8() is used if they are 8 | ||
174 | words long, bn_mul_recursive() if they are larger than | ||
175 | B<BN_MULL_SIZE_NORMAL> and the size is an exact multiple of the word | ||
176 | size, and bn_mul_part_recursive() for others that are larger than | ||
177 | B<BN_MULL_SIZE_NORMAL>. | ||
178 | |||
179 | bn_sqr_normal(B<r>, B<a>, B<n>, B<tmp>) operates on the B<n> word array | ||
180 | B<a> and the 2*B<n> word arrays B<tmp> and B<r>. | ||
181 | |||
182 | The implementations use the following macros which, depending on the | ||
183 | architecture, may use "long long" C operations or inline assembler. | ||
184 | They are defined in C<bn_lcl.h>. | ||
185 | |||
186 | mul(B<r>, B<a>, B<w>, B<c>) computes B<w>*B<a>+B<c> and places the | ||
187 | low word of the result in B<r> and the high word in B<c>. | ||
188 | |||
189 | mul_add(B<r>, B<a>, B<w>, B<c>) computes B<w>*B<a>+B<r>+B<c> and | ||
190 | places the low word of the result in B<r> and the high word in B<c>. | ||
191 | |||
192 | sqr(B<r0>, B<r1>, B<a>) computes B<a>*B<a> and places the low word | ||
193 | of the result in B<r0> and the high word in B<r1>. | ||
194 | |||
195 | =head2 Size changes | ||
196 | |||
197 | bn_expand() ensures that B<b> has enough space for a B<bits> bit | ||
198 | number. bn_wexpand() ensures that B<b> has enough space for an | ||
199 | B<n> word number. If the number has to be expanded, both macros | ||
200 | call bn_expand2(), which allocates a new B<d> array and copies the | ||
201 | data. They return B<NULL> on error, B<b> otherwise. | ||
202 | |||
203 | The bn_fix_top() macro reduces B<a-E<gt>top> to point to the most | ||
204 | significant non-zero word when B<a> has shrunk. | ||
205 | |||
206 | =head2 Debugging | ||
207 | |||
208 | bn_check_top() verifies that C<((a)-E<gt>top E<gt>= 0 && (a)-E<gt>top | ||
209 | E<lt>= (a)-E<gt>max)>. A violation will cause the program to abort. | ||
210 | |||
211 | bn_print() prints B<a> to stderr. bn_dump() prints B<n> words at B<d> | ||
212 | (in reverse order, i.e. most significant word first) to stderr. | ||
213 | |||
214 | bn_set_max() makes B<a> a static number with a B<max> of its current size. | ||
215 | This is used by bn_set_low() and bn_set_high() to make B<r> a read-only | ||
216 | B<BIGNUM> that contains the B<n> low or high words of B<a>. | ||
217 | |||
218 | If B<BN_DEBUG> is not defined, bn_check_top(), bn_print(), bn_dump() | ||
219 | and bn_set_max() are defined as empty macros. | ||
220 | |||
221 | =head1 SEE ALSO | ||
222 | |||
223 | L<bn(3)|bn(3)> | ||
224 | |||
225 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/buffer.pod b/src/lib/libssl/src/doc/crypto/buffer.pod new file mode 100644 index 0000000000..7088f51bc4 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/buffer.pod | |||
@@ -0,0 +1,73 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BUF_MEM_new, BUF_MEM_free, BUF_MEM_grow, BUF_strdup - simple | ||
6 | character arrays structure | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/buffer.h> | ||
11 | |||
12 | BUF_MEM *BUF_MEM_new(void); | ||
13 | |||
14 | void BUF_MEM_free(BUF_MEM *a); | ||
15 | |||
16 | int BUF_MEM_grow(BUF_MEM *str, int len); | ||
17 | |||
18 | char * BUF_strdup(const char *str); | ||
19 | |||
20 | =head1 DESCRIPTION | ||
21 | |||
22 | The buffer library handles simple character arrays. Buffers are used for | ||
23 | various purposes in the library, most notably memory BIOs. | ||
24 | |||
25 | The library uses the BUF_MEM structure defined in buffer.h: | ||
26 | |||
27 | typedef struct buf_mem_st | ||
28 | { | ||
29 | int length; /* current number of bytes */ | ||
30 | char *data; | ||
31 | int max; /* size of buffer */ | ||
32 | } BUF_MEM; | ||
33 | |||
34 | B<length> is the current size of the buffer in bytes, B<max> is the amount of | ||
35 | memory allocated to the buffer. There are three functions which handle these | ||
36 | and one "miscellaneous" function. | ||
37 | |||
38 | BUF_MEM_new() allocates a new buffer of zero size. | ||
39 | |||
40 | BUF_MEM_free() frees up an already existing buffer. The data is zeroed | ||
41 | before freeing up in case the buffer contains sensitive data. | ||
42 | |||
43 | BUF_MEM_grow() changes the size of an already existing buffer to | ||
44 | B<len>. Any data already in the buffer is preserved if it increases in | ||
45 | size. | ||
46 | |||
47 | BUF_strdup() copies a null terminated string into a block of allocated | ||
48 | memory and returns a pointer to the allocated block. | ||
49 | Unlike the standard C library strdup() this function uses Malloc() and so | ||
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. | ||
52 | |||
53 | The memory allocated from BUF_strdup() should be freed up using the Free() | ||
54 | function. | ||
55 | |||
56 | =head1 RETURN VALUES | ||
57 | |||
58 | BUF_MEM_new() returns the buffer or NULL on error. | ||
59 | |||
60 | BUF_MEM_free() has no return value. | ||
61 | |||
62 | BUF_MEM_grow() returns zero on error or the new size (i.e. B<len>). | ||
63 | |||
64 | =head1 SEE ALSO | ||
65 | |||
66 | L<bio(3)|bio(3)> | ||
67 | |||
68 | =head1 HISTORY | ||
69 | |||
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. | ||
72 | |||
73 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/crypto.pod b/src/lib/libssl/src/doc/crypto/crypto.pod new file mode 100644 index 0000000000..4b9ceacd91 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/crypto.pod | |||
@@ -0,0 +1,67 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | crypto - OpenSSL cryptographic library | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | =head1 DESCRIPTION | ||
10 | |||
11 | The OpenSSL B<crypto> library implements a wide range of cryptographic | ||
12 | algorithms used in various Internet standards. The services provided | ||
13 | by this library are used by the OpenSSL implementations of SSL, TLS | ||
14 | and S/MIME, and they have also been used to implement SSH, OpenPGP, and | ||
15 | other cryptographic standards. | ||
16 | |||
17 | =head1 OVERVIEW | ||
18 | |||
19 | B<libcrypto> consists of a number of sub-libraries that implement the | ||
20 | individual algorithms. | ||
21 | |||
22 | The functionality includes symmetric encryption, public key | ||
23 | cryptography and key agreement, certificate handling, cryptographic | ||
24 | hash functions and a cryptographic pseudo-random number generator. | ||
25 | |||
26 | =over 4 | ||
27 | |||
28 | =item SYMMETRIC CIPHERS | ||
29 | |||
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)> | ||
32 | |||
33 | =item PUBLIC KEY CRYPTOGRAPHY AND KEY AGREEMENT | ||
34 | |||
35 | L<dsa(3)|dsa(3)>, L<dh(3)|dh(3)>, L<rsa(3)|rsa(3)> | ||
36 | |||
37 | =item CERTIFICATES | ||
38 | |||
39 | L<x509(3)|x509(3)>, L<x509v3(3)|x509v3(3)> | ||
40 | |||
41 | =item AUTHENTICATION CODES, HASH FUNCTIONS | ||
42 | |||
43 | L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, | ||
44 | L<ripemd(3)|ripemd(3)>, L<sha(3)|sha(3)> | ||
45 | |||
46 | =item AUXILIARY FUNCTIONS | ||
47 | |||
48 | L<err(3)|err(3)>, L<threads(3)|threads(3)>, L<rand(3)|rand(3)> | ||
49 | |||
50 | =item INPUT/OUTPUT, DATA ENCODING | ||
51 | |||
52 | L<asn1(3)|asn1(3)>, L<bio(3)|bio(3)>, L<evp(3)|evp(3)>, L<pem(3)|pem(3)>, | ||
53 | L<pkcs7(3)|pkcs7(3)>, L<pkcs12(3)|pkcs12(3)> | ||
54 | |||
55 | =item INTERNAL FUNCTIONS | ||
56 | |||
57 | L<bn(3)|bn(3)>, L<buffer(3)|buffer(3)>, L<lhash(3)|lhash(3)>, | ||
58 | L<objects(3)|objects(3)>, L<stack(3)|stack(3)>, | ||
59 | L<txt_db(3)|txt_db(3)> | ||
60 | |||
61 | =back | ||
62 | |||
63 | =head1 SEE ALSO | ||
64 | |||
65 | L<openssl(1)|openssl(1)>, L<ssl(3)|ssl(3)> | ||
66 | |||
67 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/d2i_DHparams.pod b/src/lib/libssl/src/doc/crypto/d2i_DHparams.pod new file mode 100644 index 0000000000..a6d1743d39 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/d2i_DHparams.pod | |||
@@ -0,0 +1,30 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | d2i_DHparams, i2d_DHparams - ... | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dh.h> | ||
10 | |||
11 | DH *d2i_DHparams(DH **a, unsigned char **pp, long length); | ||
12 | int i2d_DHparams(DH *a, unsigned char **pp); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | ... | ||
17 | |||
18 | =head1 RETURN VALUES | ||
19 | |||
20 | ... | ||
21 | |||
22 | =head1 SEE ALSO | ||
23 | |||
24 | ... | ||
25 | |||
26 | =head1 HISTORY | ||
27 | |||
28 | ... | ||
29 | |||
30 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/d2i_RSAPublicKey.pod b/src/lib/libssl/src/doc/crypto/d2i_RSAPublicKey.pod new file mode 100644 index 0000000000..ff4d0d57db --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/d2i_RSAPublicKey.pod | |||
@@ -0,0 +1,39 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | d2i_RSAPublicKey, i2d_RSAPublicKey, d2i_RSAPrivateKey, i2d_RSAPrivateKey, i2d_Netscape_RSA, d2i_Netscape_RSA - ... | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/rsa.h> | ||
10 | |||
11 | RSA * d2i_RSAPublicKey(RSA **a, unsigned char **pp, long length); | ||
12 | |||
13 | int i2d_RSAPublicKey(RSA *a, unsigned char **pp); | ||
14 | |||
15 | RSA * d2i_RSAPrivateKey(RSA **a, unsigned char **pp, long length); | ||
16 | |||
17 | int i2d_RSAPrivateKey(RSA *a, unsigned char **pp); | ||
18 | |||
19 | int i2d_Netscape_RSA(RSA *a, unsigned char **pp, int (*cb)()); | ||
20 | |||
21 | RSA * d2i_Netscape_RSA(RSA **a, unsigned char **pp, long length, int (*cb)()); | ||
22 | |||
23 | =head1 DESCRIPTION | ||
24 | |||
25 | ... | ||
26 | |||
27 | =head1 RETURN VALUES | ||
28 | |||
29 | ... | ||
30 | |||
31 | =head1 SEE ALSO | ||
32 | |||
33 | ... | ||
34 | |||
35 | =head1 HISTORY | ||
36 | |||
37 | ... | ||
38 | |||
39 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/des_modes.pod b/src/lib/libssl/src/doc/crypto/des_modes.pod new file mode 100644 index 0000000000..d8148c86fc --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/des_modes.pod | |||
@@ -0,0 +1,250 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | Modes of DES - the variants of DES and other crypto algorithms of OpenSSL | ||
6 | |||
7 | =head1 DESCRIPTION | ||
8 | |||
9 | Several crypto algorithms fo 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 | ||
11 | other things. | ||
12 | |||
13 | =head1 OVERVIEW | ||
14 | |||
15 | =head2 Electronic Codebook Mode (ECB) | ||
16 | |||
17 | Normally, this is found as the function I<algorithm>_ecb_encrypt(). | ||
18 | |||
19 | =over 2 | ||
20 | |||
21 | =item * | ||
22 | |||
23 | 64 bits are enciphered at a time. | ||
24 | |||
25 | =item * | ||
26 | |||
27 | The order of the blocks can be rearranged without detection. | ||
28 | |||
29 | =item * | ||
30 | |||
31 | The same plaintext block always produces the same ciphertext block | ||
32 | (for the same key) making it vulnerable to a 'dictionary attack'. | ||
33 | |||
34 | =item * | ||
35 | |||
36 | An error will only affect one ciphertext block. | ||
37 | |||
38 | =back | ||
39 | |||
40 | =head2 Cipher Block Chaining Mode (CBC) | ||
41 | |||
42 | Normally, this is found as the function I<algorithm>_cbc_encrypt(). | ||
43 | Be aware that des_cbc_encrypt() is not really DES CBC (it does | ||
44 | not update the IV); use des_ncbc_encrypt() instead. | ||
45 | |||
46 | =over 2 | ||
47 | |||
48 | =item * | ||
49 | |||
50 | a multiple of 64 bits are enciphered at a time. | ||
51 | |||
52 | =item * | ||
53 | |||
54 | The CBC mode produces the same ciphertext whenever the same | ||
55 | plaintext is encrypted using the same key and starting variable. | ||
56 | |||
57 | =item * | ||
58 | |||
59 | The chaining operation makes the ciphertext blocks dependent on the | ||
60 | current and all preceding plaintext blocks and therefore blocks can not | ||
61 | be rearranged. | ||
62 | |||
63 | =item * | ||
64 | |||
65 | The use of different starting variables prevents the same plaintext | ||
66 | enciphering to the same ciphertext. | ||
67 | |||
68 | =item * | ||
69 | |||
70 | An error will affect the current and the following ciphertext blocks. | ||
71 | |||
72 | =back | ||
73 | |||
74 | =head2 Cipher Feedback Mode (CFB) | ||
75 | |||
76 | Normally, this is found as the function I<algorithm>_cfb_encrypt(). | ||
77 | |||
78 | =over 2 | ||
79 | |||
80 | =item * | ||
81 | |||
82 | a number of bits (j) <= 64 are enciphered at a time. | ||
83 | |||
84 | =item * | ||
85 | |||
86 | The CFB mode produces the same ciphertext whenever the same | ||
87 | plaintext is encrypted using the same key and starting variable. | ||
88 | |||
89 | =item * | ||
90 | |||
91 | The chaining operation makes the ciphertext variables dependent on the | ||
92 | current and all preceding variables and therefore j-bit variables are | ||
93 | chained together and can not be rearranged. | ||
94 | |||
95 | =item * | ||
96 | |||
97 | The use of different starting variables prevents the same plaintext | ||
98 | enciphering to the same ciphertext. | ||
99 | |||
100 | =item * | ||
101 | |||
102 | The strength of the CFB mode depends on the size of k (maximal if | ||
103 | j == k). In my implementation this is always the case. | ||
104 | |||
105 | =item * | ||
106 | |||
107 | Selection of a small value for j will require more cycles through | ||
108 | the encipherment algorithm per unit of plaintext and thus cause | ||
109 | greater processing overheads. | ||
110 | |||
111 | =item * | ||
112 | |||
113 | Only multiples of j bits can be enciphered. | ||
114 | |||
115 | =item * | ||
116 | |||
117 | An error will affect the current and the following ciphertext variables. | ||
118 | |||
119 | =back | ||
120 | |||
121 | =head2 Output Feedback Mode (OFB) | ||
122 | |||
123 | Normally, this is found as the function I<algorithm>_ofb_encrypt(). | ||
124 | |||
125 | =over 2 | ||
126 | |||
127 | |||
128 | =item * | ||
129 | |||
130 | a number of bits (j) <= 64 are enciphered at a time. | ||
131 | |||
132 | =item * | ||
133 | |||
134 | The OFB mode produces the same ciphertext whenever the same | ||
135 | plaintext enciphered using the same key and starting variable. More | ||
136 | over, in the OFB mode the same key stream is produced when the same | ||
137 | key and start variable are used. Consequently, for security reasons | ||
138 | a specific start variable should be used only once for a given key. | ||
139 | |||
140 | =item * | ||
141 | |||
142 | The absence of chaining makes the OFB more vulnerable to specific attacks. | ||
143 | |||
144 | =item * | ||
145 | |||
146 | The use of different start variables values prevents the same | ||
147 | plaintext enciphering to the same ciphertext, by producing different | ||
148 | key streams. | ||
149 | |||
150 | =item * | ||
151 | |||
152 | Selection of a small value for j will require more cycles through | ||
153 | the encipherment algorithm per unit of plaintext and thus cause | ||
154 | greater processing overheads. | ||
155 | |||
156 | =item * | ||
157 | |||
158 | Only multiples of j bits can be enciphered. | ||
159 | |||
160 | =item * | ||
161 | |||
162 | OFB mode of operation does not extend ciphertext errors in the | ||
163 | resultant plaintext output. Every bit error in the ciphertext causes | ||
164 | only one bit to be in error in the deciphered plaintext. | ||
165 | |||
166 | =item * | ||
167 | |||
168 | OFB mode is not self-synchronising. If the two operation of | ||
169 | encipherment and decipherment get out of synchronism, the system needs | ||
170 | to be re-initialised. | ||
171 | |||
172 | =item * | ||
173 | |||
174 | Each re-initialisation should use a value of the start variable | ||
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 | ||
177 | produced each time from the same parameters. This would be | ||
178 | susceptible to a 'known plaintext' attack. | ||
179 | |||
180 | =back | ||
181 | |||
182 | =head2 Triple ECB Mode | ||
183 | |||
184 | Normally, this is found as the function I<algorithm>_ecb3_encrypt(). | ||
185 | |||
186 | =over 2 | ||
187 | |||
188 | =item * | ||
189 | |||
190 | Encrypt with key1, decrypt with key2 and encrypt with key3 again. | ||
191 | |||
192 | =item * | ||
193 | |||
194 | As for ECB encryption but increases the key length to 168 bits. | ||
195 | There are theoretic attacks that can be used that make the effective | ||
196 | key length 112 bits, but this attack also requires 2^56 blocks of | ||
197 | memory, not very likely, even for the NSA. | ||
198 | |||
199 | =item * | ||
200 | |||
201 | If both keys are the same it is equivalent to encrypting once with | ||
202 | just one key. | ||
203 | |||
204 | =item * | ||
205 | |||
206 | If the first and last key are the same, the key length is 112 bits. | ||
207 | There are attacks that could reduce the key space to 55 bit's but it | ||
208 | requires 2^56 blocks of memory. | ||
209 | |||
210 | =item * | ||
211 | |||
212 | If all 3 keys are the same, this is effectively the same as normal | ||
213 | ecb mode. | ||
214 | |||
215 | =back | ||
216 | |||
217 | =head2 Triple CBC Mode | ||
218 | |||
219 | Normally, this is found as the function I<algorithm>_ede3_cbc_encrypt(). | ||
220 | |||
221 | =over 2 | ||
222 | |||
223 | |||
224 | =item * | ||
225 | |||
226 | Encrypt with key1, decrypt with key2 and then encrypt with key3. | ||
227 | |||
228 | =item * | ||
229 | |||
230 | As for CBC encryption but increases the key length to 168 bits with | ||
231 | the same restrictions as for triple ecb mode. | ||
232 | |||
233 | =back | ||
234 | |||
235 | =head1 NOTES | ||
236 | |||
237 | This text was been written in large parts by Eric Young in his original | ||
238 | documentation for SSLeay, the predecessor of OpenSSL. In turn, he attributed | ||
239 | it to: | ||
240 | |||
241 | AS 2805.5.2 | ||
242 | Australian Standard | ||
243 | Electronic funds transfer - Requirements for interfaces, | ||
244 | Part 5.2: Modes of operation for an n-bit block cipher algorithm | ||
245 | Appendix A | ||
246 | |||
247 | =head1 SEE ALSO | ||
248 | |||
249 | L<blowfish(3)|blowfish(3)>, L<des(3)|des(3)>, L<idea(3)|idea(3)>, | ||
250 | L<rc2(3)|rc2(3)> | ||
diff --git a/src/lib/libssl/src/doc/crypto/dh.pod b/src/lib/libssl/src/doc/crypto/dh.pod new file mode 100644 index 0000000000..0a9b7c03a2 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/dh.pod | |||
@@ -0,0 +1,68 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | dh - Diffie-Hellman key agreement | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dh.h> | ||
10 | |||
11 | DH * DH_new(void); | ||
12 | void DH_free(DH *dh); | ||
13 | |||
14 | int DH_size(DH *dh); | ||
15 | |||
16 | DH * DH_generate_parameters(int prime_len, int generator, | ||
17 | void (*callback)(int, int, void *), void *cb_arg); | ||
18 | int DH_check(DH *dh, int *codes); | ||
19 | |||
20 | int DH_generate_key(DH *dh); | ||
21 | int DH_compute_key(unsigned char *key, BIGNUM *pub_key, DH *dh); | ||
22 | |||
23 | void DH_set_default_method(DH_METHOD *meth); | ||
24 | DH_METHOD *DH_get_default_method(void); | ||
25 | DH_METHOD *DH_set_method(DH *dh, DH_METHOD *meth); | ||
26 | DH *DH_new_method(DH_METHOD *meth); | ||
27 | DH_METHOD *DH_OpenSSL(void); | ||
28 | |||
29 | int DH_get_ex_new_index(long argl, char *argp, int (*new_func)(), | ||
30 | int (*dup_func)(), void (*free_func)()); | ||
31 | int DH_set_ex_data(DH *d, int idx, char *arg); | ||
32 | char *DH_get_ex_data(DH *d, int idx); | ||
33 | |||
34 | DH * d2i_DHparams(DH **a, unsigned char **pp, long length); | ||
35 | int i2d_DHparams(DH *a, unsigned char **pp); | ||
36 | |||
37 | int DHparams_print_fp(FILE *fp, DH *x); | ||
38 | int DHparams_print(BIO *bp, DH *x); | ||
39 | |||
40 | =head1 DESCRIPTION | ||
41 | |||
42 | These functions implement the Diffie-Hellman key agreement protocol. | ||
43 | The generation of shared DH parameters is described in | ||
44 | L<DH_generate_parameters(3)|DH_generate_parameters(3)>; L<DH_generate_key(3)|DH_generate_key(3)> describes how | ||
45 | to perform a key agreement. | ||
46 | |||
47 | The B<DH> structure consists of several BIGNUM components. | ||
48 | |||
49 | struct | ||
50 | { | ||
51 | BIGNUM *p; // prime number (shared) | ||
52 | BIGNUM *g; // generator of Z_p (shared) | ||
53 | BIGNUM *priv_key; // private DH value x | ||
54 | BIGNUM *pub_key; // public DH value g^x | ||
55 | // ... | ||
56 | }; | ||
57 | DH | ||
58 | |||
59 | =head1 SEE ALSO | ||
60 | |||
61 | L<dhparam(1)|dhparam(1)>, L<bn(3)|bn(3)>, L<dsa(3)|dsa(3)>, L<err(3)|err(3)>, | ||
62 | L<rand(3)|rand(3)>, L<rsa(3)|rsa(3)>, L<DH_set_method(3)|DH_set_method(3)>, | ||
63 | L<DH_new(3)|DH_new(3)>, L<DH_get_ex_new_index(3)|DH_get_ex_new_index(3)>, | ||
64 | L<DH_generate_parameters(3)|DH_generate_parameters(3)>, | ||
65 | L<DH_compute_key(3)|DH_compute_key(3)>, L<d2i_DHparams(3)|d2i_DHparams(3)>, | ||
66 | L<RSA_print(3)|RSA_print(3)> | ||
67 | |||
68 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/dsa.pod b/src/lib/libssl/src/doc/crypto/dsa.pod new file mode 100644 index 0000000000..2c09244899 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/dsa.pod | |||
@@ -0,0 +1,104 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | dsa - Digital Signature Algorithm | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dsa.h> | ||
10 | |||
11 | DSA * DSA_new(void); | ||
12 | void DSA_free(DSA *dsa); | ||
13 | |||
14 | int DSA_size(DSA *dsa); | ||
15 | |||
16 | DSA * DSA_generate_parameters(int bits, unsigned char *seed, | ||
17 | int seed_len, int *counter_ret, unsigned long *h_ret, | ||
18 | void (*callback)(int, int, void *), void *cb_arg); | ||
19 | |||
20 | DH * DSA_dup_DH(DSA *r); | ||
21 | |||
22 | int DSA_generate_key(DSA *dsa); | ||
23 | |||
24 | int DSA_sign(int dummy, const unsigned char *dgst, int len, | ||
25 | unsigned char *sigret, unsigned int *siglen, DSA *dsa); | ||
26 | int DSA_sign_setup(DSA *dsa, BN_CTX *ctx, BIGNUM **kinvp, | ||
27 | BIGNUM **rp); | ||
28 | int DSA_verify(int dummy, const unsigned char *dgst, int len, | ||
29 | unsigned char *sigbuf, int siglen, DSA *dsa); | ||
30 | |||
31 | void DSA_set_default_method(DSA_METHOD *meth); | ||
32 | DSA_METHOD *DSA_get_default_method(void); | ||
33 | DSA_METHOD *DSA_set_method(DSA *dsa, DSA_METHOD *meth); | ||
34 | DSA *DSA_new_method(DSA_METHOD *meth); | ||
35 | DSA_METHOD *DSA_OpenSSL(void); | ||
36 | |||
37 | int DSA_get_ex_new_index(long argl, char *argp, int (*new_func)(), | ||
38 | int (*dup_func)(), void (*free_func)()); | ||
39 | int DSA_set_ex_data(DSA *d, int idx, char *arg); | ||
40 | char *DSA_get_ex_data(DSA *d, int idx); | ||
41 | |||
42 | DSA_SIG *DSA_SIG_new(void); | ||
43 | void DSA_SIG_free(DSA_SIG *a); | ||
44 | int i2d_DSA_SIG(DSA_SIG *a, unsigned char **pp); | ||
45 | DSA_SIG *d2i_DSA_SIG(DSA_SIG **v, unsigned char **pp, long length); | ||
46 | |||
47 | DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); | ||
48 | int DSA_do_verify(const unsigned char *dgst, int dgst_len, | ||
49 | DSA_SIG *sig, DSA *dsa); | ||
50 | |||
51 | DSA * d2i_DSAPublicKey(DSA **a, unsigned char **pp, long length); | ||
52 | DSA * d2i_DSAPrivateKey(DSA **a, unsigned char **pp, long length); | ||
53 | DSA * d2i_DSAparams(DSA **a, unsigned char **pp, long length); | ||
54 | int i2d_DSAPublicKey(DSA *a, unsigned char **pp); | ||
55 | int i2d_DSAPrivateKey(DSA *a, unsigned char **pp); | ||
56 | int i2d_DSAparams(DSA *a,unsigned char **pp); | ||
57 | |||
58 | int DSAparams_print(BIO *bp, DSA *x); | ||
59 | int DSAparams_print_fp(FILE *fp, DSA *x); | ||
60 | int DSA_print(BIO *bp, DSA *x, int off); | ||
61 | int DSA_print_fp(FILE *bp, DSA *x, int off); | ||
62 | |||
63 | =head1 DESCRIPTION | ||
64 | |||
65 | These functions implement the Digital Signature Algorithm (DSA). The | ||
66 | generation of shared DSA parameters is described in | ||
67 | L<DSA_generate_parameters(3)|DSA_generate_parameters(3)>; | ||
68 | L<DSA_generate_key(3)|DSA_generate_key(3)> describes how to | ||
69 | generate a signature key. Signature generation and verification are | ||
70 | described in L<DSA_sign(3)|DSA_sign(3)>. | ||
71 | |||
72 | The B<DSA> structure consists of several BIGNUM components. | ||
73 | |||
74 | struct | ||
75 | { | ||
76 | BIGNUM *p; // prime number (public) | ||
77 | BIGNUM *q; // 160-bit subprime, q | p-1 (public) | ||
78 | BIGNUM *g; // generator of subgroup (public) | ||
79 | BIGNUM *priv_key; // private key x | ||
80 | BIGNUM *pub_key; // public key y = g^x | ||
81 | // ... | ||
82 | } | ||
83 | DSA; | ||
84 | |||
85 | In public keys, B<priv_key> is NULL. | ||
86 | |||
87 | =head1 CONFORMING TO | ||
88 | |||
89 | US Federal Information Processing Standard FIPS 186 (Digital Signature | ||
90 | Standard, DSS), ANSI X9.30 | ||
91 | |||
92 | =head1 SEE ALSO | ||
93 | |||
94 | L<bn(3)|bn(3)>, L<dh(3)|dh(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>, | ||
95 | L<rsa(3)|rsa(3)>, L<sha(3)|sha(3)>, L<DSA_new(3)|DSA_new(3)>, | ||
96 | L<DSA_size(3)|DSA_size(3)>, | ||
97 | L<DSA_generate_parameters(3)|DSA_generate_parameters(3)>, | ||
98 | L<DSA_dup_DH(3)|DSA_dup_DH(3)>, | ||
99 | L<DSA_generate_key(3)|DSA_generate_key(3)>, | ||
100 | L<DSA_sign(3)|DSA_sign(3)>, L<DSA_set_method(3)|DSA_set_method(3)>, | ||
101 | L<DSA_get_ex_new_index(3)|DSA_get_ex_new_index(3)>, | ||
102 | L<RSA_print(3)|RSA_print(3)> | ||
103 | |||
104 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/err.pod b/src/lib/libssl/src/doc/crypto/err.pod new file mode 100644 index 0000000000..b824c92b57 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/err.pod | |||
@@ -0,0 +1,187 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | err - error codes | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/err.h> | ||
10 | |||
11 | unsigned long ERR_get_error(void); | ||
12 | unsigned long ERR_peek_error(void); | ||
13 | unsigned long ERR_get_error_line(const char **file, int *line); | ||
14 | unsigned long ERR_peek_error_line(const char **file, int *line); | ||
15 | unsigned long ERR_get_error_line_data(const char **file, int *line, | ||
16 | const char **data, int *flags); | ||
17 | unsigned long ERR_peek_error_line_data(const char **file, int *line, | ||
18 | const char **data, int *flags); | ||
19 | |||
20 | int ERR_GET_LIB(unsigned long e); | ||
21 | int ERR_GET_FUNC(unsigned long e); | ||
22 | int ERR_GET_REASON(unsigned long e); | ||
23 | |||
24 | void ERR_clear_error(void); | ||
25 | |||
26 | char *ERR_error_string(unsigned long e, char *buf); | ||
27 | const char *ERR_lib_error_string(unsigned long e); | ||
28 | const char *ERR_func_error_string(unsigned long e); | ||
29 | const char *ERR_reason_error_string(unsigned long e); | ||
30 | |||
31 | void ERR_print_errors(BIO *bp); | ||
32 | void ERR_print_errors_fp(FILE *fp); | ||
33 | |||
34 | void ERR_load_crypto_strings(void); | ||
35 | void ERR_free_strings(void); | ||
36 | |||
37 | void ERR_remove_state(unsigned long pid); | ||
38 | |||
39 | void ERR_put_error(int lib, int func, int reason, const char *file, | ||
40 | int line); | ||
41 | void ERR_add_error_data(int num, ...); | ||
42 | |||
43 | void ERR_load_strings(int lib,ERR_STRING_DATA str[]); | ||
44 | unsigned long ERR_PACK(int lib, int func, int reason); | ||
45 | int ERR_get_next_error_library(void); | ||
46 | |||
47 | =head1 DESCRIPTION | ||
48 | |||
49 | When a call to the OpenSSL library fails, this is usually signalled | ||
50 | by the return value, and an error code is stored in an error queue | ||
51 | associated with the current thread. The B<err> library provides | ||
52 | functions to obtain these error codes and textual error messages. | ||
53 | |||
54 | The L<ERR_get_error(3)|ERR_get_error(3)> manpage describes how to | ||
55 | access error codes. | ||
56 | |||
57 | Error codes contain information about where the error occurred, and | ||
58 | what went wrong. L<ERR_GET_LIB(3)|ERR_GET_LIB(3)> describes how to | ||
59 | extract this information. A method to obtain human-readable error | ||
60 | messages is described in L<ERR_error_string(3)|ERR_error_string(3)>. | ||
61 | |||
62 | L<ERR_clear_error(3)|ERR_clear_error(3)> can be used to clear the | ||
63 | error queue. | ||
64 | |||
65 | Note that L<ERR_remove_state(3)|ERR_remove_state(3)> should be used to | ||
66 | avoid memory leaks when threads are terminated. | ||
67 | |||
68 | =head1 ADDING NEW ERROR CODES TO OPENSSL | ||
69 | |||
70 | See L<ERR_put_error(3)> if you want to record error codes in the | ||
71 | OpenSSL error system from within your application. | ||
72 | |||
73 | The remainder of this section is of interest only if you want to add | ||
74 | new error codes to OpenSSL or add error codes from external libraries. | ||
75 | |||
76 | =head2 Reporting errors | ||
77 | |||
78 | Each sub-library has a specific macro XXXerr() that is used to report | ||
79 | errors. Its first argument is a function code B<XXX_F_...>, the second | ||
80 | argument is a reason code B<XXX_R_...>. Function codes are derived | ||
81 | from the function names; reason codes consist of textual error | ||
82 | descriptions. For example, the function ssl23_read() reports a | ||
83 | "handshake failure" as follows: | ||
84 | |||
85 | SSLerr(SSL_F_SSL23_READ, SSL_R_SSL_HANDSHAKE_FAILURE); | ||
86 | |||
87 | Function and reason codes should consist of upper case characters, | ||
88 | numbers and underscores only. The error file generation script translates | ||
89 | function codes into function names by looking in the header files | ||
90 | for an appropriate function name, if none is found it just uses | ||
91 | the capitalized form such as "SSL23_READ" in the above example. | ||
92 | |||
93 | The trailing section of a reason code (after the "_R_") is translated | ||
94 | into lower case and underscores changed to spaces. | ||
95 | |||
96 | When you are using new function or reason codes, run B<make errors>. | ||
97 | The necessary B<#define>s will then automatically be added to the | ||
98 | sub-library's header file. | ||
99 | |||
100 | Although a library will normally report errors using its own specific | ||
101 | XXXerr macro, another library's macro can be used. This is normally | ||
102 | only done when a library wants to include ASN1 code which must use | ||
103 | the ASN1err() macro. | ||
104 | |||
105 | =head2 Adding new libraries | ||
106 | |||
107 | When adding a new sub-library to OpenSSL, assign it a library number | ||
108 | B<ERR_LIB_XXX>, define a macro XXXerr() (both in B<err.h>), add its | ||
109 | name to B<ERR_str_libraries[]> (in B<crypto/err/err.c>), and add | ||
110 | C<ERR_load_XXX_strings()> to the ERR_load_crypto_strings() function | ||
111 | (in B<crypto/err/err_all.c>). Finally, add an entry | ||
112 | |||
113 | L XXX xxx.h xxx_err.c | ||
114 | |||
115 | to B<crypto/err/openssl.ec>, and add B<xxx_err.c> to the Makefile. | ||
116 | Running B<make errors> will then generate a file B<xxx_err.c>, and | ||
117 | add all error codes used in the library to B<xxx.h>. | ||
118 | |||
119 | Additionally the library include file must have a certain form. | ||
120 | Typically it will initially look like this: | ||
121 | |||
122 | #ifndef HEADER_XXX_H | ||
123 | #define HEADER_XXX_H | ||
124 | |||
125 | #ifdef __cplusplus | ||
126 | extern "C" { | ||
127 | #endif | ||
128 | |||
129 | /* Include files */ | ||
130 | |||
131 | #include <openssl/bio.h> | ||
132 | #include <openssl/x509.h> | ||
133 | |||
134 | /* Macros, structures and function prototypes */ | ||
135 | |||
136 | |||
137 | /* BEGIN ERROR CODES */ | ||
138 | |||
139 | The B<BEGIN ERROR CODES> sequence is used by the error code | ||
140 | generation script as the point to place new error codes, any text | ||
141 | after this point will be overwritten when B<make errors> is run. | ||
142 | The closing #endif etc will be automatically added by the script. | ||
143 | |||
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 | ||
146 | header file must load any additional header files containg any | ||
147 | definitions it uses. | ||
148 | |||
149 | =head1 USING ERROR CODES IN EXTERNAL LIBRARIES | ||
150 | |||
151 | It is also possible to use OpenSSL's error code scheme in external | ||
152 | libraries. The library needs to load its own codes and call the OpenSSL | ||
153 | error code insertion script B<mkerr.pl> explicitly to add codes to | ||
154 | the header file and generate the C error code file. This will normally | ||
155 | be done if the external library needs to generate new ASN1 structures | ||
156 | but it can also be used to add more general purpose error code handling. | ||
157 | |||
158 | TBA more details | ||
159 | |||
160 | =head1 INTERNALS | ||
161 | |||
162 | The error queues are stored in a hash table with one B<ERR_STATE> | ||
163 | entry for each pid. ERR_get_state() returns the current thread's | ||
164 | B<ERR_STATE>. An B<ERR_STATE> can hold up to B<ERR_NUM_ERRORS> error | ||
165 | codes. When more error codes are added, the old ones are overwritten, | ||
166 | on the assumption that the most recent errors are most important. | ||
167 | |||
168 | Error strings are also stored in hash table. The hash tables can | ||
169 | be obtained by calling ERR_get_err_state_table(void) and | ||
170 | ERR_get_string_table(void) respectively. | ||
171 | |||
172 | =head1 SEE ALSO | ||
173 | |||
174 | L<CRYPTO_set_id_callback(3)|CRYPTO_set_id_callback(3)>, | ||
175 | L<CRYPTO_set_locking_callback(3)|<CRYPTO_set_locking_callback(3)>, | ||
176 | L<ERR_get_error(3)|ERR_get_error(3)>, | ||
177 | L<ERR_GET_LIB(3)|ERR_GET_LIB(3)>, | ||
178 | L<ERR_clear_error(3)|ERR_clear_error(3)>, | ||
179 | L<ERR_error_string(3)|ERR_error_string(3)>, | ||
180 | L<ERR_print_errors(3)|ERR_print_errors(3)>, | ||
181 | L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)>, | ||
182 | L<ERR_remove_state(3)|ERR_remove_state(3)>, | ||
183 | L<ERR_put_error(3)|ERR_put_error(3)>, | ||
184 | L<ERR_load_strings(3)|ERR_load_strings(3)>, | ||
185 | L<SSL_get_error(3)|SSL_get_error(3)> | ||
186 | |||
187 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/hmac.pod b/src/lib/libssl/src/doc/crypto/hmac.pod new file mode 100644 index 0000000000..45b6108c39 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/hmac.pod | |||
@@ -0,0 +1,75 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | HMAC, HMAC_Init, HMAC_Update, HMAC_Final - HMAC message authentication code | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/hmac.h> | ||
10 | |||
11 | unsigned char *HMAC(const EVP_MD *evp_md, const void *key, | ||
12 | int key_len, const unsigned char *d, int n, | ||
13 | unsigned char *md, unsigned int *md_len); | ||
14 | |||
15 | void HMAC_Init(HMAC_CTX *ctx, const void *key, int key_len, | ||
16 | const EVP_MD *md); | ||
17 | void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len); | ||
18 | void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len); | ||
19 | |||
20 | void HMAC_cleanup(HMAC_CTX *ctx); | ||
21 | |||
22 | =head1 DESCRIPTION | ||
23 | |||
24 | HMAC is a MAC (message authentication code), i.e. a keyed hash | ||
25 | function used for message authentication, which is based on a hash | ||
26 | function. | ||
27 | |||
28 | HMAC() computes the message authentication code of the B<n> bytes at | ||
29 | B<d> using the hash function B<evp_md> and the key B<key> which is | ||
30 | B<key_len> bytes long. | ||
31 | |||
32 | It places the result in B<md> (which must have space for the output of | ||
33 | the hash function, which is no more than B<EVP_MAX_MD_SIZE> bytes). | ||
34 | If B<md> is NULL, the digest is placed in a static array. The size of | ||
35 | the output is placed in B<md_len>, unless it is B<NULL>. | ||
36 | |||
37 | B<evp_md> can be EVP_sha1(), EVP_ripemd160() etc. | ||
38 | B<key> and B<evp_md> may be B<NULL> if a key and hash function have | ||
39 | been set in a previous call to HMAC_Init() for that B<HMAC_CTX>. | ||
40 | |||
41 | HMAC_cleanup() erases the key and other data from the B<HMAC_CTX>. | ||
42 | |||
43 | The following functions may be used if the message is not completely | ||
44 | stored in memory: | ||
45 | |||
46 | HMAC_Init() initializes a B<HMAC_CTX> structure to use the hash | ||
47 | function B<evp_md> and the key B<key> which is B<key_len> bytes long. | ||
48 | |||
49 | HMAC_Update() can be called repeatedly with chunks of the message to | ||
50 | be authenticated (B<len> bytes at B<data>). | ||
51 | |||
52 | HMAC_Final() places the message authentication code in B<md>, which | ||
53 | must have space for the hash function output. | ||
54 | |||
55 | =head1 RETURN VALUES | ||
56 | |||
57 | HMAC() returns a pointer to the message authentication code. | ||
58 | |||
59 | HMAC_Init(), HMAC_Update(), HMAC_Final() and HMAC_cleanup() do not | ||
60 | return values. | ||
61 | |||
62 | =head1 CONFORMING TO | ||
63 | |||
64 | RFC 2104 | ||
65 | |||
66 | =head1 SEE ALSO | ||
67 | |||
68 | L<sha(3)|sha(3)>, L<evp(3)|evp(3)> | ||
69 | |||
70 | =head1 HISTORY | ||
71 | |||
72 | HMAC(), HMAC_Init(), HMAC_Update(), HMAC_Final() and HMAC_cleanup() | ||
73 | are available since SSLeay 0.9.0. | ||
74 | |||
75 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/lh_stats.pod b/src/lib/libssl/src/doc/crypto/lh_stats.pod new file mode 100644 index 0000000000..3eeaa72e52 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/lh_stats.pod | |||
@@ -0,0 +1,60 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | lh_stats, lh_node_stats, lh_node_usage_stats, lh_stats_bio, | ||
6 | lh_node_stats_bio, lh_node_usage_stats_bio - LHASH statistics | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/lhash.h> | ||
11 | |||
12 | void lh_stats(LHASH *table, FILE *out); | ||
13 | void lh_node_stats(LHASH *table, FILE *out); | ||
14 | void lh_node_usage_stats(LHASH *table, FILE *out); | ||
15 | |||
16 | void lh_stats_bio(LHASH *table, BIO *out); | ||
17 | void lh_node_stats_bio(LHASH *table, BIO *out); | ||
18 | void lh_node_usage_stats_bio(LHASH *table, BIO *out); | ||
19 | |||
20 | =head1 DESCRIPTION | ||
21 | |||
22 | The B<LHASH> structure records statistics about most aspects of | ||
23 | accessing the hash table. This is mostly a legacy of Eric Young | ||
24 | writing this library for the reasons of implementing what looked like | ||
25 | a nice algorithm rather than for a particular software product. | ||
26 | |||
27 | lh_stats() prints out statistics on the size of the hash table, how | ||
28 | many entries are in it, and the number and result of calls to the | ||
29 | routines in this library. | ||
30 | |||
31 | lh_node_stats() prints the number of entries for each 'bucket' in the | ||
32 | hash table. | ||
33 | |||
34 | lh_node_usage_stats() prints out a short summary of the state of the | ||
35 | hash table. It prints the 'load' and the 'actual load'. The load is | ||
36 | the average number of data items per 'bucket' in the hash table. The | ||
37 | 'actual load' is the average number of items per 'bucket', but only | ||
38 | for buckets which contain entries. So the 'actual load' is the | ||
39 | average number of searches that will need to find an item in the hash | ||
40 | table, while the 'load' is the average number that will be done to | ||
41 | record a miss. | ||
42 | |||
43 | lh_stats_bio(), lh_node_stats_bio() and lh_node_usage_stats_bio() | ||
44 | are the same as the above, except that the output goes to a B<BIO>. | ||
45 | |||
46 | =head1 RETURN VALUES | ||
47 | |||
48 | These functions do not return values. | ||
49 | |||
50 | =head1 SEE ALSO | ||
51 | |||
52 | L<bio(3)|bio(3)>, L<lhash(3)|lhash(3)> | ||
53 | |||
54 | =head1 HISTORY | ||
55 | |||
56 | These functions are available in all versions of SSLeay and OpenSSL. | ||
57 | |||
58 | This manpage is derived from the SSLeay documentation. | ||
59 | |||
60 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/lhash.pod b/src/lib/libssl/src/doc/crypto/lhash.pod new file mode 100644 index 0000000000..af2c9a7102 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/lhash.pod | |||
@@ -0,0 +1,155 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | lh_new, lh_free, lh_insert, lh_delete, lh_retrieve, lh_doall, | ||
6 | lh_doall_arg, lh_error - dynamic hash table | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/lhash.h> | ||
11 | |||
12 | LHASH *lh_new(unsigned long (*hash)(/*void *a*/), | ||
13 | int (*compare)(/*void *a,void *b*/)); | ||
14 | void lh_free(LHASH *table); | ||
15 | |||
16 | void *lh_insert(LHASH *table, void *data); | ||
17 | void *lh_delete(LHASH *table, void *data); | ||
18 | void *lh_retrieve(LHASH *table, void *data); | ||
19 | |||
20 | void lh_doall(LHASH *table, void (*func)(/*void *b*/)); | ||
21 | void lh_doall_arg(LHASH *table, void (*func)(/*void *a,void *b*/), | ||
22 | void *arg); | ||
23 | |||
24 | int lh_error(LHASH *table); | ||
25 | |||
26 | =head1 DESCRIPTION | ||
27 | |||
28 | This library implements dynamic hash tables. The hash table entries | ||
29 | can be arbitrary structures. Usually they consist of key and value | ||
30 | fields. | ||
31 | |||
32 | lh_new() creates a new B<LHASH> structure. B<hash> takes a pointer to | ||
33 | the structure and returns an unsigned long hash value of its key | ||
34 | field. The hash value is normally truncated to a power of 2, so make | ||
35 | sure that your hash function returns well mixed low order | ||
36 | bits. B<compare> takes two arguments, and returns 0 if their keys are | ||
37 | equal, non-zero otherwise. | ||
38 | |||
39 | lh_free() frees the B<LHASH> structure B<table>. Allocated hash table | ||
40 | entries will not be freed; consider using lh_doall() to deallocate any | ||
41 | remaining entries in the hash table. | ||
42 | |||
43 | lh_insert() inserts the structure pointed to by B<data> into B<table>. | ||
44 | If there already is an entry with the same key, the old value is | ||
45 | replaced. Note that lh_insert() stores pointers, the data are not | ||
46 | copied. | ||
47 | |||
48 | lh_delete() deletes an entry from B<table>. | ||
49 | |||
50 | lh_retrieve() looks up an entry in B<table>. Normally, B<data> is | ||
51 | a structure with the key field(s) set; the function will return a | ||
52 | pointer to a fully populated structure. | ||
53 | |||
54 | lh_doall() will, for every entry in the hash table, call B<func> with | ||
55 | the data item as parameters. | ||
56 | This function can be quite useful when used as follows: | ||
57 | void cleanup(STUFF *a) | ||
58 | { STUFF_free(a); } | ||
59 | lh_doall(hash,cleanup); | ||
60 | lh_free(hash); | ||
61 | This can be used to free all the entries. lh_free() then cleans up the | ||
62 | 'buckets' that point to nothing. When doing this, be careful if you | ||
63 | delete entries from the hash table in B<func>: the table may decrease | ||
64 | in size, moving item that you are currently on down lower in the hash | ||
65 | table. This could cause some entries to be skipped. The best | ||
66 | solution to this problem is to set hash-E<gt>down_load=0 before you | ||
67 | start. This will stop the hash table ever being decreased in size. | ||
68 | |||
69 | lh_doall_arg() is the same as lh_doall() except that B<func> will | ||
70 | be called with B<arg> as the second argument. | ||
71 | |||
72 | lh_error() can be used to determine if an error occurred in the last | ||
73 | operation. lh_error() is a macro. | ||
74 | |||
75 | =head1 RETURN VALUES | ||
76 | |||
77 | lh_new() returns B<NULL> on error, otherwise a pointer to the new | ||
78 | B<LHASH> structure. | ||
79 | |||
80 | When a hash table entry is replaced, lh_insert() returns the value | ||
81 | being replaced. B<NULL> is returned on normal operation and on error. | ||
82 | |||
83 | lh_delete() returns the entry being deleted. B<NULL> is returned if | ||
84 | there is no such value in the hash table. | ||
85 | |||
86 | lh_retrieve() returns the hash table entry if it has been found, | ||
87 | B<NULL> otherwise. | ||
88 | |||
89 | lh_error() returns 1 if an error occurred in the last operation, 0 | ||
90 | otherwise. | ||
91 | |||
92 | lh_free(), lh_doall() and lh_doall_arg() return no values. | ||
93 | |||
94 | =head1 BUGS | ||
95 | |||
96 | lh_insert() returns B<NULL> both for success and error. | ||
97 | |||
98 | =head1 INTERNALS | ||
99 | |||
100 | The following description is based on the SSLeay documentation: | ||
101 | |||
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 | ||
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 | ||
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 | ||
108 | cost to redistribute some values. Subsequent inserts will cause more | ||
109 | single 'bucket' redistributions but there will never be a sudden large | ||
110 | cost due to redistributing all the 'buckets'. | ||
111 | |||
112 | The state for a particular hash table is kept in the B<LHASH> structure. | ||
113 | The decision to increase or decrease the hash table size is made | ||
114 | depending on the 'load' of the hash table. The load is the number of | ||
115 | items in the hash table divided by the size of the hash table. The | ||
116 | default values are as follows. If (hash->up_load E<lt> load) =E<gt> | ||
117 | expand. if (hash-E<gt>down_load E<gt> load) =E<gt> contract. The | ||
118 | B<up_load> has a default value of 1 and B<down_load> has a default value | ||
119 | of 2. These numbers can be modified by the application by just | ||
120 | playing with the B<up_load> and B<down_load> variables. The 'load' is | ||
121 | kept in a form which is multiplied by 256. So | ||
122 | hash-E<gt>up_load=8*256; will cause a load of 8 to be set. | ||
123 | |||
124 | If you are interested in performance the field to watch is | ||
125 | num_comp_calls. The hash library keeps track of the 'hash' value for | ||
126 | each item so when a lookup is done, the 'hashes' are compared, if | ||
127 | there is a match, then a full compare is done, and | ||
128 | hash-E<gt>num_comp_calls is incremented. If num_comp_calls is not equal | ||
129 | to num_delete plus num_retrieve it means that your hash function is | ||
130 | generating hashes that are the same for different values. It is | ||
131 | probably worth changing your hash function if this is the case because | ||
132 | even if your hash table has 10 items in a 'bucket', it can be searched | ||
133 | with 10 B<unsigned long> compares and 10 linked list traverses. This | ||
134 | will be much less expensive that 10 calls to you compare function. | ||
135 | |||
136 | lh_strhash() is a demo string hashing function: | ||
137 | |||
138 | unsigned long lh_strhash(const char *c); | ||
139 | |||
140 | Since the B<LHASH> routines would normally be passed structures, this | ||
141 | routine would not normally be passed to lh_new(), rather it would be | ||
142 | used in the function passed to lh_new(). | ||
143 | |||
144 | =head1 SEE ALSO | ||
145 | |||
146 | L<lh_stats(3)|lh_stats(3)> | ||
147 | |||
148 | =head1 HISTORY | ||
149 | |||
150 | The B<lhash> library is available in all versions of SSLeay and OpenSSL. | ||
151 | lh_error() was added in SSLeay 0.9.1b. | ||
152 | |||
153 | This manpage is derived from the SSLeay documentation. | ||
154 | |||
155 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/md5.pod b/src/lib/libssl/src/doc/crypto/md5.pod new file mode 100644 index 0000000000..d7c120023d --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/md5.pod | |||
@@ -0,0 +1,85 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | MD2, MD5, MD2_Init, MD2_Update, MD2_Final, MD5_Init, MD5_Update, | ||
6 | MD5_Final - MD2 and MD5 hash functions | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/md2.h> | ||
11 | |||
12 | unsigned char *MD2(const unsigned char *d, unsigned long n, | ||
13 | unsigned char *md); | ||
14 | |||
15 | void MD2_Init(MD2_CTX *c); | ||
16 | void MD2_Update(MD2_CTX *c, const unsigned char *data, | ||
17 | unsigned long len); | ||
18 | void MD2_Final(unsigned char *md, MD2_CTX *c); | ||
19 | |||
20 | |||
21 | #include <openssl/md5.h> | ||
22 | |||
23 | unsigned char *MD5(const unsigned char *d, unsigned long n, | ||
24 | unsigned char *md); | ||
25 | |||
26 | void MD5_Init(MD5_CTX *c); | ||
27 | void MD5_Update(MD5_CTX *c, const void *data, | ||
28 | unsigned long len); | ||
29 | void MD5_Final(unsigned char *md, MD5_CTX *c); | ||
30 | |||
31 | =head1 DESCRIPTION | ||
32 | |||
33 | MD2 and MD5 are cryptographic hash functions with a 128 bit output. | ||
34 | |||
35 | MD2() and MD5() compute the MD2 and MD5 message digest of the B<n> | ||
36 | bytes at B<d> and place it in B<md> (which must have space for | ||
37 | MD2_DIGEST_LENGTH == MD5_DIGEST_LENGTH == 16 bytes of output). If | ||
38 | B<md> is NULL, the digest is placed in a static array. | ||
39 | |||
40 | The following functions may be used if the message is not completely | ||
41 | stored in memory: | ||
42 | |||
43 | MD2_Init() initializes a B<MD2_CTX> structure. | ||
44 | |||
45 | MD2_Update() can be called repeatedly with chunks of the message to | ||
46 | be hashed (B<len> bytes at B<data>). | ||
47 | |||
48 | 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>. | ||
50 | |||
51 | MD5_Init(), MD5_Update() and MD5_Final() are analogous using an | ||
52 | B<MD5_CTX> structure. | ||
53 | |||
54 | Applications should use the higher level functions | ||
55 | L<EVP_DigestInit(3)|EVP_DigestInit(3)> | ||
56 | etc. instead of calling the hash functions directly. | ||
57 | |||
58 | =head1 NOTE | ||
59 | |||
60 | MD2 and MD5 are recommended only for compatibility with existing | ||
61 | applications. In new applications, SHA-1 or RIPEMD-160 should be | ||
62 | preferred. | ||
63 | |||
64 | =head1 RETURN VALUES | ||
65 | |||
66 | MD2() and MD5() return pointers to the hash value. | ||
67 | |||
68 | MD2_Init(), MD2_Update() MD2_Final(), MD5_Init(), MD5_Update() and | ||
69 | MD5_Final() do not return values. | ||
70 | |||
71 | =head1 CONFORMING TO | ||
72 | |||
73 | RFC 1319, RFC 1321 | ||
74 | |||
75 | =head1 SEE ALSO | ||
76 | |||
77 | L<sha(3)|sha(3)>, L<ripemd(3)|ripemd(3)>, L<EVP_DigestInit(3)|EVP_DigestInit(3)> | ||
78 | |||
79 | =head1 HISTORY | ||
80 | |||
81 | MD2(), MD2_Init(), MD2_Update() MD2_Final(), MD5(), MD5_Init(), | ||
82 | MD5_Update() and MD5_Final() are available in all versions of SSLeay | ||
83 | and OpenSSL. | ||
84 | |||
85 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/mdc2.pod b/src/lib/libssl/src/doc/crypto/mdc2.pod new file mode 100644 index 0000000000..11dc303e04 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/mdc2.pod | |||
@@ -0,0 +1,64 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | MDC2, MDC2_Init, MDC2_Update, MDC2_Final - MDC2 hash function | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/mdc2.h> | ||
10 | |||
11 | unsigned char *MDC2(const unsigned char *d, unsigned long n, | ||
12 | unsigned char *md); | ||
13 | |||
14 | void MDC2_Init(MDC2_CTX *c); | ||
15 | void MDC2_Update(MDC2_CTX *c, const unsigned char *data, | ||
16 | unsigned long len); | ||
17 | void MDC2_Final(unsigned char *md, MDC2_CTX *c); | ||
18 | |||
19 | =head1 DESCRIPTION | ||
20 | |||
21 | MDC2 is a method to construct hash functions with 128 bit output from | ||
22 | block ciphers. These functions are an implementation of MDC2 with | ||
23 | DES. | ||
24 | |||
25 | MDC2() computes the MDC2 message digest of the B<n> | ||
26 | bytes at B<d> and places it in B<md> (which must have space for | ||
27 | MDC2_DIGEST_LENGTH == 16 bytes of output). If B<md> is NULL, the digest | ||
28 | is placed in a static array. | ||
29 | |||
30 | The following functions may be used if the message is not completely | ||
31 | stored in memory: | ||
32 | |||
33 | MDC2_Init() initializes a B<MDC2_CTX> structure. | ||
34 | |||
35 | MDC2_Update() can be called repeatedly with chunks of the message to | ||
36 | be hashed (B<len> bytes at B<data>). | ||
37 | |||
38 | MDC2_Final() places the message digest in B<md>, which must have space | ||
39 | for MDC2_DIGEST_LENGTH == 16 bytes of output, and erases the B<MDC2_CTX>. | ||
40 | |||
41 | Applications should use the higher level functions | ||
42 | L<EVP_DigestInit(3)|EVP_DigestInit(3)> etc. instead of calling the | ||
43 | hash functions directly. | ||
44 | |||
45 | =head1 RETURN VALUES | ||
46 | |||
47 | MDC2() returns a pointer to the hash value. | ||
48 | |||
49 | MDC2_Init(), MDC2_Update() and MDC2_Final() do not return values. | ||
50 | |||
51 | =head1 CONFORMING TO | ||
52 | |||
53 | ISO/IEC 10118-2, with DES | ||
54 | |||
55 | =head1 SEE ALSO | ||
56 | |||
57 | L<sha(3)|sha(3)>, L<EVP_DigestInit(3)|EVP_DigestInit(3)> | ||
58 | |||
59 | =head1 HISTORY | ||
60 | |||
61 | MDC2(), MDC2_Init(), MDC2_Update() and MDC2_Final() are available since | ||
62 | SSLeay 0.8. | ||
63 | |||
64 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/rand.pod b/src/lib/libssl/src/doc/crypto/rand.pod new file mode 100644 index 0000000000..295b681050 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/rand.pod | |||
@@ -0,0 +1,158 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | rand - pseudo-random number generator | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/rand.h> | ||
10 | |||
11 | int RAND_bytes(unsigned char *buf,int num); | ||
12 | int RAND_pseudo_bytes(unsigned char *buf,int num); | ||
13 | |||
14 | void RAND_seed(const void *buf,int num); | ||
15 | void RAND_add(const void *buf,int num,int entropy); | ||
16 | int RAND_status(void); | ||
17 | void RAND_screen(void); | ||
18 | |||
19 | int RAND_load_file(const char *file,long max_bytes); | ||
20 | int RAND_write_file(const char *file); | ||
21 | const char *RAND_file_name(char *file,int num); | ||
22 | |||
23 | int RAND_egd(const char *path); | ||
24 | |||
25 | void RAND_set_rand_method(RAND_METHOD *meth); | ||
26 | RAND_METHOD *RAND_get_rand_method(void); | ||
27 | RAND_METHOD *RAND_SSLeay(void); | ||
28 | |||
29 | void RAND_cleanup(void); | ||
30 | |||
31 | =head1 DESCRIPTION | ||
32 | |||
33 | These functions implement a cryptographically secure pseudo-random | ||
34 | number generator (PRNG). It is used by other library functions for | ||
35 | example to generate random keys, and applications can use it when they | ||
36 | need randomness. | ||
37 | |||
38 | A cryptographic PRNG must be seeded with unpredictable data such as | ||
39 | mouse movements or keys pressed at random by the user. This is | ||
40 | described in L<RAND_add(3)|RAND_add(3)>. Its state can be saved in a seed file | ||
41 | (see L<RAND_load_file(3)|RAND_load_file(3)>) to avoid having to go through the | ||
42 | seeding process whenever the application is started. | ||
43 | |||
44 | L<RAND_bytes(3)|RAND_bytes(3)> describes how to obtain random data from the | ||
45 | PRNG. | ||
46 | |||
47 | =head1 INTERNALS | ||
48 | |||
49 | The RAND_SSLeay() method implements a PRNG based on a cryptographic | ||
50 | hash function. | ||
51 | |||
52 | The following description of its design is based on the SSLeay | ||
53 | documentation: | ||
54 | |||
55 | First up I will state the things I believe I need for a good RNG. | ||
56 | |||
57 | =over 4 | ||
58 | |||
59 | =item 1 | ||
60 | |||
61 | A good hashing algorithm to mix things up and to convert the RNG 'state' | ||
62 | to random numbers. | ||
63 | |||
64 | =item 2 | ||
65 | |||
66 | An initial source of random 'state'. | ||
67 | |||
68 | =item 3 | ||
69 | |||
70 | The state should be very large. If the RNG is being used to generate | ||
71 | 4096 bit RSA keys, 2 2048 bit random strings are required (at a minimum). | ||
72 | If your RNG state only has 128 bits, you are obviously limiting the | ||
73 | search space to 128 bits, not 2048. I'm probably getting a little | ||
74 | carried away on this last point but it does indicate that it may not be | ||
75 | a bad idea to keep quite a lot of RNG state. It should be easier to | ||
76 | break a cipher than guess the RNG seed data. | ||
77 | |||
78 | =item 4 | ||
79 | |||
80 | Any RNG seed data should influence all subsequent random numbers | ||
81 | generated. This implies that any random seed data entered will have | ||
82 | an influence on all subsequent random numbers generated. | ||
83 | |||
84 | =item 5 | ||
85 | |||
86 | When using data to seed the RNG state, the data used should not be | ||
87 | extractable from the RNG state. I believe this should be a | ||
88 | requirement because one possible source of 'secret' semi random | ||
89 | data would be a private key or a password. This data must | ||
90 | not be disclosed by either subsequent random numbers or a | ||
91 | 'core' dump left by a program crash. | ||
92 | |||
93 | =item 6 | ||
94 | |||
95 | Given the same initial 'state', 2 systems should deviate in their RNG state | ||
96 | (and hence the random numbers generated) over time if at all possible. | ||
97 | |||
98 | =item 7 | ||
99 | |||
100 | Given the random number output stream, it should not be possible to determine | ||
101 | the RNG state or the next random number. | ||
102 | |||
103 | =back | ||
104 | |||
105 | The algorithm is as follows. | ||
106 | |||
107 | There is global state made up of a 1023 byte buffer (the 'state'), a | ||
108 | working hash value ('md'), and a counter ('count'). | ||
109 | |||
110 | Whenever seed data is added, it is inserted into the 'state' as | ||
111 | follows. | ||
112 | |||
113 | The input is chopped up into units of 20 bytes (or less for | ||
114 | the last block). Each of these blocks is run through the hash | ||
115 | function as follows: The data passed to the hash function | ||
116 | is the current 'md', the same number of bytes from the 'state' | ||
117 | (the location determined by in incremented looping index) as | ||
118 | the current 'block', the new key data 'block', and 'count' | ||
119 | (which is incremented after each use). | ||
120 | The result of this is kept in 'md' and also xored into the | ||
121 | 'state' at the same locations that were used as input into the | ||
122 | hash function. I | ||
123 | believe this system addresses points 1 (hash function; currently | ||
124 | SHA-1), 3 (the 'state'), 4 (via the 'md'), 5 (by the use of a hash | ||
125 | function and xor). | ||
126 | |||
127 | When bytes are extracted from the RNG, the following process is used. | ||
128 | For each group of 10 bytes (or less), we do the following: | ||
129 | |||
130 | Input into the hash function the top 10 bytes from the local 'md' | ||
131 | (which is initialized from the global 'md' before any bytes are | ||
132 | generated), the bytes that are to be overwritten by the random bytes, | ||
133 | and bytes from the 'state' (incrementing looping index). From this | ||
134 | digest output (which is kept in 'md'), the top (up to) 10 bytes are | ||
135 | returned to the caller and the bottom (up to) 10 bytes are xored into | ||
136 | the 'state'. | ||
137 | |||
138 | Finally, after we have finished 'num' random bytes for the caller, | ||
139 | 'count' (which is incremented) and the local and global 'md' are fed | ||
140 | into the hash function and the results are kept in the global 'md'. | ||
141 | |||
142 | I believe the above addressed points 1 (use of SHA-1), 6 (by hashing | ||
143 | into the 'state' the 'old' data from the caller that is about to be | ||
144 | overwritten) and 7 (by not using the 10 bytes given to the caller to | ||
145 | update the 'state', but they are used to update 'md'). | ||
146 | |||
147 | So of the points raised, only 2 is not addressed (but see | ||
148 | L<RAND_add(3)|RAND_add(3)>). | ||
149 | |||
150 | =head1 SEE ALSO | ||
151 | |||
152 | L<BN_rand(3)|BN_rand(3)>, L<RAND_add(3)|RAND_add(3)>, | ||
153 | L<RAND_load_file(3)|RAND_load_file(3)>, L<RAND_egd(3)|RAND_egd(3)>, | ||
154 | L<RAND_bytes(3)|RAND_bytes(3)>, | ||
155 | L<RAND_set_rand_method(3)|RAND_set_rand_method(3)>, | ||
156 | L<RAND_cleanup(3)|RAND_cleanup(3)> | ||
157 | |||
158 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/rc4.pod b/src/lib/libssl/src/doc/crypto/rc4.pod new file mode 100644 index 0000000000..b6d3a4342c --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/rc4.pod | |||
@@ -0,0 +1,62 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | RC4_set_key, RC4 - RC4 encryption | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/rc4.h> | ||
10 | |||
11 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data); | ||
12 | |||
13 | void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata, | ||
14 | unsigned char *outdata); | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | This library implements the Alleged RC4 cipher, which is described for | ||
19 | example in I<Applied Cryptography>. It is believed to be compatible | ||
20 | with RC4[TM], a proprietary cipher of RSA Security Inc. | ||
21 | |||
22 | RC4 is a stream cipher with variable key length. Typically, 128 bit | ||
23 | (16 byte) keys are used for strong encryption, but shorter insecure | ||
24 | key sizes have been widely used due to export restrictions. | ||
25 | |||
26 | RC4 consists of a key setup phase and the actual encryption or | ||
27 | decryption phase. | ||
28 | |||
29 | RC4_set_key() sets up the B<RC4_KEY> B<key> using the B<len> bytes long | ||
30 | key at B<data>. | ||
31 | |||
32 | RC4() encrypts or decrypts the B<len> bytes of data at B<indata> using | ||
33 | B<key> and places the result at B<outdata>. Repeated RC4() calls with | ||
34 | the same B<key> yield a continuous key stream. | ||
35 | |||
36 | Since RC4 is a stream cipher (the input is XORed with a pseudo-random | ||
37 | key stream to produce the output), decryption uses the same function | ||
38 | calls as encryption. | ||
39 | |||
40 | Applications should use the higher level functions | ||
41 | L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> | ||
42 | etc. instead of calling the RC4 functions directly. | ||
43 | |||
44 | =head1 RETURN VALUES | ||
45 | |||
46 | RC4_set_key() and RC4() do not return values. | ||
47 | |||
48 | =head1 NOTE | ||
49 | |||
50 | Certain conditions have to be observed to securely use stream ciphers. | ||
51 | It is not permissible to perform multiple encryptions using the same | ||
52 | key stream. | ||
53 | |||
54 | =head1 SEE ALSO | ||
55 | |||
56 | L<blowfish(3)|blowfish(3)>, L<des(3)|des(3)>, L<rc2(3)|rc2(3)> | ||
57 | |||
58 | =head1 HISTORY | ||
59 | |||
60 | RC4_set_key() and RC4() are available in all versions of SSLeay and OpenSSL. | ||
61 | |||
62 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/ripemd.pod b/src/lib/libssl/src/doc/crypto/ripemd.pod new file mode 100644 index 0000000000..31054b6a8c --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/ripemd.pod | |||
@@ -0,0 +1,66 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | RIPEMD160, RIPEMD160_Init, RIPEMD160_Update, RIPEMD160_Final - | ||
6 | RIPEMD-160 hash function | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ripemd.h> | ||
11 | |||
12 | unsigned char *RIPEMD160(const unsigned char *d, unsigned long n, | ||
13 | unsigned char *md); | ||
14 | |||
15 | void RIPEMD160_Init(RIPEMD160_CTX *c); | ||
16 | void RIPEMD160_Update(RIPEMD_CTX *c, const void *data, | ||
17 | unsigned long len); | ||
18 | void RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); | ||
19 | |||
20 | =head1 DESCRIPTION | ||
21 | |||
22 | RIPEMD-160 is a cryptographic hash function with a | ||
23 | 160 bit output. | ||
24 | |||
25 | RIPEMD160() computes the RIPEMD-160 message digest of the B<n> | ||
26 | bytes at B<d> and places it in B<md> (which must have space for | ||
27 | RIPEMD160_DIGEST_LENGTH == 20 bytes of output). If B<md> is NULL, the digest | ||
28 | is placed in a static array. | ||
29 | |||
30 | The following functions may be used if the message is not completely | ||
31 | stored in memory: | ||
32 | |||
33 | RIPEMD160_Init() initializes a B<RIPEMD160_CTX> structure. | ||
34 | |||
35 | RIPEMD160_Update() can be called repeatedly with chunks of the message to | ||
36 | be hashed (B<len> bytes at B<data>). | ||
37 | |||
38 | RIPEMD160_Final() places the message digest in B<md>, which must have | ||
39 | space for RIPEMD160_DIGEST_LENGTH == 20 bytes of output, and erases | ||
40 | the B<RIPEMD160_CTX>. | ||
41 | |||
42 | Applications should use the higher level functions | ||
43 | L<EVP_DigestInit(3)|EVP_DigestInit(3)> etc. instead of calling the | ||
44 | hash functions directly. | ||
45 | |||
46 | =head1 RETURN VALUES | ||
47 | |||
48 | RIPEMD160() returns a pointer to the hash value. | ||
49 | |||
50 | RIPEMD160_Init(), RIPEMD160_Update() and RIPEMD160_Final() do not | ||
51 | return values. | ||
52 | |||
53 | =head1 CONFORMING TO | ||
54 | |||
55 | ISO/IEC 10118-3 (draft) (??) | ||
56 | |||
57 | =head1 SEE ALSO | ||
58 | |||
59 | L<sha(3)|sha(3)>, L<hmac(3)|hmac(3)>, L<EVP_DigestInit(3)|EVP_DigestInit(3)> | ||
60 | |||
61 | =head1 HISTORY | ||
62 | |||
63 | RIPEMD160(), RIPEMD160_Init(), RIPEMD160_Update() and | ||
64 | RIPEMD160_Final() are available since SSLeay 0.9.0. | ||
65 | |||
66 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/rsa.pod b/src/lib/libssl/src/doc/crypto/rsa.pod new file mode 100644 index 0000000000..0486c044a6 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/rsa.pod | |||
@@ -0,0 +1,115 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | rsa - RSA public key cryptosystem | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/rsa.h> | ||
10 | |||
11 | RSA * RSA_new(void); | ||
12 | void RSA_free(RSA *rsa); | ||
13 | |||
14 | int RSA_public_encrypt(int flen, unsigned char *from, | ||
15 | unsigned char *to, RSA *rsa, int padding); | ||
16 | int RSA_private_decrypt(int flen, unsigned char *from, | ||
17 | unsigned char *to, RSA *rsa, int padding); | ||
18 | |||
19 | int RSA_sign(int type, unsigned char *m, unsigned int m_len, | ||
20 | unsigned char *sigret, unsigned int *siglen, RSA *rsa); | ||
21 | int RSA_verify(int type, unsigned char *m, unsigned int m_len, | ||
22 | unsigned char *sigbuf, unsigned int siglen, RSA *rsa); | ||
23 | |||
24 | int RSA_size(RSA *rsa); | ||
25 | |||
26 | RSA *RSA_generate_key(int num, unsigned long e, | ||
27 | void (*callback)(int,int,void *), void *cb_arg); | ||
28 | |||
29 | int RSA_check_key(RSA *rsa); | ||
30 | |||
31 | int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); | ||
32 | void RSA_blinding_off(RSA *rsa); | ||
33 | |||
34 | void RSA_set_default_method(RSA_METHOD *meth); | ||
35 | RSA_METHOD *RSA_get_default_method(void); | ||
36 | RSA_METHOD *RSA_set_method(RSA *rsa, RSA_METHOD *meth); | ||
37 | RSA_METHOD *RSA_get_method(RSA *rsa); | ||
38 | RSA_METHOD *RSA_PKCS1_SSLeay(void); | ||
39 | RSA_METHOD *RSA_PKCS1_RSAref(void); | ||
40 | RSA_METHOD *RSA_null_method(void); | ||
41 | int RSA_flags(RSA *rsa); | ||
42 | RSA *RSA_new_method(RSA_METHOD *method); | ||
43 | |||
44 | int RSA_print(BIO *bp, RSA *x, int offset); | ||
45 | int RSA_print_fp(FILE *fp, RSA *x, int offset); | ||
46 | |||
47 | int RSA_get_ex_new_index(long argl, char *argp, int (*new_func)(), | ||
48 | int (*dup_func)(), void (*free_func)()); | ||
49 | int RSA_set_ex_data(RSA *r,int idx,char *arg); | ||
50 | char *RSA_get_ex_data(RSA *r, int idx); | ||
51 | |||
52 | int RSA_private_encrypt(int flen, unsigned char *from, | ||
53 | unsigned char *to, RSA *rsa,int padding); | ||
54 | int RSA_public_decrypt(int flen, unsigned char *from, | ||
55 | unsigned char *to, RSA *rsa,int padding); | ||
56 | |||
57 | int RSA_sign_ASN1_OCTET_STRING(int dummy, unsigned char *m, | ||
58 | unsigned int m_len, unsigned char *sigret, unsigned int *siglen, | ||
59 | RSA *rsa); | ||
60 | int RSA_verify_ASN1_OCTET_STRING(int dummy, unsigned char *m, | ||
61 | unsigned int m_len, unsigned char *sigbuf, unsigned int siglen, | ||
62 | RSA *rsa); | ||
63 | |||
64 | =head1 DESCRIPTION | ||
65 | |||
66 | These functions implement RSA public key encryption and signatures | ||
67 | as defined in PKCS #1 v2.0 [RFC 2437]. | ||
68 | |||
69 | The B<RSA> structure consists of several BIGNUM components. It can | ||
70 | contain public as well as private RSA keys: | ||
71 | |||
72 | struct | ||
73 | { | ||
74 | BIGNUM *n; // public modulus | ||
75 | BIGNUM *e; // public exponent | ||
76 | BIGNUM *d; // private exponent | ||
77 | BIGNUM *p; // secret prime factor | ||
78 | BIGNUM *q; // secret prime factor | ||
79 | BIGNUM *dmp1; // d mod (p-1) | ||
80 | BIGNUM *dmq1; // d mod (q-1) | ||
81 | BIGNUM *iqmp; // q^-1 mod p | ||
82 | // ... | ||
83 | }; | ||
84 | RSA | ||
85 | |||
86 | In public keys, the private exponent and the related secret values are | ||
87 | B<NULL>. | ||
88 | |||
89 | B<dmp1>, B<dmq1> and B<iqmp> may be B<NULL> in private keys, but the | ||
90 | RSA operations are much faster when these values are available. | ||
91 | |||
92 | =head1 CONFORMING TO | ||
93 | |||
94 | SSL, PKCS #1 v2.0 | ||
95 | |||
96 | =head1 PATENTS | ||
97 | |||
98 | RSA is covered by a US patent which expires in September 2000. | ||
99 | |||
100 | =head1 SEE ALSO | ||
101 | |||
102 | L<rsa(1)|rsa(1)>, L<bn(3)|bn(3)>, L<dsa(3)|dsa(3)>, L<dh(3)|dh(3)>, | ||
103 | L<rand(3)|rand(3)>, L<RSA_new(3)|RSA_new(3)>, | ||
104 | L<RSA_public_encrypt(3)|RSA_public_encrypt(3)>, | ||
105 | L<RSA_sign(3)|RSA_sign(3)>, L<RSA_size(3)|RSA_size(3)>, | ||
106 | L<RSA_generate_key(3)|RSA_generate_key(3)>, | ||
107 | L<RSA_check_key(3)|RSA_check_key(3)>, | ||
108 | L<RSA_blinding_on(3)|RSA_blinding_on(3)>, | ||
109 | L<RSA_set_method(3)|RSA_set_method(3)>, L<RSA_print(3)|RSA_print(3)>, | ||
110 | L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>, | ||
111 | L<RSA_private_encrypt(3)|RSA_private_encrypt(3)>, | ||
112 | L<RSA_sign_ASN_OCTET_STRING(3)|RSA_sign_ASN_OCTET_STRING(3)>, | ||
113 | L<RSA_padding_add_PKCS1_type_1(3)|RSA_padding_add_PKCS1_type_1(3)> | ||
114 | |||
115 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/sha.pod b/src/lib/libssl/src/doc/crypto/sha.pod new file mode 100644 index 0000000000..0ba315d6d7 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/sha.pod | |||
@@ -0,0 +1,70 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SHA1, SHA1_Init, SHA1_Update, SHA1_Final - Secure Hash Algorithm | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/sha.h> | ||
10 | |||
11 | unsigned char *SHA1(const unsigned char *d, unsigned long n, | ||
12 | unsigned char *md); | ||
13 | |||
14 | void SHA1_Init(SHA_CTX *c); | ||
15 | void SHA1_Update(SHA_CTX *c, const void *data, | ||
16 | unsigned long len); | ||
17 | void SHA1_Final(unsigned char *md, SHA_CTX *c); | ||
18 | |||
19 | =head1 DESCRIPTION | ||
20 | |||
21 | SHA-1 (Secure Hash Algorithm) is a cryptographic hash function with a | ||
22 | 160 bit output. | ||
23 | |||
24 | SHA1() computes the SHA-1 message digest of the B<n> | ||
25 | bytes at B<d> and places it in B<md> (which must have space for | ||
26 | SHA_DIGEST_LENGTH == 20 bytes of output). If B<md> is NULL, the digest | ||
27 | is placed in a static array. | ||
28 | |||
29 | The following functions may be used if the message is not completely | ||
30 | stored in memory: | ||
31 | |||
32 | SHA1_Init() initializes a B<SHA_CTX> structure. | ||
33 | |||
34 | SHA1_Update() can be called repeatedly with chunks of the message to | ||
35 | be hashed (B<len> bytes at B<data>). | ||
36 | |||
37 | SHA1_Final() places the message digest in B<md>, which must have space | ||
38 | for SHA_DIGEST_LENGTH == 20 bytes of output, and erases the B<SHA_CTX>. | ||
39 | |||
40 | Applications should use the higher level functions | ||
41 | L<EVP_DigestInit(3)|EVP_DigestInit(3)> | ||
42 | etc. instead of calling the hash functions directly. | ||
43 | |||
44 | The predecessor of SHA-1, SHA, is also implemented, but it should be | ||
45 | used only when backward compatibility is required. | ||
46 | |||
47 | =head1 RETURN VALUES | ||
48 | |||
49 | SHA1() returns a pointer to the hash value. | ||
50 | |||
51 | SHA1_Init(), SHA1_Update() and SHA1_Final() do not return values. | ||
52 | |||
53 | =head1 CONFORMING TO | ||
54 | |||
55 | SHA: US Federal Information Processing Standard FIPS PUB 180 (Secure Hash | ||
56 | Standard), | ||
57 | SHA-1: US Federal Information Processing Standard FIPS PUB 180-1 (Secure Hash | ||
58 | Standard), | ||
59 | ANSI X9.30 | ||
60 | |||
61 | =head1 SEE ALSO | ||
62 | |||
63 | L<ripemd(3)|ripemd(3)>, L<hmac(3)|hmac(3)>, L<EVP_DigestInit(3)|EVP_DigestInit(3)> | ||
64 | |||
65 | =head1 HISTORY | ||
66 | |||
67 | SHA1(), SHA1_Init(), SHA1_Update() and SHA1_Final() are available in all | ||
68 | versions of SSLeay and OpenSSL. | ||
69 | |||
70 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/threads.pod b/src/lib/libssl/src/doc/crypto/threads.pod new file mode 100644 index 0000000000..5da056f3f8 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/threads.pod | |||
@@ -0,0 +1,70 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | CRYPTO_set_locking_callback, CRYPTO_set_id_callback - OpenSSL thread support | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/crypto.h> | ||
10 | |||
11 | void CRYPTO_set_locking_callback(void (*locking_function)(int mode, | ||
12 | int n, const char *file, int line)); | ||
13 | |||
14 | void CRYPTO_set_id_callback(unsigned long (*id_function)(void)); | ||
15 | |||
16 | int CRYPTO_num_locks(void); | ||
17 | |||
18 | =head1 DESCRIPTION | ||
19 | |||
20 | OpenSSL can safely be used in multi-threaded applications provided | ||
21 | that two callback functions are set. | ||
22 | |||
23 | locking_function(int mode, int n, const char *file, int line) is | ||
24 | needed to perform locking on shared data stuctures. Multi-threaded | ||
25 | applications will crash at random if it is not set. | ||
26 | |||
27 | locking_function() must be able to handle up to CRYPTO_num_locks() | ||
28 | different mutex locks. It sets the B<n>-th lock if B<mode> & | ||
29 | B<CRYPTO_LOCK>, and releases it otherwise. | ||
30 | |||
31 | B<file> and B<line> are the file number of the function setting the | ||
32 | lock. They can be useful for debugging. | ||
33 | |||
34 | 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 | ||
36 | ID for each thread (most notably Linux). | ||
37 | |||
38 | =head1 RETURN VALUES | ||
39 | |||
40 | CRYPTO_num_locks() returns the required number of locks. | ||
41 | The other functions return no values. | ||
42 | |||
43 | =head1 NOTE | ||
44 | |||
45 | You can find out if OpenSSL was configured with thread support: | ||
46 | |||
47 | #define OPENSSL_THREAD_DEFINES | ||
48 | #include <openssl/opensslconf.h> | ||
49 | #if defined(THREADS) | ||
50 | // thread support enabled | ||
51 | #else | ||
52 | // no thread support | ||
53 | #endif | ||
54 | |||
55 | =head1 EXAMPLES | ||
56 | |||
57 | B<crypto/threads/mttest.c> shows examples of the callback functions on | ||
58 | Solaris, Irix and Win32. | ||
59 | |||
60 | =head1 HISTORY | ||
61 | |||
62 | CRYPTO_set_locking_callback() and CRYPTO_set_id_callback() are | ||
63 | available in all versions of SSLeay and OpenSSL. | ||
64 | CRYPTO_num_locks() was added in OpenSSL 0.9.4. | ||
65 | |||
66 | =head1 SEE ALSO | ||
67 | |||
68 | L<crypto(3)|crypto(3)> | ||
69 | |||
70 | =cut | ||
diff --git a/src/lib/libssl/src/doc/openssl.pod b/src/lib/libssl/src/doc/openssl.pod index 561f01e0ca..e69de29bb2 100644 --- a/src/lib/libssl/src/doc/openssl.pod +++ b/src/lib/libssl/src/doc/openssl.pod | |||
@@ -1,304 +0,0 @@ | |||
1 | |||
2 | =pod | ||
3 | |||
4 | =head1 NAME | ||
5 | |||
6 | openssl - OpenSSL command line tool | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | B<openssl> | ||
11 | I<command> | ||
12 | [ I<command_opts> ] | ||
13 | [ I<command_args> ] | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL | ||
18 | v2/v3) and Transport Layer Security (TLS v1) network protocols and related | ||
19 | cryptography standards required by them. | ||
20 | |||
21 | The B<openssl> program is a command line tool for using the various | ||
22 | cryptography functions of OpenSSL's B<crypto> library from the shell. | ||
23 | It can be used for | ||
24 | |||
25 | o Creation of RSA, DH and DSA key parameters | ||
26 | o Creation of X.509 certificates, CSRs and CRLs | ||
27 | o Calculation of Message Digests | ||
28 | o Encryption and Decryption with Ciphers | ||
29 | o SSL/TLS Client and Server Tests | ||
30 | |||
31 | =head1 COMMAND SUMMARY | ||
32 | |||
33 | The B<openssl> program provides a rich variety of commands (I<command> in the | ||
34 | SYNOPSIS above), each of which often has a wealth of options and arguments | ||
35 | (I<command_opts> and I<command_args> in the SYNOPSIS). | ||
36 | |||
37 | =head2 STANDARD COMMANDS | ||
38 | |||
39 | =over 10 | ||
40 | |||
41 | =item B<asn1parse> | ||
42 | |||
43 | Parse an ASN.1 sequence. | ||
44 | |||
45 | =item B<ca> | ||
46 | |||
47 | Certificate Authority (CA) Management. | ||
48 | |||
49 | =item B<ciphers> | ||
50 | |||
51 | Cipher Suite Description Determination. | ||
52 | |||
53 | =item B<crl> | ||
54 | |||
55 | Certificate Revocation List (CRL) Management. | ||
56 | |||
57 | =item B<crl2pkcs7> | ||
58 | |||
59 | CRL2 to PKCS#7 Conversion. | ||
60 | |||
61 | =item B<dgst> | ||
62 | |||
63 | Message Digest Calculation. | ||
64 | |||
65 | =item B<dh> | ||
66 | |||
67 | Diffie-Hellman Data Management. | ||
68 | |||
69 | =item B<dsa> | ||
70 | |||
71 | DSA Data Management. | ||
72 | |||
73 | =item B<dsaparam> | ||
74 | |||
75 | DSA Parameter Generation. | ||
76 | |||
77 | =item B<enc> | ||
78 | |||
79 | Encoding with Ciphers. | ||
80 | |||
81 | =item B<errstr> | ||
82 | |||
83 | Error Number to Error String Conversion. | ||
84 | |||
85 | =item B<gendh> | ||
86 | |||
87 | Generation of Diffie-Hellman Parameters. | ||
88 | |||
89 | =item B<gendsa> | ||
90 | |||
91 | Generation of DSA Parameters. | ||
92 | |||
93 | =item B<genrsa> | ||
94 | |||
95 | Generation of RSA Parameters. | ||
96 | |||
97 | =item B<pkcs7> | ||
98 | |||
99 | PKCS#7 Data Management. | ||
100 | |||
101 | =item B<req> | ||
102 | |||
103 | X.509 Certificate Signing Request (CSR) Management. | ||
104 | |||
105 | =item B<rsa> | ||
106 | |||
107 | RSA Data Management. | ||
108 | |||
109 | =item B<s_client> | ||
110 | |||
111 | This implements a generic SSL/TLS client which can establish a transparent | ||
112 | connection to a remote server speaking SSL/TLS. It's intended for testing | ||
113 | purposes only and provides only rudimentary interface functionality but | ||
114 | internally uses mostly all functionality of the OpenSSL B<ssl> library. | ||
115 | |||
116 | =item B<s_server> | ||
117 | |||
118 | This implements a generic SSL/TLS server which accepts connections from remote | ||
119 | clients speaking SSL/TLS. It's intended for testing purposes only and provides | ||
120 | only rudimentary interface functionality but internally uses mostly all | ||
121 | functionality of the OpenSSL B<ssl> library. It provides both an own command | ||
122 | line oriented protocol for testing SSL functions and a simple HTTP response | ||
123 | facility to emulate an SSL/TLS-aware webserver. | ||
124 | |||
125 | =item B<s_time> | ||
126 | |||
127 | SSL Connection Timer. | ||
128 | |||
129 | =item B<sess_id> | ||
130 | |||
131 | SSL Session Data Management. | ||
132 | |||
133 | =item B<speed> | ||
134 | |||
135 | Algorithm Speed Measurement. | ||
136 | |||
137 | =item B<verify> | ||
138 | |||
139 | X.509 Certificate Verification. | ||
140 | |||
141 | =item B<version> | ||
142 | |||
143 | OpenSSL Version Information. | ||
144 | |||
145 | =item B<x509> | ||
146 | |||
147 | X.509 Certificate Data Management. | ||
148 | |||
149 | =back | ||
150 | |||
151 | =head2 MESSAGE DIGEST COMMANDS | ||
152 | |||
153 | =over 10 | ||
154 | |||
155 | =item B<md2> | ||
156 | |||
157 | MD2 Digest | ||
158 | |||
159 | =item B<md5> | ||
160 | |||
161 | MD5 Digest | ||
162 | |||
163 | =item B<mdc2> | ||
164 | |||
165 | MDC2 Digest | ||
166 | |||
167 | =item B<rmd160> | ||
168 | |||
169 | RMD-160 Digest | ||
170 | |||
171 | =item B<sha> | ||
172 | |||
173 | SHA Digest | ||
174 | |||
175 | =item B<sha1> | ||
176 | |||
177 | SHA-1 Digest | ||
178 | |||
179 | =back | ||
180 | |||
181 | =head2 ENCODING AND CIPHER COMMANDS | ||
182 | |||
183 | =over 10 | ||
184 | |||
185 | =item B<base64> | ||
186 | |||
187 | Base64 Encoding | ||
188 | |||
189 | =item B<bf bf-cbc bf-cfb bf-ecb bf-ofb> | ||
190 | |||
191 | Blowfish Cipher | ||
192 | |||
193 | =item B<cast cast-cbc> | ||
194 | |||
195 | CAST Cipher | ||
196 | |||
197 | =item B<cast5-cbc cast5-cfb cast5-ecb cast5-ofb> | ||
198 | |||
199 | CAST5 Cipher | ||
200 | |||
201 | =item B<des des-cbc des-cfb des-ecb des-ede des-ede-cbc des-ede-cfb des-ede-ofb des-ofb> | ||
202 | |||
203 | DES Cipher | ||
204 | |||
205 | =item B<des3 desx des-ede3 des-ede3-cbc des-ede3-cfb des-ede3-ofb> | ||
206 | |||
207 | Triple-DES Cipher | ||
208 | |||
209 | =item B<idea idea-cbc idea-cfb idea-ecb idea-ofb> | ||
210 | |||
211 | IDEA Cipher | ||
212 | |||
213 | =item B<rc2 rc2-cbc rc2-cfb rc2-ecb rc2-ofb> | ||
214 | |||
215 | RC2 Cipher | ||
216 | |||
217 | =item B<rc4> | ||
218 | |||
219 | RC4 Cipher | ||
220 | |||
221 | =item B<rc5 rc5-cbc rc5-cfb rc5-ecb rc5-ofb> | ||
222 | |||
223 | RC5 Cipher | ||
224 | |||
225 | =back | ||
226 | |||
227 | =head1 DETAILED COMMAND DESCRIPTION | ||
228 | |||
229 | The following is a detailed description of every B<openssl> I<command>. | ||
230 | |||
231 | =over 4 | ||
232 | |||
233 | =item B<openssl> B<s_client> | ||
234 | [B<-connect> I<host>B<:>I<port>] | ||
235 | [B<-verify> I<arg>] | ||
236 | [B<-cert> I<arg>] | ||
237 | [B<-key> I<arg>] | ||
238 | [B<-CApath> I<arg>] | ||
239 | [B<-CAfile> I<arg>] | ||
240 | [B<-reconnect>] | ||
241 | [B<-pause>] | ||
242 | [B<-debug>] | ||
243 | [B<-nbio_test>] | ||
244 | [B<-state>] | ||
245 | [B<-nbio>] | ||
246 | [B<-quiet>] | ||
247 | [B<-ssl2>] | ||
248 | [B<-ssl3>] | ||
249 | [B<-tls1>] | ||
250 | [B<-no_ssl2>] | ||
251 | [B<-no_ssl3>] | ||
252 | [B<-no_tls1>] | ||
253 | [B<-bugs>] | ||
254 | [B<-cipher>] | ||
255 | |||
256 | The B<s_client> command implements a generic SSL/TLS client which can | ||
257 | establish a transparent connection to a remote I<host> and I<port> speaking | ||
258 | SSL/TLS. | ||
259 | |||
260 | =item B<openssl> B<s_server> | ||
261 | [B<-accept> I<port>] | ||
262 | [B<-verify> I<arg>] | ||
263 | [B<-Verify> I<arg>] | ||
264 | [B<-cert> I<arg>] | ||
265 | [B<-key> I<arg>] | ||
266 | [B<-dcert> I<arg>] | ||
267 | [B<-dkey> I<arg>] | ||
268 | [B<-nbio>] | ||
269 | [B<-nbio_test>] | ||
270 | [B<-debug>] | ||
271 | [B<-state>] | ||
272 | [B<-CApath> I<arg>] | ||
273 | [B<-CAfile> I<arg>] | ||
274 | [B<-nocert>] | ||
275 | [B<-cipher> I<arg>] | ||
276 | [B<-quiet>] | ||
277 | [B<-no_tmp_rsa>] | ||
278 | [B<-ssl2>] | ||
279 | [B<-ssl3>] | ||
280 | [B<-tls1>] | ||
281 | [B<-no_ssl2>] | ||
282 | [B<-no_ssl3>] | ||
283 | [B<-no_tls1>] | ||
284 | [B<-bugs>] | ||
285 | [B<-www>] | ||
286 | [B<-WWW>] | ||
287 | |||
288 | The B<s_server> command implements a generic SSL/TLS server which accepts | ||
289 | connections from remote clients on I<port> speaking SSL/TLS. | ||
290 | |||
291 | =back | ||
292 | |||
293 | ... | ||
294 | |||
295 | =head1 SEE ALSO | ||
296 | |||
297 | crypto(3), ssl(3) | ||
298 | |||
299 | =head1 HISTORY | ||
300 | |||
301 | The openssl(3) document appeared in OpenSSL 0.9.2 | ||
302 | |||
303 | =cut | ||
304 | |||
diff --git a/src/lib/libssl/src/doc/openssl.txt b/src/lib/libssl/src/doc/openssl.txt index 91b85e5f14..880eace4da 100644 --- a/src/lib/libssl/src/doc/openssl.txt +++ b/src/lib/libssl/src/doc/openssl.txt | |||
@@ -1,53 +1,12 @@ | |||
1 | 1 | ||
2 | This is some preliminary documentation for OpenSSL. | 2 | This is some preliminary documentation for OpenSSL. |
3 | 3 | ||
4 | ============================================================================== | 4 | Contents: |
5 | BUFFER Library | ||
6 | ============================================================================== | ||
7 | |||
8 | The buffer library handles simple character arrays. Buffers are used for | ||
9 | various purposes in the library, most notably memory BIOs. | ||
10 | |||
11 | The library uses the BUF_MEM structure defined in buffer.h: | ||
12 | |||
13 | typedef struct buf_mem_st | ||
14 | { | ||
15 | int length; /* current number of bytes */ | ||
16 | char *data; | ||
17 | int max; /* size of buffer */ | ||
18 | } BUF_MEM; | ||
19 | |||
20 | 'length' is the current size of the buffer in bytes, 'max' is the amount of | ||
21 | memory allocated to the buffer. There are three functions which handle these | ||
22 | and one "miscellaneous" function. | ||
23 | |||
24 | BUF_MEM *BUF_MEM_new() | ||
25 | |||
26 | This allocates a new buffer of zero size. Returns the buffer or NULL on error. | ||
27 | |||
28 | void BUF_MEM_free(BUF_MEM *a) | ||
29 | |||
30 | This frees up an already existing buffer. The data is zeroed before freeing | ||
31 | up in case the buffer contains sensitive data. | ||
32 | |||
33 | int BUF_MEM_grow(BUF_MEM *str, int len) | ||
34 | |||
35 | This changes the size of an already existing buffer. It returns zero on error | ||
36 | or the new size (i.e. 'len'). Any data already in the buffer is preserved if | ||
37 | it increases in size. | ||
38 | |||
39 | char * BUF_strdup(char *str) | ||
40 | 5 | ||
41 | This is the previously mentioned strdup function: like the standard library | 6 | OpenSSL X509V3 extension configuration |
42 | strdup() it copies a null terminated string into a block of allocated memory | 7 | X509V3 Extension code: programmers guide |
43 | and returns a pointer to the allocated block. | 8 | PKCS#12 Library |
44 | 9 | ||
45 | Unlike the standard C library strdup() this function uses Malloc() and so | ||
46 | should be used in preference to the standard library strdup() because it can | ||
47 | be used for memory leak checking or replacing the malloc() function. | ||
48 | |||
49 | The memory allocated from BUF_strdup() should be freed up using the Free() | ||
50 | function. | ||
51 | 10 | ||
52 | ============================================================================== | 11 | ============================================================================== |
53 | OpenSSL X509V3 extension configuration | 12 | OpenSSL X509V3 extension configuration |
@@ -188,7 +147,7 @@ email.1=steve@here | |||
188 | email.2=steve@there | 147 | email.2=steve@there |
189 | 148 | ||
190 | This is because the configuration file code cannot handle the same name | 149 | This is because the configuration file code cannot handle the same name |
191 | occurring twice in the same extension. | 150 | occurring twice in the same section. |
192 | 151 | ||
193 | The syntax of raw extensions is governed by the extension code: it can | 152 | The syntax of raw extensions is governed by the extension code: it can |
194 | for example contain data in multiple sections. The correct syntax to | 153 | for example contain data in multiple sections. The correct syntax to |
@@ -315,6 +274,41 @@ TRUE. An end user certificate MUST NOT have the CA value set to true. | |||
315 | According to PKIX recommendations it should exclude the extension entirely, | 274 | According to PKIX recommendations it should exclude the extension entirely, |
316 | however some software may require CA set to FALSE for end entity certificates. | 275 | however some software may require CA set to FALSE for end entity certificates. |
317 | 276 | ||
277 | Extended Key Usage. | ||
278 | |||
279 | This extensions consists of a list of usages. | ||
280 | |||
281 | These can either be object short names of the dotted numerical form of OIDs. | ||
282 | While any OID can be used only certain values make sense. In particular the | ||
283 | following PKIX, NS and MS values are meaningful: | ||
284 | |||
285 | Value Meaning | ||
286 | ----- ------- | ||
287 | serverAuth SSL/TLS Web Server Authentication. | ||
288 | clientAuth SSL/TLS Web Client Authentication. | ||
289 | codeSigning Code signing. | ||
290 | emailProtection E-mail Protection (S/MIME). | ||
291 | timeStamping Trusted Timestamping | ||
292 | msCodeInd Microsoft Individual Code Signing (authenticode) | ||
293 | msCodeCom Microsoft Commercial Code Signing (authenticode) | ||
294 | msCTLSign Microsoft Trust List Signing | ||
295 | msSGC Microsoft Server Gated Crypto | ||
296 | msEFS Microsoft Encrypted File System | ||
297 | nsSGC Netscape Server Gated Crypto | ||
298 | |||
299 | For example, under IE5 a CA can be used for any purpose: by including a list | ||
300 | of the above usages the CA can be restricted to only authorised uses. | ||
301 | |||
302 | Note: software packages may place additional interpretations on certificate | ||
303 | use, in particular some usages may only work for selected CAs. Don't for example | ||
304 | expect just including msSGC or nsSGC will automatically mean that a certificate | ||
305 | can be used for SGC ("step up" encryption) otherwise anyone could use it. | ||
306 | |||
307 | Examples: | ||
308 | |||
309 | extendedKeyUsage=critical,codeSigning,1.2.3.4 | ||
310 | extendedKeyUsage=nsSGC,msSGC | ||
311 | |||
318 | Subject Key Identifier. | 312 | Subject Key Identifier. |
319 | 313 | ||
320 | This is really a string extension and can take two possible values. Either | 314 | This is really a string extension and can take two possible values. Either |
@@ -459,16 +453,16 @@ extension in a human or machine readable form. | |||
459 | 453 | ||
460 | 1. Initialisation and cleanup. | 454 | 1. Initialisation and cleanup. |
461 | 455 | ||
462 | X509V3_add_standard_extensions(); | 456 | No special initialisation is needed before calling the extension functions. |
463 | 457 | You used to have to call X509V3_add_standard_extensions(); but this is no longer | |
464 | This function should be called before any other extension code. It adds support | 458 | required and this function no longer does anything. |
465 | for some common PKIX and Netscape extensions. Additional custom extensions can | ||
466 | be added as well (see later). | ||
467 | 459 | ||
468 | void X509V3_EXT_cleanup(void); | 460 | void X509V3_EXT_cleanup(void); |
469 | 461 | ||
470 | This function should be called last to cleanup the extension code. After this | 462 | This function should be called to cleanup the extension code if any custom |
471 | call no other extension calls should be made. | 463 | extensions have been added. If no custom extensions have been added then this |
464 | call does nothing. After this call all custom extension code is freed up but | ||
465 | you can still use the standard extensions. | ||
472 | 466 | ||
473 | 2. Printing and parsing extensions. | 467 | 2. Printing and parsing extensions. |
474 | 468 | ||
@@ -512,7 +506,7 @@ or CRL is due to be signed. Both return 0 on error on non zero for success. | |||
512 | In each case 'conf' is the LHASH pointer of the configuration file to use | 506 | In each case 'conf' is the LHASH pointer of the configuration file to use |
513 | and 'section' is the section containing the extension details. | 507 | and 'section' is the section containing the extension details. |
514 | 508 | ||
515 | See the 'context functions' section for a description of the ctx paramater. | 509 | See the 'context functions' section for a description of the ctx parameter. |
516 | 510 | ||
517 | 511 | ||
518 | X509_EXTENSION *X509V3_EXT_conf(LHASH *conf, X509V3_CTX *ctx, char *name, | 512 | X509_EXTENSION *X509V3_EXT_conf(LHASH *conf, X509V3_CTX *ctx, char *name, |
@@ -531,7 +525,7 @@ takes the NID of the extension rather than its name. | |||
531 | For example to produce basicConstraints with the CA flag and a path length of | 525 | For example to produce basicConstraints with the CA flag and a path length of |
532 | 10: | 526 | 10: |
533 | 527 | ||
534 | x = X509V3_EXT_conf_nid(NULL, NULL, NID_basicConstraints, "CA:TRUE,pathlen:10"); | 528 | x = X509V3_EXT_conf_nid(NULL, NULL, NID_basic_constraints,"CA:TRUE,pathlen:10"); |
535 | 529 | ||
536 | 530 | ||
537 | X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc); | 531 | X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc); |
@@ -659,7 +653,7 @@ The same as above but for an unsigned character value. | |||
659 | int X509V3_add_value_bool(const char *name, int asn1_bool, | 653 | int X509V3_add_value_bool(const char *name, int asn1_bool, |
660 | STACK_OF(CONF_VALUE) **extlist); | 654 | STACK_OF(CONF_VALUE) **extlist); |
661 | 655 | ||
662 | This adds either "TRUE" or "FALSE" depending on the value of 'ans1_bool' | 656 | This adds either "TRUE" or "FALSE" depending on the value of 'asn1_bool' |
663 | 657 | ||
664 | int X509V3_add_value_bool_nf(char *name, int asn1_bool, | 658 | int X509V3_add_value_bool_nf(char *name, int asn1_bool, |
665 | STACK_OF(CONF_VALUE) **extlist); | 659 | STACK_OF(CONF_VALUE) **extlist); |
@@ -686,7 +680,7 @@ Multi value extensions are passed a STACK_OF(CONF_VALUE) name and value pairs | |||
686 | or return a STACK_OF(CONF_VALUE). | 680 | or return a STACK_OF(CONF_VALUE). |
687 | 681 | ||
688 | Raw extensions are just passed a BIO or a value and it is the extensions | 682 | Raw extensions are just passed a BIO or a value and it is the extensions |
689 | responsiblity to handle all the necessary printing. | 683 | responsibility to handle all the necessary printing. |
690 | 684 | ||
691 | There are two ways to add an extension. One is simply as an alias to an already | 685 | There are two ways to add an extension. One is simply as an alias to an already |
692 | existing extension. An alias is an extension that is identical in ASN1 structure | 686 | existing extension. An alias is an extension that is identical in ASN1 structure |
@@ -811,7 +805,7 @@ int i2r(struct v3_ext_method *method, void *ext, BIO *out, int indent); | |||
811 | 805 | ||
812 | This function is passed the internal extension structure in the ext parameter | 806 | This function is passed the internal extension structure in the ext parameter |
813 | and sends out a human readable version of the extension to out. The 'indent' | 807 | and sends out a human readable version of the extension to out. The 'indent' |
814 | paremeter should be noted to determine the necessary amount of indentation | 808 | parameter should be noted to determine the necessary amount of indentation |
815 | needed on the output. | 809 | needed on the output. |
816 | 810 | ||
817 | void * r2i(struct v3_ext_method *method, struct v3_ext_ctx *ctx, char *str); | 811 | void * r2i(struct v3_ext_method *method, struct v3_ext_ctx *ctx, char *str); |
@@ -882,7 +876,7 @@ d2i_PKCS12_fp(fp, p12) | |||
882 | 876 | ||
883 | This is the same but for a FILE pointer. | 877 | This is the same but for a FILE pointer. |
884 | 878 | ||
885 | 3. Parsing and creation functions. | 879 | 3. High level functions. |
886 | 880 | ||
887 | 3.1 Parsing with PKCS12_parse(). | 881 | 3.1 Parsing with PKCS12_parse(). |
888 | 882 | ||
@@ -920,6 +914,14 @@ p12 = PKCS12_create(pass, "My Certificate", pkey, cert, NULL, 0,0,0,0,0); | |||
920 | i2d_PKCS12_fp(fp, p12); | 914 | i2d_PKCS12_fp(fp, p12); |
921 | PKCS12_free(p12); | 915 | PKCS12_free(p12); |
922 | 916 | ||
917 | 3.3 Changing a PKCS#12 structure password. | ||
918 | |||
919 | int PKCS12_newpass(PKCS12 *p12, char *oldpass, char *newpass); | ||
920 | |||
921 | This changes the password of an already existing PKCS#12 structure. oldpass | ||
922 | is the old password and newpass is the new one. An error occurs if the old | ||
923 | password is incorrect. | ||
924 | |||
923 | LOW LEVEL FUNCTIONS. | 925 | LOW LEVEL FUNCTIONS. |
924 | 926 | ||
925 | In some cases the high level functions do not provide the necessary | 927 | In some cases the high level functions do not provide the necessary |
diff --git a/src/lib/libssl/src/doc/ssl.pod b/src/lib/libssl/src/doc/ssl.pod index 46ee443f57..e69de29bb2 100644 --- a/src/lib/libssl/src/doc/ssl.pod +++ b/src/lib/libssl/src/doc/ssl.pod | |||
@@ -1,633 +0,0 @@ | |||
1 | |||
2 | =pod | ||
3 | |||
4 | =head1 NAME | ||
5 | |||
6 | SSL - OpenSSL SSL/TLS library | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | =head1 DESCRIPTION | ||
11 | |||
12 | The OpenSSL B<ssl> library implements the Secure Sockets Layer (SSL v2/v3) and | ||
13 | Transport Layer Security (TLS v1) protocols. It provides a rich API which is | ||
14 | documented here. | ||
15 | |||
16 | =head1 HEADER FILES | ||
17 | |||
18 | Currently the OpenSSL B<ssl> library provides the following C header files | ||
19 | containing the prototypes for the data structures and and functions: | ||
20 | |||
21 | =over 4 | ||
22 | |||
23 | =item B<ssl.h> | ||
24 | |||
25 | That's the common header file for the SSL/TLS API. Include it into your | ||
26 | program to make the API of the B<ssl> library available. It internally | ||
27 | includes both more private SSL headers and headers from the B<crypto> library. | ||
28 | Whenever you need hard-core details on the internals of the SSL API, look | ||
29 | inside this header file. | ||
30 | |||
31 | =item B<ssl2.h> | ||
32 | |||
33 | That's the sub header file dealing with the SSLv2 protocol only. | ||
34 | I<Usually you don't have to include it explicitly because | ||
35 | it's already included by ssl.h>. | ||
36 | |||
37 | =item B<ssl3.h> | ||
38 | |||
39 | That's the sub header file dealing with the SSLv3 protocol only. | ||
40 | I<Usually you don't have to include it explicitly because | ||
41 | it's already included by ssl.h>. | ||
42 | |||
43 | =item B<ssl23.h> | ||
44 | |||
45 | That's the sub header file dealing with the combined use of the SSLv2 and | ||
46 | SSLv3 protocols. | ||
47 | I<Usually you don't have to include it explicitly because | ||
48 | it's already included by ssl.h>. | ||
49 | |||
50 | =item B<tls1.h> | ||
51 | |||
52 | That's the sub header file dealing with the TLSv1 protocol only. | ||
53 | I<Usually you don't have to include it explicitly because | ||
54 | it's already included by ssl.h>. | ||
55 | |||
56 | =back | ||
57 | |||
58 | =head1 DATA STRUCTURES | ||
59 | |||
60 | Currently the OpenSSL B<ssl> library functions deals with the following data | ||
61 | structures: | ||
62 | |||
63 | =over 4 | ||
64 | |||
65 | =item B<SSL_METHOD> (SSL Method) | ||
66 | |||
67 | That's a dispatch structure describing the internal B<ssl> library | ||
68 | methods/functions which implement the various protocol versions (SSLv1, SSLv2 | ||
69 | and TLSv1). It's needed to create an B<SSL_CTX>. | ||
70 | |||
71 | =item B<SSL_CIPHER> (SSL Cipher) | ||
72 | |||
73 | This structure holds the algorithm information for a particular cipher which | ||
74 | are a core part of the SSL/TLS protocol. The available ciphers are configured | ||
75 | on a B<SSL_CTX> basis and the actually used ones are then part of the | ||
76 | B<SSL_SESSION>. | ||
77 | |||
78 | =item B<SSL_CTX> (SSL Context) | ||
79 | |||
80 | That's the global context structure which is created by a server or client | ||
81 | once per program life-time and which holds mainly default values for the | ||
82 | B<SSL> structures which are later created for the connections. | ||
83 | |||
84 | =item B<SSL_SESSION> (SSL Session) | ||
85 | |||
86 | This is a structure containing the current SSL session details for a | ||
87 | connection: B<SSL_CIPHER>s, client and server certificates, keys, etc. | ||
88 | |||
89 | =item B<SSL> (SSL Connection) | ||
90 | |||
91 | That's the main SSL/TLS structure which is created by a server or client per | ||
92 | established connection. This actually is the core structure in the SSL API. | ||
93 | Under run-time the application usually deals with this structure which has | ||
94 | links to mostly all other structures. | ||
95 | |||
96 | =back | ||
97 | |||
98 | =head1 API FUNCTIONS | ||
99 | |||
100 | Currently the OpenSSL B<ssl> library exports 214 API functions. | ||
101 | They are documented in the following: | ||
102 | |||
103 | =head2 DEALING WITH PROTOCOL METHODS | ||
104 | |||
105 | Here we document the various API functions which deal with the SSL/TLS | ||
106 | protocol methods defined in B<SSL_METHOD> structures. | ||
107 | |||
108 | =over 4 | ||
109 | |||
110 | =item SSL_METHOD *B<SSLv2_client_method>(void); | ||
111 | |||
112 | Constructor for the SSLv2 SSL_METHOD structure for a dedicated client. | ||
113 | |||
114 | =item SSL_METHOD *B<SSLv2_server_method>(void); | ||
115 | |||
116 | Constructor for the SSLv2 SSL_METHOD structure for a dedicated server. | ||
117 | |||
118 | =item SSL_METHOD *B<SSLv2_method>(void); | ||
119 | |||
120 | Constructor for the SSLv2 SSL_METHOD structure for combined client and server. | ||
121 | |||
122 | =item SSL_METHOD *B<SSLv3_client_method>(void); | ||
123 | |||
124 | Constructor for the SSLv3 SSL_METHOD structure for a dedicated client. | ||
125 | |||
126 | =item SSL_METHOD *B<SSLv3_server_method>(void); | ||
127 | |||
128 | Constructor for the SSLv3 SSL_METHOD structure for a dedicated server. | ||
129 | |||
130 | =item SSL_METHOD *B<SSLv3_method>(void); | ||
131 | |||
132 | Constructor for the SSLv3 SSL_METHOD structure for combined client and server. | ||
133 | |||
134 | =item SSL_METHOD *B<TLSv1_client_method>(void); | ||
135 | |||
136 | Constructor for the TLSv1 SSL_METHOD structure for a dedicated client. | ||
137 | |||
138 | =item SSL_METHOD *B<TLSv1_server_method>(void); | ||
139 | |||
140 | Constructor for the TLSv1 SSL_METHOD structure for a dedicated server. | ||
141 | |||
142 | =item SSL_METHOD *B<TLSv1_method>(void); | ||
143 | |||
144 | Constructor for the TLSv1 SSL_METHOD structure for combined client and server. | ||
145 | |||
146 | =back | ||
147 | |||
148 | =head2 DEALING WITH CIPHERS | ||
149 | |||
150 | Here we document the various API functions which deal with the SSL/TLS | ||
151 | ciphers defined in B<SSL_CIPHER> structures. | ||
152 | |||
153 | =over 4 | ||
154 | |||
155 | =item char *B<SSL_CIPHER_description>(SSL_CIPHER *cipher, char *buf, int len); | ||
156 | |||
157 | Write a string to I<buf> (with a maximum size of I<len>) containing a human | ||
158 | readable description of I<cipher>. Returns I<buf>. | ||
159 | |||
160 | =item int B<SSL_CIPHER_get_bits>(SSL_CIPHER *cipher, int *alg_bits); | ||
161 | |||
162 | 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 | ||
164 | I<alg_bits>) and the bits which are actually used (the return value). | ||
165 | |||
166 | =item char *B<SSL_CIPHER_get_name>(SSL_CIPHER *cipher); | ||
167 | |||
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> | ||
170 | definitions in the header files. | ||
171 | |||
172 | =item char *B<SSL_CIPHER_get_version>(SSL_CIPHER *cipher); | ||
173 | |||
174 | Returns a string like "C<TLSv1/SSLv3>" or "C<SSLv2>" which indicates the | ||
175 | SSL/TLS protocol version to which I<cipher> belongs (i.e. where it was defined | ||
176 | in the specification the first time). | ||
177 | |||
178 | =back | ||
179 | |||
180 | =head2 DEALING WITH PROTOCOL CONTEXTS | ||
181 | |||
182 | Here we document the various API functions which deal with the SSL/TLS | ||
183 | protocol context defined in the B<SSL_CTX> structure. | ||
184 | |||
185 | =over 4 | ||
186 | |||
187 | =item int B<SSL_CTX_add_client_CA>(SSL_CTX *ctx, X509 *x); | ||
188 | |||
189 | =item long B<SSL_CTX_add_extra_chain_cert>(SSL_CTX *ctx, X509 *x509); | ||
190 | |||
191 | =item int B<SSL_CTX_add_session>(SSL_CTX *ctx, SSL_SESSION *c); | ||
192 | |||
193 | =item int B<SSL_CTX_check_private_key>(SSL_CTX *ctx); | ||
194 | |||
195 | =item long B<SSL_CTX_ctrl>(SSL_CTX *ctx, int cmd, long larg, char *parg); | ||
196 | |||
197 | =item void B<SSL_CTX_flush_sessions>(SSL_CTX *s, long t); | ||
198 | |||
199 | =item void B<SSL_CTX_free>(SSL_CTX *a); | ||
200 | |||
201 | =item char *B<SSL_CTX_get_app_data>(SSL_CTX *ctx); | ||
202 | |||
203 | =item X509_STORE *B<SSL_CTX_get_cert_store>(SSL_CTX *ctx); | ||
204 | |||
205 | =item STACK *B<SSL_CTX_get_client_CA_list>(SSL_CTX *ctx); | ||
206 | |||
207 | =item int (*B<SSL_CTX_get_client_cert_cb>(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey); | ||
208 | |||
209 | =item char *B<SSL_CTX_get_ex_data>(SSL_CTX *s, int idx); | ||
210 | |||
211 | =item int B<SSL_CTX_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) | ||
212 | |||
213 | =item void (*B<SSL_CTX_get_info_callback>(SSL_CTX *ctx))(SSL *ssl, int cb, int ret); | ||
214 | |||
215 | =item int B<SSL_CTX_get_quiet_shutdown>(SSL_CTX *ctx); | ||
216 | |||
217 | =item int B<SSL_CTX_get_session_cache_mode>(SSL_CTX *ctx); | ||
218 | |||
219 | =item long B<SSL_CTX_get_timeout>(SSL_CTX *ctx); | ||
220 | |||
221 | =item int (*B<SSL_CTX_get_verify_callback>(SSL_CTX *ctx))(int ok, X509_STORE_CTX *ctx); | ||
222 | |||
223 | =item int B<SSL_CTX_get_verify_mode>(SSL_CTX *ctx); | ||
224 | |||
225 | =item int B<SSL_CTX_load_verify_locations>(SSL_CTX *ctx, char *CAfile, char *CApath); | ||
226 | |||
227 | =item long B<SSL_CTX_need_tmp_RSA>(SSL_CTX *ctx); | ||
228 | |||
229 | =item SSL_CTX *B<SSL_CTX_new>(SSL_METHOD *meth); | ||
230 | |||
231 | =item int B<SSL_CTX_remove_session>(SSL_CTX *ctx, SSL_SESSION *c); | ||
232 | |||
233 | =item int B<SSL_CTX_sess_accept>(SSL_CTX *ctx); | ||
234 | |||
235 | =item int B<SSL_CTX_sess_accept_good>(SSL_CTX *ctx); | ||
236 | |||
237 | =item int B<SSL_CTX_sess_accept_renegotiate>(SSL_CTX *ctx); | ||
238 | |||
239 | =item int B<SSL_CTX_sess_cache_full>(SSL_CTX *ctx); | ||
240 | |||
241 | =item int B<SSL_CTX_sess_cb_hits>(SSL_CTX *ctx); | ||
242 | |||
243 | =item int B<SSL_CTX_sess_connect>(SSL_CTX *ctx); | ||
244 | |||
245 | =item int B<SSL_CTX_sess_connect_good>(SSL_CTX *ctx); | ||
246 | |||
247 | =item int B<SSL_CTX_sess_connect_renegotiate>(SSL_CTX *ctx); | ||
248 | |||
249 | =item int B<SSL_CTX_sess_get_cache_size>(SSL_CTX *ctx); | ||
250 | |||
251 | =item SSL_SESSION *(*B<SSL_CTX_sess_get_get_cb>(SSL_CTX *ctx))(SSL *ssl, unsigned char *data, int len, int *copy); | ||
252 | |||
253 | =item int (*B<SSL_CTX_sess_get_new_cb>(SSL_CTX *ctx)(SSL *ssl, SSL_SESSION *sess); | ||
254 | |||
255 | =item void (*B<SSL_CTX_sess_get_remove_cb>(SSL_CTX *ctx)(SSL_CTX *ctx, SSL_SESSION *sess); | ||
256 | |||
257 | =item int B<SSL_CTX_sess_hits>(SSL_CTX *ctx); | ||
258 | |||
259 | =item int B<SSL_CTX_sess_misses>(SSL_CTX *ctx); | ||
260 | |||
261 | =item int B<SSL_CTX_sess_number>(SSL_CTX *ctx); | ||
262 | |||
263 | =item void B<SSL_CTX_sess_set_cache_size>(SSL_CTX *ctx,t); | ||
264 | |||
265 | =item void B<SSL_CTX_sess_set_get_cb>(SSL_CTX *ctx, SSL_SESSION *(*cb)(SSL *ssl, unsigned char *data, int len, int *copy)); | ||
266 | |||
267 | =item void B<SSL_CTX_sess_set_new_cb>(SSL_CTX *ctx, int (*cb)(SSL *ssl, SSL_SESSION *sess)); | ||
268 | |||
269 | =item void B<SSL_CTX_sess_set_remove_cb>(SSL_CTX *ctx, void (*cb)(SSL_CTX *ctx, SSL_SESSION *sess)); | ||
270 | |||
271 | =item int B<SSL_CTX_sess_timeouts>(SSL_CTX *ctx); | ||
272 | |||
273 | =item LHASH *B<SSL_CTX_sessions>(SSL_CTX *ctx); | ||
274 | |||
275 | =item void B<SSL_CTX_set_app_data>(SSL_CTX *ctx, void *arg); | ||
276 | |||
277 | =item void B<SSL_CTX_set_cert_store>(SSL_CTX *ctx, X509_STORE *cs); | ||
278 | |||
279 | =item void B<SSL_CTX_set_cert_verify_cb>(SSL_CTX *ctx, int (*cb)(SSL_CTX *), char *arg) | ||
280 | |||
281 | =item int B<SSL_CTX_set_cipher_list>(SSL_CTX *ctx, char *str); | ||
282 | |||
283 | =item void B<SSL_CTX_set_client_CA_list>(SSL_CTX *ctx, STACK *list); | ||
284 | |||
285 | =item void B<SSL_CTX_set_client_cert_cb>(SSL_CTX *ctx, int (*cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)); | ||
286 | |||
287 | =item void B<SSL_CTX_set_default_passwd_cb>(SSL_CTX *ctx, int (*cb);(void)) | ||
288 | |||
289 | =item void B<SSL_CTX_set_default_read_ahead>(SSL_CTX *ctx, int m); | ||
290 | |||
291 | =item int B<SSL_CTX_set_default_verify_paths>(SSL_CTX *ctx); | ||
292 | |||
293 | =item int B<SSL_CTX_set_ex_data>(SSL_CTX *s, int idx, char *arg); | ||
294 | |||
295 | =item void B<SSL_CTX_set_info_callback>(SSL_CTX *ctx, void (*cb)(SSL *ssl, int cb, int ret)); | ||
296 | |||
297 | =item void B<SSL_CTX_set_options>(SSL_CTX *ctx, unsigned long op); | ||
298 | |||
299 | =item void B<SSL_CTX_set_quiet_shutdown>(SSL_CTX *ctx, int mode); | ||
300 | |||
301 | =item void B<SSL_CTX_set_session_cache_mode>(SSL_CTX *ctx, int mode); | ||
302 | |||
303 | =item int B<SSL_CTX_set_ssl_version>(SSL_CTX *ctx, SSL_METHOD *meth); | ||
304 | |||
305 | =item void B<SSL_CTX_set_timeout>(SSL_CTX *ctx, long t); | ||
306 | |||
307 | =item long B<SSL_CTX_set_tmp_dh>(SSL_CTX* ctx, DH *dh); | ||
308 | |||
309 | =item long B<SSL_CTX_set_tmp_dh_callback>(SSL_CTX *ctx, DH *(*cb)(void)); | ||
310 | |||
311 | =item long B<SSL_CTX_set_tmp_rsa>(SSL_CTX *ctx, RSA *rsa); | ||
312 | |||
313 | =item SSL_CTX_set_tmp_rsa_callback | ||
314 | |||
315 | C<long B<SSL_CTX_set_tmp_rsa_callback>(SSL_CTX *B<ctx>, RSA *(*B<cb>)(SSL *B<ssl>, int B<export>, int B<keylength>));> | ||
316 | |||
317 | Sets the callback which will be called when a temporary private key is | ||
318 | required. The B<C<export>> flag will be set if the reason for needing | ||
319 | a temp key is that an export ciphersuite is in use, in which case, | ||
320 | B<C<keylength>> will contain the required keylength in bits. Generate a key of | ||
321 | appropriate size (using ???) and return it. | ||
322 | |||
323 | =item SSL_set_tmp_rsa_callback | ||
324 | |||
325 | long B<SSL_set_tmp_rsa_callback>(SSL *ssl, RSA *(*cb)(SSL *ssl, int export, int keylength)); | ||
326 | |||
327 | The same as L<"SSL_CTX_set_tmp_rsa_callback">, except it operates on an SSL | ||
328 | session instead of a context. | ||
329 | |||
330 | =item void B<SSL_CTX_set_verify>(SSL_CTX *ctx, int mode, int (*cb);(void)) | ||
331 | |||
332 | =item int B<SSL_CTX_use_PrivateKey>(SSL_CTX *ctx, EVP_PKEY *pkey); | ||
333 | |||
334 | =item int B<SSL_CTX_use_PrivateKey_ASN1>(int type, SSL_CTX *ctx, unsigned char *d, long len); | ||
335 | |||
336 | =item int B<SSL_CTX_use_PrivateKey_file>(SSL_CTX *ctx, char *file, int type); | ||
337 | |||
338 | =item int B<SSL_CTX_use_RSAPrivateKey>(SSL_CTX *ctx, RSA *rsa); | ||
339 | |||
340 | =item int B<SSL_CTX_use_RSAPrivateKey_ASN1>(SSL_CTX *ctx, unsigned char *d, long len); | ||
341 | |||
342 | =item int B<SSL_CTX_use_RSAPrivateKey_file>(SSL_CTX *ctx, char *file, int type); | ||
343 | |||
344 | =item int B<SSL_CTX_use_certificate>(SSL_CTX *ctx, X509 *x); | ||
345 | |||
346 | =item int B<SSL_CTX_use_certificate_ASN1>(SSL_CTX *ctx, int len, unsigned char *d); | ||
347 | |||
348 | =item int B<SSL_CTX_use_certificate_file>(SSL_CTX *ctx, char *file, int type); | ||
349 | |||
350 | =back | ||
351 | |||
352 | =head2 DEALING WITH SESSIONS | ||
353 | |||
354 | Here we document the various API functions which deal with the SSL/TLS | ||
355 | sessions defined in the B<SSL_SESSION> structures. | ||
356 | |||
357 | =over 4 | ||
358 | |||
359 | =item int B<SSL_SESSION_cmp>(SSL_SESSION *a, SSL_SESSION *b); | ||
360 | |||
361 | =item void B<SSL_SESSION_free>(SSL_SESSION *ss); | ||
362 | |||
363 | =item char *B<SSL_SESSION_get_app_data>(SSL_SESSION *s); | ||
364 | |||
365 | =item char *B<SSL_SESSION_get_ex_data>(SSL_SESSION *s, int idx); | ||
366 | |||
367 | =item int B<SSL_SESSION_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) | ||
368 | |||
369 | =item long B<SSL_SESSION_get_time>(SSL_SESSION *s); | ||
370 | |||
371 | =item long B<SSL_SESSION_get_timeout>(SSL_SESSION *s); | ||
372 | |||
373 | =item unsigned long B<SSL_SESSION_hash>(SSL_SESSION *a); | ||
374 | |||
375 | =item SSL_SESSION *B<SSL_SESSION_new>(void); | ||
376 | |||
377 | =item int B<SSL_SESSION_print>(BIO *bp, SSL_SESSION *x); | ||
378 | |||
379 | =item int B<SSL_SESSION_print_fp>(FILE *fp, SSL_SESSION *x); | ||
380 | |||
381 | =item void B<SSL_SESSION_set_app_data>(SSL_SESSION *s, char *a); | ||
382 | |||
383 | =item int B<SSL_SESSION_set_ex_data>(SSL_SESSION *s, int idx, char *arg); | ||
384 | |||
385 | =item long B<SSL_SESSION_set_time>(SSL_SESSION *s, long t); | ||
386 | |||
387 | =item long B<SSL_SESSION_set_timeout>(SSL_SESSION *s, long t); | ||
388 | |||
389 | =back | ||
390 | |||
391 | =head2 DEALING WITH CONNECTIONS | ||
392 | |||
393 | Here we document the various API functions which deal with the SSL/TLS | ||
394 | connection defined in the B<SSL> structure. | ||
395 | |||
396 | =over 4 | ||
397 | |||
398 | =item int B<SSL_accept>(SSL *ssl); | ||
399 | |||
400 | =item int B<SSL_add_dir_cert_subjects_to_stack>(STACK *stack, const char *dir); | ||
401 | |||
402 | =item int B<SSL_add_file_cert_subjects_to_stack>(STACK *stack, const char *file); | ||
403 | |||
404 | =item int B<SSL_add_client_CA>(SSL *ssl, X509 *x); | ||
405 | |||
406 | =item char *B<SSL_alert_desc_string>(int value); | ||
407 | |||
408 | =item char *B<SSL_alert_desc_string_long>(int value); | ||
409 | |||
410 | =item char *B<SSL_alert_type_string>(int value); | ||
411 | |||
412 | =item char *B<SSL_alert_type_string_long>(int value); | ||
413 | |||
414 | =item int B<SSL_check_private_key>(SSL *ssl); | ||
415 | |||
416 | =item void B<SSL_clear>(SSL *ssl); | ||
417 | |||
418 | =item long B<SSL_clear_num_renegotiations>(SSL *ssl); | ||
419 | |||
420 | =item int B<SSL_connect>(SSL *ssl); | ||
421 | |||
422 | =item void B<SSL_copy_session_id>(SSL *t, SSL *f); | ||
423 | |||
424 | =item long B<SSL_ctrl>(SSL *ssl, int cmd, long larg, char *parg); | ||
425 | |||
426 | =item int B<SSL_do_handshake>(SSL *ssl); | ||
427 | |||
428 | =item SSL *B<SSL_dup>(SSL *ssl); | ||
429 | |||
430 | =item STACK *B<SSL_dup_CA_list>(STACK *sk); | ||
431 | |||
432 | =item void B<SSL_free>(SSL *ssl); | ||
433 | |||
434 | =item SSL_CTX *B<SSL_get_SSL_CTX>(SSL *ssl); | ||
435 | |||
436 | =item char *B<SSL_get_app_data>(SSL *ssl); | ||
437 | |||
438 | =item X509 *B<SSL_get_certificate>(SSL *ssl); | ||
439 | |||
440 | =item SSL_CIPHER *B<SSL_get_cipher>(SSL *ssl); | ||
441 | |||
442 | =item int B<SSL_get_cipher_bits>(SSL *ssl, int *alg_bits); | ||
443 | |||
444 | =item char *B<SSL_get_cipher_list>(SSL *ssl, int n); | ||
445 | |||
446 | =item char *B<SSL_get_cipher_name>(SSL *ssl); | ||
447 | |||
448 | =item char *B<SSL_get_cipher_version>(SSL *ssl); | ||
449 | |||
450 | =item STACK *B<SSL_get_ciphers>(SSL *ssl); | ||
451 | |||
452 | =item STACK *B<SSL_get_client_CA_list>(SSL *ssl); | ||
453 | |||
454 | =item SSL_CIPHER *B<SSL_get_current_cipher>(SSL *ssl); | ||
455 | |||
456 | =item long B<SSL_get_default_timeout>(SSL *ssl); | ||
457 | |||
458 | =item int B<SSL_get_error>(SSL *ssl, int i); | ||
459 | |||
460 | =item char *B<SSL_get_ex_data>(SSL *ssl, int idx); | ||
461 | |||
462 | =item int B<SSL_get_ex_data_X509_STORE_CTX_idx>(void); | ||
463 | |||
464 | =item int B<SSL_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) | ||
465 | |||
466 | =item int B<SSL_get_fd>(SSL *ssl); | ||
467 | |||
468 | =item void (*B<SSL_get_info_callback>(SSL *ssl);)(void) | ||
469 | |||
470 | =item STACK *B<SSL_get_peer_cert_chain>(SSL *ssl); | ||
471 | |||
472 | =item X509 *B<SSL_get_peer_certificate>(SSL *ssl); | ||
473 | |||
474 | =item EVP_PKEY *B<SSL_get_privatekey>(SSL *ssl); | ||
475 | |||
476 | =item int B<SSL_get_quiet_shutdown>(SSL *ssl); | ||
477 | |||
478 | =item BIO *B<SSL_get_rbio>(SSL *ssl); | ||
479 | |||
480 | =item int B<SSL_get_read_ahead>(SSL *ssl); | ||
481 | |||
482 | =item SSL_SESSION *B<SSL_get_session>(SSL *ssl); | ||
483 | |||
484 | =item char *B<SSL_get_shared_ciphers>(SSL *ssl, char *buf, int len); | ||
485 | |||
486 | =item int B<SSL_get_shutdown>(SSL *ssl); | ||
487 | |||
488 | =item SSL_METHOD *B<SSL_get_ssl_method>(SSL *ssl); | ||
489 | |||
490 | =item int B<SSL_get_state>(SSL *ssl); | ||
491 | |||
492 | =item long B<SSL_get_time>(SSL *ssl); | ||
493 | |||
494 | =item long B<SSL_get_timeout>(SSL *ssl); | ||
495 | |||
496 | =item int (*B<SSL_get_verify_callback>(SSL *ssl);)(void) | ||
497 | |||
498 | =item int B<SSL_get_verify_mode>(SSL *ssl); | ||
499 | |||
500 | =item long B<SSL_get_verify_result>(SSL *ssl); | ||
501 | |||
502 | =item char *B<SSL_get_version>(SSL *ssl); | ||
503 | |||
504 | =item BIO *B<SSL_get_wbio>(SSL *ssl); | ||
505 | |||
506 | =item int B<SSL_in_accept_init>(SSL *ssl); | ||
507 | |||
508 | =item int B<SSL_in_before>(SSL *ssl); | ||
509 | |||
510 | =item int B<SSL_in_connect_init>(SSL *ssl); | ||
511 | |||
512 | =item int B<SSL_in_init>(SSL *ssl); | ||
513 | |||
514 | =item int B<SSL_is_init_finished>(SSL *ssl); | ||
515 | |||
516 | =item STACK *B<SSL_load_client_CA_file>(char *file); | ||
517 | |||
518 | =item void B<SSL_load_error_strings>(void); | ||
519 | |||
520 | =item SSL *B<SSL_new>(SSL_CTX *ctx); | ||
521 | |||
522 | =item long B<SSL_num_renegotiations>(SSL *ssl); | ||
523 | |||
524 | =item int B<SSL_peek>(SSL *ssl, char *buf, int num); | ||
525 | |||
526 | =item int B<SSL_pending>(SSL *ssl); | ||
527 | |||
528 | =item int B<SSL_read>(SSL *ssl, char *buf, int num); | ||
529 | |||
530 | =item int B<SSL_renegotiate>(SSL *ssl); | ||
531 | |||
532 | =item char *B<SSL_rstate_string>(SSL *ssl); | ||
533 | |||
534 | =item char *B<SSL_rstate_string_long>(SSL *ssl); | ||
535 | |||
536 | =item long B<SSL_session_reused>(SSL *ssl); | ||
537 | |||
538 | =item void B<SSL_set_accept_state>(SSL *ssl); | ||
539 | |||
540 | =item void B<SSL_set_app_data>(SSL *ssl, char *arg); | ||
541 | |||
542 | =item void B<SSL_set_bio>(SSL *ssl, BIO *rbio, BIO *wbio); | ||
543 | |||
544 | =item int B<SSL_set_cipher_list>(SSL *ssl, char *str); | ||
545 | |||
546 | =item void B<SSL_set_client_CA_list>(SSL *ssl, STACK *list); | ||
547 | |||
548 | =item void B<SSL_set_connect_state>(SSL *ssl); | ||
549 | |||
550 | =item int B<SSL_set_ex_data>(SSL *ssl, int idx, char *arg); | ||
551 | |||
552 | =item int B<SSL_set_fd>(SSL *ssl, int fd); | ||
553 | |||
554 | =item void B<SSL_set_info_callback>(SSL *ssl, void (*cb);(void)) | ||
555 | |||
556 | =item void B<SSL_set_options>(SSL *ssl, unsigned long op); | ||
557 | |||
558 | =item void B<SSL_set_quiet_shutdown>(SSL *ssl, int mode); | ||
559 | |||
560 | =item void B<SSL_set_read_ahead>(SSL *ssl, int yes); | ||
561 | |||
562 | =item int B<SSL_set_rfd>(SSL *ssl, int fd); | ||
563 | |||
564 | =item int B<SSL_set_session>(SSL *ssl, SSL_SESSION *session); | ||
565 | |||
566 | =item void B<SSL_set_shutdown>(SSL *ssl, int mode); | ||
567 | |||
568 | =item int B<SSL_set_ssl_method>(SSL *ssl, SSL_METHOD *meth); | ||
569 | |||
570 | =item void B<SSL_set_time>(SSL *ssl, long t); | ||
571 | |||
572 | =item void B<SSL_set_timeout>(SSL *ssl, long t); | ||
573 | |||
574 | =item void B<SSL_set_verify>(SSL *ssl, int mode, int (*callback);(void)) | ||
575 | |||
576 | =item void B<SSL_set_verify_result>(SSL *ssl, long arg); | ||
577 | |||
578 | =item int B<SSL_set_wfd>(SSL *ssl, int fd); | ||
579 | |||
580 | =item int B<SSL_shutdown>(SSL *ssl); | ||
581 | |||
582 | =item int B<SSL_state>(SSL *ssl); | ||
583 | |||
584 | =item char *B<SSL_state_string>(SSL *ssl); | ||
585 | |||
586 | =item char *B<SSL_state_string_long>(SSL *ssl); | ||
587 | |||
588 | =item long B<SSL_total_renegotiations>(SSL *ssl); | ||
589 | |||
590 | =item int B<SSL_use_PrivateKey>(SSL *ssl, EVP_PKEY *pkey); | ||
591 | |||
592 | =item int B<SSL_use_PrivateKey_ASN1>(int type, SSL *ssl, unsigned char *d, long len); | ||
593 | |||
594 | =item int B<SSL_use_PrivateKey_file>(SSL *ssl, char *file, int type); | ||
595 | |||
596 | =item int B<SSL_use_RSAPrivateKey>(SSL *ssl, RSA *rsa); | ||
597 | |||
598 | =item int B<SSL_use_RSAPrivateKey_ASN1>(SSL *ssl, unsigned char *d, long len); | ||
599 | |||
600 | =item int B<SSL_use_RSAPrivateKey_file>(SSL *ssl, char *file, int type); | ||
601 | |||
602 | =item int B<SSL_use_certificate>(SSL *ssl, X509 *x); | ||
603 | |||
604 | =item int B<SSL_use_certificate_ASN1>(SSL *ssl, int len, unsigned char *d); | ||
605 | |||
606 | =item int B<SSL_use_certificate_file>(SSL *ssl, char *file, int type); | ||
607 | |||
608 | =item int B<SSL_version>(SSL *ssl); | ||
609 | |||
610 | =item int B<SSL_want>(SSL *ssl); | ||
611 | |||
612 | =item int B<SSL_want_nothing>(SSL *ssl); | ||
613 | |||
614 | =item int B<SSL_want_read>(SSL *ssl); | ||
615 | |||
616 | =item int B<SSL_want_write>(SSL *ssl); | ||
617 | |||
618 | =item int B<SSL_want_x509_lookup>(s); | ||
619 | |||
620 | =item int B<SSL_write>(SSL *ssl, char *buf, int num); | ||
621 | |||
622 | =back | ||
623 | |||
624 | =head1 SEE ALSO | ||
625 | |||
626 | openssl(1), crypto(3) | ||
627 | |||
628 | =head1 HISTORY | ||
629 | |||
630 | The ssl(3) document appeared in OpenSSL 0.9.2 | ||
631 | |||
632 | =cut | ||
633 | |||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_error.pod b/src/lib/libssl/src/doc/ssl/SSL_get_error.pod new file mode 100644 index 0000000000..9cacdedc57 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_error.pod | |||
@@ -0,0 +1,91 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_error - obtain result code for SSL I/O operation | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_get_error(SSL *ssl, int ret); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_get_error() returns a result code (suitable for the C "switch" | ||
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 | ||
18 | SSL I/O function must be passed to SSL_get_error() in parameter | ||
19 | B<ret>. | ||
20 | |||
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 | ||
23 | used in the same thread that performed the SSL I/O operation, and no | ||
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 | ||
26 | attempted, or SSL_get_error() will not work reliably. | ||
27 | |||
28 | =head1 RETURN VALUES | ||
29 | |||
30 | The following return values can currently occur: | ||
31 | |||
32 | =over 4 | ||
33 | |||
34 | =item SSL_ERROR_NONE | ||
35 | |||
36 | The SSL I/O operation completed. This result code is returned | ||
37 | if and only if B<ret E<gt> 0>. | ||
38 | |||
39 | =item SSL_ERROR_ZERO_RETURN | ||
40 | |||
41 | The 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 | ||
43 | alerts has occurred in the protocol, i.e. if the connection has been | ||
44 | closed cleanly. | ||
45 | |||
46 | =item SSL_ERROR_WANT_READ, SSL_ERROR_WANT_WRITE | ||
47 | |||
48 | The operation did not complete; the same SSL I/O function should be | ||
49 | 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 | ||
51 | 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 | ||
53 | select() or poll() on the underlying socket can be used to find out | ||
54 | when the SSL I/O function should be retried. | ||
55 | |||
56 | Caveat: Any 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() | ||
58 | may want to write data and SSL_write() may want to read data. | ||
59 | |||
60 | =item SSL_ERROR_WANT_X509_LOOKUP | ||
61 | |||
62 | The operation did not complete because an application callback set by | ||
63 | SSL_CTX_set_client_cert_cb() has asked to be called again. | ||
64 | The SSL I/O function should be called again later. | ||
65 | Details depend on the application. | ||
66 | |||
67 | =item SSL_ERROR_SYSCALL | ||
68 | |||
69 | Some I/O error occurred. The OpenSSL error queue may contain more | ||
70 | information on the error. If the error queue is empty | ||
71 | (i.e. ERR_get_error() returns 0), B<ret> can be used to find out more | ||
72 | about the error: If B<ret == 0>, an EOF was observed that violates | ||
73 | the protocol. If B<ret == -1>, the underlying B<BIO> reported an | ||
74 | I/O error (for socket I/O on Unix systems, consult B<errno> for details). | ||
75 | |||
76 | =item SSL_ERROR_SSL | ||
77 | |||
78 | A failure in the SSL library occurred, usually a protocol error. The | ||
79 | OpenSSL error queue contains more information on the error. | ||
80 | |||
81 | =back | ||
82 | |||
83 | =head1 SEE ALSO | ||
84 | |||
85 | L<ssl(3)|ssl(3)>, L<err(3)|err(3)> | ||
86 | |||
87 | =head1 HISTORY | ||
88 | |||
89 | SSL_get_error() was added in SSLeay 0.8. | ||
90 | |||
91 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/ssl.pod b/src/lib/libssl/src/doc/ssl/ssl.pod new file mode 100644 index 0000000000..e53876654a --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/ssl.pod | |||
@@ -0,0 +1,634 @@ | |||
1 | |||
2 | =pod | ||
3 | |||
4 | =head1 NAME | ||
5 | |||
6 | SSL - OpenSSL SSL/TLS library | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | =head1 DESCRIPTION | ||
11 | |||
12 | The OpenSSL B<ssl> library implements the Secure Sockets Layer (SSL v2/v3) and | ||
13 | Transport Layer Security (TLS v1) protocols. It provides a rich API which is | ||
14 | documented here. | ||
15 | |||
16 | =head1 HEADER FILES | ||
17 | |||
18 | Currently the OpenSSL B<ssl> library provides the following C header files | ||
19 | containing the prototypes for the data structures and and functions: | ||
20 | |||
21 | =over 4 | ||
22 | |||
23 | =item B<ssl.h> | ||
24 | |||
25 | That's the common header file for the SSL/TLS API. Include it into your | ||
26 | program to make the API of the B<ssl> library available. It internally | ||
27 | includes both more private SSL headers and headers from the B<crypto> library. | ||
28 | Whenever you need hard-core details on the internals of the SSL API, look | ||
29 | inside this header file. | ||
30 | |||
31 | =item B<ssl2.h> | ||
32 | |||
33 | That's the sub header file dealing with the SSLv2 protocol only. | ||
34 | I<Usually you don't have to include it explicitly because | ||
35 | it's already included by ssl.h>. | ||
36 | |||
37 | =item B<ssl3.h> | ||
38 | |||
39 | That's the sub header file dealing with the SSLv3 protocol only. | ||
40 | I<Usually you don't have to include it explicitly because | ||
41 | it's already included by ssl.h>. | ||
42 | |||
43 | =item B<ssl23.h> | ||
44 | |||
45 | That's the sub header file dealing with the combined use of the SSLv2 and | ||
46 | SSLv3 protocols. | ||
47 | I<Usually you don't have to include it explicitly because | ||
48 | it's already included by ssl.h>. | ||
49 | |||
50 | =item B<tls1.h> | ||
51 | |||
52 | That's the sub header file dealing with the TLSv1 protocol only. | ||
53 | I<Usually you don't have to include it explicitly because | ||
54 | it's already included by ssl.h>. | ||
55 | |||
56 | =back | ||
57 | |||
58 | =head1 DATA STRUCTURES | ||
59 | |||
60 | Currently the OpenSSL B<ssl> library functions deals with the following data | ||
61 | structures: | ||
62 | |||
63 | =over 4 | ||
64 | |||
65 | =item B<SSL_METHOD> (SSL Method) | ||
66 | |||
67 | That's a dispatch structure describing the internal B<ssl> library | ||
68 | methods/functions which implement the various protocol versions (SSLv1, SSLv2 | ||
69 | and TLSv1). It's needed to create an B<SSL_CTX>. | ||
70 | |||
71 | =item B<SSL_CIPHER> (SSL Cipher) | ||
72 | |||
73 | This structure holds the algorithm information for a particular cipher which | ||
74 | are a core part of the SSL/TLS protocol. The available ciphers are configured | ||
75 | on a B<SSL_CTX> basis and the actually used ones are then part of the | ||
76 | B<SSL_SESSION>. | ||
77 | |||
78 | =item B<SSL_CTX> (SSL Context) | ||
79 | |||
80 | That's the global context structure which is created by a server or client | ||
81 | once per program life-time and which holds mainly default values for the | ||
82 | B<SSL> structures which are later created for the connections. | ||
83 | |||
84 | =item B<SSL_SESSION> (SSL Session) | ||
85 | |||
86 | This is a structure containing the current SSL session details for a | ||
87 | connection: B<SSL_CIPHER>s, client and server certificates, keys, etc. | ||
88 | |||
89 | =item B<SSL> (SSL Connection) | ||
90 | |||
91 | That's the main SSL/TLS structure which is created by a server or client per | ||
92 | established connection. This actually is the core structure in the SSL API. | ||
93 | Under run-time the application usually deals with this structure which has | ||
94 | links to mostly all other structures. | ||
95 | |||
96 | =back | ||
97 | |||
98 | =head1 API FUNCTIONS | ||
99 | |||
100 | Currently the OpenSSL B<ssl> library exports 214 API functions. | ||
101 | They are documented in the following: | ||
102 | |||
103 | =head2 DEALING WITH PROTOCOL METHODS | ||
104 | |||
105 | Here we document the various API functions which deal with the SSL/TLS | ||
106 | protocol methods defined in B<SSL_METHOD> structures. | ||
107 | |||
108 | =over 4 | ||
109 | |||
110 | =item SSL_METHOD *B<SSLv2_client_method>(void); | ||
111 | |||
112 | Constructor for the SSLv2 SSL_METHOD structure for a dedicated client. | ||
113 | |||
114 | =item SSL_METHOD *B<SSLv2_server_method>(void); | ||
115 | |||
116 | Constructor for the SSLv2 SSL_METHOD structure for a dedicated server. | ||
117 | |||
118 | =item SSL_METHOD *B<SSLv2_method>(void); | ||
119 | |||
120 | Constructor for the SSLv2 SSL_METHOD structure for combined client and server. | ||
121 | |||
122 | =item SSL_METHOD *B<SSLv3_client_method>(void); | ||
123 | |||
124 | Constructor for the SSLv3 SSL_METHOD structure for a dedicated client. | ||
125 | |||
126 | =item SSL_METHOD *B<SSLv3_server_method>(void); | ||
127 | |||
128 | Constructor for the SSLv3 SSL_METHOD structure for a dedicated server. | ||
129 | |||
130 | =item SSL_METHOD *B<SSLv3_method>(void); | ||
131 | |||
132 | Constructor for the SSLv3 SSL_METHOD structure for combined client and server. | ||
133 | |||
134 | =item SSL_METHOD *B<TLSv1_client_method>(void); | ||
135 | |||
136 | Constructor for the TLSv1 SSL_METHOD structure for a dedicated client. | ||
137 | |||
138 | =item SSL_METHOD *B<TLSv1_server_method>(void); | ||
139 | |||
140 | Constructor for the TLSv1 SSL_METHOD structure for a dedicated server. | ||
141 | |||
142 | =item SSL_METHOD *B<TLSv1_method>(void); | ||
143 | |||
144 | Constructor for the TLSv1 SSL_METHOD structure for combined client and server. | ||
145 | |||
146 | =back | ||
147 | |||
148 | =head2 DEALING WITH CIPHERS | ||
149 | |||
150 | Here we document the various API functions which deal with the SSL/TLS | ||
151 | ciphers defined in B<SSL_CIPHER> structures. | ||
152 | |||
153 | =over 4 | ||
154 | |||
155 | =item char *B<SSL_CIPHER_description>(SSL_CIPHER *cipher, char *buf, int len); | ||
156 | |||
157 | Write a string to I<buf> (with a maximum size of I<len>) containing a human | ||
158 | readable description of I<cipher>. Returns I<buf>. | ||
159 | |||
160 | =item int B<SSL_CIPHER_get_bits>(SSL_CIPHER *cipher, int *alg_bits); | ||
161 | |||
162 | 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 | ||
164 | I<alg_bits>) and the bits which are actually used (the return value). | ||
165 | |||
166 | =item char *B<SSL_CIPHER_get_name>(SSL_CIPHER *cipher); | ||
167 | |||
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> | ||
170 | definitions in the header files. | ||
171 | |||
172 | =item char *B<SSL_CIPHER_get_version>(SSL_CIPHER *cipher); | ||
173 | |||
174 | Returns a string like "C<TLSv1/SSLv3>" or "C<SSLv2>" which indicates the | ||
175 | SSL/TLS protocol version to which I<cipher> belongs (i.e. where it was defined | ||
176 | in the specification the first time). | ||
177 | |||
178 | =back | ||
179 | |||
180 | =head2 DEALING WITH PROTOCOL CONTEXTS | ||
181 | |||
182 | Here we document the various API functions which deal with the SSL/TLS | ||
183 | protocol context defined in the B<SSL_CTX> structure. | ||
184 | |||
185 | =over 4 | ||
186 | |||
187 | =item int B<SSL_CTX_add_client_CA>(SSL_CTX *ctx, X509 *x); | ||
188 | |||
189 | =item long B<SSL_CTX_add_extra_chain_cert>(SSL_CTX *ctx, X509 *x509); | ||
190 | |||
191 | =item int B<SSL_CTX_add_session>(SSL_CTX *ctx, SSL_SESSION *c); | ||
192 | |||
193 | =item int B<SSL_CTX_check_private_key>(SSL_CTX *ctx); | ||
194 | |||
195 | =item long B<SSL_CTX_ctrl>(SSL_CTX *ctx, int cmd, long larg, char *parg); | ||
196 | |||
197 | =item void B<SSL_CTX_flush_sessions>(SSL_CTX *s, long t); | ||
198 | |||
199 | =item void B<SSL_CTX_free>(SSL_CTX *a); | ||
200 | |||
201 | =item char *B<SSL_CTX_get_app_data>(SSL_CTX *ctx); | ||
202 | |||
203 | =item X509_STORE *B<SSL_CTX_get_cert_store>(SSL_CTX *ctx); | ||
204 | |||
205 | =item STACK *B<SSL_CTX_get_client_CA_list>(SSL_CTX *ctx); | ||
206 | |||
207 | =item int (*B<SSL_CTX_get_client_cert_cb>(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey); | ||
208 | |||
209 | =item char *B<SSL_CTX_get_ex_data>(SSL_CTX *s, int idx); | ||
210 | |||
211 | =item int B<SSL_CTX_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) | ||
212 | |||
213 | =item void (*B<SSL_CTX_get_info_callback>(SSL_CTX *ctx))(SSL *ssl, int cb, int ret); | ||
214 | |||
215 | =item int B<SSL_CTX_get_quiet_shutdown>(SSL_CTX *ctx); | ||
216 | |||
217 | =item int B<SSL_CTX_get_session_cache_mode>(SSL_CTX *ctx); | ||
218 | |||
219 | =item long B<SSL_CTX_get_timeout>(SSL_CTX *ctx); | ||
220 | |||
221 | =item int (*B<SSL_CTX_get_verify_callback>(SSL_CTX *ctx))(int ok, X509_STORE_CTX *ctx); | ||
222 | |||
223 | =item int B<SSL_CTX_get_verify_mode>(SSL_CTX *ctx); | ||
224 | |||
225 | =item int B<SSL_CTX_load_verify_locations>(SSL_CTX *ctx, char *CAfile, char *CApath); | ||
226 | |||
227 | =item long B<SSL_CTX_need_tmp_RSA>(SSL_CTX *ctx); | ||
228 | |||
229 | =item SSL_CTX *B<SSL_CTX_new>(SSL_METHOD *meth); | ||
230 | |||
231 | =item int B<SSL_CTX_remove_session>(SSL_CTX *ctx, SSL_SESSION *c); | ||
232 | |||
233 | =item int B<SSL_CTX_sess_accept>(SSL_CTX *ctx); | ||
234 | |||
235 | =item int B<SSL_CTX_sess_accept_good>(SSL_CTX *ctx); | ||
236 | |||
237 | =item int B<SSL_CTX_sess_accept_renegotiate>(SSL_CTX *ctx); | ||
238 | |||
239 | =item int B<SSL_CTX_sess_cache_full>(SSL_CTX *ctx); | ||
240 | |||
241 | =item int B<SSL_CTX_sess_cb_hits>(SSL_CTX *ctx); | ||
242 | |||
243 | =item int B<SSL_CTX_sess_connect>(SSL_CTX *ctx); | ||
244 | |||
245 | =item int B<SSL_CTX_sess_connect_good>(SSL_CTX *ctx); | ||
246 | |||
247 | =item int B<SSL_CTX_sess_connect_renegotiate>(SSL_CTX *ctx); | ||
248 | |||
249 | =item int B<SSL_CTX_sess_get_cache_size>(SSL_CTX *ctx); | ||
250 | |||
251 | =item SSL_SESSION *(*B<SSL_CTX_sess_get_get_cb>(SSL_CTX *ctx))(SSL *ssl, unsigned char *data, int len, int *copy); | ||
252 | |||
253 | =item int (*B<SSL_CTX_sess_get_new_cb>(SSL_CTX *ctx)(SSL *ssl, SSL_SESSION *sess); | ||
254 | |||
255 | =item void (*B<SSL_CTX_sess_get_remove_cb>(SSL_CTX *ctx)(SSL_CTX *ctx, SSL_SESSION *sess); | ||
256 | |||
257 | =item int B<SSL_CTX_sess_hits>(SSL_CTX *ctx); | ||
258 | |||
259 | =item int B<SSL_CTX_sess_misses>(SSL_CTX *ctx); | ||
260 | |||
261 | =item int B<SSL_CTX_sess_number>(SSL_CTX *ctx); | ||
262 | |||
263 | =item void B<SSL_CTX_sess_set_cache_size>(SSL_CTX *ctx,t); | ||
264 | |||
265 | =item void B<SSL_CTX_sess_set_get_cb>(SSL_CTX *ctx, SSL_SESSION *(*cb)(SSL *ssl, unsigned char *data, int len, int *copy)); | ||
266 | |||
267 | =item void B<SSL_CTX_sess_set_new_cb>(SSL_CTX *ctx, int (*cb)(SSL *ssl, SSL_SESSION *sess)); | ||
268 | |||
269 | =item void B<SSL_CTX_sess_set_remove_cb>(SSL_CTX *ctx, void (*cb)(SSL_CTX *ctx, SSL_SESSION *sess)); | ||
270 | |||
271 | =item int B<SSL_CTX_sess_timeouts>(SSL_CTX *ctx); | ||
272 | |||
273 | =item LHASH *B<SSL_CTX_sessions>(SSL_CTX *ctx); | ||
274 | |||
275 | =item void B<SSL_CTX_set_app_data>(SSL_CTX *ctx, void *arg); | ||
276 | |||
277 | =item void B<SSL_CTX_set_cert_store>(SSL_CTX *ctx, X509_STORE *cs); | ||
278 | |||
279 | =item void B<SSL_CTX_set_cert_verify_cb>(SSL_CTX *ctx, int (*cb)(SSL_CTX *), char *arg) | ||
280 | |||
281 | =item int B<SSL_CTX_set_cipher_list>(SSL_CTX *ctx, char *str); | ||
282 | |||
283 | =item void B<SSL_CTX_set_client_CA_list>(SSL_CTX *ctx, STACK *list); | ||
284 | |||
285 | =item void B<SSL_CTX_set_client_cert_cb>(SSL_CTX *ctx, int (*cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)); | ||
286 | |||
287 | =item void B<SSL_CTX_set_default_passwd_cb>(SSL_CTX *ctx, int (*cb);(void)) | ||
288 | |||
289 | =item void B<SSL_CTX_set_default_read_ahead>(SSL_CTX *ctx, int m); | ||
290 | |||
291 | =item int B<SSL_CTX_set_default_verify_paths>(SSL_CTX *ctx); | ||
292 | |||
293 | =item int B<SSL_CTX_set_ex_data>(SSL_CTX *s, int idx, char *arg); | ||
294 | |||
295 | =item void B<SSL_CTX_set_info_callback>(SSL_CTX *ctx, void (*cb)(SSL *ssl, int cb, int ret)); | ||
296 | |||
297 | =item void B<SSL_CTX_set_options>(SSL_CTX *ctx, unsigned long op); | ||
298 | |||
299 | =item void B<SSL_CTX_set_quiet_shutdown>(SSL_CTX *ctx, int mode); | ||
300 | |||
301 | =item void B<SSL_CTX_set_session_cache_mode>(SSL_CTX *ctx, int mode); | ||
302 | |||
303 | =item int B<SSL_CTX_set_ssl_version>(SSL_CTX *ctx, SSL_METHOD *meth); | ||
304 | |||
305 | =item void B<SSL_CTX_set_timeout>(SSL_CTX *ctx, long t); | ||
306 | |||
307 | =item long B<SSL_CTX_set_tmp_dh>(SSL_CTX* ctx, DH *dh); | ||
308 | |||
309 | =item long B<SSL_CTX_set_tmp_dh_callback>(SSL_CTX *ctx, DH *(*cb)(void)); | ||
310 | |||
311 | =item long B<SSL_CTX_set_tmp_rsa>(SSL_CTX *ctx, RSA *rsa); | ||
312 | |||
313 | =item SSL_CTX_set_tmp_rsa_callback | ||
314 | |||
315 | C<long B<SSL_CTX_set_tmp_rsa_callback>(SSL_CTX *B<ctx>, RSA *(*B<cb>)(SSL *B<ssl>, int B<export>, int B<keylength>));> | ||
316 | |||
317 | Sets the callback which will be called when a temporary private key is | ||
318 | required. The B<C<export>> flag will be set if the reason for needing | ||
319 | a temp key is that an export ciphersuite is in use, in which case, | ||
320 | B<C<keylength>> will contain the required keylength in bits. Generate a key of | ||
321 | appropriate size (using ???) and return it. | ||
322 | |||
323 | =item SSL_set_tmp_rsa_callback | ||
324 | |||
325 | long B<SSL_set_tmp_rsa_callback>(SSL *ssl, RSA *(*cb)(SSL *ssl, int export, int keylength)); | ||
326 | |||
327 | The same as L<"SSL_CTX_set_tmp_rsa_callback">, except it operates on an SSL | ||
328 | session instead of a context. | ||
329 | |||
330 | =item void B<SSL_CTX_set_verify>(SSL_CTX *ctx, int mode, int (*cb);(void)) | ||
331 | |||
332 | =item int B<SSL_CTX_use_PrivateKey>(SSL_CTX *ctx, EVP_PKEY *pkey); | ||
333 | |||
334 | =item int B<SSL_CTX_use_PrivateKey_ASN1>(int type, SSL_CTX *ctx, unsigned char *d, long len); | ||
335 | |||
336 | =item int B<SSL_CTX_use_PrivateKey_file>(SSL_CTX *ctx, char *file, int type); | ||
337 | |||
338 | =item int B<SSL_CTX_use_RSAPrivateKey>(SSL_CTX *ctx, RSA *rsa); | ||
339 | |||
340 | =item int B<SSL_CTX_use_RSAPrivateKey_ASN1>(SSL_CTX *ctx, unsigned char *d, long len); | ||
341 | |||
342 | =item int B<SSL_CTX_use_RSAPrivateKey_file>(SSL_CTX *ctx, char *file, int type); | ||
343 | |||
344 | =item int B<SSL_CTX_use_certificate>(SSL_CTX *ctx, X509 *x); | ||
345 | |||
346 | =item int B<SSL_CTX_use_certificate_ASN1>(SSL_CTX *ctx, int len, unsigned char *d); | ||
347 | |||
348 | =item int B<SSL_CTX_use_certificate_file>(SSL_CTX *ctx, char *file, int type); | ||
349 | |||
350 | =back | ||
351 | |||
352 | =head2 DEALING WITH SESSIONS | ||
353 | |||
354 | Here we document the various API functions which deal with the SSL/TLS | ||
355 | sessions defined in the B<SSL_SESSION> structures. | ||
356 | |||
357 | =over 4 | ||
358 | |||
359 | =item int B<SSL_SESSION_cmp>(SSL_SESSION *a, SSL_SESSION *b); | ||
360 | |||
361 | =item void B<SSL_SESSION_free>(SSL_SESSION *ss); | ||
362 | |||
363 | =item char *B<SSL_SESSION_get_app_data>(SSL_SESSION *s); | ||
364 | |||
365 | =item char *B<SSL_SESSION_get_ex_data>(SSL_SESSION *s, int idx); | ||
366 | |||
367 | =item int B<SSL_SESSION_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) | ||
368 | |||
369 | =item long B<SSL_SESSION_get_time>(SSL_SESSION *s); | ||
370 | |||
371 | =item long B<SSL_SESSION_get_timeout>(SSL_SESSION *s); | ||
372 | |||
373 | =item unsigned long B<SSL_SESSION_hash>(SSL_SESSION *a); | ||
374 | |||
375 | =item SSL_SESSION *B<SSL_SESSION_new>(void); | ||
376 | |||
377 | =item int B<SSL_SESSION_print>(BIO *bp, SSL_SESSION *x); | ||
378 | |||
379 | =item int B<SSL_SESSION_print_fp>(FILE *fp, SSL_SESSION *x); | ||
380 | |||
381 | =item void B<SSL_SESSION_set_app_data>(SSL_SESSION *s, char *a); | ||
382 | |||
383 | =item int B<SSL_SESSION_set_ex_data>(SSL_SESSION *s, int idx, char *arg); | ||
384 | |||
385 | =item long B<SSL_SESSION_set_time>(SSL_SESSION *s, long t); | ||
386 | |||
387 | =item long B<SSL_SESSION_set_timeout>(SSL_SESSION *s, long t); | ||
388 | |||
389 | =back | ||
390 | |||
391 | =head2 DEALING WITH CONNECTIONS | ||
392 | |||
393 | Here we document the various API functions which deal with the SSL/TLS | ||
394 | connection defined in the B<SSL> structure. | ||
395 | |||
396 | =over 4 | ||
397 | |||
398 | =item int B<SSL_accept>(SSL *ssl); | ||
399 | |||
400 | =item int B<SSL_add_dir_cert_subjects_to_stack>(STACK *stack, const char *dir); | ||
401 | |||
402 | =item int B<SSL_add_file_cert_subjects_to_stack>(STACK *stack, const char *file); | ||
403 | |||
404 | =item int B<SSL_add_client_CA>(SSL *ssl, X509 *x); | ||
405 | |||
406 | =item char *B<SSL_alert_desc_string>(int value); | ||
407 | |||
408 | =item char *B<SSL_alert_desc_string_long>(int value); | ||
409 | |||
410 | =item char *B<SSL_alert_type_string>(int value); | ||
411 | |||
412 | =item char *B<SSL_alert_type_string_long>(int value); | ||
413 | |||
414 | =item int B<SSL_check_private_key>(SSL *ssl); | ||
415 | |||
416 | =item void B<SSL_clear>(SSL *ssl); | ||
417 | |||
418 | =item long B<SSL_clear_num_renegotiations>(SSL *ssl); | ||
419 | |||
420 | =item int B<SSL_connect>(SSL *ssl); | ||
421 | |||
422 | =item void B<SSL_copy_session_id>(SSL *t, SSL *f); | ||
423 | |||
424 | =item long B<SSL_ctrl>(SSL *ssl, int cmd, long larg, char *parg); | ||
425 | |||
426 | =item int B<SSL_do_handshake>(SSL *ssl); | ||
427 | |||
428 | =item SSL *B<SSL_dup>(SSL *ssl); | ||
429 | |||
430 | =item STACK *B<SSL_dup_CA_list>(STACK *sk); | ||
431 | |||
432 | =item void B<SSL_free>(SSL *ssl); | ||
433 | |||
434 | =item SSL_CTX *B<SSL_get_SSL_CTX>(SSL *ssl); | ||
435 | |||
436 | =item char *B<SSL_get_app_data>(SSL *ssl); | ||
437 | |||
438 | =item X509 *B<SSL_get_certificate>(SSL *ssl); | ||
439 | |||
440 | =item SSL_CIPHER *B<SSL_get_cipher>(SSL *ssl); | ||
441 | |||
442 | =item int B<SSL_get_cipher_bits>(SSL *ssl, int *alg_bits); | ||
443 | |||
444 | =item char *B<SSL_get_cipher_list>(SSL *ssl, int n); | ||
445 | |||
446 | =item char *B<SSL_get_cipher_name>(SSL *ssl); | ||
447 | |||
448 | =item char *B<SSL_get_cipher_version>(SSL *ssl); | ||
449 | |||
450 | =item STACK *B<SSL_get_ciphers>(SSL *ssl); | ||
451 | |||
452 | =item STACK *B<SSL_get_client_CA_list>(SSL *ssl); | ||
453 | |||
454 | =item SSL_CIPHER *B<SSL_get_current_cipher>(SSL *ssl); | ||
455 | |||
456 | =item long B<SSL_get_default_timeout>(SSL *ssl); | ||
457 | |||
458 | =item int B<SSL_get_error>(SSL *ssl, int i); | ||
459 | |||
460 | =item char *B<SSL_get_ex_data>(SSL *ssl, int idx); | ||
461 | |||
462 | =item int B<SSL_get_ex_data_X509_STORE_CTX_idx>(void); | ||
463 | |||
464 | =item int B<SSL_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) | ||
465 | |||
466 | =item int B<SSL_get_fd>(SSL *ssl); | ||
467 | |||
468 | =item void (*B<SSL_get_info_callback>(SSL *ssl);)(void) | ||
469 | |||
470 | =item STACK *B<SSL_get_peer_cert_chain>(SSL *ssl); | ||
471 | |||
472 | =item X509 *B<SSL_get_peer_certificate>(SSL *ssl); | ||
473 | |||
474 | =item EVP_PKEY *B<SSL_get_privatekey>(SSL *ssl); | ||
475 | |||
476 | =item int B<SSL_get_quiet_shutdown>(SSL *ssl); | ||
477 | |||
478 | =item BIO *B<SSL_get_rbio>(SSL *ssl); | ||
479 | |||
480 | =item int B<SSL_get_read_ahead>(SSL *ssl); | ||
481 | |||
482 | =item SSL_SESSION *B<SSL_get_session>(SSL *ssl); | ||
483 | |||
484 | =item char *B<SSL_get_shared_ciphers>(SSL *ssl, char *buf, int len); | ||
485 | |||
486 | =item int B<SSL_get_shutdown>(SSL *ssl); | ||
487 | |||
488 | =item SSL_METHOD *B<SSL_get_ssl_method>(SSL *ssl); | ||
489 | |||
490 | =item int B<SSL_get_state>(SSL *ssl); | ||
491 | |||
492 | =item long B<SSL_get_time>(SSL *ssl); | ||
493 | |||
494 | =item long B<SSL_get_timeout>(SSL *ssl); | ||
495 | |||
496 | =item int (*B<SSL_get_verify_callback>(SSL *ssl);)(void) | ||
497 | |||
498 | =item int B<SSL_get_verify_mode>(SSL *ssl); | ||
499 | |||
500 | =item long B<SSL_get_verify_result>(SSL *ssl); | ||
501 | |||
502 | =item char *B<SSL_get_version>(SSL *ssl); | ||
503 | |||
504 | =item BIO *B<SSL_get_wbio>(SSL *ssl); | ||
505 | |||
506 | =item int B<SSL_in_accept_init>(SSL *ssl); | ||
507 | |||
508 | =item int B<SSL_in_before>(SSL *ssl); | ||
509 | |||
510 | =item int B<SSL_in_connect_init>(SSL *ssl); | ||
511 | |||
512 | =item int B<SSL_in_init>(SSL *ssl); | ||
513 | |||
514 | =item int B<SSL_is_init_finished>(SSL *ssl); | ||
515 | |||
516 | =item STACK *B<SSL_load_client_CA_file>(char *file); | ||
517 | |||
518 | =item void B<SSL_load_error_strings>(void); | ||
519 | |||
520 | =item SSL *B<SSL_new>(SSL_CTX *ctx); | ||
521 | |||
522 | =item long B<SSL_num_renegotiations>(SSL *ssl); | ||
523 | |||
524 | =item int B<SSL_peek>(SSL *ssl, char *buf, int num); | ||
525 | |||
526 | =item int B<SSL_pending>(SSL *ssl); | ||
527 | |||
528 | =item int B<SSL_read>(SSL *ssl, char *buf, int num); | ||
529 | |||
530 | =item int B<SSL_renegotiate>(SSL *ssl); | ||
531 | |||
532 | =item char *B<SSL_rstate_string>(SSL *ssl); | ||
533 | |||
534 | =item char *B<SSL_rstate_string_long>(SSL *ssl); | ||
535 | |||
536 | =item long B<SSL_session_reused>(SSL *ssl); | ||
537 | |||
538 | =item void B<SSL_set_accept_state>(SSL *ssl); | ||
539 | |||
540 | =item void B<SSL_set_app_data>(SSL *ssl, char *arg); | ||
541 | |||
542 | =item void B<SSL_set_bio>(SSL *ssl, BIO *rbio, BIO *wbio); | ||
543 | |||
544 | =item int B<SSL_set_cipher_list>(SSL *ssl, char *str); | ||
545 | |||
546 | =item void B<SSL_set_client_CA_list>(SSL *ssl, STACK *list); | ||
547 | |||
548 | =item void B<SSL_set_connect_state>(SSL *ssl); | ||
549 | |||
550 | =item int B<SSL_set_ex_data>(SSL *ssl, int idx, char *arg); | ||
551 | |||
552 | =item int B<SSL_set_fd>(SSL *ssl, int fd); | ||
553 | |||
554 | =item void B<SSL_set_info_callback>(SSL *ssl, void (*cb);(void)) | ||
555 | |||
556 | =item void B<SSL_set_options>(SSL *ssl, unsigned long op); | ||
557 | |||
558 | =item void B<SSL_set_quiet_shutdown>(SSL *ssl, int mode); | ||
559 | |||
560 | =item void B<SSL_set_read_ahead>(SSL *ssl, int yes); | ||
561 | |||
562 | =item int B<SSL_set_rfd>(SSL *ssl, int fd); | ||
563 | |||
564 | =item int B<SSL_set_session>(SSL *ssl, SSL_SESSION *session); | ||
565 | |||
566 | =item void B<SSL_set_shutdown>(SSL *ssl, int mode); | ||
567 | |||
568 | =item int B<SSL_set_ssl_method>(SSL *ssl, SSL_METHOD *meth); | ||
569 | |||
570 | =item void B<SSL_set_time>(SSL *ssl, long t); | ||
571 | |||
572 | =item void B<SSL_set_timeout>(SSL *ssl, long t); | ||
573 | |||
574 | =item void B<SSL_set_verify>(SSL *ssl, int mode, int (*callback);(void)) | ||
575 | |||
576 | =item void B<SSL_set_verify_result>(SSL *ssl, long arg); | ||
577 | |||
578 | =item int B<SSL_set_wfd>(SSL *ssl, int fd); | ||
579 | |||
580 | =item int B<SSL_shutdown>(SSL *ssl); | ||
581 | |||
582 | =item int B<SSL_state>(SSL *ssl); | ||
583 | |||
584 | =item char *B<SSL_state_string>(SSL *ssl); | ||
585 | |||
586 | =item char *B<SSL_state_string_long>(SSL *ssl); | ||
587 | |||
588 | =item long B<SSL_total_renegotiations>(SSL *ssl); | ||
589 | |||
590 | =item int B<SSL_use_PrivateKey>(SSL *ssl, EVP_PKEY *pkey); | ||
591 | |||
592 | =item int B<SSL_use_PrivateKey_ASN1>(int type, SSL *ssl, unsigned char *d, long len); | ||
593 | |||
594 | =item int B<SSL_use_PrivateKey_file>(SSL *ssl, char *file, int type); | ||
595 | |||
596 | =item int B<SSL_use_RSAPrivateKey>(SSL *ssl, RSA *rsa); | ||
597 | |||
598 | =item int B<SSL_use_RSAPrivateKey_ASN1>(SSL *ssl, unsigned char *d, long len); | ||
599 | |||
600 | =item int B<SSL_use_RSAPrivateKey_file>(SSL *ssl, char *file, int type); | ||
601 | |||
602 | =item int B<SSL_use_certificate>(SSL *ssl, X509 *x); | ||
603 | |||
604 | =item int B<SSL_use_certificate_ASN1>(SSL *ssl, int len, unsigned char *d); | ||
605 | |||
606 | =item int B<SSL_use_certificate_file>(SSL *ssl, char *file, int type); | ||
607 | |||
608 | =item int B<SSL_version>(SSL *ssl); | ||
609 | |||
610 | =item int B<SSL_want>(SSL *ssl); | ||
611 | |||
612 | =item int B<SSL_want_nothing>(SSL *ssl); | ||
613 | |||
614 | =item int B<SSL_want_read>(SSL *ssl); | ||
615 | |||
616 | =item int B<SSL_want_write>(SSL *ssl); | ||
617 | |||
618 | =item int B<SSL_want_x509_lookup>(s); | ||
619 | |||
620 | =item int B<SSL_write>(SSL *ssl, char *buf, int num); | ||
621 | |||
622 | =back | ||
623 | |||
624 | =head1 SEE ALSO | ||
625 | |||
626 | L<openssl(1)|openssl(1)>, L<crypto(3)|crypto(3)>, | ||
627 | L<SSL_get_error(3)|SSL_get_error(3)> | ||
628 | |||
629 | =head1 HISTORY | ||
630 | |||
631 | The L<ssl(3)|ssl(3)> document appeared in OpenSSL 0.9.2 | ||
632 | |||
633 | =cut | ||
634 | |||
diff --git a/src/lib/libssl/src/doc/ssleay.txt b/src/lib/libssl/src/doc/ssleay.txt index 094e28ce48..3e964c2e9a 100644 --- a/src/lib/libssl/src/doc/ssleay.txt +++ b/src/lib/libssl/src/doc/ssleay.txt | |||
@@ -6710,8 +6710,8 @@ CRYPTO_set_locking_callback(locking_function); | |||
6710 | before any multithreading is started. | 6710 | before any multithreading is started. |
6711 | id_function does not need to be defined under Windows NT or 95, the | 6711 | id_function does not need to be defined under Windows NT or 95, the |
6712 | correct function will be called if it is not. Under unix, getpid() | 6712 | correct function will be called if it is not. Under unix, getpid() |
6713 | is call if the id_callback is not defined, for solaris this is wrong | 6713 | is call if the id_callback is not defined, for Solaris this is wrong |
6714 | (since threads id's are not pid's) but under IRIX it is correct | 6714 | (since threads id's are not pid's) but under Linux it is correct |
6715 | (threads are just processes sharing the data segement). | 6715 | (threads are just processes sharing the data segement). |
6716 | 6716 | ||
6717 | The locking_callback is used to perform locking by the SSLeay library. | 6717 | The locking_callback is used to perform locking by the SSLeay library. |