summaryrefslogtreecommitdiff
path: root/src/lib/libssl/src/doc
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/src/doc')
-rw-r--r--src/lib/libssl/src/doc/README10
-rw-r--r--src/lib/libssl/src/doc/apps/CA.pl.pod138
-rw-r--r--src/lib/libssl/src/doc/apps/asn1parse.pod129
-rw-r--r--src/lib/libssl/src/doc/apps/ca.pod479
-rw-r--r--src/lib/libssl/src/doc/apps/ciphers.pod342
-rw-r--r--src/lib/libssl/src/doc/apps/config.pod138
-rw-r--r--src/lib/libssl/src/doc/apps/crl.pod117
-rw-r--r--src/lib/libssl/src/doc/apps/crl2pkcs7.pod90
-rw-r--r--src/lib/libssl/src/doc/apps/dgst.pod49
-rw-r--r--src/lib/libssl/src/doc/apps/dhparam.pod115
-rw-r--r--src/lib/libssl/src/doc/apps/dsa.pod150
-rw-r--r--src/lib/libssl/src/doc/apps/dsaparam.pod102
-rw-r--r--src/lib/libssl/src/doc/apps/enc.pod257
-rw-r--r--src/lib/libssl/src/doc/apps/gendsa.pod58
-rw-r--r--src/lib/libssl/src/doc/apps/genrsa.pod85
-rw-r--r--src/lib/libssl/src/doc/apps/nseq.pod70
-rw-r--r--src/lib/libssl/src/doc/apps/openssl.pod298
-rw-r--r--src/lib/libssl/src/doc/apps/passwd.pod69
-rw-r--r--src/lib/libssl/src/doc/apps/pkcs12.pod310
-rw-r--r--src/lib/libssl/src/doc/apps/pkcs7.pod97
-rw-r--r--src/lib/libssl/src/doc/apps/pkcs8.pod235
-rw-r--r--src/lib/libssl/src/doc/apps/req.pod528
-rw-r--r--src/lib/libssl/src/doc/apps/rsa.pod156
-rw-r--r--src/lib/libssl/src/doc/apps/s_client.pod213
-rw-r--r--src/lib/libssl/src/doc/apps/s_server.pod265
-rw-r--r--src/lib/libssl/src/doc/apps/sess_id.pod151
-rw-r--r--src/lib/libssl/src/doc/apps/smime.pod325
-rw-r--r--src/lib/libssl/src/doc/apps/speed.pod45
-rw-r--r--src/lib/libssl/src/doc/apps/spkac.pod127
-rw-r--r--src/lib/libssl/src/doc/apps/verify.pod273
-rw-r--r--src/lib/libssl/src/doc/apps/version.pod56
-rw-r--r--src/lib/libssl/src/doc/apps/x509.pod543
-rw-r--r--src/lib/libssl/src/doc/c-indentation.el11
-rw-r--r--src/lib/libssl/src/doc/crypto.pod27
-rw-r--r--src/lib/libssl/src/doc/crypto/BN_CTX_new.pod53
-rw-r--r--src/lib/libssl/src/doc/crypto/BN_CTX_start.pod51
-rw-r--r--src/lib/libssl/src/doc/crypto/BN_add.pod99
-rw-r--r--src/lib/libssl/src/doc/crypto/BN_add_word.pod57
-rw-r--r--src/lib/libssl/src/doc/crypto/BN_bn2bin.pod95
-rw-r--r--src/lib/libssl/src/doc/crypto/BN_cmp.pod48
-rw-r--r--src/lib/libssl/src/doc/crypto/BN_copy.pod34
-rw-r--r--src/lib/libssl/src/doc/crypto/BN_generate_prime.pod102
-rw-r--r--src/lib/libssl/src/doc/crypto/BN_mod_inverse.pod36
-rw-r--r--src/lib/libssl/src/doc/crypto/BN_mod_mul_montgomery.pod95
-rw-r--r--src/lib/libssl/src/doc/crypto/BN_mod_mul_reciprocal.pod81
-rw-r--r--src/lib/libssl/src/doc/crypto/BN_new.pod53
-rw-r--r--src/lib/libssl/src/doc/crypto/BN_num_bytes.pod37
-rw-r--r--src/lib/libssl/src/doc/crypto/BN_rand.pod45
-rw-r--r--src/lib/libssl/src/doc/crypto/BN_set_bit.pod66
-rw-r--r--src/lib/libssl/src/doc/crypto/BN_zero.pod55
-rw-r--r--src/lib/libssl/src/doc/crypto/CRYPTO_set_ex_data.pod51
-rw-r--r--src/lib/libssl/src/doc/crypto/DH_generate_key.pod50
-rw-r--r--src/lib/libssl/src/doc/crypto/DH_generate_parameters.pod72
-rw-r--r--src/lib/libssl/src/doc/crypto/DH_get_ex_new_index.pod36
-rw-r--r--src/lib/libssl/src/doc/crypto/DH_new.pod40
-rw-r--r--src/lib/libssl/src/doc/crypto/DH_set_method.pod99
-rw-r--r--src/lib/libssl/src/doc/crypto/DH_size.pod33
-rw-r--r--src/lib/libssl/src/doc/crypto/DSA_SIG_new.pod39
-rw-r--r--src/lib/libssl/src/doc/crypto/DSA_do_sign.pod47
-rw-r--r--src/lib/libssl/src/doc/crypto/DSA_dup_DH.pod36
-rw-r--r--src/lib/libssl/src/doc/crypto/DSA_generate_key.pod33
-rw-r--r--src/lib/libssl/src/doc/crypto/DSA_generate_parameters.pod105
-rw-r--r--src/lib/libssl/src/doc/crypto/DSA_get_ex_new_index.pod36
-rw-r--r--src/lib/libssl/src/doc/crypto/DSA_new.pod41
-rw-r--r--src/lib/libssl/src/doc/crypto/DSA_set_method.pod111
-rw-r--r--src/lib/libssl/src/doc/crypto/DSA_sign.pod66
-rw-r--r--src/lib/libssl/src/doc/crypto/DSA_size.pod33
-rw-r--r--src/lib/libssl/src/doc/crypto/ERR_GET_LIB.pod51
-rw-r--r--src/lib/libssl/src/doc/crypto/ERR_clear_error.pod29
-rw-r--r--src/lib/libssl/src/doc/crypto/ERR_error_string.pod65
-rw-r--r--src/lib/libssl/src/doc/crypto/ERR_get_error.pod62
-rw-r--r--src/lib/libssl/src/doc/crypto/ERR_load_crypto_strings.pod46
-rw-r--r--src/lib/libssl/src/doc/crypto/ERR_load_strings.pod54
-rw-r--r--src/lib/libssl/src/doc/crypto/ERR_print_errors.pod51
-rw-r--r--src/lib/libssl/src/doc/crypto/ERR_put_error.pod44
-rw-r--r--src/lib/libssl/src/doc/crypto/ERR_remove_state.pod34
-rw-r--r--src/lib/libssl/src/doc/crypto/EVP_DigestInit.pod197
-rw-r--r--src/lib/libssl/src/doc/crypto/EVP_EncryptInit.pod224
-rw-r--r--src/lib/libssl/src/doc/crypto/OPENSSL_VERSION_NUMBER.pod46
-rw-r--r--src/lib/libssl/src/doc/crypto/OpenSSL_add_all_algorithms.pod65
-rw-r--r--src/lib/libssl/src/doc/crypto/RAND_add.pod68
-rw-r--r--src/lib/libssl/src/doc/crypto/RAND_bytes.pod46
-rw-r--r--src/lib/libssl/src/doc/crypto/RAND_cleanup.pod29
-rw-r--r--src/lib/libssl/src/doc/crypto/RAND_egd.pod38
-rw-r--r--src/lib/libssl/src/doc/crypto/RAND_load_file.pod53
-rw-r--r--src/lib/libssl/src/doc/crypto/RAND_set_rand_method.pod57
-rw-r--r--src/lib/libssl/src/doc/crypto/RSA_blinding_on.pod43
-rw-r--r--src/lib/libssl/src/doc/crypto/RSA_check_key.pod39
-rw-r--r--src/lib/libssl/src/doc/crypto/RSA_generate_key.pod68
-rw-r--r--src/lib/libssl/src/doc/crypto/RSA_get_ex_new_index.pod122
-rw-r--r--src/lib/libssl/src/doc/crypto/RSA_new.pod38
-rw-r--r--src/lib/libssl/src/doc/crypto/RSA_padding_add_PKCS1_type_1.pod124
-rw-r--r--src/lib/libssl/src/doc/crypto/RSA_print.pod48
-rw-r--r--src/lib/libssl/src/doc/crypto/RSA_private_encrypt.pod69
-rw-r--r--src/lib/libssl/src/doc/crypto/RSA_public_encrypt.pod86
-rw-r--r--src/lib/libssl/src/doc/crypto/RSA_set_method.pod153
-rw-r--r--src/lib/libssl/src/doc/crypto/RSA_sign.pod62
-rw-r--r--src/lib/libssl/src/doc/crypto/RSA_sign_ASN1_OCTET_STRING.pod59
-rw-r--r--src/lib/libssl/src/doc/crypto/RSA_size.pod33
-rw-r--r--src/lib/libssl/src/doc/crypto/blowfish.pod106
-rw-r--r--src/lib/libssl/src/doc/crypto/bn.pod148
-rw-r--r--src/lib/libssl/src/doc/crypto/bn_internal.pod225
-rw-r--r--src/lib/libssl/src/doc/crypto/buffer.pod73
-rw-r--r--src/lib/libssl/src/doc/crypto/crypto.pod67
-rw-r--r--src/lib/libssl/src/doc/crypto/d2i_DHparams.pod30
-rw-r--r--src/lib/libssl/src/doc/crypto/d2i_RSAPublicKey.pod39
-rw-r--r--src/lib/libssl/src/doc/crypto/des_modes.pod250
-rw-r--r--src/lib/libssl/src/doc/crypto/dh.pod68
-rw-r--r--src/lib/libssl/src/doc/crypto/dsa.pod104
-rw-r--r--src/lib/libssl/src/doc/crypto/err.pod187
-rw-r--r--src/lib/libssl/src/doc/crypto/hmac.pod75
-rw-r--r--src/lib/libssl/src/doc/crypto/lh_stats.pod60
-rw-r--r--src/lib/libssl/src/doc/crypto/lhash.pod155
-rw-r--r--src/lib/libssl/src/doc/crypto/md5.pod85
-rw-r--r--src/lib/libssl/src/doc/crypto/mdc2.pod64
-rw-r--r--src/lib/libssl/src/doc/crypto/rand.pod158
-rw-r--r--src/lib/libssl/src/doc/crypto/rc4.pod62
-rw-r--r--src/lib/libssl/src/doc/crypto/ripemd.pod66
-rw-r--r--src/lib/libssl/src/doc/crypto/rsa.pod115
-rw-r--r--src/lib/libssl/src/doc/crypto/sha.pod70
-rw-r--r--src/lib/libssl/src/doc/crypto/threads.pod70
-rw-r--r--src/lib/libssl/src/doc/openssl.pod304
-rw-r--r--src/lib/libssl/src/doc/openssl.txt120
-rw-r--r--src/lib/libssl/src/doc/ssl.pod633
-rw-r--r--src/lib/libssl/src/doc/ssl/SSL_get_error.pod91
-rw-r--r--src/lib/libssl/src/doc/ssl/ssl.pod634
-rw-r--r--src/lib/libssl/src/doc/ssleay.txt4
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
6CA.pl - friendlier interface for OpenSSL certificate programs
7
8=head1 SYNOPSIS
9
10B<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
26The B<CA.pl> script is a perl script that supplies the relevant command line
27arguments to the B<openssl> command for some common certificate operations.
28It is intended to simplify the process of certificate creation and management
29by the use of some simple options.
30
31=head1 COMMAND OPTIONS
32
33=over 4
34
35=item B<?>, B<-h>, B<-help>
36
37prints a usage message.
38
39=item B<-newcert>
40
41creates a new self signed certificate. The private key and certificate are
42written to the file "newreq.pem".
43
44=item B<-newreq>
45
46creates a new certificate request. The private key and request are
47written to the file "newreq.pem".
48
49=item B<-newca>
50
51creates a new CA hierarchy for use with the B<ca> program (or the B<-signcert>
52and B<-xsign> options). The user is prompted to enter the filename of the CA
53certificates (which should also contain the private key) or by hitting ENTER
54details of the CA will be prompted for. The relevant files and directories
55are created in a directory called "demoCA" in the current directory.
56
57=item B<-pkcs12>
58
59create a PKCS#12 file containing the user certificate, private key and CA
60certificate. It expects the user certificate and private key to be in the
61file "newcert.pem" and the CA certificate to be in the file demoCA/cacert.pem,
62it creates a file "newcert.p12". This command can thus be called after the
63B<-sign> option. The PKCS#12 file can be imported directly into a browser.
64If 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
66list box), otherwise the name "My Certificate" is used.
67
68=item B<-sign>, B<-signreq>, B<-xsign>
69
70calls the B<ca> program to sign a certificate request. It expects the request
71to 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
73to standard output.
74
75=item B<-signcert>
76
77this option is the same as B<-sign> except it expects a self signed certificate
78to be present in the file "newreq.pem".
79
80=item B<-verify>
81
82verifies certificates against the CA certificate for "demoCA". If no certificates
83are specified on the command line it tries to verify the file "newcert.pem".
84
85=item B<files>
86
87one or more optional certificate file names for use with the B<-verify> command.
88
89=back
90
91=head1 EXAMPLES
92
93Create a CA hierarchy:
94
95 CA.pl -newca
96
97Complete certificate creation example: create a CA, create a request, sign
98the 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
107Most of the filenames mentioned can be modified by editing the B<CA.pl> script.
108
109If the demoCA directory already exists then the B<-newca> command will not
110overwrite it and will do nothing. This can happen if a previous call using
111the B<-newca> option terminated abnormally. To get the correct behaviour
112delete the demoCA directory if it already exists.
113
114Under some environments it may not be possible to run the B<CA.pl> script
115directly (for example Win32) and the default configuration file location may
116be wrong. In this case the command:
117
118 perl -S CA.pl
119
120can be used and the B<OPENSSL_CONF> environment variable changed to point to
121the correct path of the configuration file "openssl.cnf".
122
123The script is intended as a simple front end for the B<openssl> program for use
124by a beginner. Its behaviour isn't always what is wanted. For more control over the
125behaviour of the certificate commands call the B<openssl> command directly.
126
127=head1 ENVIRONMENT VARIABLES
128
129The variable B<OPENSSL_CONF> if defined allows an alternative configuration
130file location to be specified, it should contain the full path to the
131configuration file, not just its directory.
132
133=head1 SEE ALSO
134
135L<x509(1)|x509(1)>, L<ca(1)|ca(1)>, L<req(1)|req(1)>, L<pkcs12(1)|pkcs12(1)>,
136L<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
5asn1parse - ASN.1 parsing tool
6
7=head1 SYNOPSIS
8
9B<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
22The B<asn1parse> command is a diagnostic utility that can parse ASN.1
23structures. 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
31the input format. B<DER> is binary format and B<PEM> (the default) is base64
32encoded.
33
34=item B<-in filename>
35
36the input file, default is standard input
37
38=item B<-out filename>
39
40output file to place the DER encoded data into. If this
41option is not present then no data will be output. This is most useful when
42combined with the B<-strparse> option.
43
44=item B<-noout>
45
46don't output the parsed version of the input file.
47
48=item B<-offset number>
49
50starting offset to begin parsing, default is start of file.
51
52=item B<-length number>
53
54number of bytes to parse, default is until end of file.
55
56=item B<-i>
57
58indents the output according to the "depth" of the structures.
59
60=item B<-oid filename>
61
62a file containing additional OBJECT IDENTIFIERs (OIDs). The format of this
63file is described in the NOTES section below.
64
65=item B<-strparse offset>
66
67parse the contents octets of the ASN.1 object starting at B<offset>. This
68option can be used multiple times to "drill down" into a nested structure.
69
70
71=back
72
73=head2 OUTPUT
74
75The 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
94This example is part of a self signed certificate. Each line starts with the
95offset in decimal. B<d=XX> specifies the current depth. The depth is increased
96within 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
98the contents octets.
99
100The B<-i> option can be used to make the output more readable.
101
102Some knowledge of the ASN.1 structure is needed to interpret the output.
103
104In this example the BIT STRING at offset 229 is the certificate public key.
105The contents octets of this will contain the public key information. This can
106be 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
114If an OID is not part of OpenSSL's internal table it will be represented in
115numerical form (for example 1.2.3.4). The file passed to the B<-oid> option
116allows additional OIDs to be included. Each line consists of three columns,
117the first column is the OID in numerical format and should be followed by white
118space. The second column is the "short name" which is a single word followed
119by 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
122C<1.2.3.4 shortName A long name>
123
124=head1 BUGS
125
126There should be options to change the format of input lines. The output of some
127ASN.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
6ca - sample minimal CA application
7
8=head1 SYNOPSIS
9
10B<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
41The B<ca> command is a minimal CA application. It can be used
42to sign certificate requests in a variety of forms and generate
43CRLs it also maintains a text database of issued certificates
44and their status.
45
46The options descriptions will be divided into each purpose.
47
48=head1 CA OPTIONS
49
50=over 4
51
52=item B<-config filename>
53
54specifies the configuration file to use.
55
56=item B<-in filename>
57
58an input filename containing a single certificate request to be
59signed by the CA.
60
61=item B<-ss_cert filename>
62
63a single self signed certificate to be signed by the CA.
64
65=item B<-spkac filename>
66
67a file containing a single Netscape signed public key and challenge
68and additional field values to be signed by the CA. See the B<NOTES>
69section for information on the required format.
70
71=item B<-infiles>
72
73if present this should be the last option, all subsequent arguments
74are assumed to the the names of files containing certificate requests.
75
76=item B<-out filename>
77
78the output file to output certificates to. The default is standard
79output. The certificate details will also be printed out to this
80file.
81
82=item B<-outdir directory>
83
84the directory to output certificates to. The certificate will be
85written to a filename consisting of the serial number in hex with
86".pem" appended.
87
88=item B<-cert>
89
90the CA certificate file.
91
92=item B<-keyfile filename>
93
94the private key to sign requests with.
95
96=item B<-key password>
97
98the password used to encrypt the private key. Since on some
99systems the command line arguments are visible (e.g. Unix with
100the 'ps' utility) this option should be used with caution.
101
102=item B<-verbose>
103
104this prints extra details about the operations being performed.
105
106=item B<-notext>
107
108don't output the text form of a certificate to the output file.
109
110=item B<-startdate date>
111
112this allows the start date to be explicitly set. The format of the
113date is YYMMDDHHMMSSZ (the same as an ASN1 UTCTime structure).
114
115=item B<-enddate date>
116
117this allows the expiry date to be explicitly set. The format of the
118date is YYMMDDHHMMSSZ (the same as an ASN1 UTCTime structure).
119
120=item B<-days arg>
121
122the number of days to certify the certificate for.
123
124=item B<-md alg>
125
126the message digest to use. Possible values include md5, sha1 and mdc2.
127This option also applies to CRLs.
128
129=item B<-policy arg>
130
131this option defines the CA "policy" to use. This is a section in
132the configuration file which decides which fields should be mandatory
133or match the CA certificate. Check out the B<POLICY FORMAT> section
134for more information.
135
136=item B<-msie_hack>
137
138this is a legacy option to make B<ca> work with very old versions of
139the IE certificate enrollment control "certenr3". It used UniversalStrings
140for almost everything. Since the old control has various security bugs
141its use is strongly discouraged. The newer control "Xenroll" does not
142need this option.
143
144=item B<-preserveDN>
145
146Normally the DN order of a certificate is the same as the order of the
147fields in the relevant policy section. When this option is set the order
148is the same as the request. This is largely for compatibility with the
149older IE enrollment control which would only accept certificates if their
150DNs match the order of the request. This is not needed for Xenroll.
151
152=item B<-batch>
153
154this sets the batch mode. In this mode no questions will be asked
155and all certificates will be certified automatically.
156
157=item B<-extensions section>
158
159the section of the configuration file containing certificate extensions
160to be added when a certificate is issued. If no extension section is
161present then a V1 certificate is created. If the extension section
162is 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
172this option generates a CRL based on information in the index file.
173
174=item B<-crldays num>
175
176the number of days before the next CRL is due. That is the days from
177now to place in the CRL nextUpdate field.
178
179=item B<-crlhours num>
180
181the number of hours before the next CRL is due.
182
183=item B<-revoke filename>
184
185a filename containing a certificate to revoke.
186
187=item B<-crlexts section>
188
189the section of the configuration file containing CRL extensions to
190include. If no CRL extension section is present then a V1 CRL is
191created, if the CRL extension section is present (even if it is
192empty) then a V2 CRL is created. The CRL extensions specified are
193CRL extensions and B<not> CRL entry extensions. It should be noted
194that some software (for example Netscape) can't handle V2 CRLs.
195
196=back
197
198=head1 CONFIGURATION FILE OPTIONS
199
200The options for B<ca> are contained in the B<ca> section of the
201configuration file. Many of these are identical to command line
202options. Where the option is present in the configuration file
203and the command line the command line value is used. Where an
204option is described as mandatory then it must be present in
205the configuration file or the command line equivalent (if
206any) used.
207
208=over 4
209
210=item B<oid_file>
211
212This specifies a file containing additional B<OBJECT IDENTIFIERS>.
213Each line of the file should consist of the numerical form of the
214object identifier followed by white space then the short name followed
215by white space and finally the long name.
216
217=item B<oid_section>
218
219This specifies a section in the configuration file containing extra
220object identifiers. Each line should consist of the short name of the
221object identifier followed by B<=> and the numerical form. The short
222and long names are the same when this option is used.
223
224=item B<new_certs_dir>
225
226the same as the B<-outdir> command line option. It specifies
227the directory where new certificates will be placed. Mandatory.
228
229=item B<certificate>
230
231the same as B<-cert>. It gives the file containing the CA
232certificate. Mandatory.
233
234=item B<private_key>
235
236same as the B<-keyfile> option. The file containing the
237CA private key. Mandatory.
238
239=item B<RANDFILE>
240
241a file used to read and write random number seed information, or
242an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>).
243
244=item B<default_days>
245
246the same as the B<-days> option. The number of days to certify
247a certificate for.
248
249=item B<default_startdate>
250
251the same as the B<-startdate> option. The start date to certify
252a certificate for. If not set the current time is used.
253
254=item B<default_enddate>
255
256the same as the B<-enddate> option. Either this option or
257B<default_days> (or the command line equivalents) must be
258present.
259
260=item B<default_crl_hours default_crl_days>
261
262the same as the B<-crlhours> and the B<-crldays> options. These
263will only be used if neither command line option is present. At
264least one of these must be present to generate a CRL.
265
266=item B<default_md>
267
268the same as the B<-md> option. The message digest to use. Mandatory.
269
270=item B<database>
271
272the text database file to use. Mandatory. This file must be present
273though initially it will be empty.
274
275=item B<serialfile>
276
277a text file containing the next serial number to use in hex. Mandatory.
278This file must be present and contain a valid serial number.
279
280=item B<x509_extensions>
281
282the same as B<-extensions>.
283
284=item B<crl_extensions>
285
286the same as B<-crlexts>.
287
288=item B<preserve>
289
290the same as B<-preserveDN>
291
292=item B<msie_hack>
293
294the same as B<-msie_hack>
295
296=item B<policy>
297
298the same as B<-policy>. Mandatory. See the B<POLICY FORMAT> section
299for more information.
300
301=back
302
303=head1 POLICY FORMAT
304
305The policy section consists of a set of variables corresponding to
306certificate DN fields. If the value is "match" then the field value
307must 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
309it may be present. Any fields not mentioned in the policy section
310are silently deleted, unless the B<-preserveDN> option is set but
311this can be regarded more of a quirk than intended behaviour.
312
313=head1 SPKAC FORMAT
314
315The input to the B<-spkac> command line option is a Netscape
316signed public key and challenge. This will usually come from
317the B<KEYGEN> tag in an HTML form to create a new private key.
318It is however possible to create SPKACs using the B<spkac> utility.
319
320The file should contain the variable SPKAC set to the value of
321the SPKAC and also the required DN components as name value pairs.
322If you need to include the same component twice then it can be
323preceded by a number and a '.'.
324
325=head1 EXAMPLES
326
327Note: these examples assume that the B<ca> directory structure is
328already set up and the relevant files already exist. This usually
329involves creating a CA certificate and private key with B<req>, a
330serial number file and an empty index file and placing them in
331the relevant directories.
332
333To use the sample configuration file below the directories demoCA,
334demoCA/private and demoCA/newcerts would be created. The CA
335certificate would be copied to demoCA/cacert.pem and its private
336key to demoCA/private/cakey.pem. A file demoCA/serial would be
337created containing for example "01" and the empty index file
338demoCA/index.txt.
339
340
341Sign a certificate request:
342
343 openssl ca -in req.pem -out newcert.pem
344
345Generate a CRL
346
347 openssl ca -gencrl -out crl.pem
348
349Sign several requests:
350
351 openssl ca -infiles req1.pem req2.pem req3.pem
352
353Certify a Netscape SPKAC:
354
355 openssl ca -spkac spkac.txt
356
357A 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
365A 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
397The B<ca> command is quirky and at times downright unfriendly.
398
399The B<ca> utility was originally meant as an example of how to do things
400in a CA. It was not supposed be be used as a full blown CA itself:
401nevertheless some people are using it for this purpose.
402
403The B<ca> command is effectively a single user command: no locking is
404done on the various files and attempts to run more than one B<ca> command
405on the same database can have unpredictable results.
406
407=head1 FILES
408
409Note: the location of all files can change either by compile time options,
410configuration file entries, environment variables or command line options.
411The 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
426B<OPENSSL_CONF> reflects the location of master configuration file it can
427be overridden by the B<-config> command line option.
428
429=head1 RESTRICTIONS
430
431The text database index file is a critical part of the process and
432if corrupted it can be difficult to fix. It is theoretically possible
433to rebuild the index file from all the issued certificates and a current
434CRL: however there is no option to do this.
435
436CRL entry extensions cannot currently be created: only CRL extensions
437can be added.
438
439V2 CRL features like delta CRL support and CRL numbers are not currently
440supported.
441
442Although several requests can be input and handled at once it is only
443possible to include one SPKAC or self signed certificate.
444
445=head1 BUGS
446
447The use of an in memory text database can cause problems when large
448numbers of certificates are present because, as the name implies
449the database has to be kept in memory.
450
451Certificate request extensions are ignored: some kind of "policy" should
452be included to use certain static extensions and certain extensions
453from the request.
454
455It is not possible to certify two certificates with the same DN: this
456is a side effect of how the text database is indexed and it cannot easily
457be fixed without introducing other problems. Some S/MIME clients can use
458two certificates with the same DN for separate signing and encryption
459keys.
460
461The B<ca> command really needs rewriting or the required functionality
462exposed 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
464B<CA.pl> help a little but not very much.
465
466Any fields in a request that are not present in a policy are silently
467deleted. This does not happen if the B<-preserveDN> option is used but
468the extra fields are not displayed when the user is asked to certify
469a request. The behaviour should be more friendly and configurable.
470
471Cancelling some commands by refusing to certify a certificate can
472create an empty file.
473
474=head1 SEE ALSO
475
476L<req(1)|req(1)>, L<spkac(1)|spkac(1)>, L<x509(1)|x509(1)>, L<CA.pl(1)|CA.pl(1)>,
477L<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
5ciphers - SSL cipher display and cipher list tool.
6
7=head1 SYNOPSIS
8
9B<openssl> B<ciphers>
10[B<-v>]
11[B<-ssl2>]
12[B<-ssl3>]
13[B<-tls1>]
14[B<cipherlist>]
15
16=head1 DESCRIPTION
17
18The B<cipherlist> command converts OpenSSL cipher lists into ordered
19SSL cipher preference lists. It can be used as a test tool to determine
20the appropriate cipherlist.
21
22=head1 COMMAND OPTIONS
23
24=over 4
25
26=item B<-v>
27
28verbose option. List ciphers with a complete description of the authentication,
29key exchange, encryption and mac algorithms used along with any key size
30restrictions and whether the algorithm is classed as an "export" cipher.
31
32=item B<-ssl3>
33
34only include SSL v3 ciphers.
35
36=item B<-ssl2>
37
38only include SSL v2 ciphers.
39
40=item B<-tls1>
41
42only include TLS v1 ciphers.
43
44=item B<-h>, B<-?>
45
46print a brief usage message.
47
48=item B<cipherlist>
49
50a cipher list to convert to a cipher preference list. If it is not included
51then the default cipher list will be used. The format is described below.
52
53=back
54
55=head1 CIPHER LIST FORMAT
56
57The cipher list consists of one or more I<cipher strings> separated by colons.
58Commas or spaces are also acceptable separators but colons are normally used.
59
60The actual cipher string can take several different forms.
61
62It can consist of a single cipher suite such as B<RC4-SHA>.
63
64It can represent a list of cipher suites containing a certain algorithm, or
65cipher suites of a certain type. For example B<SHA1> represents all ciphers
66suites using the digest algorithm SHA1 and B<SSLv3> represents all SSL v3
67algorithms.
68
69Lists of cipher suites can be combined in a single cipher string using the
70B<+> character. This is used as a logical B<and> operation. For example
71B<SHA1+DES> represents all cipher suites containing the SHA1 B<and> the DES
72algorithms.
73
74Each cipher string can be optionally preceded by the characters B<!>,
75B<-> or B<+>.
76
77If B<!> is used then the ciphers are permanently deleted from the list.
78The ciphers deleted can never reappear in the list even if they are
79explicitly stated.
80
81If B<-> is used then the ciphers are deleted from the list, but some or
82all of the ciphers can be added again by later options.
83
84If B<+> is used then the ciphers are moved to the end of the list. This
85option doesn't add any new ciphers it just moves matching existing ones.
86
87If none of these characters is present then the string is just interpreted
88as a list of ciphers to be appended to the current preference list. If the
89list includes any ciphers already present they will be ignored: that is they
90will not moved to the end of the list.
91
92Additionally the cipher string B<@STRENGTH> can be used at any point to sort
93the current cipher list in order of encryption algorithm key length.
94
95=head1 CIPHER STRINGS
96
97The following is a list of all permitted cipher strings and their meanings.
98
99=over 4
100
101=item B<DEFAULT>
102
103the default cipher list. This is determined at compile time and is normally
104B<ALL:!ADH:RC4+RSA:+SSLv2:@STRENGTH>. This must be the first cipher string
105specified.
106
107=item B<ALL>
108
109all 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
114than 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
123but excluding export cipher suites.
124
125=item B<EXP>, B<EXPORT>
126
127export encryption algorithms. Including 40 and 56 bits algorithms.
128
129=item B<EXPORT40>
130
13140 bit export encryption algorithms
132
133=item B<EXPORT56>
134
13556 bit export encryption algorithms.
136
137=item B<eNULL>, B<NULL>
138
139the "NULL" ciphers that is those offering no encryption. Because these offer no
140encryption at all and are a security risk they are disabled unless explicitly
141included.
142
143=item B<aNULL>
144
145the cipher suites offering no authentication. This is currently the anonymous
146DH algorithms. These cipher suites are vulnerable to a "man in the middle"
147attack and so their use is normally discouraged.
148
149=item B<kRSA>, B<RSA>
150
151cipher suites using RSA key exchange.
152
153=item B<kEDH>
154
155cipher suites using ephemeral DH key agreement.
156
157=item B<kDHr>, B<kDHd>
158
159cipher suites using DH key agreement and DH certificates signed by CAs with RSA
160and DSS keys respectively. Not implemented.
161
162=item B<aRSA>
163
164cipher suites using RSA authentication, i.e. the certificates carry RSA keys.
165
166=item B<aDSS>, B<DSS>
167
168cipher suites using DSS authentication, i.e. the certificates carry DSS keys.
169
170=item B<aDH>
171
172cipher suites effectively using DH authentication, i.e. the certificates carry
173DH keys. Not implemented.
174
175=item B<kFZA>, B<aFZA>, B<eFZA>, B<FZA>
176
177ciphers suites using FORTEZZA key exchange, authentication, encryption or all
178FORTEZZA algorithms. Not implemented.
179
180=item B<TLSv1>, B<SSLv3>, B<SSLv2>
181
182TLS v1.0, SSL v3.0 or SSL v2.0 cipher suites respectively.
183
184=item B<DH>
185
186cipher suites using DH, including anonymous DH.
187
188=item B<ADH>
189
190anonymous DH cipher suites.
191
192=item B<3DES>
193
194cipher suites using triple DES.
195
196=item B<DES>
197
198cipher suites using DES (not triple DES).
199
200=item B<RC4>
201
202cipher suites using RC4.
203
204=item B<RC2>
205
206cipher suites using RC2.
207
208=item B<IDEA>
209
210cipher suites using IDEA.
211
212=item B<MD5>
213
214cipher suites using MD5.
215
216=item B<SHA1>, B<SHA>
217
218cipher suites using SHA1.
219
220=back
221
222=head1 CIPHER SUITE NAMES
223
224The following lists give the SSL or TLS cipher suites names from the
225relevant 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
297Note: 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
317The non-ephemeral DH modes are currently unimplemented in OpenSSL
318because there is no support for DH certificates.
319
320Some compiled versions of OpenSSL may not include all the ciphers
321listed here because some ciphers were excluded at compile time.
322
323=head1 EXAMPLES
324
325Verbose listing of all OpenSSL ciphers including NULL ciphers:
326
327 openssl ciphers -v 'ALL:eNULL'
328
329Include all ciphers except NULL and anonymous DH then sort by
330strength:
331
332 openssl ciphers -v 'ALL:!ADH:@STRENGTH'
333
334Include only 3DES ciphers and then place RSA ciphers last:
335
336 openssl ciphers -v '3DES:+RSA'
337
338=head1 SEE ALSO
339
340L<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
6config - OpenSSL CONF library configuration files
7
8=head1 DESCRIPTION
9
10The OpenSSL CONF library can be used to read configuration files.
11It is used for the OpenSSL master configuration file B<openssl.cnf>
12and in a few other places like B<SPKAC> files and certificate extension
13files for the B<x509> utility.
14
15A configuration file is divided into a number of sections. Each section
16starts with a line B<[ section_name ]> and ends when a new section is
17started or end of file is reached. A section name can consist of
18alphanumeric characters and underscores.
19
20The first section of a configuration file is special and is referred
21to as the B<default> section this is usually unnamed and is from the
22start of file until the first named section. When a name is being looked up
23it is first looked up in a named section (if any) and then the
24default section.
25
26The environment is mapped onto a section called B<ENV>.
27
28Comments can be included by preceding them with the B<#> character
29
30Each section in a configuration file consists of a number of name and
31value pairs of the form B<name=value>
32
33The B<name> string can contain any alphanumeric characters as well as
34a few punctuation symbols such as B<.> B<,> B<;> and B<_>.
35
36The B<value> string consists of the string following the B<=> character
37until end of line with any leading and trailing white space removed.
38
39The value string undergoes variable expansion. This can be done by
40including the form B<$var> or B<${var}>: this will substitute the value
41of the named variable in the current section. It is also possible to
42substitute a value from another section using the syntax B<$section::name>
43or B<${section::name}>. By using the form B<$ENV::name> environment
44variables can be substituted. It is also possible to assign values to
45environment variables by using the name B<ENV::name>, this will work
46if the program looks up environment variables using the B<CONF> library
47instead of calling B<getenv()> directly.
48
49It is possible to escape certain characters by using any kind of quote
50or the B<\> character. By making the last character of a line a B<\>
51a B<value> string can be spread across multiple lines. In addition
52the sequences B<\n>, B<\r>, B<\b> and B<\t> are recognized.
53
54=head1 NOTES
55
56If a configuration file attempts to expand a variable that doesn't exist
57then an error is flagged and the file will not load. This can happen
58if an attempt is made to expand an environment variable that doesn't
59exist. For example the default OpenSSL master configuration file used
60the value of B<HOME> which may not be defined on non Unix systems.
61
62This can be worked around by including a B<default> section to provide
63a default value: then if the environment lookup fails the default value
64will be used instead. For this to work properly the default value must
65be defined earlier in the configuration file than the expansion. See
66the B<EXAMPLES> section for an example of how to do this.
67
68If the same variable exists in the same section then all but the last
69value will be silently ignored. In certain circumstances such as with
70DNs the same field may occur multiple times. This is usually worked
71around 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
78Here is a sample configuration file using some of the features
79mentioned 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
104This next example shows how to expand environment variables safely.
105
106Suppose you want a variable called B<tmpfile> to refer to a
107temporary filename. The directory it is placed in can determined by
108the the B<TEMP> or B<TMP> environment variables but they may not be
109set to any value at all. If you just include the environment variable
110names and the variable doesn't exist then this will cause an error when
111an attempt is made to load the configuration file. By making use of the
112default section both values can be looked up with B<TEMP> taking
113priority 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
123Currently there is no way to include characters using the octal B<\nnn>
124form. Strings are all null terminated so nulls cannot form part of
125the value.
126
127The escaping isn't quite right: if you want to use sequences like B<\n>
128you can't use any quote escaping on the same line.
129
130Files are loaded in a single pass. This means that an variable expansion
131will only work if the variables referenced are defined earlier in the
132file.
133
134=head1 SEE ALSO
135
136L<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
5crl - CRL utility
6
7=head1 SYNOPSIS
8
9B<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
25The 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
33This specifies the input format. B<DER> format is DER encoded CRL
34structure. B<PEM> (the default) is a base64 encoded version of
35the DER form with header and footer lines.
36
37=item B<-outform DER|PEM>
38
39This specifies the output format, the options have the same meaning as the
40B<-inform> option.
41
42=item B<-in filename>
43
44This specifies the input filename to read from or standard input if this
45option is not specified.
46
47=item B<-out filename>
48
49specifies the output filename to write to or standard output by
50default.
51
52=item B<-text>
53
54print out the CRL in text form.
55
56=item B<-noout>
57
58don't output the encoded version of the CRL.
59
60=item B<-hash>
61
62output a hash of the issuer name. This can be use to lookup CRLs in
63a directory by issuer name.
64
65=item B<-issuer>
66
67output the issuer name.
68
69=item B<-lastupdate>
70
71output the lastUpdate field.
72
73=item B<-nextupdate>
74
75output the nextUpdate field.
76
77=item B<-CAfile file>
78
79verify the signature on a CRL by looking up the issuing certificate in
80B<file>
81
82=item B<-CApath dir>
83
84verify the signature on a CRL by looking up the issuing certificate in
85B<dir>. This directory must be a standard certificate directory: that
86is a hash of each subject name (using B<x509 -hash>) should be linked
87to each certificate.
88
89=back
90
91=head1 NOTES
92
93The PEM CRL format uses the header and footer lines:
94
95 -----BEGIN X509 CRL-----
96 -----END X509 CRL-----
97
98=head1 EXAMPLES
99
100Convert a CRL file from PEM to DER:
101
102 openssl crl -in crl.pem -outform DER -out crl.der
103
104Output the text form of a DER encoded certificate:
105
106 openssl crl -in crl.der -text -noout
107
108=head1 BUGS
109
110Ideally it should be possible to create a CRL using appropriate options
111and files too.
112
113=head1 SEE ALSO
114
115L<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
5crl2pkcs7 - Create a PKCS#7 structure from a CRL and certificates.
6
7=head1 SYNOPSIS
8
9B<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
18The B<crl2pkcs7> command takes an optional CRL and one or more
19certificates and converts them into a PKCS#7 degenerate "certificates
20only" structure.
21
22=head1 COMMAND OPTIONS
23
24=over 4
25
26=item B<-inform DER|PEM>
27
28This specifies the CRL input format. B<DER> format is DER encoded CRL
29structure.B<PEM> (the default) is a base64 encoded version of
30the DER form with header and footer lines.
31
32=item B<-outform DER|PEM>
33
34This specifies the PKCS#7 structure output format. B<DER> format is DER
35encoded PKCS#7 structure.B<PEM> (the default) is a base64 encoded version of
36the DER form with header and footer lines.
37
38=item B<-in filename>
39
40This specifies the input filename to read a CRL from or standard input if this
41option is not specified.
42
43=item B<-out filename>
44
45specifies the output filename to write the PKCS#7 structure to or standard
46output by default.
47
48=item B<-certfile filename>
49
50specifies a filename containing one or more certificates in B<PEM> format.
51All certificates in the file will be added to the PKCS#7 structure. This
52option can be used more than once to read certificates form multiple
53files.
54
55=item B<-nocrl>
56
57normally a CRL is included in the output file. With this option no CRL is
58included in the output file and a CRL is not read from the input file.
59
60=back
61
62=head1 EXAMPLES
63
64Create a PKCS#7 structure from a certificate and CRL:
65
66 openssl crl2pkcs7 -in crl.pem -certfile cert.pem -out p7.pem
67
68Creates a PKCS#7 structure in DER format with no CRL from several
69different certificates:
70
71 openssl crl2pkcs7 -nocrl -certfile newcert.pem
72 -certfile demoCA/cacert.pem -outform DER -out p7.der
73
74=head1 NOTES
75
76The output file is a PKCS#7 signed data structure containing no signers and
77just certificates and an optional CRL.
78
79This utility can be used to send certificates and CAs to Netscape as part of
80the certificate enrollment process. This involves sending the DER encoded output
81as MIME type application/x-x509-user-cert.
82
83The B<PEM> encoded form with the header and footer lines removed can be used to
84install user certificates and CAs in MSIE using the Xenroll control.
85
86=head1 SEE ALSO
87
88L<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
5dgst, 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
22The digest functions print out the message digest of a supplied file or files
23in hexadecimal form.
24
25=head1 OPTIONS
26
27=over 4
28
29=item B<-c>
30
31print out the digest in two digit groups separated by colons.
32
33=item B<-d>
34
35print out BIO debugging information.
36
37=item B<file...>
38
39file or files to digest. If no files are specified then standard input is
40used.
41
42=back
43
44=head1 NOTES
45
46The digest of choice for all new applications is SHA1. Other digests are
47however 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
5dhparam - DH parameter manipulation and generation
6
7=head1 SYNOPSIS
8
9B<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
24This command is used to manipulate DH parameter files.
25
26=head1 OPTIONS
27
28=over 4
29
30=item B<-inform DER|PEM>
31
32This specifies the input format. The B<DER> option uses an ASN1 DER encoded
33form compatible with the PKCS#3 DHparameter structure. The PEM form is the
34default format: it consists of the B<DER> format base64 encoded with
35additional header and footer lines.
36
37=item B<-outform DER|PEM>
38
39This specifies the output format, the options have the same meaning as the
40B<-inform> option.
41
42=item B<-in filename>
43
44This specifies the input filename to read parameters from or standard input if
45this option is not specified.
46
47=item B<-out filename>
48
49This specifies the output filename parameters to. Standard output is used
50if this option is not present. The output filename should B<not> be the same
51as the input filename.
52
53=item B<-2>, B<-5>
54
55The generator to use, either 2 or 5. 2 is the default. If present then the
56input file is ignored and parameters are generated instead.
57
58=item B<-rand file(s)>
59
60a file or files containing random data used to seed the random number
61generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>).
62Multiple files can be specified separated by a OS-dependent character.
63The separator is B<;> for MS-Windows, B<,> for OpenVSM, and B<:> for
64all others.
65
66=item B<numbits>
67
68this option specifies that a parameter set should be generated of size
69B<numbits>. It must be the last option. If not present then a value of 512
70is used. If this option is present then the input file is ignored and
71parameters are generated instead.
72
73=item B<-noout>
74
75this option inhibits the output of the encoded version of the parameters.
76
77=item B<-text>
78
79this option prints out the DH parameters in human readable form.
80
81=item B<-C>
82
83this option converts the parameters into C code. The parameters can then
84be loaded by calling the B<get_dhXXX()> function.
85
86=back
87
88=head1 WARNINGS
89
90The program B<dhparam> combines the functionality of the programs B<dh> and
91B<gendh> in previous versions of OpenSSL and SSLeay. The B<dh> and B<gendh>
92programs are retained for now but may have different purposes in future
93versions of OpenSSL.
94
95=head1 NOTES
96
97PEM format DH parameters use the header and footer lines:
98
99 -----BEGIN DH PARAMETERS-----
100 -----END DH PARAMETERS-----
101
102OpenSSL currently only supports the older PKCS#3 DH, not the newer X9.42
103DH.
104
105This program manipulates DH parameters not keys.
106
107=head1 BUGS
108
109There should be a way to generate and manipulate DH keys.
110
111=head1 SEE ALSO
112
113L<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
5dsa - DSA key processing
6
7=head1 SYNOPSIS
8
9B<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
27The B<dsa> command processes DSA keys. They can be converted between various
28forms and their components printed out. B<Note> This command uses the
29traditional SSLeay compatible format for private key encryption: newer
30applications 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
38This specifies the input format. The B<DER> option with a private key uses
39an ASN1 DER encoded form of an ASN.1 SEQUENCE consisting of the values of
40version (currently zero), p, q, g, the public and private key components
41respectively as ASN.1 INTEGERs. When used with a public key it uses a
42SubjectPublicKeyInfo structure: it is an error if the key is not DSA.
43
44The B<PEM> form is the default format: it consists of the B<DER> format base64
45encoded with additional header and footer lines. In the case of a private key
46PKCS#8 format is also accepted.
47
48=item B<-outform DER|PEM>
49
50This specifies the output format, the options have the same meaning as the
51B<-inform> option.
52
53=item B<-in filename>
54
55This specifies the input filename to read a key from or standard input if this
56option is not specified. If the key is encrypted a pass phrase will be
57prompted for.
58
59=item B<-passin arg>
60
61the input file password source. For more information about the format of B<arg>
62see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
63
64=item B<-out filename>
65
66This specifies the output filename to write a key to or standard output by
67is not specified. If any encryption options are set then a pass phrase will be
68prompted for. The output filename should B<not> be the same as the input
69filename.
70
71=item B<-passout arg>
72
73the output file password source. For more information about the format of B<arg>
74see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
75
76=item B<-des|-des3|-idea>
77
78These options encrypt the private key with the DES, triple DES, or the
79IDEA ciphers respectively before outputting it. A pass phrase is prompted for.
80If none of these options is specified the key is written in plain text. This
81means that using the B<dsa> utility to read in an encrypted key with no
82encryption option can be used to remove the pass phrase from a key, or by
83setting the encryption options it can be use to add or change the pass phrase.
84These options can only be used with PEM format output files.
85
86=item B<-text>
87
88prints out the public, private key components and parameters.
89
90=item B<-noout>
91
92this option prevents output of the encoded version of the key.
93
94=item B<-modulus>
95
96this option prints out the value of the public key component of the key.
97
98=item B<-pubin>
99
100by default a private key is read from the input file: with this option a
101public key is read instead.
102
103=item B<-pubout>
104
105by default a private key is output. With this option a public
106key will be output instead. This option is automatically set if the input is
107a public key.
108
109=back
110
111=head1 NOTES
112
113The PEM private key format uses the header and footer lines:
114
115 -----BEGIN DSA PRIVATE KEY-----
116 -----END DSA PRIVATE KEY-----
117
118The PEM public key format uses the header and footer lines:
119
120 -----BEGIN PUBLIC KEY-----
121 -----END PUBLIC KEY-----
122
123=head1 EXAMPLES
124
125To remove the pass phrase on a DSA private key:
126
127 openssl dsa -in key.pem -out keyout.pem
128
129To encrypt a private key using triple DES:
130
131 openssl dsa -in key.pem -des3 -out keyout.pem
132
133To convert a private key from PEM to DER format:
134
135 openssl dsa -in key.pem -outform DER -out keyout.der
136
137To print out the components of a private key to standard output:
138
139 openssl dsa -in key.pem -text -noout
140
141To 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
147L<dsaparam(1)|dsaparam(1)>, L<gendsa(1)|gendsa(1)>, L<rsa(1)|rsa(1)>,
148L<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
5dsaparam - DSA parameter manipulation and generation
6
7=head1 SYNOPSIS
8
9B<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
23This 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
31This specifies the input format. The B<DER> option uses an ASN1 DER encoded
32form compatible with RFC2459 (PKIX) DSS-Parms that is a SEQUENCE consisting
33of p, q and g respectively. The PEM form is the default format: it consists
34of the B<DER> format base64 encoded with additional header and footer lines.
35
36=item B<-outform DER|PEM>
37
38This specifies the output format, the options have the same meaning as the
39B<-inform> option.
40
41=item B<-in filename>
42
43This specifies the input filename to read parameters from or standard input if
44this option is not specified. If the B<numbits> parameter is included then
45this option will be ignored.
46
47=item B<-out filename>
48
49This specifies the output filename parameters to. Standard output is used
50if this option is not present. The output filename should B<not> be the same
51as the input filename.
52
53=item B<-noout>
54
55this option inhibits the output of the encoded version of the parameters.
56
57=item B<-text>
58
59this option prints out the DSA parameters in human readable form.
60
61=item B<-C>
62
63this option converts the parameters into C code. The parameters can then
64be loaded by calling the B<get_dsaXXX()> function.
65
66=item B<-genkey>
67
68this option will generate a DSA either using the specified or generated
69parameters.
70
71=item B<-rand file(s)>
72
73a file or files containing random data used to seed the random number
74generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>).
75Multiple files can be specified separated by a OS-dependent character.
76The separator is B<;> for MS-Windows, B<,> for OpenVSM, and B<:> for
77all others.
78
79=item B<numbits>
80
81this option specifies that a parameter set should be generated of size
82B<numbits>. It must be the last option. If this option is included then
83the input file (if any) is ignored.
84
85=back
86
87=head1 NOTES
88
89PEM format DSA parameters use the header and footer lines:
90
91 -----BEGIN DSA PARAMETERS-----
92 -----END DSA PARAMETERS-----
93
94DSA parameter generation is a slow process and as a result the same set of
95DSA parameters is often used to generate several distinct keys.
96
97=head1 SEE ALSO
98
99L<gendsa(1)|gendsa(1)>, L<dsa(1)|dsa(1)>, L<genrsa(1)|genrsa(1)>,
100L<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
5enc - symmetric cipher routines
6
7=head1 SYNOPSIS
8
9B<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
28The symmetric cipher commands allow data to be encrypted or decrypted
29using various block and stream ciphers using keys based on passwords
30or explicitly provided. Base64 encoding or decoding can also be performed
31either 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
39the input filename, standard input by default.
40
41=item B<-out filename>
42
43the output filename, standard output by default.
44
45=item B<-pass arg>
46
47the password source. For more information about the format of B<arg>
48see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
49
50=item B<-salt>
51
52use a salt in the key derivation routines. This option should B<ALWAYS>
53be used unless compatibility with previous versions of OpenSSL or SSLeay
54is required. This option is only present on OpenSSL versions 0.9.5 or
55above.
56
57=item B<-nosalt>
58
59don't use a salt in the key derivation routines. This is the default for
60compatibility with previous versions of OpenSSL and SSLeay.
61
62=item B<-e>
63
64encrypt the input data: this is the default.
65
66=item B<-d>
67
68decrypt the input data.
69
70=item B<-a>
71
72base64 process the data. This means that if encryption is taking place
73the data is base64 encoded after encryption. If decryption is set then
74the input data is base64 decoded before being decrypted.
75
76=item B<-A>
77
78if the B<-a> option is set then base64 process the data on one line.
79
80=item B<-k password>
81
82the password to derive the key from. This is for compatibility with previous
83versions of OpenSSL. Superseded by the B<-pass> argument.
84
85=item B<-kfile filename>
86
87read the password to derive the key from the first line of B<filename>.
88This is for computability with previous versions of OpenSSL. Superseded by
89the B<-pass> argument.
90
91=item B<-S salt>
92
93the actual salt to use: this must be represented as a string comprised only
94of hex digits.
95
96=item B<-K key>
97
98the actual key to use: this must be represented as a string comprised only
99of hex digits.
100
101=item B<-iv IV>
102
103the actual IV to use: this must be represented as a string comprised only
104of hex digits.
105
106=item B<-p>
107
108print out the key and IV used.
109
110=item B<-P>
111
112print out the key and IV used then immediately exit: don't do any encryption
113or decryption.
114
115=item B<-bufsize number>
116
117set the buffer size for I/O
118
119=item B<-debug>
120
121debug the BIOs used for I/O.
122
123=back
124
125=head1 NOTES
126
127The program can be called either as B<openssl ciphername> or
128B<openssl enc -ciphername>.
129
130A password will be prompted for to derive the key and IV if necessary.
131
132The B<-salt> option should B<ALWAYS> be used if the key is being derived
133from a password unless you want compatibility with previous versions of
134OpenSSL and SSLeay.
135
136Without the B<-salt> option it is possible to perform efficient dictionary
137attacks on the password and to attack stream cipher encrypted data. The reason
138for this is that without the salt the same password always generates the same
139encryption key. When the salt is being used the first eight bytes of the
140encrypted data are reserved for the salt: it is generated at random when
141encrypting a file and read from the encrypted file when it is decrypted.
142
143Some of the ciphers do not have large keys and others have security
144implications if not used correctly. A beginner is advised to just use
145a strong block cipher in CBC mode such as bf or des3.
146
147All the block ciphers use PKCS#5 padding also known as standard block
148padding: this allows a rudimentary integrity or password check to be
149performed. However since the chance of random data passing the test is
150better than 1 in 256 it isn't a very good test.
151
152All RC2 ciphers have the same key and effective key length.
153
154Blowfish 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
218Just base64 encode a binary file:
219
220 openssl base64 -in file.bin -out file.b64
221
222Decode the same file
223
224 openssl base64 -d -in file.b64 -out file.bin
225
226Encrypt a file using triple DES in CBC mode using a prompted password:
227
228 openssl des3 -salt -in file.txt -out file.des3
229
230Decrypt a file using a supplied password:
231
232 openssl des3 -d -salt -in file.des3 -out file.txt -k mypassword
233
234Encrypt a file then base64 encode it (so it can be sent via mail for example)
235using Blowfish in CBC mode:
236
237 openssl bf -a -salt -in file.txt -out file.bf
238
239Base64 decode a file then decrypt it:
240
241 openssl bf -d -salt -a -in file.bf -out file.txt
242
243Decrypt 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
249The B<-A> option when used with large files doesn't work properly.
250
251There should be an option to allow an iteration count to be included.
252
253Like the EVP library the B<enc> program only supports a fixed number of
254algorithms with certain parameters. So if, for example, you want to use RC2
255with 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
5gendsa - generate a DSA private key from a set of parameters
6
7=head1 SYNOPSIS
8
9B<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
19The 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
28These options encrypt the private key with the DES, triple DES, or the
29IDEA ciphers respectively before outputting it. A pass phrase is prompted for.
30If none of these options is specified no encryption is used.
31
32=item B<-rand file(s)>
33
34a file or files containing random data used to seed the random number
35generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>).
36Multiple files can be specified separated by a OS-dependent character.
37The separator is B<;> for MS-Windows, B<,> for OpenVSM, and B<:> for
38all others.
39
40=item B<paramfile>
41
42This option specifies the DSA parameter file to use. The parameters in this
43file determine the size of the private key. DSA parameters can be generated
44and examined using the B<openssl dsaparam> command.
45
46=back
47
48=head1 NOTES
49
50DSA key generation is little more than random number generation so it is
51much quicker that RSA key generation for example.
52
53=head1 SEE ALSO
54
55L<dsaparam(1)|dsaparam(1)>, L<dsa(1)|dsa(1)>, L<genrsa(1)|genrsa(1)>,
56L<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
5genrsa - generate an RSA private key
6
7=head1 SYNOPSIS
8
9B<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
22The B<genrsa> command generates an RSA private key.
23
24=head1 OPTIONS
25
26=over 4
27
28=item B<-out filename>
29
30the output filename. If this argument is not specified then standard output is
31used.
32
33=item B<-passout arg>
34
35the output file password source. For more information about the format of B<arg>
36see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
37
38=item B<-des|-des3|-idea>
39
40These options encrypt the private key with the DES, triple DES, or the
41IDEA ciphers respectively before outputting it. If none of these options is
42specified no encryption is used. If encryption is used a pass phrase is prompted
43for if it is not supplied via the B<-passout> argument.
44
45=item B<-F4|-3>
46
47the public exponent to use, either 65537 or 3. The default is 65537.
48
49=item B<-rand file(s)>
50
51a file or files containing random data used to seed the random number
52generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>).
53Multiple files can be specified separated by a OS-dependent character.
54The separator is B<;> for MS-Windows, B<,> for OpenVSM, and B<:> for
55all others.
56
57=item B<numbits>
58
59the size of the private key to generate in bits. This must be the last option
60specified. The default is 512.
61
62=back
63
64=head1 NOTES
65
66RSA private key generation essentially involves the generation of two prime
67numbers. When generating a private key various symbols will be output to
68indicate the progress of the generation. A B<.> represents each number which
69has passed an initial sieve test, B<+> means a number has passed a single
70round of the Miller-Rabin primality test. A newline means that the number has
71passed all the prime tests (the actual number depends on the key size).
72
73Because key generation is a random process the time taken to generate a key
74may vary somewhat.
75
76=head1 BUGS
77
78A quirk of the prime generation algorithm is that it cannot generate small
79primes. Therefore the number of bits should not be less that 64. For typical
80private keys this will not matter because for security reasons they will
81be much larger (typically 1024 bits).
82
83=head1 SEE ALSO
84
85L<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
5nseq - create or examine a netscape certificate sequence
6
7=head1 SYNOPSIS
8
9B<openssl> B<nseq>
10[B<-in filename>]
11[B<-out filename>]
12[B<-toseq>]
13
14=head1 DESCRIPTION
15
16The B<nseq> command takes a file containing a Netscape certificate
17sequence and prints out the certificates contained in it or takes a
18file of certificates and converts it into a Netscape certificate
19sequence.
20
21=head1 COMMAND OPTIONS
22
23=over 4
24
25=item B<-in filename>
26
27This specifies the input filename to read or standard input if this
28option is not specified.
29
30=item B<-out filename>
31
32specifies the output filename or standard output by default.
33
34=item B<-toseq>
35
36normally a Netscape certificate sequence will be input and the output
37is the certificates contained in it. With the B<-toseq> option the
38situation is reversed: a Netscape certificate sequence is created from
39a file of certificates.
40
41=back
42
43=head1 EXAMPLES
44
45Output the certificates in a Netscape certificate sequence
46
47 openssl nseq -in nseq.pem -out certs.pem
48
49Create a Netscape certificate sequence
50
51 openssl nseq -in certs.pem -toseq -out nseq.pem
52
53=head1 NOTES
54
55The B<PEM> encoded form uses the same headers and footers as a certificate:
56
57 -----BEGIN CERTIFICATE-----
58 -----END CERTIFICATE-----
59
60A Netscape certificate sequence is a Netscape specific form that can be sent
61to browsers as an alternative to the standard PKCS#7 format when several
62certificates are sent to the browser: for example during certificate enrollment.
63It is used by Netscape certificate server for example.
64
65=head1 BUGS
66
67This program needs a few more options: like allowing DER or PEM input and
68output 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
6openssl - OpenSSL command line tool
7
8=head1 SYNOPSIS
9
10B<openssl>
11I<command>
12[ I<command_opts> ]
13[ I<command_args> ]
14
15=head1 DESCRIPTION
16
17OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL
18v2/v3) and Transport Layer Security (TLS v1) network protocols and related
19cryptography standards required by them.
20
21The B<openssl> program is a command line tool for using the various
22cryptography functions of OpenSSL's B<crypto> library from the shell.
23It 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
34The B<openssl> program provides a rich variety of commands (I<command> in the
35SYNOPSIS 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
44Parse an ASN.1 sequence.
45
46=item L<B<ca>|ca(1)>
47
48Certificate Authority (CA) Management.
49
50=item L<B<ciphers>|ciphers(1)>
51
52Cipher Suite Description Determination.
53
54=item L<B<crl>|crl(1)>
55
56Certificate Revocation List (CRL) Management.
57
58=item L<B<crl2pkcs7>|crl2pkcs7(1)>
59
60CRL to PKCS#7 Conversion.
61
62=item L<B<dgst>|dgst(1)>
63
64Message Digest Calculation.
65
66=item L<B<dh>|dh(1)>
67
68Diffie-Hellman Data Management.
69
70=item L<B<dsa>|dsa(1)>
71
72DSA Data Management.
73
74=item L<B<dsaparam>|dsaparam(1)>
75
76DSA Parameter Generation.
77
78=item L<B<enc>|enc(1)>
79
80Encoding with Ciphers.
81
82=item L<B<errstr>|errstr(1)>
83
84Error Number to Error String Conversion.
85
86=item L<B<gendh>|gendh(1)>
87
88Generation of Diffie-Hellman Parameters.
89
90=item L<B<gendsa>|gendsa(1)>
91
92Generation of DSA Parameters.
93
94=item L<B<genrsa>|genrsa(1)>
95
96Generation of RSA Parameters.
97
98=item L<B<passwd>|passwd(1)>
99
100Generation of hashed passwords.
101
102=item L<B<pkcs7>|pkcs7(1)>
103
104PKCS#7 Data Management.
105
106=item L<B<req>|req(1)>
107
108X.509 Certificate Signing Request (CSR) Management.
109
110=item L<B<rsa>|rsa(1)>
111
112RSA Data Management.
113
114=item L<B<s_client>|s_client(1)>
115
116This implements a generic SSL/TLS client which can establish a transparent
117connection to a remote server speaking SSL/TLS. It's intended for testing
118purposes only and provides only rudimentary interface functionality but
119internally uses mostly all functionality of the OpenSSL B<ssl> library.
120
121=item L<B<s_server>|s_server(1)>
122
123This implements a generic SSL/TLS server which accepts connections from remote
124clients speaking SSL/TLS. It's intended for testing purposes only and provides
125only rudimentary interface functionality but internally uses mostly all
126functionality of the OpenSSL B<ssl> library. It provides both an own command
127line oriented protocol for testing SSL functions and a simple HTTP response
128facility to emulate an SSL/TLS-aware webserver.
129
130=item L<B<s_time>|s_time(1)>
131
132SSL Connection Timer.
133
134=item L<B<sess_id>|sess_id(1)>
135
136SSL Session Data Management.
137
138=item L<B<smime>|smime(1)>
139
140S/MIME mail processing.
141
142=item L<B<speed>|speed(1)>
143
144Algorithm Speed Measurement.
145
146=item L<B<verify>|verify(1)>
147
148X.509 Certificate Verification.
149
150=item L<B<version>|version(1)>
151
152OpenSSL Version Information.
153
154=item L<B<x509>|x509(1)>
155
156X.509 Certificate Data Management.
157
158=back
159
160=head2 MESSAGE DIGEST COMMANDS
161
162=over 10
163
164=item B<md2>
165
166MD2 Digest
167
168=item B<md5>
169
170MD5 Digest
171
172=item B<mdc2>
173
174MDC2 Digest
175
176=item B<rmd160>
177
178RMD-160 Digest
179
180=item B<sha>
181
182SHA Digest
183
184=item B<sha1>
185
186SHA-1 Digest
187
188=back
189
190=head2 ENCODING AND CIPHER COMMANDS
191
192=over 10
193
194=item B<base64>
195
196Base64 Encoding
197
198=item B<bf bf-cbc bf-cfb bf-ecb bf-ofb>
199
200Blowfish Cipher
201
202=item B<cast cast-cbc>
203
204CAST Cipher
205
206=item B<cast5-cbc cast5-cfb cast5-ecb cast5-ofb>
207
208CAST5 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
212DES Cipher
213
214=item B<des3 desx des-ede3 des-ede3-cbc des-ede3-cfb des-ede3-ofb>
215
216Triple-DES Cipher
217
218=item B<idea idea-cbc idea-cfb idea-ecb idea-ofb>
219
220IDEA Cipher
221
222=item B<rc2 rc2-cbc rc2-cfb rc2-ecb rc2-ofb>
223
224RC2 Cipher
225
226=item B<rc4>
227
228RC4 Cipher
229
230=item B<rc5 rc5-cbc rc5-cfb rc5-ecb rc5-ofb>
231
232RC5 Cipher
233
234=back
235
236=head1 PASS PHRASE ARGUMENTS
237
238Several commands accept password arguments, typically using B<-passin>
239and B<-passout> for input and output passwords respectively. These allow
240the password to be obtained from a variety of sources. Both of these
241options take a single argument whose format is described below. If no
242password argument is given and a password is required then the user is
243prompted to enter one: this will typically be read from the current
244terminal with echoing turned off.
245
246=over 10
247
248=item B<pass:password>
249
250the actual password is B<password>. Since the password is visible
251to utilities (like 'ps' under Unix) this form should only be used
252where security is not important.
253
254=item B<env:var>
255
256obtain the password from the environment variable B<var>. Since
257the 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
262the first line of B<pathname> is the password. If the same B<pathname>
263argument is supplied to B<-passin> and B<-passout> arguments then the first
264line will be used for the input password and the next line for the output
265password. B<pathname> need not refer to a regular file: it could for example
266refer to a device or named pipe.
267
268=item B<fd:number>
269
270read the password from the file descriptor B<number>. This can be used to
271send the data via a pipe for example.
272
273=item B<stdin>
274
275read the password from standard input.
276
277=back
278
279=head1 SEE ALSO
280
281L<asn1parse(1)|asn1parse(1)>, L<ca(1)|ca(1)>, L<config(5)|config(5)>,
282L<crl(1)|crl(1)>, L<crl2pkcs7(1)|crl2pkcs7(1)>, L<dgst(1)|dgst(1)>,
283L<dhparam(1)|dhparam(1)>, L<dsa(1)|dsa(1)>, L<dsaparam(1)|dsaparam(1)>,
284L<enc(1)|enc(1)>, L<gendsa(1)|gendsa(1)>,
285L<genrsa(1)|genrsa(1)>, L<nseq(1)|nseq(1)>, L<openssl(1)|openssl(1)>,
286L<passwd(1)|passwd(1)>,
287L<pkcs12(1)|pkcs12(1)>, L<pkcs7(1)|pkcs7(1)>, L<pkcs8(1)|pkcs8(1)>,
288L<req(1)|req(1)>, L<rsa(1)|rsa(1)>, L<s_client(1)|s_client(1)>,
289L<s_server(1)|s_server(1)>, L<smime(1)|smime(1)>, L<spkac(1)|spkac(1)>,
290L<verify(1)|verify(1)>, L<version(1)|version(1)>, L<x509(1)|x509(1)>,
291L<crypto(3)|crypto(3)>, L<ssl(3)|ssl(3)>
292
293=head1 HISTORY
294
295The 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
5passwd - compute password hashes
6
7=head1 SYNOPSIS
8
9B<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
21The B<passwd> command computes the hash of a password typed at
22run-time or the hash of each password in a list. The password list is
23taken from the named file for option B<-in file>, from stdin for
24option B<-stdin>, and from the command line otherwise.
25The Unix standard algorithm B<crypt> and the MD5-based B<apr1> algorithm
26are available.
27
28=head1 OPTIONS
29
30=over 4
31
32=item B<-crypt>
33
34Use the B<crypt> algorithm (default).
35
36=item B<-apr1>
37
38Use the B<apr1> algorithm.
39
40=item B<-salt> I<string>
41
42Use the specified salt.
43
44=item B<-in> I<file>
45
46Read passwords from I<file>.
47
48=item B<-stdin>
49
50Read passwords from B<stdin>.
51
52=item B<-quiet>
53
54Don't output warnings when passwords given at the command line are truncated.
55
56=item B<-table>
57
58In the output list, prepend the cleartext password and a TAB character
59to each password hash.
60
61=back
62
63=head1 EXAMPLES
64
65B<openssl passwd -crypt -salt xx password> prints B<xxj31ZMTZzkVA>.
66
67B<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
6pkcs12 - PKCS#12 file utility
7
8=head1 SYNOPSIS
9
10B<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
45The B<pkcs12> command allows PKCS#12 files (sometimes referred to as
46PFX files) to be created and parsed. PKCS#12 files are used by several
47programs including Netscape, MSIE and MS Outlook.
48
49=head1 COMMAND OPTIONS
50
51There are a lot of options the meaning of some depends of whether a PKCS#12 file
52is being created or parsed. By default a PKCS#12 file is parsed a PKCS#12
53file 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
61This specifies filename of the PKCS#12 file to be parsed. Standard input is used
62by default.
63
64=item B<-out filename>
65
66The filename to write certificates and private keys to, standard output by default.
67They are all written in PEM format.
68
69=item B<-pass arg>, B<-passin arg>
70
71the PKCS#12 file (i.e. input file) password source. For more information about the
72format of B<arg> see the B<PASS PHRASE ARGUMENTS> section in
73L<openssl(1)|openssl(1)>.
74
75=item B<-passout arg>
76
77pass phrase source to encrypt any outputed private keys with. For more information
78about the format of B<arg> see the B<PASS PHRASE ARGUMENTS> section in
79L<openssl(1)|openssl(1)>.
80
81=item B<-noout>
82
83this option inhibits output of the keys and certificates to the output file version
84of the PKCS#12 file.
85
86=item B<-clcerts>
87
88only output client certificates (not CA certificates).
89
90=item B<-cacerts>
91
92only output CA certificates (not client certificates).
93
94=item B<-nocerts>
95
96no certificates at all will be output.
97
98=item B<-nokeys>
99
100no private keys will be output.
101
102=item B<-info>
103
104output additional information about the PKCS#12 file structure, algorithms used and
105iteration counts.
106
107=item B<-des>
108
109use DES to encrypt private keys before outputting.
110
111=item B<-des3>
112
113use triple DES to encrypt private keys before outputting, this is the default.
114
115=item B<-idea>
116
117use IDEA to encrypt private keys before outputting.
118
119=item B<-nodes>
120
121don't encrypt the private keys at all.
122
123=item B<-nomacver>
124
125don't attempt to verify the integrity MAC before reading the file.
126
127=item B<-twopass>
128
129prompt for separate integrity and encryption passwords: most software
130always assumes these are the same so this option will render such
131PKCS#12 files unreadable.
132
133=back
134
135=head1 FILE CREATION OPTIONS
136
137=over 4
138
139=item B<-export>
140
141This option specifies that a PKCS#12 file will be created rather than
142parsed.
143
144=item B<-out filename>
145
146This specifies filename to write the PKCS#12 file to. Standard output is used
147by default.
148
149=item B<-in filename>
150
151The filename to read certificates and private keys from, standard input by default.
152They must all be in PEM format. The order doesn't matter but one private key and
153its corresponding certificate should be present. If additional certificates are
154present they will also be included in the PKCS#12 file.
155
156=item B<-inkey filename>
157
158file to read private key from. If not present then a private key must be present
159in the input file.
160
161=item B<-name friendlyname>
162
163This specifies the "friendly name" for the certificate and private key. This name
164is typically displayed in list boxes by software importing the file.
165
166=item B<-certfile filename>
167
168A filename to read additional certificates from.
169
170=item B<-caname friendlyname>
171
172This specifies the "friendly name" for other certificates. This option may be
173used multiple times to specify names for all certificates in the order they
174appear. Netscape ignores friendly names on other certificates whereas MSIE
175displays them.
176
177=item B<-pass arg>, B<-passout arg>
178
179the PKCS#12 file (i.e. output file) password source. For more information about
180the format of B<arg> see the B<PASS PHRASE ARGUMENTS> section in
181L<openssl(1)|openssl(1)>.
182
183=item B<-passin password>
184
185pass phrase source to decrypt any input private keys with. For more information
186about the format of B<arg> see the B<PASS PHRASE ARGUMENTS> section in
187L<openssl(1)|openssl(1)>.
188
189=item B<-chain>
190
191if this option is present then an attempt is made to include the entire
192certificate chain of the user certificate. The standard CA store is used
193for this search. If the search fails it is considered a fatal error.
194
195=item B<-descert>
196
197encrypt the certificate using triple DES, this may render the PKCS#12
198file unreadable by some "export grade" software. By default the private
199key is encrypted using triple DES and the certificate using 40 bit RC2.
200
201=item B<-keypbe alg>, B<-certpbe alg>
202
203these options allow the algorithm used to encrypt the private key and
204certificates to be selected. Although any PKCS#5 v1.5 or PKCS#12 algorithms
205can be selected it is advisable only to use PKCS#12 algorithms. See the list
206in the B<NOTES> section for more information.
207
208=item B<-keyex|-keysig>
209
210specifies that the private key is to be used for key exchange or just signing.
211This 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
213encryption purposes but arbitrary length keys for signing. The B<-keysig>
214option marks the key for signing only. Signing only keys can be used for
215S/MIME signing, authenticode (ActiveX control signing) and SSL client
216authentication, however due to a bug only MSIE 5.0 and later support
217the use of signing only keys for SSL client authentication.
218
219=item B<-nomaciter>, B<-noiter>
220
221these options affect the iteration counts on the MAC and key algorithms.
222Unless you wish to produce files compatible with MSIE 4.0 you should leave
223these options alone.
224
225To discourage attacks by using large dictionaries of common passwords the
226algorithm that derives keys from passwords can have an iteration count applied
227to it: this causes a certain part of the algorithm to be repeated and slows it
228down. The MAC is used to check the file integrity but since it will normally
229have the same password as the keys and certificates it could also be attacked.
230By default both MAC and encryption iteration counts are set to 2048, using
231these options the MAC and encryption iteration counts can be set to 1, since
232this reduces the file security you should not use these options unless you
233really have to. Most software supports both MAC and key iteration counts.
234MSIE 4.0 doesn't support MAC iteration counts so it needs the B<-nomaciter>
235option.
236
237=item B<-maciter>
238
239This option is included for compatibility with previous versions, it used
240to be needed to use MAC iterations counts but they are now used by default.
241
242=item B<-rand file(s)>
243
244a file or files containing random data used to seed the random number
245generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>).
246Multiple files can be specified separated by a OS-dependent character.
247The separator is B<;> for MS-Windows, B<,> for OpenVSM, and B<:> for
248all others.
249
250=back
251
252=head1 NOTES
253
254Although there are a large number of options most of them are very rarely
255used. For PKCS#12 file parsing only B<-in> and B<-out> need to be used
256for PKCS#12 file creation B<-export> and B<-name> are also used.
257
258If none of the B<-clcerts>, B<-cacerts> or B<-nocerts> options are present
259then all certificates will be output in the order they appear in the input
260PKCS#12 files. There is no guarantee that the first certificate present is
261the one corresponding to the private key. Certain software which requires
262a private key and certificate and assumes the first certificate in the
263file is the one corresponding to the private key: this may not always
264be the case. Using the B<-clcerts> option will solve this problem by only
265outputing the certificate corresponding to the private key. If the CA
266certificates are required then they can be output to a separate file using
267the B<-nokeys -cacerts> options to just output CA certificates.
268
269The B<-keypbe> and B<-certpbe> algorithms allow the precise encryption
270algorithms for private keys and certificates to be specified. Normally
271the defaults are fine but occasionally software can't handle triple DES
272encrypted private keys, then the option B<-keypbe PBE-SHA1-RC2-40> can
273be used to reduce the private key encryption to 40 bit RC2. A complete
274description of all algorithms is contained in the B<pkcs8> manual page.
275
276=head1 EXAMPLES
277
278Parse a PKCS#12 file and output it to a file:
279
280 openssl pkcs12 -in file.p12 -out file.pem
281
282Output only client certificates to a file:
283
284 openssl pkcs12 -in file.p12 -clcerts -out file.pem
285
286Don't encrypt the private key:
287
288 openssl pkcs12 -in file.p12 -out file.pem -nodes
289
290Print some info about a PKCS#12 file:
291
292 openssl pkcs12 -in file.p12 -info -noout
293
294Create a PKCS#12 file:
295
296 openssl pkcs12 -export -in file.pem -out file.p12 -name "My Certificate"
297
298Include 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
305Some would argue that the PKCS#12 standard is one big bug :-)
306
307=head1 SEE ALSO
308
309L<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
5pkcs7 - PKCS#7 utility
6
7=head1 SYNOPSIS
8
9B<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
20The 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
28This specifies the input format. B<DER> format is DER encoded PKCS#7
29v1.5 structure.B<PEM> (the default) is a base64 encoded version of
30the DER form with header and footer lines.
31
32=item B<-outform DER|PEM>
33
34This specifies the output format, the options have the same meaning as the
35B<-inform> option.
36
37=item B<-in filename>
38
39This specifies the input filename to read from or standard input if this
40option is not specified.
41
42=item B<-out filename>
43
44specifies the output filename to write to or standard output by
45default.
46
47=item B<-print_certs>
48
49prints out any certificates or CRLs contained in the file. They are
50preceded by their subject and issuer names in one line format.
51
52=item B<-text>
53
54prints out certificates details in full rather than just subject and
55issuer names.
56
57=item B<-noout>
58
59don't output the encoded version of the PKCS#7 structure (or certificates
60is B<-print_certs> is set).
61
62=back
63
64=head1 EXAMPLES
65
66Convert a PKCS#7 file from PEM to DER:
67
68 openssl pkcs7 -in file.pem -outform DER -out file.der
69
70Output all certificates in a file:
71
72 openssl pkcs7 -in file.pem -print_certs -out certs.pem
73
74=head1 NOTES
75
76The PEM PKCS#7 format uses the header and footer lines:
77
78 -----BEGIN PKCS7-----
79 -----END PKCS7-----
80
81For compatability with some CAs it will also accept:
82
83 -----BEGIN CERTIFICATE-----
84 -----END CERTIFICATE-----
85
86=head1 RESTRICTIONS
87
88There is no option to print out all the fields of a PKCS#7 file.
89
90This PKCS#7 routines only understand PKCS#7 v 1.5 as specified in RFC2315 they
91cannot currently parse, for example, the new CMS as described in RFC2630.
92
93=head1 SEE ALSO
94
95L<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
5pkcs8 - PKCS#8 format private key conversion tool
6
7=head1 SYNOPSIS
8
9B<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
27The B<pkcs8> command processes private keys in PKCS#8 format. It can handle
28both unencrypted PKCS#8 PrivateKeyInfo format and EncryptedPrivateKeyInfo
29format 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
37Normally a PKCS#8 private key is expected on input and a traditional format
38private key will be written. With the B<-topk8> option the situation is
39reversed: it reads a traditional format private key and writes a PKCS#8
40format key.
41
42=item B<-inform DER|PEM>
43
44This specifies the input format. If a PKCS#8 format key is expected on input
45then either a B<DER> or B<PEM> encoded version of a PKCS#8 key will be
46expected. Otherwise the B<DER> or B<PEM> format of the traditional format
47private key is used.
48
49=item B<-outform DER|PEM>
50
51This specifies the output format, the options have the same meaning as the
52B<-inform> option.
53
54=item B<-in filename>
55
56This specifies the input filename to read a key from or standard input if this
57option is not specified. If the key is encrypted a pass phrase will be
58prompted for.
59
60=item B<-passin arg>
61
62the input file password source. For more information about the format of B<arg>
63see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
64
65=item B<-out filename>
66
67This specifies the output filename to write a key to or standard output by
68default. If any encryption options are set then a pass phrase will be
69prompted for. The output filename should B<not> be the same as the input
70filename.
71
72=item B<-passout arg>
73
74the output file password source. For more information about the format of B<arg>
75see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
76
77=item B<-nocrypt>
78
79PKCS#8 keys generated or input are normally PKCS#8 EncryptedPrivateKeyInfo
80structures using an appropriate password based encryption algorithm. With
81this option an unencrypted PrivateKeyInfo structure is expected or output.
82This option does not encrypt private keys at all and should only be used
83when absolutely necessary. Certain software such as some versions of Java
84code signing software used unencrypted private keys.
85
86=item B<-nooct>
87
88This option generates RSA private keys in a broken format that some software
89uses. Specifically the private key should be enclosed in a OCTET STRING
90but some software just includes the structure itself without the
91surrounding OCTET STRING.
92
93=item B<-embed>
94
95This option generates DSA keys in a broken format. The DSA parameters are
96embedded inside the PrivateKey structure. In this form the OCTET STRING
97contains an ASN1 SEQUENCE consisting of two structures: a SEQUENCE containing
98the parameters and an ASN1 INTEGER containing the private key.
99
100=item B<-nsdb>
101
102This option generates DSA keys in a broken format compatible with Netscape
103private key databases. The PrivateKey contains a SEQUENCE consisting of
104the public and private keys respectively.
105
106=item B<-v2 alg>
107
108This option enables the use of PKCS#5 v2.0 algorithms. Normally PKCS#8
109private keys are encrypted with the password based encryption algorithm
110called B<pbeWithMD5AndDES-CBC> this uses 56 bit DES encryption but it
111was the strongest encryption algorithm supported in PKCS#5 v1.5. Using
112the B<-v2> option PKCS#5 v2.0 algorithms are used which can use any
113encryption algorithm such as 168 bit triple DES or 128 bit RC2 however
114not many implementations support PKCS#5 v2.0 yet. If you are just using
115private keys with OpenSSL then this doesn't matter.
116
117The B<alg> argument is the encryption algorithm to use, valid values include
118B<des>, B<des3> and B<rc2>. It is recommended that B<des3> is used.
119
120=item B<-v1 alg>
121
122This option specifies a PKCS#5 v1.5 or PKCS#12 algorithm to use. A complete
123list of possible algorithms is included below.
124
125=back
126
127=head1 NOTES
128
129The encrypted form of a PEM encode PKCS#8 files uses the following
130headers and footers:
131
132 -----BEGIN ENCRYPTED PRIVATE KEY-----
133 -----END ENCRYPTED PRIVATE KEY-----
134
135The unencrypted form uses:
136
137 -----BEGIN PRIVATE KEY-----
138 -----END PRIVATE KEY-----
139
140Private keys encrypted using PKCS#5 v2.0 algorithms and high iteration
141counts are more secure that those encrypted using the traditional
142SSLeay compatible formats. So if additional security is considered
143important the keys should be converted.
144
145The default encryption is only 56 bits because this is the encryption
146that most current implementations of PKCS#8 will support.
147
148Some software may use PKCS#12 password based encryption algorithms
149with PKCS#8 format private keys: these are handled automatically
150but there is no option to produce them.
151
152It is possible to write out DER encoded encrypted private keys in
153PKCS#8 format because the encryption details are included at an ASN1
154level whereas the traditional format includes them at a PEM level.
155
156=head1 PKCS#5 v1.5 and PKCS#12 algorithms.
157
158Various algorithms can be used with the B<-v1> command line option,
159including PKCS#5 v1.5 and PKCS#12. These are described in more detail
160below.
161
162=over 4
163
164=item B<PBE-MD2-DES PBE-MD5-DES>
165
166These algorithms were included in the original PKCS#5 v1.5 specification.
167They 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
171These algorithms are not mentioned in the original PKCS#5 v1.5 specification
172but they use the same key derivation algorithm and are supported by some
173software. They are mentioned in PKCS#5 v2.0. They use either 64 bit RC2 or
17456 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
178These algorithms use the PKCS#12 password based encryption algorithm and
179allow strong encryption algorithms like triple DES or 128 bit RC2 to be used.
180
181=back
182
183=head1 EXAMPLES
184
185Convert a private from traditional to PKCS#5 v2.0 format using triple
186DES:
187
188 openssl pkcs8 -in key.pem -topk8 -v2 des3 -out enckey.pem
189
190Convert 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
195Convert 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
200Read a DER unencrypted PKCS#8 format private key:
201
202 openssl pkcs8 -inform DER -nocrypt -in key.der -out key.pem
203
204Convert 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
210Test vectors from this PKCS#5 v2.0 implementation were posted to the
211pkcs-tng mailing list using triple DES, DES and RC2 with high iteration
212counts, several people confirmed that they could decrypt the private
213keys produced and Therefore it can be assumed that the PKCS#5 v2.0
214implementation is reasonably accurate at least as far as these
215algorithms are concerned.
216
217The format of PKCS#8 DSA (and other) private keys is not well documented:
218it is hidden away in PKCS#11 v2.01, section 11.9. OpenSSL's default DSA
219PKCS#8 private key format complies with this standard.
220
221=head1 BUGS
222
223There should be an option that prints out the encryption algorithm
224in use and other details such as the iteration count.
225
226PKCS#8 using triple DES and PKCS#5 v2.0 should be the default private
227key format for OpenSSL: for compatibility several of the utilities use
228the old format at present.
229
230=head1 SEE ALSO
231
232L<dsa(1)|dsa(1)>, L<rsa(1)|rsa(1)>, L<genrsa(1)|genrsa(1)>,
233L<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
6req - PKCS#10 certificate and certificate generating utility.
7
8=head1 SYNOPSIS
9
10B<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
39The B<req> command primarily creates and processes certificate requests
40in PKCS#10 format. It can additionally create self signed certificates
41for use as root CAs for example.
42
43=head1 COMMAND OPTIONS
44
45=over 4
46
47=item B<-inform DER|PEM>
48
49This specifies the input format. The B<DER> option uses an ASN1 DER encoded
50form compatible with the PKCS#10. The B<PEM> form is the default format: it
51consists of the B<DER> format base64 encoded with additional header and
52footer lines.
53
54=item B<-outform DER|PEM>
55
56This specifies the output format, the options have the same meaning as the
57B<-inform> option.
58
59=item B<-in filename>
60
61This specifies the input filename to read a request from or standard input
62if this option is not specified. A request is only read if the creation
63options (B<-new> and B<-newkey>) are not specified.
64
65=item B<-passin arg>
66
67the input file password source. For more information about the format of B<arg>
68see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
69
70=item B<-out filename>
71
72This specifies the output filename to write to or standard output by
73default.
74
75=item B<-passout arg>
76
77the output file password source. For more information about the format of B<arg>
78see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
79
80=item B<-text>
81
82prints out the certificate request in text form.
83
84=item B<-noout>
85
86this option prevents output of the encoded version of the request.
87
88=item B<-modulus>
89
90this option prints out the value of the modulus of the public key
91contained in the request.
92
93=item B<-verify>
94
95verifies the signature on the request.
96
97=item B<-new>
98
99this option generates a new certificate request. It will prompt
100the user for the relevant field values. The actual fields
101prompted for and their maximum and minimum sizes are specified
102in the configuration file and any requested extensions.
103
104If the B<-key> option is not used it will generate a new RSA private
105key using information specified in the configuration file.
106
107=item B<-newkey arg>
108
109this option creates a new certificate request and a new private
110key. The argument takes one of two forms. B<rsa:nbits>, where
111B<nbits> is the number of bits, generates an RSA key B<nbits>
112in size. B<dsa:filename> generates a DSA key using the parameters
113in the file B<filename>.
114
115=item B<-key filename>
116
117This specifies the file to read the private key from. It also
118accepts PKCS#8 format private keys for PEM format files.
119
120=item B<-keyform PEM|DER>
121
122the format of the private key file specified in the B<-key>
123argument. PEM is the default.
124
125=item B<-keyout filename>
126
127this gives the filename to write the newly created private key to.
128If this option is not specified then the filename present in the
129configuration file is used.
130
131=item B<-nodes>
132
133if this option is specified then if a private key is created it
134will not be encrypted.
135
136=item B<-[md5|sha1|md2|mdc2]>
137
138this specifies the message digest to sign the request with. This
139overrides the digest algorithm specified in the configuration file.
140This option is ignored for DSA requests: they always use SHA1.
141
142=item B<-config filename>
143
144this allows an alternative configuration file to be specified,
145this overrides the compile time filename or any specified in
146the B<OPENSSL_CONF> environment variable.
147
148=item B<-x509>
149
150this option outputs a self signed certificate instead of a certificate
151request. This is typically used to generate a test certificate or
152a 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
157when the B<-x509> option is being used this specifies the number of
158days to certify the certificate for. The default is 30 days.
159
160=item B<-extensions section>
161=item B<-reqexts section>
162
163these options specify alternative sections to include certificate
164extensions (if the B<-x509> option is present) or certificate
165request extensions. This allows several different sections to
166be used in the same configuration file to specify requests for
167a variety of purposes.
168
169=item B<-asn1-kludge>
170
171by default the B<req> command outputs certificate requests containing
172no attributes in the correct PKCS#10 format. However certain CAs will only
173accept requests containing no attributes in an invalid form: this
174option produces this invalid format.
175
176More precisely the B<Attributes> in a PKCS#10 certificate request
177are defined as a B<SET OF Attribute>. They are B<not OPTIONAL> so
178if no attributes are present then they should be encoded as an
179empty B<SET OF>. The invalid form does not include the empty
180B<SET OF> whereas the correct form does.
181
182It should be noted that very few CAs still require the use of this option.
183
184=item B<-newhdr>
185
186Adds the word B<NEW> to the PEM file header and footer lines on the outputed
187request. Some software (Netscape certificate server) and some CAs need this.
188
189=back
190
191=head1 CONFIGURATION FILE FORMAT
192
193The configuration options are specified in the B<req> section of
194the configuration file. As with all configuration files if no
195value is specified in the specific section (i.e. B<req>) then
196the initial unnamed or B<default> section is searched too.
197
198The options available are described in detail below.
199
200=over 4
201
202=item B<input_password output_password>
203
204The passwords for the input private key file (if present) and
205the output private key file (if one will be created). The
206command line options B<passin> and B<passout> override the
207configuration file values.
208
209=item B<default_bits>
210
211This specifies the default key size in bits. If not specified then
212512 is used. It is used if the B<-new> option is used. It can be
213overridden by using the B<-newkey> option.
214
215=item B<default_keyfile>
216
217This is the default filename to write a private key to. If not
218specified the key is written to standard output. This can be
219overridden by the B<-keyout> option.
220
221=item B<oid_file>
222
223This specifies a file containing additional B<OBJECT IDENTIFIERS>.
224Each line of the file should consist of the numerical form of the
225object identifier followed by white space then the short name followed
226by white space and finally the long name.
227
228=item B<oid_section>
229
230This specifies a section in the configuration file containing extra
231object identifiers. Each line should consist of the short name of the
232object identifier followed by B<=> and the numerical form. The short
233and long names are the same when this option is used.
234
235=item B<RANDFILE>
236
237This specifies a filename in which random number seed information is
238placed and read from, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>).
239It is used for private key generation.
240
241=item B<encrypt_key>
242
243If this is set to B<no> then if a private key is generated it is
244B<not> encrypted. This is equivalent to the B<-nodes> command line
245option. For compatibility B<encrypt_rsa_key> is an equivalent option.
246
247=item B<default_md>
248
249This option specifies the digest algorithm to use. Possible values
250include B<md5 sha1 mdc2>. If not present then MD5 is used. This
251option can be overridden on the command line.
252
253=item B<string_mask>
254
255This option masks out the use of certain string types in certain
256fields. Most users will not need to change this option.
257
258It can be set to several values B<default> which is also the default
259option uses PrintableStrings, T61Strings and BMPStrings if the
260B<pkix> value is used then only PrintableStrings and BMPStrings will
261be used. This follows the PKIX recommendation in RFC2459. If the
262B<utf8only> option is used then only UTF8Strings will be used: this
263is the PKIX recommendation in RFC2459 after 2003. Finally the B<nombstr>
264option just uses PrintableStrings and T61Strings: certain software has
265problems with BMPStrings and UTF8Strings: in particular Netscape.
266
267=item B<req_extensions>
268
269this specifies the configuration file section containing a list of
270extensions to add to the certificate request. It can be overridden
271by the B<-reqexts> command line switch.
272
273=item B<x509_extensions>
274
275this specifies the configuration file section containing a list of
276extensions to add to certificate generated when the B<-x509> switch
277is used. It can be overridden by the B<-extensions> command line switch.
278
279=item B<prompt>
280
281if set to the value B<no> this disables prompting of certificate fields
282and just takes values from the config file directly. It also changes the
283expected format of the B<distinguished_name> and B<attributes> sections.
284
285=item B<attributes>
286
287this specifies the section containing any request attributes: its format
288is the same as B<distinguished_name>. Typically these may contain the
289challengePassword or unstructuredName types. They are currently ignored
290by OpenSSL's request signing utilities but some CAs might want them.
291
292=item B<distinguished_name>
293
294This specifies the section containing the distinguished name fields to
295prompt for when generating a certificate or certificate request. The format
296is described in the next section.
297
298=back
299
300=head1 DISTINGUISHED NAME AND ATTRIBUTE SECTION FORMAT
301
302There are two separate formats for the distinguished name and attribute
303sections. If the B<prompt> option is set to B<no> then these sections
304just consist of field names and values: for example,
305
306 CN=My Name
307 OU=My Organization
308 emailAddress=someone@somewhere.org
309
310This allows external programs (e.g. GUI based) to generate a template file
311with all the field names and values and just pass it to B<req>. An example
312of this kind of configuration file is contained in the B<EXAMPLES> section.
313
314Alternatively if the B<prompt> option is absent or not set to B<no> then the
315file 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).
323The "prompt" string is used to ask the user to enter the relevant
324details. If the user enters nothing then the default value is used if no
325default value is present then the field is omitted. A field can
326still be omitted if a default value is present if the user just
327enters the '.' character.
328
329The number of characters entered must be between the fieldName_min and
330fieldName_max limits: there may be additional restrictions based
331on the field being used (for example countryName can only ever be
332two characters long and must fit in a PrintableString).
333
334Some fields (such as organizationName) can be used more than once
335in a DN. This presents a problem because configuration files will
336not recognize the same name occurring twice. To avoid this problem
337if the fieldName contains some characters followed by a full stop
338they will be ignored. So for example a second organizationName can
339be input by calling it "1.organizationName".
340
341The actual permitted field names are any object identifier short or
342long names. These are compiled into OpenSSL and include the usual
343values such as commonName, countryName, localityName, organizationName,
344organizationUnitName, stateOrPrivinceName. Additionally emailAddress
345is include as well as name, surname, givenName initials and dnQualifier.
346
347Additional object identifiers can be defined with the B<oid_file> or
348B<oid_section> options in the configuration file. Any additional fields
349will be treated as though they were a DirectoryString.
350
351
352=head1 EXAMPLES
353
354Examine and verify certificate request:
355
356 openssl req -in req.pem -text -verify -noout
357
358Create 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
363The same but just using req:
364
365 openssl req -newkey rsa:1024 -keyout key.pem -out req.pem
366
367Generate a self signed root certificate:
368
369 openssl req -x509 -newkey rsa:1024 -keyout key.pem -out req.pem
370
371Example 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
376Example of a section pointed to by B<oid_section> making use of variable
377expansion:
378
379 testoid1=1.2.3.5
380 testoid2=${testoid1}.6
381
382Sample 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
420Sample 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
448The header and footer lines in the B<PEM> format are normally:
449
450 -----BEGIN CERTIFICATE REQUEST----
451 -----END CERTIFICATE REQUEST----
452
453some software (some versions of Netscape certificate server) instead needs:
454
455 -----BEGIN NEW CERTIFICATE REQUEST----
456 -----END NEW CERTIFICATE REQUEST----
457
458which is produced with the B<-newhdr> option but is otherwise compatible.
459Either form is accepted transparently on input.
460
461The certificate requests generated by B<Xenroll> with MSIE have extensions
462added. It includes the B<keyUsage> extension which determines the type of
463key (signature only or general purpose) and any additional OIDs entered
464by the script in an extendedKeyUsage extension.
465
466=head1 DIAGNOSTICS
467
468The following messages are frequently asked about:
469
470 Using configuration from /some/path/openssl.cnf
471 Unable to load config info
472
473This is followed some time later by...
474
475 unable to find 'distinguished_name' in config
476 problems making Certificate Request
477
478The first error message is the clue: it can't find the configuration
479file! Certain operations (like examining a certificate request) don't
480need a configuration file so its use isn't enforced. Generation of
481certificates or requests however does need a configuration file. This
482could be regarded as a bug.
483
484Another puzzling message is this:
485
486 Attributes:
487 a0:00
488
489this is displayed when no attributes are present and the request includes
490the correct empty B<SET OF> structure (the DER encoding of which is 0xa0
4910x00). If you just see:
492
493 Attributes:
494
495then the B<SET OF> is missing and the encoding is technically invalid (but
496it is tolerated). See the description of the command line option B<-asn1-kludge>
497for more information.
498
499=head1 ENVIRONMENT VARIABLES
500
501The variable B<OPENSSL_CONF> if defined allows an alternative configuration
502file location to be specified, it will be overridden by the B<-config> command
503line switch if it is present. For compatibility reasons the B<SSLEAY_CONF>
504environment variable serves the same purpose but its use is discouraged.
505
506=head1 BUGS
507
508OpenSSL's handling of T61Strings (aka TeletexStrings) is broken: it effectively
509treats them as ISO-8859-1 (Latin 1), Netscape and MSIE have similar behaviour.
510This can cause problems if you need characters that aren't available in
511PrintableStrings and you don't want to or can't use BMPStrings.
512
513As a consequence of the T61String handling the only correct way to represent
514accented characters in OpenSSL is to use a BMPString: unfortunately Netscape
515currently chokes on these. If you have to use accented characters with Netscape
516and MSIE then you currently need to use the invalid T61String form.
517
518The current prompting is not very friendly. It doesn't allow you to confirm what
519you've just entered. Other things like extensions in certificate requests are
520statically defined in the configuration file. Some of these: like an email
521address in subjectAltName should be input by the user.
522
523=head1 SEE ALSO
524
525L<x509(1)|x509(1)>, L<ca(1)|ca(1)>, L<genrsa(1)|genrsa(1)>,
526L<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
6rsa - RSA key processing tool
7
8=head1 SYNOPSIS
9
10B<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
29The B<rsa> command processes RSA keys. They can be converted between various
30forms and their components printed out. B<Note> this command uses the
31traditional SSLeay compatible format for private key encryption: newer
32applications should use the more secure PKCS#8 format using the B<pkcs8>
33utility.
34
35=head1 COMMAND OPTIONS
36
37=over 4
38
39=item B<-inform DER|NET|PEM>
40
41This specifies the input format. The B<DER> option uses an ASN1 DER encoded
42form compatible with the PKCS#1 RSAPrivateKey or SubjectPublicKeyInfo format.
43The B<PEM> form is the default format: it consists of the B<DER> format base64
44encoded with additional header and footer lines. On input PKCS#8 format private
45keys are also accepted. The B<NET> form is a format compatible with older Netscape
46servers and MS IIS, this uses unsalted RC4 for its encryption. It is not very
47secure and so should only be used when necessary.
48
49=item B<-outform DER|NET|PEM>
50
51This specifies the output format, the options have the same meaning as the
52B<-inform> option.
53
54=item B<-in filename>
55
56This specifies the input filename to read a key from or standard input if this
57option is not specified. If the key is encrypted a pass phrase will be
58prompted for.
59
60=item B<-passin arg>
61
62the input file password source. For more information about the format of B<arg>
63see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
64
65=item B<-out filename>
66
67This specifies the output filename to write a key to or standard output if this
68option is not specified. If any encryption options are set then a pass phrase
69will be prompted for. The output filename should B<not> be the same as the input
70filename.
71
72=item B<-passout password>
73
74the output file password source. For more information about the format of B<arg>
75see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
76
77=item B<-des|-des3|-idea>
78
79These options encrypt the private key with the DES, triple DES, or the
80IDEA ciphers respectively before outputting it. A pass phrase is prompted for.
81If none of these options is specified the key is written in plain text. This
82means that using the B<rsa> utility to read in an encrypted key with no
83encryption option can be used to remove the pass phrase from a key, or by
84setting the encryption options it can be use to add or change the pass phrase.
85These options can only be used with PEM format output files.
86
87=item B<-text>
88
89prints out the various public or private key components in
90plain text in addition to the encoded version.
91
92=item B<-noout>
93
94this option prevents output of the encoded version of the key.
95
96=item B<-modulus>
97
98this option prints out the value of the modulus of the key.
99
100=item B<-check>
101
102this option checks the consistency of an RSA private key.
103
104=item B<-pubin>
105
106by default a private key is read from the input file: with this
107option a public key is read instead.
108
109=item B<-pubout>
110
111by default a private key is output: with this option a public
112key will be output instead. This option is automatically set if
113the input is a public key.
114
115=back
116
117=head1 NOTES
118
119The PEM private key format uses the header and footer lines:
120
121 -----BEGIN RSA PRIVATE KEY-----
122 -----END RSA PRIVATE KEY-----
123
124The PEM public key format uses the header and footer lines:
125
126 -----BEGIN PUBLIC KEY-----
127 -----END PUBLIC KEY-----
128
129=head1 EXAMPLES
130
131To remove the pass phrase on an RSA private key:
132
133 openssl rsa -in key.pem -out keyout.pem
134
135To encrypt a private key using triple DES:
136
137 openssl rsa -in key.pem -des3 -out keyout.pem
138
139To convert a private key from PEM to DER format:
140
141 openssl rsa -in key.pem -outform DER -out keyout.der
142
143To print out the components of a private key to standard output:
144
145 openssl rsa -in key.pem -text -noout
146
147To 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
153L<pkcs8(1)|pkcs8(1)>, L<dsa(1)|dsa(1)>, L<genrsa(1)|genrsa(1)>,
154L<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
6s_client - SSL/TLS client program
7
8=head1 SYNOPSIS
9
10B<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
37The B<s_client> command implements a generic SSL/TLS client which connects
38to a remote host using SSL/TLS. It is a I<very> useful diagnostic tool for
39SSL servers.
40
41=head1 OPTIONS
42
43=over 4
44
45=item B<-connect host:port>
46
47This specifies the host and optional port to connect to. If not specified
48then an attempt is made to connect to the local host on port 4433.
49
50=item B<-cert certname>
51
52The certificate to use, if one is requested by the server. The default is
53not to use a certificate.
54
55=item B<-key keyfile>
56
57The private key to use. If not specified then the certificate file will
58be used.
59
60=item B<-verify depth>
61
62The verify depth to use. This specifies the maximum length of the
63server certificate chain and turns on server certificate verification.
64Currently the verify operation continues after errors so all the problems
65with a certificate chain can be seen. As a side effect the connection
66will never fail due to a server certificate verify failure.
67
68=item B<-CApath directory>
69
70The directory to use for server certificate verification. This directory
71must be in "hash format", see B<verify> for more information. These are
72also used when building the client certificate chain.
73
74=item B<-CAfile file>
75
76A file containing trusted certificates to use during server authentication
77and to use when attempting to build the client certificate chain.
78
79=item B<-reconnect>
80
81reconnects to the same server 5 times using the same session ID, this can
82be used as a test that session caching is working.
83
84=item B<-pause>
85
86pauses 1 second between each read and write call.
87
88=item B<-showcerts>
89
90display the whole server certificate chain: normally only the server
91certificate itself is displayed.
92
93=item B<-prexit>
94
95print session information when the program exits. This will always attempt
96to print out information even if the connection fails. Normally information
97will only be printed out once if the connection succeeds. This option is useful
98because the cipher in use may be renegotiated or the connection may fail
99because a client certificate is required or is requested only after an
100attempt is made to access a certain URL. Note: the output produced by this
101option is not always accurate because a connection might never have been
102established.
103
104=item B<-state>
105
106prints out the SSL session states.
107
108=item B<-debug>
109
110print extensive debugging information including a hex dump of all traffic.
111
112=item B<-nbio_test>
113
114tests non-blocking I/O
115
116=item B<-nbio>
117
118turns on non-blocking I/O
119
120=item B<-crlf>
121
122this option translated a line feed from the terminal into CR+LF as required
123by some servers.
124
125=item B<-quiet>
126
127inhibit 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
131these options disable the use of certain SSL or TLS protocols. By default
132the initial handshake uses a method which should be compatible with all
133servers and permit them to use SSL v3, SSL v2 or TLS as appropriate.
134
135Unfortunately there are a lot of ancient and broken servers in use which
136cannot handle this technique and will fail to connect. Some servers only
137work if TLS is turned off with the B<-no_tls> option others will only
138support SSL v2 and may need the B<-ssl2> option.
139
140=item B<-bugs>
141
142there are several known bug in SSL and TLS implementations. Adding this
143option enables various workarounds.
144
145=item B<-cipher cipherlist>
146
147this allows the cipher list sent by the client to be modified. Although
148the server determines which cipher suite is used it should take the first
149supported cipher in the list sent by the client. See the B<ciphers>
150command for more information.
151
152=back
153
154=head1 CONNECTED COMMANDS
155
156If a connection is established with an SSL server then any data received
157from the server is displayed and any key presses will be sent to the
158server. If the line begins with an B<R> then the session will be
159renegotiated. If the line begins with a B<Q> the connection will be closed
160down.
161
162=head1 NOTES
163
164B<s_client> can be used to debug SSL servers. To connect to an SSL HTTP
165server the command:
166
167 openssl s_client -connect servername:443
168
169would typically be used (https uses port 443). If the connection succeeds
170then an HTTP command can be given such as "GET /" to retrieve a web page.
171
172If the handshake fails then there are several possible causes, if it is
173nothing obvious like no client certificate then the B<-bugs>, B<-ssl2>,
174B<-ssl3>, B<-tls1>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1> can be tried
175in case it is a buggy server. In particular you should play with these
176options B<before> submitting a bug report to an OpenSSL mailing list.
177
178A frequent problem when attempting to get client certificates working
179is that a web client complains it has no certificates or gives an empty
180list to choose from. This is normally because the server is not sending
181the clients certificate authority in its "acceptable CA list" when it
182requests a certificate. By using B<s_client> the CA list can be viewed
183and checked. However some servers only request client authentication
184after a specific URL is requested. To obtain the list in this case it
185is necessary to use the B<-prexit> command and send an HTTP request
186for an appropriate page.
187
188If a certificate is specified on the command line using the B<-cert>
189option it will not be used unless the server specifically requests
190a client certificate. Therefor merely including a client certificate
191on the command line is no guarantee that the certificate works.
192
193If there are problems verifying a server certificate then the
194B<-showcerts> option can be used to show the whole chain.
195
196=head1 BUGS
197
198Because this program has a lot of options and also because some of
199the techniques used are rather old, the C source of s_client is rather
200hard to read and not a model of how things should be done. A typical
201SSL client program would be much simpler.
202
203The B<-verify> option should really exit if the server verification
204fails.
205
206The B<-prexit> option is a bit of a hack. We should really report
207information whenever a session is renegotiated.
208
209=head1 SEE ALSO
210
211L<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
6s_server - SSL/TLS server program
7
8=head1 SYNOPSIS
9
10B<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
45The B<s_server> command implements a generic SSL/TLS server which listens
46for connections on a given port using SSL/TLS.
47
48=head1 OPTIONS
49
50=over 4
51
52=item B<-accept port>
53
54the TCP port to listen on for connections. If not specified 4433 is used.
55
56=item B<-context id>
57
58sets the SSL context id. It can be given any string value. If this option
59is not present a default value will be used.
60
61=item B<-cert certname>
62
63The certificate to use, most servers cipher suites require the use of a
64certificate and some require a certificate with a certain public key type:
65for 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
70The private key to use. If not specified then the certificate file will
71be used.
72
73=item B<-dcert filename>, B<-dkey keyname>
74
75specify an additional certificate and private key, these behave in the
76same manner as the B<-cert> and B<-key> options except there is no default
77if they are not specified (no additional certificate and key is used). As
78noted above some cipher suites require a certificate containing a key of
79a certain type. Some cipher suites need a certificate carrying an RSA key
80and some a DSS (DSA) key. By using RSA and DSS certificates and keys
81a server can support clients which only support RSA or DSS cipher suites
82by using an appropriate certificate.
83
84=item B<-nocert>
85
86if this option is set then no certificate is used. This restricts the
87cipher suites available to the anonymous ones (currently just anonymous
88DH).
89
90=item B<-dhparam filename>
91
92the DH parameter file to use. The ephemeral DH cipher suites generate keys
93using a set of DH parameters. If not specified then an attempt is made to
94load the parameters from the server certificate file. If this fails then
95a static set of parameters hard coded into the s_server program will be used.
96
97=item B<-nodhe>
98
99if this option is set then no DH parameters will be loaded effectively
100disabling the ephemeral DH cipher suites.
101
102=item B<-no_tmp_rsa>
103
104certain export cipher suites sometimes use a temporary RSA key, this option
105disables temporary RSA key generation.
106
107=item B<-verify depth>, B<-Verify depth>
108
109The verify depth to use. This specifies the maximum length of the
110client certificate chain and makes the server request a certificate from
111the client. With the B<-verify> option a certificate is requested but the
112client does not have to send one, with the B<-Verify> option the client
113must supply a certificate or an error occurs.
114
115=item B<-CApath directory>
116
117The directory to use for client certificate verification. This directory
118must be in "hash format", see B<verify> for more information. These are
119also used when building the server certificate chain.
120
121=item B<-CAfile file>
122
123A file containing trusted certificates to use during client authentication
124and to use when attempting to build the server certificate chain. The list
125is also used in the list of acceptable client CAs passed to the client when
126a certificate is requested.
127
128=item B<-state>
129
130prints out the SSL session states.
131
132=item B<-debug>
133
134print extensive debugging information including a hex dump of all traffic.
135
136=item B<-nbio_test>
137
138tests non blocking I/O
139
140=item B<-nbio>
141
142turns on non blocking I/O
143
144=item B<-crlf>
145
146this option translated a line feed from the terminal into CR+LF.
147
148=item B<-quiet>
149
150inhibit 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
154these options disable the use of certain SSL or TLS protocols. By default
155the initial handshake uses a method which should be compatible with all
156servers and permit them to use SSL v3, SSL v2 or TLS as appropriate.
157
158=item B<-bugs>
159
160there are several known bug in SSL and TLS implementations. Adding this
161option enables various workarounds.
162
163=item B<-hack>
164
165this option enables a further workaround for some some early Netscape
166SSL code (?).
167
168=item B<-cipher cipherlist>
169
170this allows the cipher list used by the server to be modified. When
171the client sends a list of supported ciphers the first client cipher
172also included in the server list is used. Because the client specifies
173the preference order, the order of the server cipherlist irrelevant. See
174the B<ciphers> command for more information.
175
176=item B<-www>
177
178sends a status message back to the client when it connects. This includes
179lots of information about the ciphers used and various session parameters.
180The output is in HTML format so this option will normally be used with a
181web browser.
182
183=item B<-WWW>
184
185emulates a simple web server. Pages will be resolved relative to the
186current directory, for example if the URL https://myhost/page.html is
187requested the file ./page.html will be loaded.
188
189=back
190
191=head1 CONNECTED COMMANDS
192
193If a connection request is established with an SSL client and neither the
194B<-www> nor the B<-WWW> option has been used then normally any data received
195from the client is displayed and any key presses will be sent to the client.
196
197Certain single letter commands are also recognized which perform special
198operations: these are listed below.
199
200=over 4
201
202=item B<q>
203
204end the current SSL connection but still accept new connections.
205
206=item B<Q>
207
208end the current SSL connection and exit.
209
210=item B<r>
211
212renegotiate the SSL session.
213
214=item B<R>
215
216renegotiate the SSL session and request a client certificate.
217
218=item B<P>
219
220send some plain text down the underlying TCP connection: this should
221cause the client to disconnect due to a protocol violation.
222
223=item B<S>
224
225print out some session cache status information.
226
227=back
228
229=head1 NOTES
230
231B<s_server> can be used to debug SSL clients. To accept connections from
232a web browser the command:
233
234 openssl s_server -accept 443 -www
235
236can be used for example.
237
238Most web browsers (in particular Netscape and MSIE) only support RSA cipher
239suites, so they cannot connect to servers which don't use a certificate
240carrying an RSA key or a version of OpenSSL with RSA disabled.
241
242Although specifying an empty list of CAs when requesting a client certificate
243is strictly speaking a protocol violation, some SSL clients interpret this to
244mean any CA is acceptable. This is useful for debugging purposes.
245
246The session parameters can printed out using the B<sess_id> program.
247
248=head1 BUGS
249
250Because this program has a lot of options and also because some of
251the techniques used are rather old, the C source of s_server is rather
252hard to read and not a model of how things should be done. A typical
253SSL server program would be much simpler.
254
255The output of common ciphers is wrong: it just gives the list of ciphers that
256OpenSSL recognizes and the client supports.
257
258There should be a way for the B<s_server> program to print out details of any
259unknown cipher suites a client says it supports.
260
261=head1 SEE ALSO
262
263L<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
6sess_id - SSL/TLS session handling utility
7
8=head1 SYNOPSIS
9
10B<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
21The B<sess_id> process the encoded version of the SSL session structure
22and optionally prints out SSL session details (for example the SSL session
23master key) in human readable format. Since this is a diagnostic tool that
24needs some knowledge of the SSL protocol to use properly, most users will
25not need to use it.
26
27=over 4
28
29=item B<-inform DER|PEM>
30
31This specifies the input format. The B<DER> option uses an ASN1 DER encoded
32format containing session details. The precise format can vary from one version
33to the next. The B<PEM> form is the default format: it consists of the B<DER>
34format base64 encoded with additional header and footer lines.
35
36=item B<-outform DER|PEM>
37
38This specifies the output format, the options have the same meaning as the
39B<-inform> option.
40
41=item B<-in filename>
42
43This specifies the input filename to read session information from or standard
44input by default.
45
46=item B<-out filename>
47
48This specifies the output filename to write session information to or standard
49output if this option is not specified.
50
51=item B<-text>
52
53prints out the various public or private key components in
54plain text in addition to the encoded version.
55
56=item B<-cert>
57
58if a certificate is present in the session it will be output using this option,
59if the B<-text> option is also present then it will be printed out in text form.
60
61=item B<-noout>
62
63this option prevents output of the encoded version of the session.
64
65=item B<-context ID>
66
67this option can set the session id so the output session information uses the
68supplied ID. The ID can be any string of characters. This option wont normally
69be used.
70
71=back
72
73=head1 OUTPUT
74
75Typical 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
88Theses are described below in more detail.
89
90=over 4
91
92=item B<Protocol>
93
94this is the protocol in use TLSv1, SSLv3 or SSLv2.
95
96=item B<Cipher>
97
98the cipher used this is the actual raw SSL or TLS cipher code, see the SSL
99or TLS specifications for more information.
100
101=item B<Session-ID>
102
103the SSL session ID in hex format.
104
105=item B<Session-ID-ctx>
106
107the session ID context in hex format.
108
109=item B<Master-Key>
110
111this is the SSL session master key.
112
113=item B<Key-Arg>
114
115the key argument, this is only used in SSL v2.
116
117=item B<Start Time>
118
119this is the session start time represented as an integer in standard Unix format.
120
121=item B<Timeout>
122
123the timeout in seconds.
124
125=item B<Verify return code>
126
127this is the return code when an SSL client certificate is verified.
128
129=back
130
131=head1 NOTES
132
133The PEM encoded session format uses the header and footer lines:
134
135 -----BEGIN SSL SESSION PARAMETERS-----
136 -----END SSL SESSION PARAMETERS-----
137
138Since the SSL session output contains the master key it is possible to read the contents
139of an encrypted session using this information. Therefore appropriate security precautions
140should be taken if the information is being output by a "real" application. This is
141however strongly discouraged and should only be used for debugging purposes.
142
143=head1 BUGS
144
145The cipher and start time should be printed out in human readable form.
146
147=head1 SEE ALSO
148
149L<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
5smime - S/MIME utility
6
7=head1 SYNOPSIS
8
9B<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
36The B<smime> command handles S/MIME mail. It can encrypt, decrypt, sign and
37verify S/MIME messages.
38
39=head1 COMMAND OPTIONS
40
41There are five operation options that set the type of operation to be performed.
42The meaning of the other options varies according to the operation type.
43
44=over 4
45
46=item B<-encrypt>
47
48encrypt mail for the given recipient certificates. Input file is the message
49to be encrypted. The output file is the encrypted mail in MIME format.
50
51=item B<-decrypt>
52
53decrypt mail using the supplied certificate and private key. Expects an
54encrypted mail message in MIME format for the input file. The decrypted mail
55is written to the output file.
56
57=item B<-sign>
58
59sign mail using the supplied certificate and private key. Input file is
60the message to be signed. The signed message in MIME format is written
61to the output file.
62
63=item B<-verify>
64
65verify signed mail. Expects a signed mail message on input and outputs
66the signed data. Both clear text and opaque signing is supported.
67
68=item B<-pk7out>
69
70takes an input message and writes out a PEM encoded PKCS#7 structure.
71
72=item B<-in filename>
73
74the input message to be encrypted or signed or the MIME message to
75be decrypted or verified.
76
77=item B<-out filename>
78
79the message text that has been decrypted or verified or the output MIME
80format message that has been signed or verified.
81
82=item B<-text>
83
84this option adds plain text (text/plain) MIME headers to the supplied
85message if encrypting or signing. If decrypting or verifying it strips
86off text headers: if the decrypted or verified message is not of MIME
87type text/plain then an error occurs.
88
89=item B<-CAfile file>
90
91a file containing trusted CA certificates, only used with B<-verify>.
92
93=item B<-CApath dir>
94
95a directory containing trusted CA certificates, only used with
96B<-verify>. This directory must be a standard certificate directory: that
97is a hash of each subject name (using B<x509 -hash>) should be linked
98to each certificate.
99
100=item B<-des -des3 -rc2-40 -rc2-64 -rc2-128>
101
102the encryption algorithm to use. DES (56 bits), triple DES (168 bits)
103or 40, 64 or 128 bit RC2 respectively if not specified 40 bit RC2 is
104used. Only used with B<-encrypt>.
105
106=item B<-nointern>
107
108when verifying a message normally certificates (if any) included in
109the message are searched for the signing certificate. With this option
110only the certificates specified in the B<-certfile> option are used.
111The supplied certificates can still be used as untrusted CAs however.
112
113=item B<-noverify>
114
115do not verify the signers certificate of a signed message.
116
117=item B<-nochain>
118
119do not do chain verification of signers certificates: that is don't
120use the certificates in the signed message as untrusted CAs.
121
122=item B<-nosigs>
123
124don't try to verify the signatures on the message.
125
126=item B<-nocerts>
127
128when signing a message the signer's certificate is normally included
129with this option it is excluded. This will reduce the size of the
130signed message but the verifier must have a copy of the signers certificate
131available locally (passed using the B<-certfile> option for example).
132
133=item B<-noattr>
134
135normally when a message is signed a set of attributes are included which
136include the signing time and supported symmetric algorithms. With this
137option they are not included.
138
139=item B<-binary>
140
141normally the input message is converted to "canonical" format which is
142effectively using CR and LF as end of line: as required by the S/MIME
143specification. When this option is present no translation occurs. This
144is useful when handling binary data which may not be in MIME format.
145
146=item B<-nodetach>
147
148when signing a message use opaque signing: this form is more resistant
149to translation by mail relays but it cannot be read by mail agents that
150do not support S/MIME. Without this option cleartext signing with
151the MIME type multipart/signed is used.
152
153=item B<-certfile file>
154
155allows additional certificates to be specified. When signing these will
156be included with the message. When verifying these will be searched for
157the signers certificates. The certificates should be in PEM format.
158
159=item B<-signer file>
160
161the signers certificate when signing a message. If a message is
162being verified then the signers certificates will be written to this
163file if the verification was successful.
164
165=item B<-recip file>
166
167the recipients certificate when decrypting a message. This certificate
168must match one of the recipients of the message or an error occurs.
169
170=item B<-inkey file>
171
172the private key to use when signing or decrypting. This must match the
173corresponding certificate. If this option is not specified then the
174private key must be included in the certificate file specified with
175the B<-recip> or B<-signer> file.
176
177=item B<-rand file(s)>
178
179a file or files containing random data used to seed the random number
180generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>).
181Multiple files can be specified separated by a OS-dependent character.
182The separator is B<;> for MS-Windows, B<,> for OpenVSM, and B<:> for
183all others.
184
185=item B<cert.pem...>
186
187one or more certificates of message recipients: used when encrypting
188a message.
189
190=item B<-to, -from, -subject>
191
192the relevant mail headers. These are included outside the signed
193portion of a message so they may be included manually. If signing
194then many S/MIME mail clients check the signers certificate's email
195address matches that specified in the From: address.
196
197=back
198
199=head1 NOTES
200
201The MIME message must be sent without any blank lines between the
202headers and the output. Some mail programs will automatically add
203a blank line. Piping the mail directly to sendmail is one way to
204achieve the correct format.
205
206The supplied message to be signed or encrypted must include the
207necessary MIME headers: or many S/MIME clients wont display it
208properly (if at all). You can use the B<-text> option to automatically
209add plain text headers.
210
211A "signed and encrypted" message is one where a signed message is
212then encrypted. This can be produced by encrypting an already signed
213message: see the examples section.
214
215This version of the program only allows one signer per message but it
216will verify multiple signers on received messages. Some S/MIME clients
217choke if a message contains multiple signers. It is possible to sign
218messages "in parallel" by signing an already signed message.
219
220The options B<-encrypt> and B<-decrypt> reflect common usage in S/MIME
221clients. Strictly speaking these process PKCS#7 enveloped data: PKCS#7
222encrypted data is used for other purposes.
223
224=head1 EXIT CODES
225
226=over 4
227
228=item 0
229
230the operation was completely successfully.
231
232=item 1
233
234an error occurred parsing the command options.
235
236=item 2
237
238one of the input files could not be read.
239
240=item 3
241
242an error occurred creating the PKCS#7 file or when reading the MIME
243message.
244
245=item 4
246
247an error occurred decrypting or verifying the message.
248
249=item 5
250
251the message was verified correctly but an error occurred writing out
252the signers certificates.
253
254=back
255
256=head1 EXAMPLES
257
258Create a cleartext signed message:
259
260 openssl smime -sign -in message.txt -text -out mail.msg \
261 -signer mycert.pem
262
263Create and opaque signed message
264
265 openssl smime -sign -in message.txt -text -out mail.msg -nodetach \
266 -signer mycert.pem
267
268Create a signed message, include some additional certificates and
269read 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
274Send 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
280Verify 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
284Send 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
290Sign 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
297Note: the encryption command does not include the B<-text> option because the message
298being encrypted already has MIME headers.
299
300Decrypt mail:
301
302 openssl smime -decrypt -in mail.msg -recip mycert.pem -inkey key.pem
303
304=head1 BUGS
305
306The MIME parser isn't very clever: it seems to handle most messages that I've thrown
307at it but it may choke on others.
308
309The code currently will only write out the signer's certificate to a file: if the
310signer has a separate encryption certificate this must be manually extracted. There
311should be some heuristic that determines the correct encryption certificate.
312
313Ideally a database should be maintained of a certificates for each email address.
314
315The code doesn't currently take note of the permitted symmetric encryption
316algorithms as supplied in the SMIMECapabilities signed attribute. this means the
317user has to manually include the correct encryption algorithm. It should store
318the list of permitted ciphers in a database and only use those.
319
320No revocation checking is done on the signer's certificate.
321
322The current code can only handle S/MIME v2 messages, the more complex S/MIME v3
323structures 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
5speed - test library performance
6
7=head1 SYNOPSIS
8
9B<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
38This command is used to test the performance of cryptographic algorithms.
39
40=head1 OPTIONS
41
42If an option is given, B<speed> test that algorithm, otherwise all of
43the 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
5spkac - SPKAC printing and generating utility
6
7=head1 SYNOPSIS
8
9B<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
24The B<spkac> command processes Netscape signed public key and challenge
25(SPKAC) files. It can print out their contents, verify the signature and
26produce its own SPKACs from a supplied private key.
27
28=head1 COMMAND OPTIONS
29
30=over 4
31
32=item B<-in filename>
33
34This specifies the input filename to read from or standard input if this
35option is not specified. Ignored if the B<-key> option is used.
36
37=item B<-out filename>
38
39specifies the output filename to write to or standard output by
40default.
41
42=item B<-key keyfile>
43
44create an SPKAC file using the private key in B<keyfile>. The
45B<-in>, B<-noout>, B<-spksect> and B<-verify> options are ignored if
46present.
47
48=item B<-passin password>
49
50the input file password source. For more information about the format of B<arg>
51see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
52
53=item B<-challenge string>
54
55specifies the challenge string if an SPKAC is being created.
56
57=item B<-spkac spkacname>
58
59allows an alternative name form the variable containing the
60SPKAC. The default is "SPKAC". This option affects both
61generated and input SPKAC files.
62
63=item B<-spksect section>
64
65allows an alternative name form the section containing the
66SPKAC. The default is the default section.
67
68=item B<-noout>
69
70don't output the text version of the SPKAC (not used if an
71SPKAC is being created).
72
73=item B<-pubkey>
74
75output the public key of an SPKAC (not used if an SPKAC is
76being created).
77
78=item B<-verify>
79
80verifies the digital signature on the supplied SPKAC.
81
82
83=back
84
85=head1 EXAMPLES
86
87Print out the contents of an SPKAC:
88
89 openssl spkac -in spkac.cnf
90
91Verify the signature of an SPKAC:
92
93 openssl spkac -in spkac.cnf -noout -verify
94
95Create an SPKAC using the challenge string "hello":
96
97 openssl spkac -key key.pem -challenge hello -out spkac.cnf
98
99Example 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
109A created SPKAC with suitable DN components appended can be fed into
110the B<ca> utility.
111
112SPKACs are typically generated by Netscape when a form is submitted
113containing the B<KEYGEN> tag as part of the certificate enrollment
114process.
115
116The challenge string permits a primitive form of proof of possession
117of private key. By checking the SPKAC signature and a random challenge
118string some guarantee is given that the user knows the private key
119corresponding to the public key being certified. This is important in
120some applications. Without this it is possible for a previous SPKAC
121to be used in a "replay attack".
122
123=head1 SEE ALSO
124
125L<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
5pkcs7 - PKCS#7 utility
6
7=head1 SYNOPSIS
8
9B<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
22The B<verify> command verifies certificate chains.
23
24=head1 COMMAND OPTIONS
25
26=over 4
27
28=item B<-CApath directory>
29
30A directory of trusted certificates. The certificates should have names
31of the form: hash.0 or have symbolic links to them of this
32form ("hash" is the hashed certificate subject name: see the B<-hash> option
33of the B<x509> utility). Under Unix the B<c_rehash> script will automatically
34create symbolic links to a directory of certificates.
35
36=item B<-CAfile file>
37
38A file of trusted certificates. The file should contain multiple certificates
39in PEM format concatenated together.
40
41=item B<-untrusted file>
42
43A file of untrusted certificates. The file should contain multiple certificates
44
45=item B<-purpose purpose>
46
47the intended use for the certificate. Without this option no chain verification
48will be done. Currently accepted uses are B<sslclient>, B<sslserver>,
49B<nssslserver>, B<smimesign>, B<smimeencrypt>. See the B<VERIFY OPERATION>
50section for more information.
51
52=item B<-help>
53
54prints out a usage message.
55
56=item B<-verbose>
57
58print extra information about the operations being performed.
59
60=item B<->
61
62marks the last option. All arguments following this are assumed to be
63certificate files. This is useful if the first certificate filename begins
64with a B<->.
65
66=item B<certificates>
67
68one or more certificates to verify. If no certificate filenames are included
69then an attempt is made to read a certificate from standard input. They should
70all be in PEM format.
71
72
73=back
74
75=head1 VERIFY OPERATION
76
77The B<verify> program uses the same functions as the internal SSL and S/MIME
78verification, therefore this description applies to these verify operations
79too.
80
81There is one crucial difference between the verify operations performed
82by the B<verify> program: wherever possible an attempt is made to continue
83after an error whereas normally the verify operation would halt on the
84first error. This allows all the problems with a certificate chain to be
85determined.
86
87The verify operation consists of a number of separate steps.
88
89Firstly a certificate chain is built up starting from the supplied certificate
90and ending in the root CA. It is an error if the whole chain cannot be built
91up. The chain is built up by looking up a certificate whose subject name
92matches the issuer name of the current certificate. If a certificate is found
93whose subject and issuer names are identical it is assumed to be the root CA.
94The lookup first looks in the list of untrusted certificates and if no match
95is found the remaining lookups are from the trusted certificates. The root CA
96is always looked up in the trusted certificate list: if the certificate to
97verify is a root certificate then an exact match must be found in the trusted
98list.
99
100The second operation is to check every untrusted certificate's extensions for
101consistency with the supplied purpose. If the B<-purpose> option is not included
102then no checks are done. The supplied or "leaf" certificate must have extensions
103compatible with the supplied purpose and all other certificates must also be valid
104CA certificates. The precise extensions required are described in more detail in
105the B<CERTIFICATE EXTENSIONS> section of the B<x509> utility.
106
107The third operation is to check the trust settings on the root CA. The root
108CA should be trusted for the supplied purpose. For compatibility with previous
109versions of SSLeay and OpenSSL a certificate with no trust settings is considered
110to be valid for all purposes.
111
112The final operation is to check the validity of the certificate chain. The validity
113period is checked against the current system time and the notBefore and notAfter
114dates in the certificate. The certificate signatures are also checked at this
115point.
116
117If all operations complete successfully then certificate is considered valid. If
118any operation fails then the certificate is not valid.
119
120=head1 DIAGNOSTICS
121
122When a verify operation fails the output messages can be somewhat cryptic. The
123general 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
128The first line contains the name of the certificate being verified followed by
129the subject name of the certificate. The second line contains the error number
130and the depth. The depth is number of the certificate being verified when a
131problem was detected starting with zero for the certificate being verified itself
132then 1 for the CA that signed the certificate and so on. Finally a text version
133of the error number is presented.
134
135An exhaustive list of the error codes and messages is shown below, this also
136includes the name of the error code as defined in the header file x509_vfy.h
137Some of the error codes are defined but never returned: these are described
138as "unused".
139
140=over 4
141
142=item B<0 X509_V_OK: ok>
143
144the operation was successful.
145
146=item B<2 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certificate>
147
148the issuer certificate could not be found: this occurs if the issuer certificate
149of an untrusted certificate cannot be found.
150
151=item B<3 X509_V_ERR_UNABLE_TO_GET_CRL unable to get certificate CRL>
152
153the 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
157the certificate signature could not be decrypted. This means that the actual signature value
158could not be determined rather than it not matching the expected value, this is only
159meaningful for RSA keys.
160
161=item B<5 X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE: unable to decrypt CRL's signature>
162
163the CRL signature could not be decrypted: this means that the actual signature value
164could 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
168the 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
172the signature of the certificate is invalid.
173
174=item B<8 X509_V_ERR_CRL_SIGNATURE_FAILURE: CRL signature failure>
175
176the 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
180the 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
184the CRL is not yet valid. Unused.
185
186=item B<11 X509_V_ERR_CERT_HAS_EXPIRED: Certificate has expired>
187
188the 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
192the 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
196the 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
200the 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
204the 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
208the CRL nextUpdate field contains an invalid time. Unused.
209
210=item B<17 X509_V_ERR_OUT_OF_MEM: out of memory>
211
212an 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
216the passed certificate is self signed and the same certificate cannot be found in the list of
217trusted certificates.
218
219=item B<19 X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: self signed certificate in certificate chain>
220
221the certificate chain could be built up using the untrusted certificates but the root could not
222be found locally.
223
224=item B<20 X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: unable to get local issuer certificate>
225
226the issuer certificate of a locally looked up certificate could not be found. This normally means
227the 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
231no signatures could be verified because the chain contains only one certificate and it is not
232self signed.
233
234=item B<22 X509_V_ERR_CERT_CHAIN_TOO_LONG: certificate chain too long>
235
236the certificate chain length is greater than the supplied maximum depth. Unused.
237
238=item B<23 X509_V_ERR_CERT_REVOKED: certificate revoked>
239
240the certificate has been revoked. Unused.
241
242=item B<24 X509_V_ERR_INVALID_CA: invalid CA certificate>
243
244a CA certificate is invalid. Either it is not a CA or its extensions are not consistent
245with the supplied purpose.
246
247=item B<25 X509_V_ERR_PATH_LENGTH_EXCEEDED: path length constraint exceeded>
248
249the basicConstraints pathlength parameter has been exceeded.
250
251=item B<26 X509_V_ERR_INVALID_PURPOSE: unsupported certificate purpose>
252
253the supplied certificate cannot be used for the specified purpose.
254
255=item B<27 X509_V_ERR_CERT_UNTRUSTED: certificate not trusted>
256
257the root CA is not marked as trusted for the specified purpose.
258
259=item B<28 X509_V_ERR_CERT_REJECTED: certificate rejected>
260
261the root CA is marked to reject the specified purpose.
262
263=item B<50 X509_V_ERR_APPLICATION_VERIFICATION: application verification failure>
264
265an application specific error. Unused.
266
267=back
268
269=head1 SEE ALSO
270
271L<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
5version - print OpenSSL version information
6
7=head1 SYNOPSIS
8
9B<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
19This command is used to print out version information about OpenSSL.
20
21=head1 OPTIONS
22
23=over 4
24
25=item B<-a>
26
27all information, this is the same as setting all the other flags.
28
29=item B<-v>
30
31the current OpenSSL version.
32
33=item B<-b>
34
35the date the current version of OpenSSL was built.
36
37=item B<-o>
38
39option information: various options set when the library was built.
40
41=item B<-c>
42
43compilation flags.
44
45=item B<-p>
46
47platform setting.
48
49=back
50
51=head1 NOTES
52
53The output of B<openssl version -a> would typically be used when sending
54in 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
6x509 - Certificate display and signing utility
7
8=head1 SYNOPSIS
9
10B<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
53The B<x509> command is a multi purpose certificate utility. It can be
54used to display certificate information, convert certificates to
55various forms, sign certificate requests like a "mini CA" or edit
56certificate trust settings.
57
58Since there are a large number of options they will split up into
59various sections.
60
61
62=head1 INPUT, OUTPUT AND GENERAL PURPOSE OPTIONS
63
64=over 4
65
66=item B<-inform DER|PEM|NET>
67
68This specifies the input format normally the command will expect an X509
69certificate but this can change if other options such as B<-req> are
70present. The DER format is the DER encoding of the certificate and PEM
71is the base64 encoding of the DER encoding with header and footer lines
72added. The NET option is an obscure Netscape server format that is now
73obsolete.
74
75=item B<-outform DER|PEM|NET>
76
77This specifies the output format, the options have the same meaning as the
78B<-inform> option.
79
80=item B<-in filename>
81
82This specifies the input filename to read a certificate from or standard input
83if this option is not specified.
84
85=item B<-out filename>
86
87This specifies the output filename to write to or standard output by
88default.
89
90=item B<-md2|-md5|-sha1|-mdc2>
91
92the digest to use. This affects any signing or display option that uses a message
93digest, such as the B<-fingerprint>, B<-signkey> and B<-CA> options. If not
94specified then MD5 is used. If the key being used to sign with is a DSA key then
95this option has no effect: SHA1 is always used with DSA keys.
96
97
98=back
99
100=head1 DISPLAY OPTIONS
101
102Note: the B<-alias> and B<-purpose> options are also display options
103but are described in the B<TRUST OPTIONS> section.
104
105=over 4
106
107=item B<-text>
108
109prints out the certificate in text form. Full details are output including the
110public key, signature algorithms, issuer and subject names, serial number
111any extensions present and any trust settings.
112
113=item B<-noout>
114
115this option prevents output of the encoded version of the request.
116
117=item B<-modulus>
118
119this option prints out the value of the modulus of the public key
120contained in the certificate.
121
122=item B<-serial>
123
124outputs the certificate serial number.
125
126=item B<-hash>
127
128outputs the "hash" of the certificate subject name. This is used in OpenSSL to
129form an index to allow certificates in a directory to be looked up by subject
130name.
131
132=item B<-subject>
133
134outputs the subject name.
135
136=item B<-issuer>
137
138outputs the issuer name.
139
140=item B<-startdate>
141
142prints out the start date of the certificate, that is the notBefore date.
143
144=item B<-enddate>
145
146prints out the expiry date of the certificate, that is the notAfter date.
147
148=item B<-dates>
149
150prints out the start and expiry dates of a certificate.
151
152=item B<-fingerprint>
153
154prints out the digest of the DER encoded version of the whole certificate.
155
156=item B<-C>
157
158this outputs the certificate in the form of a C source file.
159
160=back
161
162=head1 TRUST SETTINGS
163
164Please note these options are currently experimental and may well change.
165
166A B<trusted certificate> is an ordinary certificate which has several
167additional pieces of information attached to it such as the permitted
168and prohibited uses of the certificate and an "alias".
169
170Normally when a certificate is being verified at least one certificate
171must be "trusted". By default a trusted certificate must be stored
172locally and must be a root CA: any certificate chain ending in this CA
173is then usable for any purpose.
174
175Trust settings currently are only used with a root CA. They allow a finer
176control over the purposes the root CA can be used for. For example a CA
177may be trusted for SSL client but not SSL server use.
178
179See the description of the B<verify> utility for more information on the
180meaning of trust settings.
181
182Future versions of OpenSSL will recognize trust settings on any
183certificate: not just root CAs.
184
185
186=over 4
187
188=item B<-trustout>
189
190this causes B<x509> to output a B<trusted> certificate. An ordinary
191or trusted certificate can be input but by default an ordinary
192certificate is output and any trust settings are discarded. With the
193B<-trustout> option a trusted certificate is output. A trusted
194certificate is automatically output if any trust settings are modified.
195
196=item B<-setalias arg>
197
198sets the alias of the certificate. This will allow the certificate
199to be referred to using a nickname for example "Steve's Certificate".
200
201=item B<-alias>
202
203outputs the certificate alias, if any.
204
205=item B<-clrtrust>
206
207clears all the permitted or trusted uses of the certificate.
208
209=item B<-clrreject>
210
211clears all the prohibited or rejected uses of the certificate.
212
213=item B<-addtrust arg>
214
215adds a trusted certificate use. Currently acceptable values
216are 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
221adds a prohibited use. It accepts the same values as the B<-addtrust>
222option.
223
224=item B<-purpose>
225
226this option performs tests on the certificate extensions and outputs
227the results. For a more complete description see the B<CERTIFICATE
228EXTENSIONS> section.
229
230=back
231
232=head1 SIGNING OPTIONS
233
234The B<x509> utility can be used to sign certificates and requests: it
235can thus behave like a "mini CA".
236
237=over 4
238
239=item B<-signkey filename>
240
241this option causes the input file to be self signed using the supplied
242private key.
243
244If the input file is a certificate it sets the issuer name to the
245subject name (i.e. makes it self signed) changes the public key to the
246supplied value and changes the start and end dates. The start date is
247set to the current time and the end date is set to a value determined
248by the B<-days> option. Any certificate extensions are retained unless
249the B<-clrext> option is supplied.
250
251If the input is a certificate request then a self signed certificate
252is created using the supplied private key using the subject name in
253the request.
254
255=item B<-clrext>
256
257delete any extensions from a certificate. This option is used when a
258certificate is being created from another certificate (for example with
259the B<-signkey> or the B<-CA> options). Normally all extensions are
260retained.
261
262=item B<-keyform PEM|DER>
263
264specifies the format (DER or PEM) of the private key file used in the
265B<-signkey> option.
266
267=item B<-days arg>
268
269specifies the number of days to make a certificate valid for. The default
270is 30 days.
271
272=item B<-x509toreq>
273
274converts a certificate into a certificate request. The B<-signkey> option
275is used to pass the required private key.
276
277=item B<-req>
278
279by default a certificate is expected on input. With this option a
280certificate request is expected instead.
281
282=item B<-CA filename>
283
284specifies the CA certificate to be used for signing. When this option is
285present B<x509> behaves like a "mini CA". The input file is signed by this
286CA using this option: that is its issuer name is set to the subject name
287of the CA and it is digitally signed using the CAs private key.
288
289This option is normally combined with the B<-req> option. Without the
290B<-req> option the input is a certificate which must be self signed.
291
292=item B<-CAkey filename>
293
294sets the CA private key to sign a certificate with. If this option is
295not specified then it is assumed that the CA private key is present in
296the CA certificate file.
297
298=item B<-CAserial filename>
299
300sets the CA serial number file to use.
301
302When the B<-CA> option is used to sign a certificate it uses a serial
303number specified in a file. This file consist of one line containing
304an even number of hex digits with the serial number to use. After each
305use the serial number is incremented and written out to the file again.
306
307The 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
313with this option the CA serial number file is created if it does not exist:
314it will contain the serial number "02" and the certificate being signed will
315have the 1 as its serial number. Normally if the B<-CA> option is specified
316and the serial number file does not exist it is an error.
317
318=item B<-extfile filename>
319
320file containing certificate extensions to use. If not specified then
321no extensions are added to the certificate.
322
323=item B<-extensions section>
324
325the section to add certificate extensions from. If this option is not
326specified 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
334Note: in these examples the '\' means the example should be all on one
335line.
336
337Display the contents of a certificate:
338
339 openssl x509 -in cert.pem -noout -text
340
341Display the certificate serial number:
342
343 openssl x509 -in cert.pem -noout -serial
344
345Display the certificate MD5 fingerprint:
346
347 openssl x509 -in cert.pem -noout -fingerprint
348
349Display the certificate SHA1 fingerprint:
350
351 openssl x509 -sha1 -in cert.pem -noout -fingerprint
352
353Convert a certificate from PEM to DER format:
354
355 openssl x509 -in cert.pem -inform PEM -out cert.der -outform DER
356
357Convert a certificate to a certificate request:
358
359 openssl x509 -x509toreq -in cert.pem -out req.pem -signkey key.pem
360
361Convert a certificate request into a self signed certificate using
362extensions 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
367Sign a certificate request using the CA certificate above and add user
368certificate 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
374Set 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
382The PEM format uses the header and footer lines:
383
384 -----BEGIN CERTIFICATE----
385 -----END CERTIFICATE----
386
387it will also handle files containing:
388
389 -----BEGIN X509 CERTIFICATE----
390 -----END X509 CERTIFICATE----
391
392Trusted certificates have the lines
393
394 -----BEGIN TRUSTED CERTIFICATE----
395 -----END TRUSTED CERTIFICATE----
396
397The B<-fingerprint> option takes the digest of the DER encoded certificate.
398This is commonly called a "fingerprint". Because of the nature of message
399digests the fingerprint of a certificate is unique to that certificate and
400two certificates with the same fingerprint can be considered to be the same.
401
402The Netscape fingerprint uses MD5 whereas MSIE uses SHA1.
403
404=head1 CERTIFICATE EXTENSIONS
405
406The B<-purpose> option checks the certificate extensions and determines
407what the certificate can be used for. The actual checks done are rather
408complex and include various hacks and workarounds to handle broken
409certificates and software.
410
411The same code is used when verifying untrusted certificates in chains
412so this section is useful if a chain is rejected by the verify code.
413
414The basicConstraints extension CA flag is used to determine whether the
415certificate can be used as a CA. If the CA flag is true then it is a CA,
416if the CA flag is false then it is not a CA. B<All> CAs should have the
417CA flag set to true.
418
419If the basicConstraints extension is absent then the certificate is
420considered to be a "possible CA" other extensions are checked according
421to the intended use of the certificate. A warning is given in this case
422because the certificate should really not be regarded as a CA: however
423it is allowed to be a CA to work around some broken software.
424
425If the certificate is a V1 certificate (and thus has no extensions) and
426it is self signed it is also assumed to be a CA but a warning is again
427given: this is to work around the problem of Verisign roots which are V1
428self signed certificates.
429
430If the keyUsage extension is present then additional restraints are
431made on the uses of the certificate. A CA certificate B<must> have the
432keyCertSign bit set if the keyUsage extension is present.
433
434The extended key usage extension places additional restrictions on the
435certificate uses. If this extension is present (whether critical or not)
436the key can only be used for the purposes specified.
437
438A complete description of each test is given below. The comments about
439basicConstraints and keyUsage and V1 certificates above apply to B<all>
440CA certificates.
441
442
443=over 4
444
445=item B<SSL Client>
446
447The extended key usage extension must be absent or include the "web client
448authentication" OID. keyUsage must be absent or it must have the
449digitalSignature bit set. Netscape certificate type must be absent or it must
450have the SSL client bit set.
451
452=item B<SSL Client CA>
453
454The extended key usage extension must be absent or include the "web client
455authentication" OID. Netscape certificate type must be absent or it must have
456the SSL CA bit set: this is used as a work around if the basicConstraints
457extension is absent.
458
459=item B<SSL Server>
460
461The extended key usage extension must be absent or include the "web server
462authentication" and/or one of the SGC OIDs. keyUsage must be absent or it
463must have the digitalSignature, the keyEncipherment set or both bits set.
464Netscape certificate type must be absent or have the SSL server bit set.
465
466=item B<SSL Server CA>
467
468The extended key usage extension must be absent or include the "web server
469authentication" and/or one of the SGC OIDs. Netscape certificate type must
470be absent or the SSL CA bit must be set: this is used as a work around if the
471basicConstraints extension is absent.
472
473=item B<Netscape SSL Server>
474
475For Netscape SSL clients to connect to an SSL server it must have the
476keyEncipherment bit set if the keyUsage extension is present. This isn't
477always valid because some cipher suites use the key for digital signing.
478Otherwise it is the same as a normal SSL server.
479
480=item B<Common S/MIME Client Tests>
481
482The extended key usage extension must be absent or include the "email
483protection" OID. Netscape certificate type must be absent or should have the
484S/MIME bit set. If the S/MIME bit is not set in netscape certificate type
485then the SSL client bit is tolerated as an alternative but a warning is shown:
486this is because some Verisign certificates don't set the S/MIME bit.
487
488=item B<S/MIME Signing>
489
490In addition to the common S/MIME client tests the digitalSignature bit must
491be set if the keyUsage extension is present.
492
493=item B<S/MIME Encryption>
494
495In addition to the common S/MIME tests the keyEncipherment bit must be set
496if the keyUsage extension is present.
497
498=item B<S/MIME CA>
499
500The extended key usage extension must be absent or include the "email
501protection" OID. Netscape certificate type must be absent or must have the
502S/MIME CA bit set: this is used as a work around if the basicConstraints
503extension is absent.
504
505=item B<CRL Signing>
506
507The keyUsage extension must be absent or it must have the CRL signing bit
508set.
509
510=item B<CRL Signing CA>
511
512The normal CA tests apply. Except in this case the basicConstraints extension
513must be present.
514
515=back
516
517=head1 BUGS
518
519The way DNs are printed is in a "historical SSLeay" format which doesn't
520follow any published standard. It should follow some standard like RFC2253
521or RFC1779 with options to make the stuff more readable.
522
523Extensions in certificates are not transferred to certificate requests and
524vice versa.
525
526It is possible to produce invalid certificates or requests by specifying the
527wrong private key or using inconsistent options in some cases: these should
528be checked.
529
530There should be options to explicitly set such things as start and end
531dates rather than an offset from the current time.
532
533The code to implement the verify behaviour described in the B<TRUST SETTINGS>
534is currently being developed. It thus describes the intended behavior rather
535than the current behaviour. It is hoped that it will represent reality in
536OpenSSL 0.9.5 and later.
537
538=head1 SEE ALSO
539
540L<req(1)|req(1)>, L<ca(1)|ca(1)>, L<genrsa(1)|genrsa(1)>,
541L<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
6Crypto - OpenSSL Cryptography library
7
8=head1 SYNOPSIS
9
10=head1 DESCRIPTION
11
12The OpenSSL B<crypto> library implements various cryptography standards
13related 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
20openssl(1), ssl(3)
21
22=head1 HISTORY
23
24The 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
5BN_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
19A B<BN_CTX> is a structure that holds B<BIGNUM> temporary variables used by
20library functions. Since dynamic memory allocation to create B<BIGNUM>s
21is rather expensive when used in conjunction with repeated subroutine
22calls, the B<BN_CTX> structure is used.
23
24BN_CTX_new() allocates and initializes a B<BN_CTX>
25structure. BN_CTX_init() initializes an existing uninitialized
26B<BN_CTX>.
27
28BN_CTX_free() frees the components of the B<BN_CTX>, and if it was
29created by BN_CTX_new(), also the structure itself.
30If L<BN_CTX_start(3)|BN_CTX_start(3)> has been used on the B<BN_CTX>,
31L<BN_CTX_end(3)|BN_CTX_end(3)> must be called before the B<BN_CTX>
32may be freed by BN_CTX_free().
33
34
35=head1 RETURN VALUES
36
37BN_CTX_new() returns a pointer to the B<BN_CTX>. If the allocation fails,
38it returns B<NULL> and sets an error code that can be obtained by
39L<ERR_get_error(3)|ERR_get_error(3)>.
40
41BN_CTX_init() and BN_CTX_free() have no return values.
42
43=head1 SEE ALSO
44
45L<bn(3)|bn(3)>, L<err(3)|err(3)>, L<BN_add(3)|BN_add(3)>,
46L<BN_CTX_start(3)|BN_CTX_start(3)>
47
48=head1 HISTORY
49
50BN_CTX_new() and BN_CTX_free() are available in all versions on SSLeay
51and 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
5BN_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
19These functions are used to obtain temporary B<BIGNUM> variables from
20a B<BN_CTX> in order to save the overhead of repeatedly creating and
21freeing B<BIGNUM>s in functions that are called from inside a loop.
22
23A function must call BN_CTX_start() first. Then, BN_CTX_get() may be
24called repeatedly to obtain temporary B<BIGNUM>s. All BN_CTX_get()
25calls must be made before calling any other functions that use the
26B<ctx> as an argument.
27
28Finally, BN_CTX_end() must be called before returning from the function.
29When BN_CTX_end() is called, the B<BIGNUM> pointers obtained from
30BN_CTX_get() become invalid.
31
32=head1 RETURN VALUES
33
34BN_CTX_start() and BN_CTX_end() return no values.
35
36BN_CTX_get() returns a pointer to the B<BIGNUM>, or B<NULL> on error.
37Once BN_CTX_get() has failed, the subsequent calls will return B<NULL>
38as well, so it is sufficient to check the return value of the last
39BN_CTX_get() call. In case of an error, an error code is set, which
40can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
41
42
43=head1 SEE ALSO
44
45L<BN_CTX_new(3)|BN_CTX_new(3)>
46
47=head1 HISTORY
48
49BN_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
5BN_add, BN_sub, BN_mul, BN_div, BN_sqr, BN_mod, BN_mod_mul, BN_exp,
6BN_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
37BN_add() adds B<a> and B<b> and places the result in B<r> (C<r=a+b>).
38B<r> may be the same B<BIGNUM> as B<a> or B<b>.
39
40BN_sub() subtracts B<b> from B<a> and places the result in B<r> (C<r=a-b>).
41
42BN_mul() multiplies B<a> and B<b> and places the result in B<r> (C<r=a*b>).
43B<r> may be the same B<BIGNUM> as B<a> or B<b>.
44For multiplication by powers of 2, use L<BN_lshift(3)|BN_lshift(3)>.
45
46BN_div() divides B<a> by B<d> and places the result in B<dv> and the
47remainder in B<rem> (C<dv=a/d, rem=a%d>). Either of B<dv> and B<rem> may
48be NULL, in which case the respective value is not returned.
49For division by powers of 2, use BN_rshift(3).
50
51BN_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>.
53This function is faster than BN_mul(r,a,a).
54
55BN_mod() find the remainder of B<a> divided by B<m> and places it in
56B<rem> (C<rem=a%m>).
57
58BN_mod_mul() multiplies B<a> by B<b> and finds the remainder when
59divided by B<m> (C<r=(a*b)%m>). B<r> may be the same B<BIGNUM> as B<a>
60or B<b>. For a more efficient algorithm, see
61L<BN_mod_mul_montgomery(3)|BN_mod_mul_montgomery(3)>; for repeated
62computations using the same modulus, see L<BN_mod_mul_reciprocal(3)|BN_mod_mul_reciprocal(3)>.
63
64BN_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
66BN_mul().
67
68BN_mod_exp() computes B<a> to the B<p>-th power modulo B<m> (C<r=a^p %
69m>). This function uses less time and space than BN_exp().
70
71BN_gcd() computes the greatest common divisor of B<a> and B<b> and
72places the result in B<r>. B<r> may be the same B<BIGNUM> as B<a> or
73B<b>.
74
75For all functions, B<ctx> is a previously allocated B<BN_CTX> used for
76temporary variables; see L<BN_CTX_new(3)|BN_CTX_new(3)>.
77
78Unless noted otherwise, the result B<BIGNUM> must be different from
79the arguments.
80
81=head1 RETURN VALUES
82
83For all functions, 1 is returned for success, 0 on error. The return
84value should always be checked (e.g., C<if (!BN_add(r,a,b)) goto err;>).
85The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
86
87=head1 SEE ALSO
88
89L<bn(3)|bn(3)>, L<err(3)|err(3)>, L<BN_CTX_new(3)|BN_CTX_new(3)>,
90L<BN_add_word(3)|BN_add_word(3)>, L<BN_set_bit(3)|BN_set_bit(3)>
91
92=head1 HISTORY
93
94BN_add(), BN_sub(), BN_div(), BN_sqr(), BN_mod(), BN_mod_mul(),
95BN_mod_exp() and BN_gcd() are available in all versions of SSLeay and
96OpenSSL. The B<ctx> argument to BN_mul() was added in SSLeay
970.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
5BN_add_word, BN_sub_word, BN_mul_word, BN_div_word, BN_mod_word - arithmetic
6functions 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
24These functions perform arithmetic operations on BIGNUMs with unsigned
25integers. They are much more efficient than the normal BIGNUM
26arithmetic operations.
27
28BN_add_word() adds B<w> to B<a> (C<a+=w>).
29
30BN_sub_word() subtracts B<w> from B<a> (C<a-=w>).
31
32BN_mul_word() multiplies B<a> and B<w> (C<a*=b>).
33
34BN_div_word() divides B<a> by B<w> (C<a/=w>) and returns the remainder.
35
36BN_mod_word() returns the remainder of B<a> divided by B<w> (C<a%m>).
37
38For BN_div_word() and BN_mod_word(), B<w> must not be 0.
39
40=head1 RETURN VALUES
41
42BN_add_word(), BN_sub_word() and BN_mul_word() return 1 for success, 0
43on error. The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
44
45BN_mod_word() and BN_div_word() return B<a>%B<w>.
46
47=head1 SEE ALSO
48
49L<bn(3)|bn(3)>, L<err(3)|err(3)>, L<BN_add(3)|BN_add(3)>
50
51=head1 HISTORY
52
53BN_add_word() and BN_mod_word() are available in all versions of
54SSLeay and OpenSSL. BN_div_word() was added in SSLeay 0.8, and
55BN_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
5BN_bn2bin, BN_bin2bn, BN_bn2hex, BN_bn2dec, BN_hex2bn, BN_dec2bn,
6BN_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
28BN_bn2bin() converts the absolute value of B<a> into big-endian form
29and stores it at B<to>. B<to> must point to BN_num_bytes(B<a>) bytes of
30memory.
31
32BN_bin2bn() converts the positive integer in big-endian form of length
33B<len> at B<s> into a B<BIGNUM> and places it in B<ret>. If B<ret> is
34NULL, a new B<BIGNUM> is created.
35
36BN_bn2hex() and BN_bn2dec() return printable strings containing the
37hexadecimal and decimal encoding of B<a> respectively. For negative
38numbers, the string is prefaced with a leading '-'. The string must be
39Free()d later.
40
41BN_hex2bn() converts the string B<str> containing a hexadecimal number
42to a B<BIGNUM> and stores it in **B<bn>. If *B<bn> is NULL, a new
43B<BIGNUM> is created. If B<bn> is NULL, it only computes the number's
44length in hexadecimal digits. If the string starts with '-', the
45number is negative. BN_dec2bn() is the same using the decimal system.
46
47BN_print() and BN_print_fp() write the hexadecimal encoding of B<a>,
48with a leading '-' for negative numbers, to the B<BIO> or B<FILE>
49B<fp>.
50
51BN_bn2mpi() and BN_mpi2bn() convert B<BIGNUM>s from and to a format
52that consists of the number's length in bytes represented as a 3-byte
53big-endian number, and the number itself in big-endian format, where
54the most significant bit signals a negative number (the representation
55of numbers with the MSB set is prefixed with null byte).
56
57BN_bn2mpi() stores the representation of B<a> at B<to>, where B<to>
58must be large enough to hold the result. The size can be determined by
59calling BN_bn2mpi(B<a>, NULL).
60
61BN_mpi2bn() converts the B<len> bytes long representation at B<s> to
62a B<BIGNUM> and stores it at B<ret>, or in a newly allocated B<BIGNUM>
63if B<ret> is NULL.
64
65=head1 RETURN VALUES
66
67BN_bn2bin() returns the length of the big-endian number placed at B<to>.
68BN_bin2bn() returns the B<BIGNUM>, NULL on error.
69
70BN_bn2hex() and BN_bn2dec() return a null-terminated string, or NULL
71on error. BN_hex2bn() and BN_dec2bn() return the number's length in
72hexadecimal or decimal digits, and 0 on error.
73
74BN_print_fp() and BN_print() return 1 on success, 0 on write errors.
75
76BN_bn2mpi() returns the length of the representation. BN_mpi2bn()
77returns the B<BIGNUM>, and NULL on error.
78
79The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
80
81=head1 SEE ALSO
82
83L<bn(3)|bn(3)>, L<err(3)|err(3)>, L<BN_zero(3)|BN_zero(3)>,
84L<ASN1_INTEGER_to_BN(3)|ASN1_INTEGER_to_BN(3)>,
85L<BN_num_bytes(3)|BN_num_bytes(3)>
86
87=head1 HISTORY
88
89BN_bn2bin(), BN_bin2bn(), BN_print_fp() and BN_print() are available
90in all versions of SSLeay and OpenSSL.
91
92BN_bn2hex(), BN_bn2dec(), BN_hex2bn(), BN_dec2bn(), BN_bn2mpi() and
93BN_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
5BN_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
21BN_cmp() compares the numbers B<a> and B<b>. BN_ucmp() compares their
22absolute values.
23
24BN_is_zero(), BN_is_one() and BN_is_word() test if B<a> equals 0, 1,
25or B<w> respectively. BN_is_odd() tests if a is odd.
26
27BN_is_zero(), BN_is_one(), BN_is_word() and BN_is_odd() are macros.
28
29=head1 RETURN VALUES
30
31BN_cmp() returns -1 if B<a> E<lt> B<b>, 0 if B<a> == B<b> and 1 if
32B<a> E<gt> B<b>. BN_ucmp() is the same using the absolute values
33of B<a> and B<b>.
34
35BN_is_zero(), BN_is_one() BN_is_word() and BN_is_odd() return 1 if
36the condition is true, 0 otherwise.
37
38=head1 SEE ALSO
39
40L<bn(3)|bn(3)>
41
42=head1 HISTORY
43
44BN_cmp(), BN_ucmp(), BN_is_zero(), BN_is_one() and BN_is_word() are
45available in all versions of SSLeay and OpenSSL.
46BN_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
5BN_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
17BN_copy() copies B<from> to B<to>. BN_dup() creates a new B<BIGNUM>
18containing the value B<from>.
19
20=head1 RETURN VALUES
21
22BN_copy() returns B<to> on success, NULL on error. BN_dup() returns
23the new B<BIGNUM>, and NULL on error. The error codes can be obtained
24by L<ERR_get_error(3)|ERR_get_error(3)>.
25
26=head1 SEE ALSO
27
28L<bn(3)|bn(3)>, L<err(3)|err(3)>
29
30=head1 HISTORY
31
32BN_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
5BN_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
23BN_generate_prime() generates a pseudo-random prime number of B<num>
24bits.
25If B<ret> is not B<NULL>, it will be used to store the number.
26
27If B<callback> is not B<NULL>, it is called as follows:
28
29=over 4
30
31=item *
32
33B<callback(0, i, cb_arg)> is called after generating the i-th
34potential prime number.
35
36=item *
37
38While the number is being tested for primality, B<callback(1, j,
39cb_arg)> is called as described below.
40
41=item *
42
43When a prime has been found, B<callback(2, i, cb_arg)> is called.
44
45=back
46
47The prime may have to fulfill additional requirements for use in
48Diffie-Hellman key exchange:
49
50If 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
52generator.
53
54If B<safe> is true, it will be a safe prime (i.e. a prime p so
55that (p-1)/2 is also prime).
56
57The PRNG must be seeded prior to calling BN_generate_prime().
58The prime number generation has a negligible error probability.
59
60BN_is_prime() and BN_is_prime_fasttest() test if the number B<a> is
61prime. The following tests are performed until one of them shows that
62B<a> is composite; if B<a> passes all these tests, it is considered
63prime.
64
65BN_is_prime_fasttest(), when called with B<do_trial_division == 1>,
66first attempts trial division by a number of small primes;
67if no divisors are found by this test and B<callback> is not B<NULL>,
68B<callback(1, -1, cb_arg)> is called.
69If B<do_trial_division == 0>, this test is skipped.
70
71Both BN_is_prime() and BN_is_prime_fasttest() perform a Miller-Rabin
72probabilistic primality test with B<checks> iterations. If
73B<checks == BN_prime_check>, a number of iterations is used that
74yields a false positive rate of at most 2^-80 for random input.
75
76If B<callback> is not B<NULL>, B<callback(1, j, cb_arg)> is called
77after the j-th iteration (j = 0, 1, ...). B<ctx> is a
78pre-allocated B<BN_CTX> (to save the overhead of allocating and
79freeing the structure in a loop), or B<NULL>.
80
81=head1 RETURN VALUES
82
83BN_generate_prime() returns the prime number on success, B<NULL> otherwise.
84
85BN_is_prime() returns 0 if the number is composite, 1 if it is
86prime with an error probability of less than 0.25^B<checks>, and
87-1 on error.
88
89The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
90
91=head1 SEE ALSO
92
93L<bn(3)|bn(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>
94
95=head1 HISTORY
96
97The B<cb_arg> arguments to BN_generate_prime() and to BN_is_prime()
98were added in SSLeay 0.9.0. The B<ret> argument to BN_generate_prime()
99was added in SSLeay 0.9.1.
100BN_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
5BN_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
16BN_mod_inverse() computes the inverse of B<a> modulo B<n>
17places the result in B<r> (C<(a*r)%n==1>). If B<r> is NULL,
18a new B<BIGNUM> is created.
19
20B<ctx> is a previously allocated B<BN_CTX> used for temporary
21variables. B<r> may be the same B<BIGNUM> as B<a> or B<n>.
22
23=head1 RETURN VALUES
24
25BN_mod_inverse() returns the B<BIGNUM> containing the inverse, and
26NULL on error. The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
27
28=head1 SEE ALSO
29
30L<bn(3)|bn(3)>, L<err(3)|err(3)>, L<BN_add(3)|BN_add(3)>
31
32=head1 HISTORY
33
34BN_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
5BN_mod_mul_montgomery, BN_MONT_CTX_new, BN_MONT_CTX_init,
6BN_MONT_CTX_free, BN_MONT_CTX_set, BN_MONT_CTX_copy,
7BN_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
31These functions implement Montgomery multiplication. They are used
32automatically when L<BN_mod_exp(3)|BN_mod_exp(3)> is called with suitable input,
33but they may be useful when several operations are to be performed
34using the same modulus.
35
36BN_MONT_CTX_new() allocates and initializes a B<BN_MONT_CTX> structure.
37BN_MONT_CTX_init() initializes an existing uninitialized B<BN_MONT_CTX>.
38
39BN_MONT_CTX_set() sets up the B<mont> structure from the modulus B<m>
40by precomputing its inverse and a value R.
41
42BN_MONT_CTX_copy() copies the B<N_MONT_CTX> B<from> to B<to>.
43
44BN_MONT_CTX_free() frees the components of the B<BN_MONT_CTX>, and, if
45it was created by BN_MONT_CTX_new(), also the structure itself.
46
47BN_mod_mul_montgomery() computes Mont(B<a>,B<b>):=B<a>*B<b>*R^-1 and places
48the result in B<r>.
49
50BN_from_montgomery() performs the Montgomery reduction B<r> = B<a>*R^-1.
51
52BN_to_montgomery() computes Mont(B<a>,R^2).
53
54For all functions, B<ctx> is a previously allocated B<BN_CTX> used for
55temporary variables.
56
57The 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
70BN_to_montgomery() is a macro.
71
72=head1 RETURN VALUES
73
74BN_MONT_CTX_new() returns the newly allocated B<BN_MONT_CTX>, and NULL
75on error.
76
77BN_MONT_CTX_init() and BN_MONT_CTX_free() have no return values.
78
79For the other functions, 1 is returned for success, 0 on error.
80The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
81
82=head1 SEE ALSO
83
84L<bn(3)|bn(3)>, L<err(3)|err(3)>, L<BN_add(3)|BN_add(3)>,
85L<BN_CTX_new(3)|BN_CTX_new(3)>
86
87=head1 HISTORY
88
89BN_MONT_CTX_new(), BN_MONT_CTX_free(), BN_MONT_CTX_set(),
90BN_mod_mul_montgomery(), BN_from_montgomery() and BN_to_montgomery()
91are available in all versions of SSLeay and OpenSSL.
92
93BN_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
5BN_mod_mul_reciprocal, BN_RECP_CTX_new, BN_RECP_CTX_init,
6BN_RECP_CTX_free, BN_RECP_CTX_set - modular multiplication using
7reciprocal
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
27BN_mod_mul_reciprocal() can be used to perform an efficient
28L<BN_mod_mul(3)|BN_mod_mul(3)> operation when the operation will be performed
29repeatedly with the same modulus. It computes B<r>=(B<a>*B<b>)%B<m>
30using B<recp>=1/B<m>, which is set as described below. B<ctx> is a
31previously allocated B<BN_CTX> used for temporary variables.
32
33BN_RECP_CTX_new() allocates and initializes a B<BN_RECP> structure.
34BN_RECP_CTX_init() initializes an existing uninitialized B<BN_RECP>.
35
36BN_RECP_CTX_free() frees the components of the B<BN_RECP>, and, if it
37was created by BN_RECP_CTX_new(), also the structure itself.
38
39BN_RECP_CTX_set() stores B<m> in B<recp> and sets it up for computing
401/B<m> and shifting it left by BN_num_bits(B<m>)+1 to make it an
41integer. The result and the number of bits it was shifted left will
42later be stored in B<recp>.
43
44BN_div_recp() divides B<a> by B<m> using B<recp>. It places the quotient
45in B<dv> and the remainder in B<rem>.
46
47The 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
58It cannot be shared between threads.
59
60=head1 RETURN VALUES
61
62BN_RECP_CTX_new() returns the newly allocated B<BN_RECP_CTX>, and NULL
63on error.
64
65BN_RECP_CTX_init() and BN_RECP_CTX_free() have no return values.
66
67For the other functions, 1 is returned for success, 0 on error.
68The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
69
70=head1 SEE ALSO
71
72L<bn(3)|bn(3)>, L<err(3)|err(3)>, L<BN_add(3)|BN_add(3)>,
73L<BN_CTX_new(3)|BN_CTX_new(3)>
74
75=head1 HISTORY
76
77B<BN_RECP_CTX> was added in SSLeay 0.9.0. Before that, the function
78BN_reciprocal() was used instead, and the BN_mod_mul_reciprocal()
79arguments 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
5BN_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
23BN_new() allocated and initializes a B<BIGNUM> structure. BN_init()
24initializes an existing uninitialized B<BIGNUM>.
25
26BN_clear() is used to destroy sensitive data such as keys when they
27are no longer needed. It erases the memory used by B<a> and sets it
28to the value 0.
29
30BN_free() frees the components of the B<BIGNUM>, and if it was created
31by BN_new(), also the structure itself. BN_clear_free() additionally
32overwrites the data before the memory is returned to the system.
33
34=head1 RETURN VALUES
35
36BN_new() returns a pointer to the B<BIGNUM>. If the allocation fails,
37it returns B<NULL> and sets an error code that can be obtained
38by L<ERR_get_error(3)|ERR_get_error(3)>.
39
40BN_init(), BN_clear(), BN_free() and BN_clear_free() have no return
41values.
42
43=head1 SEE ALSO
44
45L<bn(3)|bn(3)>, L<err(3)|err(3)>
46
47=head1 HISTORY
48
49BN_new(), BN_clear(), BN_free() and BN_clear_free() are available in
50all versions on SSLeay and OpenSSL. BN_init() was added in SSLeay
510.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
5BN_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
19These functions return the size of a B<BIGNUM> in bytes or bits,
20and the size of an unsigned integer in bits.
21
22BN_num_bytes() is a macro.
23
24=head1 RETURN VALUES
25
26The size.
27
28=head1 SEE ALSO
29
30L<bn(3)|bn(3)>
31
32=head1 HISTORY
33
34BN_num_bytes(), BN_num_bits() and BN_num_bits_word() are available in
35all 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
5BN_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
17BN_rand() generates a cryptographically strong pseudo-random number of
18B<bits> bits in length and stores it in B<rnd>. If B<top> is true, the
19two most significant bits of the number will be set to 1, so that the
20product of two such random numbers will always have 2*B<bits> length.
21If B<bottom> is true, the number will be odd.
22
23BN_pseudo_rand() does the same, but pseudo-random numbers generated by
24this function are not necessarily unpredictable. They can be used for
25non-cryptographic purposes and for certain purposes in cryptographic
26protocols, but usually not for key generation etc.
27
28The PRNG must be seeded prior to calling BN_rand().
29
30=head1 RETURN VALUES
31
32BN_rand() and BN_pseudo_rand() return 1 on success, 0 on error.
33The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
34
35=head1 SEE ALSO
36
37L<bn(3)|bn(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>,
38L<RAND_add(3)|RAND_add(3)>, L<RAND_bytes(3)|RAND_bytes(3)>
39
40=head1 HISTORY
41
42BN_rand() is available in all versions of SSLeay and OpenSSL.
43BN_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
5BN_set_bit, BN_clear_bit, BN_is_bit_set, BN_mask_bits, BN_lshift,
6BN_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
27BN_set_bit() sets bit B<n> in B<a> to 1 (C<a|=(1E<lt>E<lt>n)>). The
28number is expanded if necessary.
29
30BN_clear_bit() sets bit B<n> in B<a> to 0 (C<a&=~(1E<lt>E<lt>n)>). An
31error occurs if B<a> is shorter than B<n> bits.
32
33BN_is_bit_set() tests if bit B<n> in B<a> is set.
34
35BN_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
37shorter than B<n> bits.
38
39BN_lshift() shifts B<a> left by B<n> bits and places the result in
40B<r> (C<r=a*2^n>). BN_lshift1() shifts B<a> left by one and places
41the result in B<r> (C<r=2*a>).
42
43BN_rshift() shifts B<a> right by B<n> bits and places the result in
44B<r> (C<r=a/2^n>). BN_rshift1() shifts B<a> right by one and places
45the result in B<r> (C<r=a/2>).
46
47For the shift functions, B<r> and B<a> may be the same variable.
48
49=head1 RETURN VALUES
50
51BN_is_bit_set() returns 1 if the bit is set, 0 otherwise.
52
53All other functions return 1 for success, 0 on error. The error codes
54can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
55
56=head1 SEE ALSO
57
58L<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
62BN_set_bit(), BN_clear_bit(), BN_is_bit_set(), BN_mask_bits(),
63BN_lshift(), BN_lshift1(), BN_rshift(), and BN_rshift1() are available
64in 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
5BN_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
21BN_zero(), BN_one() and BN_set_word() set B<a> to the values 0, 1 and
22B<w> respectively. BN_zero() and BN_one() are macros.
23
24BN_value_one() returns a B<BIGNUM> constant of value 1. This constant
25is useful for use in comparisons and assignment.
26
27BN_get_word() returns B<a>, if it can be represented as an unsigned
28long.
29
30=head1 RETURN VALUES
31
32BN_get_word() returns the value B<a>, and 0xffffffffL if B<a> cannot
33be represented as an unsigned long.
34
35BN_zero(), BN_one() and BN_set_word() return 1 on success, 0 otherwise.
36BN_value_one() returns the constant.
37
38=head1 BUGS
39
40Someone might change the constant.
41
42If a B<BIGNUM> is equal to 0xffffffffL it can be represented as an
43unsigned long but this value is also returned on error.
44
45=head1 SEE ALSO
46
47L<bn(3)|bn(3)>, L<BN_bn2bin(3)|BN_bn2bin(3)>
48
49=head1 HISTORY
50
51BN_zero(), BN_one() and BN_set_word() are available in all versions of
52SSLeay and OpenSSL. BN_value_one() and BN_get_word() were added in
53SSLeay 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
5CRYPTO_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
15Several OpenSSL structures can have application specific data attached to them.
16These functions are used internally by OpenSSL to manipulate application
17specific data attached to a specific structure.
18
19These functions should only be used by applications to manipulate
20B<CRYPTO_EX_DATA> structures passed to the B<new_func()>, B<free_func()> and
21B<dup_func()> callbacks: as passed to B<RSA_get_ex_new_index()> for example.
22
23B<CRYPTO_set_ex_data()> is used to set application specific data, the data is
24supplied in the B<arg> parameter and its precise meaning is up to the
25application.
26
27B<CRYPTO_get_ex_data()> is used to retrieve application specific data. The data
28is returned to the application, this will be the same value as supplied to
29a previous B<CRYPTO_set_ex_data()> call.
30
31=head1 RETURN VALUES
32
33B<CRYPTO_set_ex_data()> returns 1 on success or 0 on failure.
34
35B<CRYPTO_get_ex_data()> returns the application data or 0 on failure. 0 may also
36be valid application data but currently it can only fail if given an invalid B<idx>
37parameter.
38
39On failure an error code can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>.
40
41=head1 SEE ALSO
42
43L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>,
44L<DSA_get_ex_new_index(3)|DSA_get_ex_new_index(3)>,
45L<DH_get_ex_new_index(3)|DH_get_ex_new_index(3)>
46
47=head1 HISTORY
48
49CRYPTO_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
5DH_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
17DH_generate_key() performs the first step of a Diffie-Hellman key
18exchange by generating private and public DH values. By calling
19DH_compute_key(), these are combined with the other party's public
20value to compute the shared key.
21
22DH_generate_key() expects B<dh> to contain the shared parameters
23B<dh-E<gt>p> and B<dh-E<gt>g>. It generates a random private DH value
24unless B<dh-E<gt>priv_key> is already set, and computes the
25corresponding public value B<dh-E<gt>pub_key>, which can then be
26published.
27
28DH_compute_key() computes the shared secret from the private DH value
29in B<dh> and the other party's public value in B<pub_key> and stores
30it in B<key>. B<key> must point to B<DH_size(dh)> bytes of memory.
31
32=head1 RETURN VALUES
33
34DH_generate_key() returns 1 on success, 0 otherwise.
35
36DH_compute_key() returns the size of the shared secret on success, -1
37on error.
38
39The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
40
41=head1 SEE ALSO
42
43L<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
47DH_generate_key() and DH_compute_key() are available in all versions
48of 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
5DH_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
18DH_generate_parameters() generates Diffie-Hellman parameters that can
19be shared among a group of users, and returns them in a newly
20allocated B<DH> structure. The pseudo-random number generator must be
21seeded prior to calling DH_generate_parameters().
22
23B<prime_len> is the length in bits of the safe prime to be generated.
24B<generator> is a small number E<gt> 1, typically 2 or 5.
25
26A callback function may be used to provide feedback about the progress
27of the key generation. If B<callback> is not B<NULL>, it will be
28called as described in L<BN_generate_prime(3)|BN_generate_prime(3)> while a random prime
29number is generated, and when a prime has been found, B<callback(3,
300, cb_arg)> is called.
31
32DH_check() validates Diffie-Hellman parameters. It checks that B<p> is
33a safe prime, and that B<g> is a suitable generator. In the case of an
34error, the bit flags DH_CHECK_P_NOT_SAFE_PRIME or
35DH_NOT_SUITABLE_GENERATOR are set in B<*codes>.
36DH_UNABLE_TO_CHECK_GENERATOR is set if the generator cannot be
37checked, i.e. it does not equal 2 or 5.
38
39=head1 RETURN VALUES
40
41DH_generate_parameters() returns a pointer to the DH structure, or
42NULL if the parameter generation fails. The error codes can be
43obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
44
45DH_check() returns 1 if the check could be performed, 0 otherwise.
46
47=head1 NOTES
48
49DH_generate_parameters() may run for several hours before finding a
50suitable prime.
51
52The parameters generated by DH_generate_parameters() are not to be
53used in signature schemes.
54
55=head1 BUGS
56
57If B<generator> is not 2 or 5, B<dh-E<gt>g>=B<generator> is not
58a usable generator.
59
60=head1 SEE ALSO
61
62L<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
66DH_check() is available in all versions of SSLeay and OpenSSL.
67The B<cb_arg> argument to DH_generate_parameters() was added in SSLeay 0.9.0.
68
69In versions before OpenSSL 0.9.5, DH_CHECK_P_NOT_STRONG_PRIME is used
70instead 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
5DH_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
22These functions handle application specific data in DH
23structures. Their usage is identical to that of
24RSA_get_ex_new_index(), RSA_set_ex_data() and RSA_get_ex_data()
25as described in L<RSA_get_ex_new_index(3)>.
26
27=head1 SEE ALSO
28
29L<RSA_get_ex_new_index()|RSA_get_ex_new_index()>, L<dh(3)|dh(3)>
30
31=head1 HISTORY
32
33DH_get_ex_new_index(), DH_set_ex_data() and DH_get_ex_data() are
34available 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
5DH_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
17DH_new() allocates and initializes a B<DH> structure.
18
19DH_free() frees the B<DH> structure and its components. The values are
20erased before the memory is returned to the system.
21
22=head1 RETURN VALUES
23
24If the allocation fails, DH_new() returns B<NULL> and sets an error
25code that can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. Otherwise it returns
26a pointer to the newly allocated structure.
27
28DH_free() returns no value.
29
30=head1 SEE ALSO
31
32L<dh(3)|dh(3)>, L<err(3)|err(3)>,
33L<DH_generate_parameters(3)|DH_generate_parameters(3)>,
34L<DH_generate_key(3)|DH_generate_key(3)>
35
36=head1 HISTORY
37
38DH_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
5DH_set_default_method, DH_get_default_method, DH_set_method,
6DH_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
24A B<DH_METHOD> specifies the functions that OpenSSL uses for Diffie-Hellman
25operations. By modifying the method, alternative implementations
26such as hardware accelerators may be used.
27
28Initially, the default is to use the OpenSSL internal implementation.
29DH_OpenSSL() returns a pointer to that method.
30
31DH_set_default_method() makes B<meth> the default method for all B<DH>
32structures created later.
33
34DH_get_default_method() returns a pointer to the current default
35method.
36
37DH_set_method() selects B<meth> for all operations using the structure B<dh>.
38
39DH_get_method() returns a pointer to the method currently selected
40for B<dh>.
41
42DH_new_method() allocates and initializes a B<DH> structure so that
43B<method> will be used for the DH operations. If B<method> is B<NULL>,
44the 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
78DH_OpenSSL(), DH_get_default_method() and DH_get_method() return
79pointers to the respective B<DH_METHOD>s.
80
81DH_set_default_method() returns no value.
82
83DH_set_method() returns a pointer to the B<DH_METHOD> previously
84associated with B<dh>.
85
86DH_new_method() returns B<NULL> and sets an error code that can be
87obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation fails. Otherwise it
88returns a pointer to the newly allocated structure.
89
90=head1 SEE ALSO
91
92L<dh(3)|dh(3)>, L<DH_new(3)|DH_new(3)>
93
94=head1 HISTORY
95
96DH_set_default_method(), DH_get_default_method(), DH_set_method(),
97DH_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
5DH_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
15This function returns the Diffie-Hellman size in bytes. It can be used
16to determine how much memory must be allocated for the shared secret
17computed by DH_compute_key().
18
19B<dh-E<gt>p> must not be B<NULL>.
20
21=head1 RETURN VALUE
22
23The size in bytes.
24
25=head1 SEE ALSO
26
27L<dh(3)|dh(3)>, L<DH_generate_key(3)|DH_generate_key(3)>
28
29=head1 HISTORY
30
31DH_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
5DSA_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
17DSA_SIG_new() allocates and initializes a B<DSA_SIG> structure.
18
19DSA_SIG_free() frees the B<DSA_SIG> structure and its components. The
20values are erased before the memory is returned to the system.
21
22=head1 RETURN VALUES
23
24If the allocation fails, DSA_SIG_new() returns B<NULL> and sets an
25error code that can be obtained by
26L<ERR_get_error(3)|ERR_get_error(3)>. Otherwise it returns a pointer
27to the newly allocated structure.
28
29DSA_SIG_free() returns no value.
30
31=head1 SEE ALSO
32
33L<dsa(3)|dsa(3)>, L<err(3)|err(3)>, L<DSA_do_sign(3)|DSA_do_sign(3)>
34
35=head1 HISTORY
36
37DSA_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
5DSA_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
18DSA_do_sign() computes a digital signature on the B<len> byte message
19digest B<dgst> using the private key B<dsa> and returns it in a
20newly allocated B<DSA_SIG> structure.
21
22L<DSA_sign_setup(3)|DSA_sign_setup(3)> may be used to precompute part
23of the signing operation in case signature generation is
24time-critical.
25
26DSA_do_verify() verifies that the signature B<sig> matches a given
27message digest B<dgst> of size B<len>. B<dsa> is the signer's public
28key.
29
30=head1 RETURN VALUES
31
32DSA_do_sign() returns the signature, NULL on error. DSA_do_verify()
33returns 1 for a valid signature, 0 for an incorrect signature and -1
34on error. The error codes can be obtained by
35L<ERR_get_error(3)|ERR_get_error(3)>.
36
37=head1 SEE ALSO
38
39L<dsa(3)|dsa(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>,
40L<DSA_SIG_new(3)|DSA_SIG_new(3)>,
41L<DSA_sign(3)|DSA_sign(3)>
42
43=head1 HISTORY
44
45DSA_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
5DSA_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
15DSA_dup_DH() duplicates DSA parameters/keys as DH parameters/keys. q
16is lost during that conversion, but the resulting DH parameters
17contain its length.
18
19=head1 RETURN VALUE
20
21DSA_dup_DH() returns the new B<DH> structure, and NULL on error. The
22error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
23
24=head1 NOTE
25
26Be careful to avoid small subgroup attacks when using this.
27
28=head1 SEE ALSO
29
30L<dh(3)|dh(3)>, L<dsa(3)|dsa(3)>, L<err(3)|err(3)>
31
32=head1 HISTORY
33
34DSA_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
5DSA_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
15DSA_generate_key() expects B<a> to contain DSA parameters. It generates
16a new key pair and stores it in B<a-E<gt>pub_key> and B<a-E<gt>priv_key>.
17
18The PRNG must be seeded prior to calling DSA_generate_key().
19
20=head1 RETURN VALUE
21
22DSA_generate_key() returns 1 on success, 0 otherwise.
23The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
24
25=head1 SEE ALSO
26
27L<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
31DSA_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
5DSA_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
17DSA_generate_parameters() generates primes p and q and a generator g
18for use in the DSA.
19
20B<bits> is the length of the prime to be generated; the DSS allows a
21maximum of 1024 bits.
22
23If B<seed> is B<NULL> or B<seed_len> E<lt> 20, the primes will be
24generated at random. Otherwise, the seed is used to generate
25them. If the given seed does not yield a prime q, a new random
26seed is chosen and placed at B<seed>.
27
28DSA_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
32A callback function may be used to provide feedback about the progress
33of the key generation. If B<callback> is not B<NULL>, it will be
34called as follows:
35
36=over 4
37
38=item *
39
40When 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
45When a candidate for q has passed a test by trial division,
46B<callback(1, -1, cb_arg)> is called.
47While a candidate for q is tested by Miller-Rabin primality tests,
48B<callback(1, i, cb_arg)> is called in the outer loop
49(once for each witness that confirms that the candidate may be prime);
50i is the loop counter (starting at 0).
51
52=item *
53
54When a prime q has been found, B<callback(2, 0, cb_arg)> and
55B<callback(3, 0, cb_arg)> are called.
56
57=item *
58
59Before a candidate for p (other than the first) is generated and tested,
60B<callback(0, counter, cb_arg)> is called.
61
62=item *
63
64When a candidate for p has passed the test by trial division,
65B<callback(1, -1, cb_arg)> is called.
66While it is tested by the Miller-Rabin primality test,
67B<callback(1, i, cb_arg)> is called in the outer loop
68(once for each witness that confirms that the candidate may be prime).
69i is the loop counter (starting at 0).
70
71=item *
72
73When p has been found, B<callback(2, 1, cb_arg)> is called.
74
75=item *
76
77When the generator has been found, B<callback(3, 1, cb_arg)> is called.
78
79=back
80
81=head1 RETURN VALUE
82
83DSA_generate_parameters() returns a pointer to the DSA structure, or
84B<NULL> if the parameter generation fails. The error codes can be
85obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
86
87=head1 BUGS
88
89Seed lengths E<gt> 20 are not supported.
90
91=head1 SEE ALSO
92
93L<dsa(3)|dsa(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>,
94L<DSA_free(3)|DSA_free(3)>
95
96=head1 HISTORY
97
98DSA_generate_parameters() appeared in SSLeay 0.8. The B<cb_arg>
99argument was added in SSLeay 0.9.0.
100In versions up to OpenSSL 0.9.4, B<callback(1, ...)> was called
101in the inner loop of the Miller-Rabin test whenever it reached the
102squaring step (the parameters to B<callback> did not reveal how many
103witnesses had been tested); since OpenSSL 0.9.5, B<callback(1, ...)>
104is 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
5DSA_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
22These functions handle application specific data in DSA
23structures. Their usage is identical to that of
24RSA_get_ex_new_index(), RSA_set_ex_data() and RSA_get_ex_data()
25as described in L<RSA_get_ex_new_index(3)>.
26
27=head1 SEE ALSO
28
29L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>, L<dsa(3)|dsa(3)>
30
31=head1 HISTORY
32
33DSA_get_ex_new_index(), DSA_set_ex_data() and DSA_get_ex_data() are
34available 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
5DSA_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
17DSA_new() allocates and initializes a B<DSA> structure.
18
19DSA_free() frees the B<DSA> structure and its components. The values are
20erased before the memory is returned to the system.
21
22=head1 RETURN VALUES
23
24If the allocation fails, DSA_new() returns B<NULL> and sets an error
25code that can be obtained by
26L<ERR_get_error(3)|ERR_get_error(3)>. Otherwise it returns a pointer
27to the newly allocated structure.
28
29DSA_free() returns no value.
30
31=head1 SEE ALSO
32
33L<dsa(3)|dsa(3)>, L<err(3)|err(3)>,
34L<DSA_generate_parameters(3)|DSA_generate_parameters(3)>,
35L<DSA_generate_key(3)|DSA_generate_key(3)>
36
37=head1 HISTORY
38
39DSA_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
5DSA_set_default_method, DSA_get_default_method, DSA_set_method,
6DSA_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
24A B<DSA_METHOD> specifies the functions that OpenSSL uses for DSA
25operations. By modifying the method, alternative implementations
26such as hardware accelerators may be used.
27
28Initially, the default is to use the OpenSSL internal implementation.
29DSA_OpenSSL() returns a pointer to that method.
30
31DSA_set_default_method() makes B<meth> the default method for all B<DSA>
32structures created later.
33
34DSA_get_default_method() returns a pointer to the current default
35method.
36
37DSA_set_method() selects B<meth> for all operations using the structure B<DSA>.
38
39DSA_get_method() returns a pointer to the method currently selected
40for B<DSA>.
41
42DSA_new_method() allocates and initializes a B<DSA> structure so that
43B<method> will be used for the DSA operations. If B<method> is B<NULL>,
44the default method is used.
45
46=head1 THE DSA_METHOD STRUCTURE
47
48struct
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
89DSA_OpenSSL(), DSA_get_default_method() and DSA_get_method() return
90pointers to the respective B<DSA_METHOD>s.
91
92DSA_set_default_method() returns no value.
93
94DSA_set_method() returns a pointer to the B<DSA_METHOD> previously
95associated with B<dsa>.
96
97DSA_new_method() returns B<NULL> and sets an error code that can be
98obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation
99fails. Otherwise it returns a pointer to the newly allocated
100structure.
101
102=head1 SEE ALSO
103
104L<dsa(3)|dsa(3)>, L<DSA_new(3)|DSA_new(3)>
105
106=head1 HISTORY
107
108DSA_set_default_method(), DSA_get_default_method(), DSA_set_method(),
109DSA_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
5DSA_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
22DSA_sign() computes a digital signature on the B<len> byte message
23digest B<dgst> using the private key B<dsa> and places its ASN.1 DER
24encoding 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
27DSA_sign_setup() may be used to precompute part of the signing
28operation in case signature generation is time-critical. It expects
29B<dsa> to contain DSA parameters. It places the precomputed values
30in newly allocated B<BIGNUM>s at *B<kinvp> and *B<rp>, after freeing
31the old ones unless *B<kinvp> and *B<rp> are NULL. These values may
32be passed to DSA_sign() in B<dsa-E<gt>kinv> and B<dsa-E<gt>r>.
33B<ctx> is a pre-allocated B<BN_CTX> or NULL.
34
35DSA_verify() verifies that the signature B<sigbuf> of size B<siglen>
36matches a given message digest B<dgst> of size B<len>.
37B<dsa> is the signer's public key.
38
39The B<type> parameter is ignored.
40
41The PRNG must be seeded before DSA_sign() (or DSA_sign_setup())
42is called.
43
44=head1 RETURN VALUES
45
46DSA_sign() and DSA_sign_setup() return 1 on success, 0 on error.
47DSA_verify() returns 1 for a valid signature, 0 for an incorrect
48signature and -1 on error. The error codes can be obtained by
49L<ERR_get_error(3)|ERR_get_error(3)>.
50
51=head1 CONFORMING TO
52
53US Federal Information Processing Standard FIPS 186 (Digital Signature
54Standard, DSS), ANSI X9.30
55
56=head1 SEE ALSO
57
58L<dsa(3)|dsa(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>,
59L<DSA_do_sign(3)|DSA_do_sign(3)>
60
61=head1 HISTORY
62
63DSA_sign() and DSA_verify() are available in all versions of SSLeay.
64DSA_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
5DSA_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
15This function returns the size of an ASN.1 encoded DSA signature in
16bytes. It can be used to determine how much memory must be allocated
17for a DSA signature.
18
19B<dsa-E<gt>q> must not be B<NULL>.
20
21=head1 RETURN VALUE
22
23The size in bytes.
24
25=head1 SEE ALSO
26
27L<dsa(3)|dsa(3)>, L<DSA_sign(3)|DSA_sign(3)>
28
29=head1 HISTORY
30
31DSA_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
5ERR_GET_LIB, ERR_GET_FUNC, ERR_GET_REASON - get library, function and
6reason 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
20The error code returned by ERR_get_error() consists of a library
21number, function code and reason code. ERR_GET_LIB(), ERR_GET_FUNC()
22and ERR_GET_REASON() can be used to extract these.
23
24The library number and function code describe where the error
25occurred, the reason code is the information about what went wrong.
26
27Each sub-library of OpenSSL has a unique library number; function and
28reason codes are unique within each sub-library. Note that different
29libraries may use the same value to signal different functions and
30reasons.
31
32B<ERR_R_...> reason codes such as B<ERR_R_MALLOC_FAILURE> are globally
33unique. However, when checking for sub-library specific reason codes,
34be sure to also compare the library number.
35
36ERR_GET_LIB(), ERR_GET_FUNC() and ERR_GET_REASON() are macros.
37
38=head1 RETURN VALUES
39
40The library number, function code and reason code respectively.
41
42=head1 SEE ALSO
43
44L<err(3)|err(3)>, L<ERR_get_error(3)|ERR_get_error(3)>
45
46=head1 HISTORY
47
48ERR_GET_LIB(), ERR_GET_FUNC() and ERR_GET_REASON() are available in
49all 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
5ERR_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
15ERR_clear_error() empties the current thread's error queue.
16
17=head1 RETURN VALUES
18
19ERR_clear_error() has no return value.
20
21=head1 SEE ALSO
22
23L<err(3)|err(3)>, L<ERR_get_error(3)|ERR_get_error(3)>
24
25=head1 HISTORY
26
27ERR_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
5ERR_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
19ERR_error_string() generates a human-readable string representing the
20error code B<e>, and places it at B<buf>. B<buf> must be at least 120
21bytes long. If B<buf> is B<NULL>, the error string is placed in a
22static buffer.
23
24The string will have the following format:
25
26 error:[error code]:[library name]:[function name]:[reason string]
27
28I<error code> is an 8 digit hexadecimal number, I<library name>,
29I<function name> and I<reason string> are ASCII text.
30
31ERR_lib_error_string(), ERR_func_error_string() and
32ERR_reason_error_string() return the library name, function
33name and reason string respectively.
34
35The OpenSSL error strings should be loaded by calling
36L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)> or, for SSL
37applications, L<SSL_load_error_strings(3)|SSL_load_error_strings(3)>
38first.
39If there is no text string registered for the given error code,
40the error string will contain the numeric code.
41
42L<ERR_print_errors(3)|ERR_print_errors(3)> can be used to print
43all error codes currently in the queue.
44
45=head1 RETURN VALUES
46
47ERR_error_string() returns a pointer to a static buffer containing the
48string if B<buf == NULL>, B<buf> otherwise.
49
50ERR_lib_error_string(), ERR_func_error_string() and
51ERR_reason_error_string() return the strings, and B<NULL> if
52none is registered for the error code.
53
54=head1 SEE ALSO
55
56L<err(3)|err(3)>, L<ERR_get_error(3)|ERR_get_error(3)>,
57L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)>,
58L<SSL_load_error_strings(3)|SSL_load_error_strings(3)>
59L<ERR_print_errors(3)|ERR_print_errors(3)>
60
61=head1 HISTORY
62
63ERR_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
5ERR_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
24ERR_get_error() returns the last error code from the thread's error
25queue and removes the entry. This function can be called repeatedly
26until there are no more error codes to return.
27
28ERR_peek_error() returns the last error code from the thread's
29error queue without modifying it.
30
31See L<ERR_GET_LIB(3)|ERR_GET_LIB(3)> for obtaining information about
32location and reason of the error, and
33L<ERR_error_string(3)|ERR_error_string(3)> for human-readable error
34messages.
35
36ERR_get_error_line() and ERR_peek_error_line() are the same as the
37above, but they additionally store the file name and line number where
38the error occurred in *B<file> and *B<line>, unless these are B<NULL>.
39
40ERR_get_error_line_data() and ERR_peek_error_line_data() store
41additional data and flags associated with the error code in *B<data>
42and *B<flags>, unless these are B<NULL>. *B<data> contains a string
43if *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
48The error code, or 0 if there is no error in the queue.
49
50=head1 SEE ALSO
51
52L<err(3)|err(3)>, L<ERR_error_string(3)|ERR_error_string(3)>,
53L<ERR_GET_LIB(3)|ERR_GET_LIB(3)>
54
55=head1 HISTORY
56
57ERR_get_error(), ERR_peek_error(), ERR_get_error_line() and
58ERR_peek_error_line() are available in all versions of SSLeay and
59OpenSSL. ERR_get_error_line_data() and ERR_peek_error_line_data()
60were 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
5ERR_load_crypto_strings, SSL_load_error_strings, ERR_free_strings -
6load 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
21ERR_load_crypto_strings() registers the error strings for all
22B<libcrypto> functions. SSL_load_error_strings() does the same,
23but also registers the B<libssl> error strings.
24
25One of these functions should be called before generating
26textual error messages. However, this is not required when memory
27usage is an issue.
28
29ERR_free_strings() frees all previously loaded error strings.
30
31=head1 RETURN VALUES
32
33ERR_load_crypto_strings(), SSL_load_error_strings() and
34ERR_free_strings() return no values.
35
36=head1 SEE ALSO
37
38L<err(3)|err(3)>, L<ERR_error_string(3)|ERR_error_string(3)>
39
40=head1 HISTORY
41
42ERR_load_error_strings(), SSL_load_error_strings() and
43ERR_free_strings() are available in all versions of SSLeay and
44OpenSSL.
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
5ERR_load_strings, ERR_PACK, ERR_get_next_error_library - load
6arbitrary 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
20ERR_load_strings() registers error strings for library number B<lib>.
21
22B<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
30The error code is generated from the library number and a function and
31reason code: B<error> = ERR_PACK(B<lib>, B<func>, B<reason>).
32ERR_PACK() is a macro.
33
34The last entry in the array is {0,0}.
35
36ERR_get_next_error_library() can be used to assign library numbers
37to user libraries at runtime.
38
39=head1 RETURN VALUE
40
41ERR_load_strings() returns no value. ERR_PACK() return the error code.
42ERR_get_next_error_library() returns a new library number.
43
44=head1 SEE ALSO
45
46L<err(3)|err(3)>, L<ERR_load_strings(3)|ERR_load_strings(3)>
47
48=head1 HISTORY
49
50ERR_load_error_strings() and ERR_PACK() are available in all versions
51of SSLeay and OpenSSL. ERR_get_next_error_library() was added in
52SSLeay 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
5ERR_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
16ERR_print_errors() is a convenience function that prints the error
17strings for all errors that OpenSSL has recorded to B<bp>, thus
18emptying the error queue.
19
20ERR_print_errors_fp() is the same, except that the output goes to a
21B<FILE>.
22
23
24The 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
28I<error code> is an 8 digit hexadecimal number. I<library name>,
29I<function name> and I<reason string> are ASCII text, as is I<optional
30text message> if one was set for the respective error code.
31
32If there is no text string registered for the given error code,
33the error string will contain the numeric code.
34
35=head1 RETURN VALUES
36
37ERR_print_errors() and ERR_print_errors_fp() return no values.
38
39=head1 SEE ALSO
40
41L<err(3)|err(3)>, L<ERR_error_string(3)|ERR_error_string(3)>,
42L<ERR_get_error(3)|ERR_get_error(3)>,
43L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)>,
44L<SSL_load_error_strings(3)|SSL_load_error_strings(3)>
45
46=head1 HISTORY
47
48ERR_print_errors() and ERR_print_errors_fp()
49are 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
5ERR_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
18ERR_put_error() adds an error code to the thread's error queue. It
19signals that the error of reason code B<reason> occurred in function
20B<func> of library B<lib>, in line number B<line> of B<file>.
21This function is usually called by a macro.
22
23ERR_add_error_data() associates the concatenation of its B<num> string
24arguments with the error code added last.
25
26L<ERR_load_strings(3)|ERR_load_strings(3)> can be used to register
27error strings so that the application can a generate human-readable
28error messages for the error code.
29
30=head1 RETURN VALUES
31
32ERR_put_error() and ERR_add_error_data() return
33no values.
34
35=head1 SEE ALSO
36
37L<err(3)|err(3)>, L<ERR_load_strings(3)|ERR_load_strings(3)>
38
39=head1 HISTORY
40
41ERR_put_error() is available in all versions of SSLeay and OpenSSL.
42ERR_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
5ERR_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
15ERR_remove_state() frees the error queue associated with thread B<pid>.
16If B<pid> == 0, the current thread will have its error queue removed.
17
18Since error queue data structures are allocated automatically for new
19threads, they must be freed when threads are terminated in oder to
20avoid memory leaks.
21
22=head1 RETURN VALUE
23
24ERR_remove_state() returns no value.
25
26=head1 SEE ALSO
27
28L<err(3)|err(3)>
29
30=head1 HISTORY
31
32ERR_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
5EVP_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
46The EVP digest routines are a high level interface to message digests.
47
48EVP_DigestInit() initialises a digest context B<ctx> to use a digest
49B<type>: this will typically be supplied by a function such as
50EVP_sha1().
51
52EVP_DigestUpdate() hashes B<cnt> bytes of data at B<d> into the
53digest context B<ctx>. This funtion can be called several times on the
54same B<ctx> to hash additional data.
55
56EVP_DigestFinal() retrieves the digest value from B<ctx> and places
57it in B<md>. If the B<s> parameter is not NULL then the number of
58bytes of data written (i.e. the length of the digest) will be written
59to the integer at B<s>, at most B<EVP_MAX_MD_SIZE> bytes will be written.
60After calling EVP_DigestFinal() no additional calls to EVP_DigestUpdate()
61can be made, but EVP_DigestInit() can be called to initialiase a new
62digest operation.
63
64EVP_MD_CTX_copy() can be used to copy the message digest state from
65B<in> to B<out>. This is useful if large amounts of data are to be
66hashed which only differ in the last few bytes.
67
68EVP_MD_size() and EVP_MD_CTX_size() return the size of the message digest
69when passed an B<EVP_MD> or an B<EVP_MD_CTX> structure, i.e. the size of the
70hash.
71
72EVP_MD_block_size() and EVP_MD_CTX_block_size() return the block size of the
73message digest when passed an B<EVP_MD> or an B<EVP_MD_CTX> structure.
74
75EVP_MD_type() and EVP_MD_CTX_type() return the NID of the OBJECT IDENTIFIER
76representing the given message digest when passed an B<EVP_MD> structure.
77For example EVP_MD_type(EVP_sha1()) returns B<NID_sha1>. This function is
78normally used when setting ASN1 OIDs.
79
80EVP_MD_CTX_md() returns the B<EVP_MD> structure corresponding to the passed
81B<EVP_MD_CTX>.
82
83EVP_MD_pkey_type() returns the NID of the public key signing algorithm associated
84with this digest. For example EVP_sha1() is associated with RSA so this will
85return B<NID_sha1WithRSAEncryption>. This "link" between digests and signature
86algorithms may not be retained in future versions of OpenSSL.
87
88EVP_md2(), EVP_md5(), EVP_sha(), EVP_sha1(), EVP_mdc2() and EVP_ripemd160()
89return B<EVP_MD> structures for the MD2, MD5, SHA, SHA1, MDC2 and RIPEMD160 digest
90algorithms respectively. The associated signature algorithm is RSA in each case.
91
92EVP_dss() and EVP_dss1() return B<EVP_MD> structures for SHA and SHA1 digest
93algorithms but using DSS (DSA) for the signature algorithm.
94
95EVP_md_null() is a "null" message digest that does nothing: i.e. the hash it
96returns is of zero length.
97
98EVP_get_digestbyname(), EVP_get_digestbynid() and EVP_get_digestbyobj()
99return an B<EVP_MD> structure when passed a digest name, a digest NID or
100an ASN1_OBJECT structure respectively. The digest table must be initialised
101using, for example, OpenSSL_add_all_digests() for these functions to work.
102
103=head1 RETURN VALUES
104
105EVP_DigestInit(), EVP_DigestUpdate() and EVP_DigestFinal() do not return values.
106
107EVP_MD_CTX_copy() returns 1 if successful or 0 for failure.
108
109EVP_MD_type(), EVP_MD_pkey_type() and EVP_MD_type() return the NID of the
110corresponding OBJECT IDENTIFIER or NID_undef if none exists.
111
112EVP_MD_size(), EVP_MD_block_size(), EVP_MD_CTX_size(e), EVP_MD_size(),
113EVP_MD_CTX_block_size() and EVP_MD_block_size() return the digest or block
114size in bytes.
115
116EVP_md_null(), EVP_md2(), EVP_md5(), EVP_sha(), EVP_sha1(), EVP_dss(),
117EVP_dss1(), EVP_mdc2() and EVP_ripemd160() return pointers to the
118corresponding EVP_MD structures.
119
120EVP_get_digestbyname(), EVP_get_digestbynid() and EVP_get_digestbyobj()
121return either an B<EVP_MD> structure or NULL if an error occurs.
122
123=head1 NOTES
124
125The B<EVP> interface to message digests should almost always be used in
126preference to the low level interfaces. This is because the code then becomes
127transparent to the digest used and much more flexible.
128
129SHA1 is the digest of choice for new applications. The other digest algorithms
130are still in common use.
131
132=head1 EXAMPLE
133
134This example digests the data "Test Message\n" and "Hello World\n", using the
135digest 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
175Several of the functions do not return values: maybe they should. Although the
176internal digest operations will never fail some future hardware based operations
177might.
178
179The link between digests and signing algorithms results in a situation where
180EVP_sha1() must be used with RSA and EVP_dss1() must be used with DSS
181even though they are identical digests.
182
183The size of an B<EVP_MD_CTX> structure is determined at compile time: this results
184in code that must be recompiled if the size of B<EVP_MD_CTX> increases.
185
186=head1 SEE ALSO
187
188L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>,
189L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>,
190L<sha(3)|sha(3)>, L<digest(1)|digest(1)>
191
192=head1 HISTORY
193
194EVP_DigestInit(), EVP_DigestUpdate() and EVP_DigestFinal() are
195available 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
5EVP_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
56The EVP cipher routines are a high level interface to certain
57symmetric ciphers.
58
59EVP_EncryptInit() initialises a cipher context B<ctx> for encryption
60with cipher B<type>. B<type> is normally supplied by a function such
61as EVP_des_cbc() . B<key> is the symmetric key to use and B<iv> is the
62IV to use (if necessary), the actual number of bytes used for the
63key and IV depends on the cipher. It is possible to set all parameters
64to NULL except B<type> in an initial call and supply the remaining
65parameters in subsequent calls. This is normally done when the
66EVP_CIPHER_asn1_to_param() function is called to set the cipher
67parameters from an ASN1 AlgorithmIdentifier and the key from a
68different source.
69
70EVP_EncryptUpdate() encrypts B<inl> bytes from the buffer B<in> and
71writes the encrypted version to B<out>. This function can be called
72multiple times to encrypt successive blocks of data. The amount
73of data written depends on the block alignment of the encrypted data:
74as a result the amount of data written may be anything from zero bytes
75to (inl + cipher_block_size - 1) so B<outl> should contain sufficient
76room. The actual number of bytes written is placed in B<outl>.
77
78EVP_EncryptFinal() encrypts the "final" data, that is any data that
79remains in a partial block. It uses L<standard block padding|/NOTES> (aka PKCS
80padding). The encrypted final data is written to B<out> which should
81have sufficient space for one cipher block. The number of bytes written
82is placed in B<outl>. After this function is called the encryption operation
83is finished and no further calls to EVP_EncryptUpdate() should be made.
84
85EVP_DecryptInit(), EVP_DecryptUpdate() and EVP_DecryptFinal() are the
86corresponding decryption operations. EVP_DecryptFinal() will return an
87error code if the final block is not correctly formatted. The parameters
88and restrictions are identical to the encryption operations except that
89the decrypted data buffer B<out> passed to EVP_DecryptUpdate() should
90have sufficient room for (B<inl> + cipher_block_size) bytes unless the
91cipher block size is 1 in which case B<inl> bytes is sufficient.
92
93EVP_CipherInit(), EVP_CipherUpdate() and EVP_CipherFinal() are functions
94that can be used for decryption or encryption. The operation performed
95depends on the value of the B<enc> parameter. It should be set to 1 for
96encryption and 0 for decryption.
97
98EVP_CIPHER_CTX_cleanup() clears all information from a cipher context.
99It should be called after all operations using a cipher are complete
100so sensitive information does not remain in memory.
101
102EVP_get_cipherbyname(), EVP_get_cipherbynid() and EVP_get_cipherbyobj()
103return an EVP_CIPHER structure when passed a cipher name, a NID or an
104ASN1_OBJECT structure.
105
106EVP_CIPHER_nid() and EVP_CIPHER_CTX_nid() return the NID of a cipher when
107passed an B<EVP_CIPHER> or B<EVP_CIPHER_CTX> structure. The actual NID
108value is an internal value which may not have a corresponding OBJECT
109IDENTIFIER.
110
111EVP_CIPHER_key_length() and EVP_CIPHER_CTX_key_length() return the key
112length of a cipher when passed an B<EVP_CIPHER> or B<EVP_CIPHER_CTX>
113structure. The constant B<EVP_MAX_KEY_LENGTH> is the maximum key length
114for all ciphers.
115
116EVP_CIPHER_iv_length() and EVP_CIPHER_CTX_iv_length() return the IV
117length of a cipher when passed an B<EVP_CIPHER> or B<EVP_CIPHER_CTX>.
118It will return zero if the cipher does not use an IV. The constant
119B<EVP_MAX_IV_LENGTH> is the maximum IV length for all ciphers.
120
121EVP_CIPHER_block_size() and EVP_CIPHER_CTX_block_size() return the block
122size of a cipher when passed an B<EVP_CIPHER> or B<EVP_CIPHER_CTX>
123structure. The constant B<EVP_MAX_IV_LENGTH> is also the maximum block
124length for all ciphers.
125
126EVP_CIPHER_type() and EVP_CIPHER_CTX_type() return the type of the passed
127cipher or context. This "type" is the actual NID of the cipher OBJECT
128IDENTIFIER as such it ignores the cipher parameters and 40 bit RC2 and
129128 bit RC2 have the same NID. If the cipher does not have an object
130identifier or does not have ASN1 support this function will return
131B<NID_undef>.
132
133EVP_CIPHER_CTX_cipher() returns the B<EVP_CIPHER> structure when passed
134an B<EVP_CIPHER_CTX> structure.
135
136EVP_CIPHER_param_to_asn1() sets the AlgorithmIdentifier "parameter" based
137on the passed cipher. This will typically include any parameters and an
138IV. The cipher IV (if any) must be set when this call is made. This call
139should be made before the cipher is actually "used" (before any
140EVP_EncryptUpdate(), EVP_DecryptUpdate() calls for example). This function
141may fail if the cipher does not have any ASN1 support.
142
143EVP_CIPHER_asn1_to_param() sets the cipher parameters based on an ASN1
144AlgorithmIdentifier "parameter". The precise effect depends on the cipher
145In the case of RC2, for example, it will set the IV and effective key length.
146This function should be called after the base cipher type is set but before
147the key is set. For example EVP_CipherInit() will be called with the IV and
148key set to NULL, EVP_CIPHER_asn1_to_param() will be called and finally
149EVP_CipherInit() again with all parameters except the key set to NULL. It is
150possible for this function to fail if the cipher does not have any ASN1 support
151or the parameters cannot be set (for example the RC2 effective key length
152does not have an B<EVP_CIPHER> structure).
153
154=head1 RETURN VALUES
155
156EVP_EncryptInit(), EVP_EncryptUpdate() and EVP_EncryptFinal() do not return
157values.
158
159EVP_DecryptInit() and EVP_DecryptUpdate() do not return values.
160EVP_DecryptFinal() returns 0 if the decrypt failed or 1 for success.
161
162EVP_CipherInit() and EVP_CipherUpdate() do not return values.
163EVP_CipherFinal() returns 1 for a decryption failure or 1 for success, if
164the operation is encryption then it always returns 1.
165
166EVP_CIPHER_CTX_cleanup() does not return a value.
167
168EVP_get_cipherbyname(), EVP_get_cipherbynid() and EVP_get_cipherbyobj()
169return an B<EVP_CIPHER> structure or NULL on error.
170
171EVP_CIPHER_nid() and EVP_CIPHER_CTX_nid() return a NID.
172
173EVP_CIPHER_block_size() and EVP_CIPHER_CTX_block_size() return the block
174size.
175
176EVP_CIPHER_key_length() and EVP_CIPHER_CTX_key_length() return the key
177length.
178
179EVP_CIPHER_iv_length() and EVP_CIPHER_CTX_iv_length() return the IV
180length or zero if the cipher does not use an IV.
181
182EVP_CIPHER_type() and EVP_CIPHER_CTX_type() return the NID of the cipher's
183OBJECT IDENTIFIER or NID_undef if it has no defined OBJECT IDENTIFIER.
184
185EVP_CIPHER_CTX_cipher() returns an B<EVP_CIPHER> structure.
186
187EVP_CIPHER_param_to_asn1() and EVP_CIPHER_asn1_to_param() return 1 for
188success or zero for failure.
189
190=head1 NOTES
191
192Where possible the B<EVP> interface to symmetric ciphers should be used in
193preference to the low level interfaces. This is because the code then becomes
194transparent to the cipher used and much more flexible.
195
196PKCS padding works by adding B<n> padding bytes of value B<n> to make the total
197length of the encrypted data a multiple of the block size. Padding is always
198added so if the data is already a multiple of the block size B<n> will equal
199the block size. For example if the block size is 8 and 11 bytes are to be
200encrypted then 5 padding bytes of value 5 will be added.
201
202When decrypting the final block is checked to see if it has the correct form.
203
204Although the decryption operation can produce an error, it is not a strong
205test that the input data or key is correct. A random block has better than
2061 in 256 chance of being of the correct format and problems with the
207input data earlier on will not produce a final decrypt error.
208
209=head1 BUGS
210
211The current B<EVP> cipher interface is not as flexible as it should be. Only
212certain "spot" encryption algorithms can be used for ciphers which have various
213parameters associated with them (RC2, RC5 for example) this is inadequate.
214
215Several of the functions do not return error codes because the software versions
216can never fail. This is not true of hardware versions.
217
218=head1 SEE ALSO
219
220L<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
5OPENSSL_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
17OPENSSL_VERSION_NUMBER is a numeric release version identifier:
18
19 MMNNFFRBB major minor fix final beta/patch
20
21for example
22
23 0x000904100 == 0.9.4 release
24 0x000905000 == 0.9.5 dev
25
26Versions prior to 0.9.3 have identifiers E<lt> 0x0930.
27For backward compatibility, SSLEAY_VERSION_NUMBER is also defined.
28
29SSLeay() returns this number. The return value can be compared to the
30macro to make sure that the correct version of the library has been
31loaded, especially when using DLLs on Windows systems.
32
33=head1 RETURN VALUE
34
35The version number.
36
37=head1 SEE ALSO
38
39L<crypto(3)|crypto(3)>
40
41=head1 HISTORY
42
43SSLeay() and SSLEAY_VERSION_NUMBER are available in all versions of SSLeay and OpenSSL.
44OPENSSL_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
5OpenSSL_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
19OpenSSL keeps an internal table of digest algorithms and ciphers. It uses
20this table to lookup ciphers via functions such as EVP_get_cipher_byname().
21
22OpenSSL_add_all_digests() adds all digest algorithms to the table.
23
24OpenSSL_add_all_algorithms() adds all algorithms to the table (digests and
25ciphers).
26
27OpenSSL_add_all_ciphers() adds all encryption algorithms to the table including
28password based encryption algorithms.
29
30EVP_cleanup() removes all ciphers and digests from the table.
31
32=head1 RETURN VALUES
33
34None of the functions return a value.
35
36=head1 NOTES
37
38A typical application will will call OpenSSL_add_all_algorithms() initially and
39EVP_cleanup() before exiting.
40
41An application does not need to add algorithms to use them explicitly, for example
42by EVP_sha1(). It just needs to add them if it (or any of the functions it calls)
43needs to lookup algorithms.
44
45The cipher and digest lookup functions are used in many parts of the library. If
46the table is not initialised several functions will misbehave and complain they
47cannot find algorithms. This includes the PEM, PKCS#12, SSL and S/MIME libraries.
48This is a common query in the OpenSSL mailing lists.
49
50Calling OpenSSL_add_all_algorithms() links in all algorithms: as a result a
51statically linked executable can be quite large. If this is important it is possible
52to just add the required ciphers and digests.
53
54=head1 BUGS
55
56Although the functions do not return error codes it is possible for them to fail.
57This will only happen as a result of a memory allocation failure so this is not
58too much of a problem in practice.
59
60=head1 SEE ALSO
61
62L<evp(3)|evp(3)>, L<EVP_DigestInit(3)|EVP_DigestInit(3)>,
63L<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
5RAND_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
21RAND_add() mixes the B<num> bytes at B<buf> into the PRNG state. Thus,
22if the data at B<buf> are unpredictable to an adversary, this
23increases the uncertainty about the state and makes the PRNG output
24less predictable. Suitable input comes from user interaction (random
25key presses, mouse movements) and certain hardware events. The
26B<entropy> argument is (the lower bound of) an estimate of how much
27randomness is contained in B<buf>, measured in bytes. Details about
28sources of randomness and how to estimate their entropy can be found
29in the literature, e.g. RFC 1750.
30
31RAND_add() may be called with sensitive data such as user entered
32passwords. The seed values cannot be recovered from the PRNG output.
33
34OpenSSL makes sure that the PRNG state is unique for each thread. On
35systems that provide C</dev/urandom>, the randomness device is used
36to seed the PRNG transparently. However, on all other systems, the
37application is responsible for seeding the PRNG by calling RAND_add(),
38L<RAND_egd(3)|RAND_egd(3)>
39or L<RAND_load_file(3)|RAND_load_file(3)>.
40
41RAND_seed() is equivalent to RAND_add() when B<num == entropy>.
42
43The RAND_screen() function is available for the convenience of Windows
44programmers. It adds the current contents of the screen to the PRNG.
45For applications that can catch Windows events, seeding the PRNG with
46the parameters of B<WM_MOUSEMOVE> events is a significantly better
47source of randomness. It should be noted that both methods cannot be
48used on servers that run without user interaction.
49
50=head1 RETURN VALUES
51
52RAND_status() returns 1 if the PRNG has been seeded with enough data,
530 otherwise.
54
55The other functions do not return values.
56
57=head1 SEE ALSO
58
59L<rand(3)|rand(3)>, L<RAND_egd(3)|RAND_egd(3)>,
60L<RAND_load_file(3)|RAND_load_file(3)>, L<RAND_cleanup(3)|RAND_cleanup(3)>
61
62=head1 HISTORY
63
64RAND_seed() and RAND_screen() are available in all versions of SSLeay
65and OpenSSL. RAND_add() and RAND_status() have been added in OpenSSL
660.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
5RAND_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
17RAND_bytes() puts B<num> cryptographically strong pseudo-random bytes
18into B<buf>. An error occurs if the PRNG has not been seeded with
19enough randomness to ensure an unpredictable byte sequence.
20
21RAND_pseudo_bytes() puts B<num> pseudo-random bytes into B<buf>.
22Pseudo-random byte sequences generated by RAND_pseudo_bytes() will be
23unique if they are of sufficient length, but are not necessarily
24unpredictable. They can be used for non-cryptographic purposes and for
25certain purposes in cryptographic protocols, but usually not for key
26generation etc.
27
28=head1 RETURN VALUES
29
30RAND_bytes() returns 1 on success, 0 otherwise. The error code can be
31obtained by L<ERR_get_error(3)|ERR_get_error(3)>. RAND_pseudo_bytes() returns 1 if the
32bytes generated are cryptographically strong, 0 otherwise. Both
33functions return -1 if they are not supported by the current RAND
34method.
35
36=head1 SEE ALSO
37
38L<rand(3)|rand(3)>, L<err(3)|err(3)>, L<RAND_add(3)|RAND_add(3)>
39
40=head1 HISTORY
41
42RAND_bytes() is available in all versions of SSLeay and OpenSSL. It
43has a return value since OpenSSL 0.9.5. RAND_pseudo_bytes() was added
44in 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
5RAND_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
15RAND_cleanup() erases the memory used by the PRNG.
16
17=head1 RETURN VALUE
18
19RAND_cleanup() returns no value.
20
21=head1 SEE ALSO
22
23L<rand(3)|rand(3)>
24
25=head1 HISTORY
26
27RAND_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
5RAND_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
15RAND_egd() queries the entropy gathering daemon EGD on socket B<path>.
16
17EGD is available from http://www.lothar.com/tech/crypto/ (C<perl
18Makefile.PL; make; make install> to install). It is run as B<egd>
19I<path>, where I<path> is an absolute path designating a socket. When
20RAND_egd() is called with that path as an argument, it tries to read
21random bytes that EGD has collected. The read is performed in
22non-blocking mode.
23
24=head1 RETURN VALUE
25
26RAND_egd() returns the number of bytes read from the daemon on
27success, and -1 if the connection failed or the daemon did not return
28enough data to fully seed the PRNG.
29
30=head1 SEE ALSO
31
32L<rand(3)|rand(3)>, L<RAND_add(3)|RAND_add(3)>, L<RAND_cleanup(3)|RAND_cleanup(3)>
33
34=head1 HISTORY
35
36RAND_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
5RAND_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
19RAND_file_name() generates a default path for the random seed
20file. B<buf> points to a buffer of size B<num> in which to store the
21filename. The seed file is $RANDFILE if that environment variable is
22set, $HOME/.rnd otherwise. If $HOME is not set either, or B<num> is
23too small for the path name, an error occurs.
24
25RAND_load_file() reads a number of bytes from file B<filename> and
26adds them to the PRNG. If B<max_bytes> is non-negative,
27up to to B<max_bytes> are read; starting with OpenSSL 0.9.5,
28if B<max_bytes> is -1, the complete file is read.
29
30RAND_write_file() writes a number of random bytes (currently 1024) to
31file B<filename> which can be used to initialize the PRNG by calling
32RAND_load_file() in a later session.
33
34=head1 RETURN VALUES
35
36RAND_load_file() returns the number of bytes read.
37
38RAND_write_file() returns the number of bytes written, and -1 if the
39bytes written were generated without appropriate seed.
40
41RAND_file_name() returns a pointer to B<buf> on success, and NULL on
42error.
43
44=head1 SEE ALSO
45
46L<rand(3)|rand(3)>, L<RAND_add(3)|RAND_add(3)>, L<RAND_cleanup(3)|RAND_cleanup(3)>
47
48=head1 HISTORY
49
50RAND_load_file(), RAND_write_file() and RAND_file_name() are available in
51all 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
5RAND_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
19A B<RAND_METHOD> specifies the functions that OpenSSL uses for random
20number generation. By modifying the method, alternative
21implementations such as hardware RNGs may be used. Initially, the
22default is to use the OpenSSL internal implementation. RAND_SSLeay()
23returns a pointer to that method.
24
25RAND_set_rand_method() sets the RAND method to B<meth>.
26RAND_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
39The components point to the implementation of RAND_seed(),
40RAND_bytes(), RAND_cleanup(), RAND_add() and RAND_pseudo_rand().
41Each component may be NULL if the function is not implemented.
42
43=head1 RETURN VALUES
44
45RAND_set_rand_method() returns no value. RAND_get_rand_method() and
46RAND_SSLeay() return pointers to the respective methods.
47
48=head1 SEE ALSO
49
50L<rand(3)|rand(3)>
51
52=head1 HISTORY
53
54RAND_set_rand_method(), RAND_get_rand_method() and RAND_SSLeay() are
55available 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
5RSA_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
17RSA is vulnerable to timing attacks. In a setup where attackers can
18measure the time of RSA decryption or signature operations, blinding
19must be used to protect the RSA operation from that attack.
20
21RSA_blinding_on() turns blinding on for key B<rsa> and generates a
22random blinding factor. B<ctx> is B<NULL> or a pre-allocated and
23initialized B<BN_CTX>. The random number generator must be seeded
24prior to calling RSA_blinding_on().
25
26RSA_blinding_off() turns blinding off and frees the memory used for
27the blinding factor.
28
29=head1 RETURN VALUES
30
31RSA_blinding_on() returns 1 on success, and 0 if an error occurred.
32
33RSA_blinding_off() returns no value.
34
35=head1 SEE ALSO
36
37L<rsa(3)|rsa(3)>, L<rand(3)|rand(3)>
38
39=head1 HISTORY
40
41RSA_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
5RSA_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
15This function validates RSA keys. It checks that B<p> and B<q> are
16in fact prime, and that B<n = p*q>.
17
18It also checks that B<d*e = 1 mod (p-1*q-1)>,
19and that B<dmp1>, B<dmq1> and B<iqmp> are set correctly or are B<NULL>.
20
21The key's public components may not be B<NULL>.
22
23=head1 RETURN VALUE
24
25RSA_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
28If the key is invalid or an error occurred, the reason code can be
29obtained using L<ERR_get_error(3)|ERR_get_error(3)>.
30
31=head1 SEE ALSO
32
33L<rsa(3)|rsa(3)>, L<err(3)|err(3)>
34
35=head1 HISTORY
36
37RSA_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
5RSA_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
16RSA_generate_key() generates a key pair and returns it in a newly
17allocated B<RSA> structure. The pseudo-random number generator must
18be seeded prior to calling RSA_generate_key().
19
20The modulus size will be B<num> bits, and the public exponent will be
21B<e>. Key sizes with B<num> E<lt> 1024 should be considered insecure.
22The exponent is an odd number, typically 3 or 65535.
23
24A callback function may be used to provide feedback about the
25progress of the key generation. If B<callback> is not B<NULL>, it
26will be called as follows:
27
28=over 4
29
30=item *
31
32While a random prime number is generated, it is called as
33described in L<BN_generate_prime(3)|BN_generate_prime(3)>.
34
35=item *
36
37When the n-th randomly generated prime is rejected as not
38suitable for the key, B<callback(2, n, cb_arg)> is called.
39
40=item *
41
42When a random p has been found with p-1 relatively prime to B<e>,
43it is called as B<callback(3, 0, cb_arg)>.
44
45=back
46
47The process is then repeated for prime q with B<callback(3, 1, cb_arg)>.
48
49=head1 RETURN VALUE
50
51If key generation fails, RSA_generate_key() returns B<NULL>; the
52error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
53
54=head1 BUGS
55
56B<callback(2, x, cb_arg)> is used with two different meanings.
57
58RSA_generate_key() goes into an infinite loop for illegal input values.
59
60=head1 SEE ALSO
61
62L<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
66The 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
5RSA_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
31Several OpenSSL structures can have application specific data attached to them.
32This has several potential uses, it can be used to cache data associated with
33a structure (for example the hash of some part of the structure) or some
34additional data (for example a handle to the data in an external library).
35
36Since the application data can be anything at all it is passed and retrieved
37as a B<void *> type.
38
39The B<RSA_get_ex_new_index()> function is initially called to "register" some
40new application specific data. It takes three optional function pointers which
41are called when the parent structure (in this case an RSA structure) is
42initially created, when it is copied and when it is freed up. If any or all of
43these function pointer arguments are not used they should be set to NULL. The
44precise manner in which these function pointers are called is described in more
45detail below. B<RSA_get_ex_new_index()> also takes additional long and pointer
46parameters which will be passed to the supplied functions but which otherwise
47have 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
49the remaining functions. Each successful call to B<RSA_get_ex_new_index()>
50will return an index greater than any previously returned, this is important
51because the optional functions are called in order of increasing index value.
52
53B<RSA_set_ex_data()> is used to set application specific data, the data is
54supplied in the B<arg> parameter and its precise meaning is up to the
55application.
56
57B<RSA_get_ex_data()> is used to retrieve application specific data. The data
58is returned to the application, this will be the same value as supplied to
59a previous B<RSA_set_ex_data()> call.
60
61B<new_func()> is called when a structure is initially allocated (for example
62with B<RSA_new()>. The parent structure members will not have any meaningful
63values at this point. This function will typically be used to allocate any
64application specific structure.
65
66B<free_func()> is called when a structure is being freed up. The dynamic parent
67structure members should not be accessed because they will be freed up when
68this function is called.
69
70B<new_func()> and B<free_func()> take the same parameters. B<parent> is a
71pointer 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
73B<CRYPTO_EX_DATA> structure from the parent RSA structure: the functions
74B<CRYPTO_get_ex_data()> and B<CRYPTO_set_ex_data()> can be called to manipulate
75it. The B<idx> parameter is the index: this will be the same value returned by
76B<RSA_get_ex_new_index()> when the functions were initially registered. Finally
77the B<argl> and B<argp> parameters are the values originally passed to the same
78corresponding parameters when B<RSA_get_ex_new_index()> was called.
79
80B<dup_func()> is called when a structure is being copied. Pointers to the
81destination and source B<CRYPTO_EX_DATA> structures are passed in the B<to> and
82B<from> parameters respectively. The B<from_d> parameter is passed a pointer to
83the source application data when the function is called, when the function returns
84the value is copied to the destination: the application can thus modify the data
85pointed to by B<from_d> and have different values in the source and destination.
86The B<idx>, B<argl> and B<argp> parameters are the same as those in B<new_func()>
87and B<free_func()>.
88
89=head1 RETURN VALUES
90
91B<RSA_get_ex_new_index()> returns a new index or -1 on failure (note 0 is a valid
92index value).
93
94B<RSA_set_ex_data()> returns 1 on success or 0 on failure.
95
96B<RSA_get_ex_data()> returns the application data or 0 on failure. 0 may also
97be valid application data but currently it can only fail if given an invalid B<idx>
98parameter.
99
100B<new_func()> and B<dup_func()> should return 0 for failure and 1 for success.
101
102On failure an error code can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>.
103
104=head1 BUGS
105
106B<dup_func()> is currently never called.
107
108The return value of B<new_func()> is ignored.
109
110The B<new_func()> function isn't very useful because no meaningful values are
111present in the parent RSA structure when it is called.
112
113=head1 SEE ALSO
114
115L<rsa(3)|rsa(3)>, L<CRYPTO_set_ex_data(3)|CRYPTO_set_ex_data(3)>
116
117=head1 HISTORY
118
119RSA_get_ex_new_index(), RSA_set_ex_data() and RSA_get_ex_data() are
120available 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
5RSA_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
17RSA_new() allocates and initializes an B<RSA> structure.
18
19RSA_free() frees the B<RSA> structure and its components. The key is
20erased before the memory is returned to the system.
21
22=head1 RETURN VALUES
23
24If the allocation fails, RSA_new() returns B<NULL> and sets an error
25code that can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. Otherwise it returns
26a pointer to the newly allocated structure.
27
28RSA_free() returns no value.
29
30=head1 SEE ALSO
31
32L<err(3)|err(3)>, L<rsa(3)|rsa(3)>, L<RSA_generate_key(3)|RSA_generate_key(3)>
33
34=head1 HISTORY
35
36RSA_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
5RSA_padding_add_PKCS1_type_1, RSA_padding_check_PKCS1_type_1,
6RSA_padding_add_PKCS1_type_2, RSA_padding_check_PKCS1_type_2,
7RSA_padding_add_PKCS1_OAEP, RSA_padding_check_PKCS1_OAEP,
8RSA_padding_add_SSLv23, RSA_padding_check_SSLv23,
9RSA_padding_add_none, RSA_padding_check_none - asymmetric encryption
10padding
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
48The RSA_padding_xxx_xxx() functions are called from the RSA encrypt,
49decrypt, sign and verify functions. Normally they should not be called
50from application programs.
51
52However, they can also be called directly to implement padding for other
53asymmetric ciphers. RSA_padding_add_PKCS1_OAEP() and
54RSA_padding_check_PKCS1_OAEP() may be used in an application combined
55with B<RSA_NO_PADDING> in order to implement OAEP with an encoding
56parameter.
57
58RSA_padding_add_xxx() encodes B<fl> bytes from B<f> so as to fit into
59B<tlen> bytes and stores the result at B<to>. An error occurs if B<fl>
60does not meet the size requirements of the encoding method.
61
62The following encoding methods are implemented:
63
64=over 4
65
66=item PKCS1_type_1
67
68PKCS #1 v2.0 EMSA-PKCS1-v1_5 (PKCS #1 v1.5 block type 1); used for signatures
69
70=item PKCS1_type_2
71
72PKCS #1 v2.0 EME-PKCS1-v1_5 (PKCS #1 v1.5 block type 2)
73
74=item PKCS1_OAEP
75
76PKCS #1 v2.0 EME-OAEP
77
78=item SSLv23
79
80PKCS #1 EME-PKCS1-v1_5 with SSL-specific modification
81
82=item none
83
84simply copy the data
85
86=back
87
88The random number generator must be seeded prior to calling
89RSA_padding_add_xxx().
90
91RSA_padding_check_xxx() verifies that the B<fl> bytes at B<f> contain
92a valid encoding for a B<rsa_len> byte RSA key in the respective
93encoding method and stores the recovered data of at most B<tlen> bytes
94(for B<RSA_NO_PADDING>: of size B<tlen>)
95at B<to>.
96
97For RSA_padding_xxx_OAEP(), B<p> points to the encoding parameter
98of length B<pl>. B<p> may be B<NULL> if B<pl> is 0.
99
100=head1 RETURN VALUES
101
102The RSA_padding_add_xxx() functions return 1 on success, 0 on error.
103The RSA_padding_check_xxx() functions return the length of the
104recovered data, -1 on error. Error codes can be obtained by calling
105L<ERR_get_error(3)|ERR_get_error(3)>.
106
107=head1 SEE ALSO
108
109L<RSA_public_encrypt(3)|RSA_public_encrypt(3)>,
110L<RSA_private_decrypt(3)|RSA_private_decrypt(3)>,
111L<RSA_sign(3)|RSA_sign(3)>, L<RSA_verify(3)|RSA_verify(3)>
112
113=head1 HISTORY
114
115RSA_padding_add_PKCS1_type_1(), RSA_padding_check_PKCS1_type_1(),
116RSA_padding_add_PKCS1_type_2(), RSA_padding_check_PKCS1_type_2(),
117RSA_padding_add_SSLv23(), RSA_padding_check_SSLv23(),
118RSA_padding_add_none() and RSA_padding_check_none() appeared in
119SSLeay 0.9.0.
120
121RSA_padding_add_PKCS1_OAEP() and RSA_padding_check_PKCS1_OAEP() were
122added 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
5RSA_print, RSA_print_fp, DHparams_print, DHparams_print_fp - print
6cryptographic 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
29A human-readable hexadecimal output of the components of the RSA
30key, DSA parameters or key or DH parameters is printed to B<bp> or B<fp>.
31
32The output lines are indented by B<offset> spaces.
33
34=head1 RETURN VALUES
35
36These functions return 1 on success, 0 on error.
37
38=head1 SEE ALSO
39
40L<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
44RSA_print(), RSA_print_fp(), DSA_print(), DSA_print_fp(), DH_print(),
45DH_print_fp() are available in all versions of SSLeay and OpenSSL.
46DSAparams_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
5RSA_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
19These functions handle RSA signatures at a low level.
20
21RSA_private_encrypt() signs the B<flen> bytes at B<from> (usually a
22message digest with an algorithm identifier) using the private key
23B<rsa> and stores the signature in B<to>. B<to> must point to
24B<RSA_size(rsa)> bytes of memory.
25
26B<padding> denotes one of the following modes:
27
28=over 4
29
30=item RSA_PKCS1_PADDING
31
32PKCS #1 v1.5 padding. This function does not handle the
33B<algorithmIdentifier> specified in PKCS #1. When generating or
34verifying PKCS #1 signatures, L<RSA_sign(3)|RSA_sign(3)> and L<RSA_verify(3)|RSA_verify(3)> should be
35used.
36
37=item RSA_NO_PADDING
38
39Raw RSA signature. This mode should I<only> be used to implement
40cryptographically sound padding modes in the application code.
41Signing user data directly with RSA is insecure.
42
43=back
44
45RSA_public_decrypt() recovers the message digest from the B<flen>
46bytes long signature at B<from> using the signer's public key
47B<rsa>. B<to> must point to a memory section large enough to hold the
48message digest (which is smaller than B<RSA_size(rsa) -
4911>). B<padding> is the padding mode that was used to sign the data.
50
51=head1 RETURN VALUES
52
53RSA_private_encrypt() returns the size of the signature (i.e.,
54RSA_size(rsa)). RSA_public_decrypt() returns the size of the
55recovered message digest.
56
57On error, -1 is returned; the error codes can be
58obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
59
60=head1 SEE ALSO
61
62L<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
66The B<padding> argument was added in SSLeay 0.8. RSA_NO_PADDING is
67available 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
5RSA_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
19RSA_public_encrypt() encrypts the B<flen> bytes at B<from> (usually a
20session key) using the public key B<rsa> and stores the ciphertext in
21B<to>. B<to> must point to RSA_size(B<rsa>) bytes of memory.
22
23B<padding> denotes one of the following modes:
24
25=over 4
26
27=item RSA_PKCS1_PADDING
28
29PKCS #1 v1.5 padding. This currently is the most widely used mode.
30
31=item RSA_PKCS1_OAEP_PADDING
32
33EME-OAEP as defined in PKCS #1 v2.0 with SHA-1, MGF1 and an empty
34encoding parameter. This mode is recommended for all new applications.
35
36=item RSA_SSLV23_PADDING
37
38PKCS #1 v1.5 padding with an SSL-specific modification that denotes
39that the server is SSL3 capable.
40
41=item RSA_NO_PADDING
42
43Raw RSA encryption. This mode should I<only> be used to implement
44cryptographically sound padding modes in the application code.
45Encrypting user data directly with RSA is insecure.
46
47=back
48
49B<flen> must be less than RSA_size(B<rsa>) - 11 for the PKCS #1 v1.5
50based padding modes, and less than RSA_size(B<rsa>) - 21 for
51RSA_PKCS1_OAEP_PADDING. The random number generator must be seeded
52prior to calling RSA_public_encrypt().
53
54RSA_private_decrypt() decrypts the B<flen> bytes at B<from> using the
55private key B<rsa> and stores the plaintext in B<to>. B<to> must point
56to a memory section large enough to hold the decrypted data (which is
57smaller than RSA_size(B<rsa>)). B<padding> is the padding mode that
58was used to encrypt the data.
59
60=head1 RETURN VALUES
61
62RSA_public_encrypt() returns the size of the encrypted data (i.e.,
63RSA_size(B<rsa>)). RSA_private_decrypt() returns the size of the
64recovered plaintext.
65
66On error, -1 is returned; the error codes can be
67obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
68
69=head1 CONFORMING TO
70
71SSL, PKCS #1 v2.0
72
73=head1 SEE ALSO
74
75L<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
79The L<RSA_PKCS1_RSAref(3)|RSA_PKCS1_RSAref(3)> method supports only the RSA_PKCS1_PADDING mode.
80
81=head1 HISTORY
82
83The B<padding> argument was added in SSLeay 0.8. RSA_NO_PADDING is
84available 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
5RSA_set_default_method, RSA_get_default_method, RSA_set_method,
6RSA_get_method, RSA_PKCS1_SSLeay, RSA_PKCS1_RSAref,
7RSA_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
33An B<RSA_METHOD> specifies the functions that OpenSSL uses for RSA
34operations. By modifying the method, alternative implementations
35such as hardware accelerators may be used.
36
37Initially, the default is to use the OpenSSL internal implementation,
38unless OpenSSL was configured with the C<rsaref> or C<-DRSA_NULL>
39options. RSA_PKCS1_SSLeay() returns a pointer to that method.
40
41RSA_PKCS1_RSAref() returns a pointer to a method that uses the RSAref
42library. This is the default method in the C<rsaref> configuration;
43the function is not available in other configurations.
44RSA_null_method() returns a pointer to a method that does not support
45the RSA transformation. It is the default if OpenSSL is compiled with
46C<-DRSA_NULL>. These methods may be useful in the USA because of a
47patent on the RSA cryptosystem.
48
49RSA_set_default_method() makes B<meth> the default method for all B<RSA>
50structures created later.
51
52RSA_get_default_method() returns a pointer to the current default
53method.
54
55RSA_set_method() selects B<meth> for all operations using the key
56B<rsa>.
57
58RSA_get_method() returns a pointer to the method currently selected
59for B<rsa>.
60
61RSA_flags() returns the B<flags> that are set for B<rsa>'s current method.
62
63RSA_new_method() allocates and initializes an B<RSA> structure so that
64B<method> will be used for the RSA operations. If B<method> is B<NULL>,
65the 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
129RSA_PKCS1_SSLeay(), RSA_PKCS1_RSAref(), RSA_PKCS1_null_method(),
130RSA_get_default_method() and RSA_get_method() return pointers to the
131respective B<RSA_METHOD>s.
132
133RSA_set_default_method() returns no value.
134
135RSA_set_method() returns a pointer to the B<RSA_METHOD> previously
136associated with B<rsa>.
137
138RSA_new_method() returns B<NULL> and sets an error code that can be
139obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation fails. Otherwise it
140returns a pointer to the newly allocated structure.
141
142=head1 SEE ALSO
143
144L<rsa(3)|rsa(3)>, L<RSA_new(3)|RSA_new(3)>
145
146=head1 HISTORY
147
148RSA_new_method() and RSA_set_default_method() appeared in SSLeay 0.8.
149RSA_get_default_method(), RSA_set_method() and RSA_get_method() as
150well as the rsa_sign and rsa_verify components of RSA_METHOD were
151added 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
5RSA_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
19RSA_sign() signs the message digest B<m> of size B<m_len> using the
20private key B<rsa> as specified in PKCS #1 v2.0. It stores the
21signature in B<sigret> and the signature size in B<siglen>. B<sigret>
22must point to RSA_size(B<rsa>) bytes of memory.
23
24B<type> denotes the message digest algorithm that was used to generate
25B<m>. It usually is one of B<NID_sha1>, B<NID_ripemd160> and B<NID_md5>;
26see L<objects(3)|objects(3)> for details. If B<type> is B<NID_md5_sha1>,
27an SSL signature (MD5 and SHA1 message digests with PKCS #1 padding
28and no algorithm identifier) is created.
29
30RSA_verify() verifies that the signature B<sigbuf> of size B<siglen>
31matches a given message digest B<m> of size B<m_len>. B<type> denotes
32the message digest algorithm that was used to generate the signature.
33B<rsa> is the signer's public key.
34
35=head1 RETURN VALUES
36
37RSA_sign() returns 1 on success, 0 otherwise. RSA_verify() returns 1
38on successful verification, 0 otherwise.
39
40The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
41
42=head1 BUGS
43
44Certain signatures with an improper algorithm identifier are accepted
45for compatibility with SSLeay 0.4.5 :-)
46
47=head1 CONFORMING TO
48
49SSL, PKCS #1 v2.0
50
51=head1 SEE ALSO
52
53L<err(3)|err(3)>, L<objects(3)|objects(3)>, L<rsa(3)|rsa(3)>,
54L<RSA_private_encrypt(3)|RSA_private_encrypt(3)>,
55L<RSA_public_decrypt(3)|RSA_public_decrypt(3)>
56
57=head1 HISTORY
58
59RSA_sign() and RSA_verify() are available in all versions of SSLeay
60and 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
5RSA_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
21RSA_sign_ASN1_OCTET_STRING() signs the octet string B<m> of size
22B<m_len> using the private key B<rsa> represented in DER using PKCS #1
23padding. It stores the signature in B<sigret> and the signature size
24in B<siglen>. B<sigret> must point to B<RSA_size(rsa)> bytes of
25memory.
26
27B<dummy> is ignored.
28
29The random number generator must be seeded prior to calling RSA_sign_ASN1_OCTET_STRING().
30
31RSA_verify_ASN1_OCTET_STRING() verifies that the signature B<sigbuf>
32of size B<siglen> is the DER representation of a given octet string
33B<m> of size B<m_len>. B<dummy> is ignored. B<rsa> is the signer's
34public key.
35
36=head1 RETURN VALUES
37
38RSA_sign_ASN1_OCTET_STRING() returns 1 on success, 0 otherwise.
39RSA_verify_ASN1_OCTET_STRING() returns 1 on successful verification, 0
40otherwise.
41
42The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
43
44=head1 BUGS
45
46These functions serve no recognizable purpose.
47
48=head1 SEE ALSO
49
50L<err(3)|err(3)>, L<objects(3)|objects(3)>, L<rand(3)|rand(3)>,
51L<rsa(3)|rsa(3)>, L<RSA_sign(3)|RSA_sign(3)>,
52L<RSA_verify(3)|RSA_verify(3)>
53
54=head1 HISTORY
55
56RSA_sign_ASN1_OCTET_STRING() and RSA_verify_ASN1_OCTET_STRING() were
57added 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
5RSA_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
15This function returns the RSA modulus size in bytes. It can be used to
16determine how much memory must be allocated for an RSA encrypted
17value.
18
19B<rsa-E<gt>n> must not be B<NULL>.
20
21=head1 RETURN VALUE
22
23The size in bytes.
24
25=head1 SEE ALSO
26
27L<rsa(3)|rsa(3)>
28
29=head1 HISTORY
30
31RSA_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
5blowfish, BF_set_key, BF_encrypt, BF_decrypt, BF_ecb_encrypt, BF_cbc_encrypt,
6BF_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
30This library implements the Blowfish cipher, which is invented and described
31by Counterpane (see http://www.counterpane.com/blowfish/ ).
32
33Blowfish is a block cipher that operates on 64 bit (8 byte) blocks of data.
34It uses a variable size key, but typically, 128 bit (16 byte) keys are
35a considered good for strong encryption. Blowfish can be used in the same
36modes as DES (see L<des_modes(7)|des_modes(7)>). Blowfish is currently one
37of the faster block ciphers. It is quite a bit faster than DES, and much
38faster than IDEA or RC2.
39
40Blowfish consists of a key setup phase and the actual encryption or decryption
41phase.
42
43BF_set_key() sets up the B<BF_KEY> B<key> using the B<len> bytes long key
44at B<data>.
45
46BF_encrypt() and BF_decrypt() are the lowest level functions for Blowfish
47encryption. They encrypt/decrypt the first 64 bits of the vector pointed by
48B<data>, using the key B<key>. These functions should not be used unless you
49implement 'modes' of Blowfish.
50
51BF_ecb_encrypt() is the basic Blowfish encryption and decryption function.
52It encrypts or decrypts the first 64 bits of B<in> using the key B<key>,
53putting the result in B<out>. B<enc> decides if encryption (B<BF_ENCRYPT>)
54or decryption (B<BF_DECRYPT>) shall be performed. The vector pointed at by
55B<in> and B<out> must be 64 bits in length, no less. If they are larger,
56everything after the first 64 bits is ignored.
57
58The mode functions BF_cbc_encrypt(), BF_cfb64_encrypt() and BF_ofb64_encrypt()
59all operate on variable length data. They all take an initialisation vector
60B<ivec> which must be initially filled with zeros, but then just need to be
61passed along into the next call of the same function for the same message.
62BF_cbc_encrypt() operates of data that is a multiple of 8 bytes long, while
63BF_cfb64_encrypt() and BF_ofb64_encrypt() are used to encrypt an variable
64number of bytes (the amount does not have to be an exact multiple of 8). The
65purpose of the latter two is to simulate stream ciphers, and therefore, they
66need the parameter B<num>, which is a pointer to an integer where the current
67offset in B<ivec> is stored between calls. This integer must be initialised
68to zero when B<ivec> is filled with zeros.
69
70BF_cbc_encrypt() is the Cipher Block Chaining function for Blowfish. It
71encrypts or decrypts the 64 bits chunks of B<in> using the key B<schedule>,
72putting the result in B<out>. B<enc> decides if encryption (BF_ENCRYPT) or
73decryption (BF_DECRYPT) shall be performed. B<ivec> must point at an 8 byte
74long initialisation vector, which must be initially filled with zeros.
75
76BF_cfb64_encrypt() is the CFB mode for Blowfish with 64 bit feedback.
77It encrypts or decrypts the bytes in B<in> using the key B<schedule>,
78putting the result in B<out>. B<enc> decides if encryption (B<BF_ENCRYPT>)
79or decryption (B<BF_DECRYPT>) shall be performed. B<ivec> must point at an
808 byte long initialisation vector, which must be initially filled with zeros.
81B<num> must point at an integer which must be initially zero.
82
83BF_ofb64_encrypt() is the OFB mode for Blowfish with 64 bit feedback.
84It uses the same parameters as BF_cfb64_encrypt(), which must be initialised
85the same way.
86
87=head1 RETURN VALUES
88
89None of the functions presented here return any value.
90
91=head1 NOTE
92
93Applications should use the higher level functions
94L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> etc. instead of calling the
95blowfish functions directly.
96
97=head1 SEE ALSO
98
99L<des_modes(7)|des_modes(7)>
100
101=head1 HISTORY
102
103The 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
5bn - 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
114This library performs arithmetic operations on integers of arbitrary
115size. It was written for use in public key cryptography, such as RSA
116and Diffie-Hellman.
117
118It uses dynamic memory allocation for storing its data structures.
119That means that there is no limit on the size of the numbers
120manipulated by these functions, but return values must always be
121checked in case a memory allocation error has occurred.
122
123The basic object in this library is a B<BIGNUM>. It is used to hold a
124single large integer. This type should be considered opaque and fields
125should not be modified or accessed directly.
126
127The creation of B<BIGNUM> objects is described in L<BN_new(3)|BN_new(3)>;
128L<BN_add(3)|BN_add(3)> describes most of the arithmetic operations.
129Comparison is described in L<BN_cmp(3)|BN_cmp(3)>; L<BN_zero(3)|BN_zero(3)>
130describes certain assignments, L<BN_rand(3)|BN_rand(3)> the generation of
131random numbers, L<BN_generate_prime(3)|BN_generate_prime(3)> deals with prime
132numbers and L<BN_set_bit(3)|BN_set_bit(3)> with bit operations. The conversion
133of B<BIGNUM>s to external formats is described in L<BN_bn2bin(3)|BN_bn2bin(3)>.
134
135=head1 SEE ALSO
136
137L<bn_internal(3)|bn_internal(3)>,
138L<dh(3)|dh(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>, L<rsa(3)|rsa(3)>,
139L<BN_new(3)|BN_new(3)>, L<BN_CTX_new(3)|BN_CTX_new(3)>,
140L<BN_copy(3)|BN_copy(3)>, L<BN_num_bytes(3)|BN_num_bytes(3)>,
141L<BN_add(3)|BN_add(3)>, L<BN_add_word(3)|BN_add_word(3)>,
142L<BN_cmp(3)|BN_cmp(3)>, L<BN_zero(3)|BN_zero(3)>, L<BN_rand(3)|BN_rand(3)>,
143L<BN_generate_prime(3)|BN_generate_prime(3)>, L<BN_set_bit(3)|BN_set_bit(3)>,
144L<BN_bn2bin(3)|BN_bn2bin(3)>, L<BN_mod_inverse(3)|BN_mod_inverse(3)>,
145L<BN_mod_mul_reciprocal(3)|BN_mod_mul_reciprocal(3)>,
146L<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
5bn_mul_words, bn_mul_add_words, bn_sqr_words, bn_div_words,
6bn_add_words, bn_sub_words, bn_mul_comba4, bn_mul_comba8,
7bn_sqr_comba4, bn_sqr_comba8, bn_cmp_words, bn_mul_normal,
8bn_mul_low_normal, bn_mul_recursive, bn_mul_part_recursive,
9bn_mul_low_recursive, bn_mul_high, bn_sqr_normal, bn_sqr_recursive,
10bn_expand, bn_wexpand, bn_expand2, bn_fix_top, bn_check_top,
11bn_print, bn_dump, bn_set_max, bn_set_high, bn_set_low - BIGNUM
12library 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
66This page documents the internal functions used by the OpenSSL
67B<BIGNUM> implementation. They are described here to facilitate
68debugging and extending the library. They are I<not> to be used by
69applications.
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
81The big number is stored in B<d>, a malloc()ed array of B<BN_ULONG>s,
82least significant first. A B<BN_ULONG> can be either 16, 32 or 64 bits
83in size (B<BITS2>), depending on the 'number of bits' specified in
84C<openssl/bn.h>.
85
86B<max> is the size of the B<d> array that has been allocated. B<top>
87is the 'last' entry being used, so for a value of 4, bn.d[0]=4 and
88bn.top=1. B<neg> is 1 if the number is negative. When a B<BIGNUM> is
89B<0>, the B<d> field can be B<NULL> and B<top> == B<0>.
90
91Various routines in this library require the use of temporary
92B<BIGNUM> variables during their execution. Since dynamic memory
93allocation to create B<BIGNUM>s is rather expensive when used in
94conjunction with repeated subroutine calls, the B<BN_CTX> structure is
95used. This structure contains B<BN_CTX_NUM> B<BIGNUM>s, see
96L<BN_CTX_start(3)|BN_CTX_start(3)>.
97
98=head2 Low-level arithmetic operations
99
100These functions are implemented in C and for several platforms in
101assembly language:
102
103bn_mul_words(B<rp>, B<ap>, B<num>, B<w>) operates on the B<num> word
104arrays B<rp> and B<ap>. It computes B<ap> * B<w>, places the result
105in B<rp>, and returns the high word (carry).
106
107bn_mul_add_words(B<rp>, B<ap>, B<num>, B<w>) operates on the B<num>
108word arrays B<rp> and B<ap>. It computes B<ap> * B<w> + B<rp>, places
109the result in B<rp>, and returns the high word (carry).
110
111bn_sqr_words(B<rp>, B<ap>, B<n>) operates on the B<num> word array
112B<ap> and the 2*B<num> word array B<ap>. It computes B<ap> * B<ap>
113word-wise, and places the low and high bytes of the result in B<rp>.
114
115bn_div_words(B<h>, B<l>, B<d>) divides the two word number (B<h>,B<l>)
116by B<d> and returns the result.
117
118bn_add_words(B<rp>, B<ap>, B<bp>, B<num>) operates on the B<num> word
119arrays B<ap>, B<bp> and B<rp>. It computes B<ap> + B<bp>, places the
120result in B<rp>, and returns the high word (carry).
121
122bn_sub_words(B<rp>, B<ap>, B<bp>, B<num>) operates on the B<num> word
123arrays B<ap>, B<bp> and B<rp>. It computes B<ap> - B<bp>, places the
124result in B<rp>, and returns the carry (1 if B<bp> E<gt> B<ap>, 0
125otherwise).
126
127bn_mul_comba4(B<r>, B<a>, B<b>) operates on the 4 word arrays B<a> and
128B<b> and the 8 word array B<r>. It computes B<a>*B<b> and places the
129result in B<r>.
130
131bn_mul_comba8(B<r>, B<a>, B<b>) operates on the 8 word arrays B<a> and
132B<b> and the 16 word array B<r>. It computes B<a>*B<b> and places the
133result in B<r>.
134
135bn_sqr_comba4(B<r>, B<a>, B<b>) operates on the 4 word arrays B<a> and
136B<b> and the 8 word array B<r>.
137
138bn_sqr_comba8(B<r>, B<a>, B<b>) operates on the 8 word arrays B<a> and
139B<b> and the 16 word array B<r>.
140
141The following functions are implemented in C:
142
143bn_cmp_words(B<a>, B<b>, B<n>) operates on the B<n> word arrays B<a>
144and B<b>. It returns 1, 0 and -1 if B<a> is greater than, equal and
145less than B<b>.
146
147bn_mul_normal(B<r>, B<a>, B<na>, B<b>, B<nb>) operates on the B<na>
148word array B<a>, the B<nb> word array B<b> and the B<na>+B<nb> word
149array B<r>. It computes B<a>*B<b> and places the result in B<r>.
150
151bn_mul_low_normal(B<r>, B<a>, B<b>, B<n>) operates on the B<n> word
152arrays B<r>, B<a> und B<b>. It computes the B<n> low words of
153B<a>*B<b> and places the result in B<r>.
154
155bn_mul_recursive(B<r>, B<a>, B<b>, B<n2>, B<t>) operates on the B<n2>
156word arrays B<a> and B<b> and the 2*B<n2> word arrays B<r> and B<t>.
157B<n2> must be a power of 2. It computes B<a>*B<b> and places the
158result in B<r>.
159
160bn_mul_part_recursive(B<r>, B<a>, B<b>, B<tn>, B<n>, B<tmp>) operates
161on the B<n>+B<tn> word arrays B<a> and B<b> and the 4*B<n> word arrays
162B<r> and B<tmp>.
163
164bn_mul_low_recursive(B<r>, B<a>, B<b>, B<n2>, B<tmp>) operates on the
165B<n2> word arrays B<r> and B<tmp> and the B<n2>/2 word arrays B<a>
166and B<b>.
167
168bn_mul_high(B<r>, B<a>, B<b>, B<l>, B<n2>, B<tmp>) operates on the
169B<n2> word arrays B<r>, B<a>, B<b> and B<l> (?) and the 3*B<n2> word
170array B<tmp>.
171
172BN_mul() calls bn_mul_normal(), or an optimized implementation if the
173factors have the same size: bn_mul_comba8() is used if they are 8
174words long, bn_mul_recursive() if they are larger than
175B<BN_MULL_SIZE_NORMAL> and the size is an exact multiple of the word
176size, and bn_mul_part_recursive() for others that are larger than
177B<BN_MULL_SIZE_NORMAL>.
178
179bn_sqr_normal(B<r>, B<a>, B<n>, B<tmp>) operates on the B<n> word array
180B<a> and the 2*B<n> word arrays B<tmp> and B<r>.
181
182The implementations use the following macros which, depending on the
183architecture, may use "long long" C operations or inline assembler.
184They are defined in C<bn_lcl.h>.
185
186mul(B<r>, B<a>, B<w>, B<c>) computes B<w>*B<a>+B<c> and places the
187low word of the result in B<r> and the high word in B<c>.
188
189mul_add(B<r>, B<a>, B<w>, B<c>) computes B<w>*B<a>+B<r>+B<c> and
190places the low word of the result in B<r> and the high word in B<c>.
191
192sqr(B<r0>, B<r1>, B<a>) computes B<a>*B<a> and places the low word
193of the result in B<r0> and the high word in B<r1>.
194
195=head2 Size changes
196
197bn_expand() ensures that B<b> has enough space for a B<bits> bit
198number. bn_wexpand() ensures that B<b> has enough space for an
199B<n> word number. If the number has to be expanded, both macros
200call bn_expand2(), which allocates a new B<d> array and copies the
201data. They return B<NULL> on error, B<b> otherwise.
202
203The bn_fix_top() macro reduces B<a-E<gt>top> to point to the most
204significant non-zero word when B<a> has shrunk.
205
206=head2 Debugging
207
208bn_check_top() verifies that C<((a)-E<gt>top E<gt>= 0 && (a)-E<gt>top
209E<lt>= (a)-E<gt>max)>. A violation will cause the program to abort.
210
211bn_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
214bn_set_max() makes B<a> a static number with a B<max> of its current size.
215This is used by bn_set_low() and bn_set_high() to make B<r> a read-only
216B<BIGNUM> that contains the B<n> low or high words of B<a>.
217
218If B<BN_DEBUG> is not defined, bn_check_top(), bn_print(), bn_dump()
219and bn_set_max() are defined as empty macros.
220
221=head1 SEE ALSO
222
223L<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
5BUF_MEM_new, BUF_MEM_free, BUF_MEM_grow, BUF_strdup - simple
6character 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
22The buffer library handles simple character arrays. Buffers are used for
23various purposes in the library, most notably memory BIOs.
24
25The 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
34B<length> is the current size of the buffer in bytes, B<max> is the amount of
35memory allocated to the buffer. There are three functions which handle these
36and one "miscellaneous" function.
37
38BUF_MEM_new() allocates a new buffer of zero size.
39
40BUF_MEM_free() frees up an already existing buffer. The data is zeroed
41before freeing up in case the buffer contains sensitive data.
42
43BUF_MEM_grow() changes the size of an already existing buffer to
44B<len>. Any data already in the buffer is preserved if it increases in
45size.
46
47BUF_strdup() copies a null terminated string into a block of allocated
48memory and returns a pointer to the allocated block.
49Unlike the standard C library strdup() this function uses Malloc() and so
50should be used in preference to the standard library strdup() because it can
51be used for memory leak checking or replacing the malloc() function.
52
53The memory allocated from BUF_strdup() should be freed up using the Free()
54function.
55
56=head1 RETURN VALUES
57
58BUF_MEM_new() returns the buffer or NULL on error.
59
60BUF_MEM_free() has no return value.
61
62BUF_MEM_grow() returns zero on error or the new size (i.e. B<len>).
63
64=head1 SEE ALSO
65
66L<bio(3)|bio(3)>
67
68=head1 HISTORY
69
70BUF_MEM_new(), BUF_MEM_free() and BUF_MEM_grow() are available in all
71versions 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
5crypto - OpenSSL cryptographic library
6
7=head1 SYNOPSIS
8
9=head1 DESCRIPTION
10
11The OpenSSL B<crypto> library implements a wide range of cryptographic
12algorithms used in various Internet standards. The services provided
13by this library are used by the OpenSSL implementations of SSL, TLS
14and S/MIME, and they have also been used to implement SSH, OpenPGP, and
15other cryptographic standards.
16
17=head1 OVERVIEW
18
19B<libcrypto> consists of a number of sub-libraries that implement the
20individual algorithms.
21
22The functionality includes symmetric encryption, public key
23cryptography and key agreement, certificate handling, cryptographic
24hash functions and a cryptographic pseudo-random number generator.
25
26=over 4
27
28=item SYMMETRIC CIPHERS
29
30L<blowfish(3)|blowfish(3)>, L<cast(3)|cast(3)>, L<des(3)|des(3)>,
31L<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
35L<dsa(3)|dsa(3)>, L<dh(3)|dh(3)>, L<rsa(3)|rsa(3)>
36
37=item CERTIFICATES
38
39L<x509(3)|x509(3)>, L<x509v3(3)|x509v3(3)>
40
41=item AUTHENTICATION CODES, HASH FUNCTIONS
42
43L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>,
44L<ripemd(3)|ripemd(3)>, L<sha(3)|sha(3)>
45
46=item AUXILIARY FUNCTIONS
47
48L<err(3)|err(3)>, L<threads(3)|threads(3)>, L<rand(3)|rand(3)>
49
50=item INPUT/OUTPUT, DATA ENCODING
51
52L<asn1(3)|asn1(3)>, L<bio(3)|bio(3)>, L<evp(3)|evp(3)>, L<pem(3)|pem(3)>,
53L<pkcs7(3)|pkcs7(3)>, L<pkcs12(3)|pkcs12(3)>
54
55=item INTERNAL FUNCTIONS
56
57L<bn(3)|bn(3)>, L<buffer(3)|buffer(3)>, L<lhash(3)|lhash(3)>,
58L<objects(3)|objects(3)>, L<stack(3)|stack(3)>,
59L<txt_db(3)|txt_db(3)>
60
61=back
62
63=head1 SEE ALSO
64
65L<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
5d2i_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
5d2i_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
5Modes of DES - the variants of DES and other crypto algorithms of OpenSSL
6
7=head1 DESCRIPTION
8
9Several crypto algorithms fo OpenSSL can be used in a number of modes. Those
10are used for using block ciphers in a way similar to stream ciphers, among
11other things.
12
13=head1 OVERVIEW
14
15=head2 Electronic Codebook Mode (ECB)
16
17Normally, this is found as the function I<algorithm>_ecb_encrypt().
18
19=over 2
20
21=item *
22
2364 bits are enciphered at a time.
24
25=item *
26
27The order of the blocks can be rearranged without detection.
28
29=item *
30
31The 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
36An error will only affect one ciphertext block.
37
38=back
39
40=head2 Cipher Block Chaining Mode (CBC)
41
42Normally, this is found as the function I<algorithm>_cbc_encrypt().
43Be aware that des_cbc_encrypt() is not really DES CBC (it does
44not update the IV); use des_ncbc_encrypt() instead.
45
46=over 2
47
48=item *
49
50a multiple of 64 bits are enciphered at a time.
51
52=item *
53
54The CBC mode produces the same ciphertext whenever the same
55plaintext is encrypted using the same key and starting variable.
56
57=item *
58
59The chaining operation makes the ciphertext blocks dependent on the
60current and all preceding plaintext blocks and therefore blocks can not
61be rearranged.
62
63=item *
64
65The use of different starting variables prevents the same plaintext
66enciphering to the same ciphertext.
67
68=item *
69
70An error will affect the current and the following ciphertext blocks.
71
72=back
73
74=head2 Cipher Feedback Mode (CFB)
75
76Normally, this is found as the function I<algorithm>_cfb_encrypt().
77
78=over 2
79
80=item *
81
82a number of bits (j) <= 64 are enciphered at a time.
83
84=item *
85
86The CFB mode produces the same ciphertext whenever the same
87plaintext is encrypted using the same key and starting variable.
88
89=item *
90
91The chaining operation makes the ciphertext variables dependent on the
92current and all preceding variables and therefore j-bit variables are
93chained together and can not be rearranged.
94
95=item *
96
97The use of different starting variables prevents the same plaintext
98enciphering to the same ciphertext.
99
100=item *
101
102The strength of the CFB mode depends on the size of k (maximal if
103j == k). In my implementation this is always the case.
104
105=item *
106
107Selection of a small value for j will require more cycles through
108the encipherment algorithm per unit of plaintext and thus cause
109greater processing overheads.
110
111=item *
112
113Only multiples of j bits can be enciphered.
114
115=item *
116
117An error will affect the current and the following ciphertext variables.
118
119=back
120
121=head2 Output Feedback Mode (OFB)
122
123Normally, this is found as the function I<algorithm>_ofb_encrypt().
124
125=over 2
126
127
128=item *
129
130a number of bits (j) <= 64 are enciphered at a time.
131
132=item *
133
134The OFB mode produces the same ciphertext whenever the same
135plaintext enciphered using the same key and starting variable. More
136over, in the OFB mode the same key stream is produced when the same
137key and start variable are used. Consequently, for security reasons
138a specific start variable should be used only once for a given key.
139
140=item *
141
142The absence of chaining makes the OFB more vulnerable to specific attacks.
143
144=item *
145
146The use of different start variables values prevents the same
147plaintext enciphering to the same ciphertext, by producing different
148key streams.
149
150=item *
151
152Selection of a small value for j will require more cycles through
153the encipherment algorithm per unit of plaintext and thus cause
154greater processing overheads.
155
156=item *
157
158Only multiples of j bits can be enciphered.
159
160=item *
161
162OFB mode of operation does not extend ciphertext errors in the
163resultant plaintext output. Every bit error in the ciphertext causes
164only one bit to be in error in the deciphered plaintext.
165
166=item *
167
168OFB mode is not self-synchronising. If the two operation of
169encipherment and decipherment get out of synchronism, the system needs
170to be re-initialised.
171
172=item *
173
174Each re-initialisation should use a value of the start variable
175different from the start variable values used before with the same
176key. The reason for this is that an identical bit stream would be
177produced each time from the same parameters. This would be
178susceptible to a 'known plaintext' attack.
179
180=back
181
182=head2 Triple ECB Mode
183
184Normally, this is found as the function I<algorithm>_ecb3_encrypt().
185
186=over 2
187
188=item *
189
190Encrypt with key1, decrypt with key2 and encrypt with key3 again.
191
192=item *
193
194As for ECB encryption but increases the key length to 168 bits.
195There are theoretic attacks that can be used that make the effective
196key length 112 bits, but this attack also requires 2^56 blocks of
197memory, not very likely, even for the NSA.
198
199=item *
200
201If both keys are the same it is equivalent to encrypting once with
202just one key.
203
204=item *
205
206If the first and last key are the same, the key length is 112 bits.
207There are attacks that could reduce the key space to 55 bit's but it
208requires 2^56 blocks of memory.
209
210=item *
211
212If all 3 keys are the same, this is effectively the same as normal
213ecb mode.
214
215=back
216
217=head2 Triple CBC Mode
218
219Normally, this is found as the function I<algorithm>_ede3_cbc_encrypt().
220
221=over 2
222
223
224=item *
225
226Encrypt with key1, decrypt with key2 and then encrypt with key3.
227
228=item *
229
230As for CBC encryption but increases the key length to 168 bits with
231the same restrictions as for triple ecb mode.
232
233=back
234
235=head1 NOTES
236
237This text was been written in large parts by Eric Young in his original
238documentation for SSLeay, the predecessor of OpenSSL. In turn, he attributed
239it 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
249L<blowfish(3)|blowfish(3)>, L<des(3)|des(3)>, L<idea(3)|idea(3)>,
250L<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
5dh - 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
42These functions implement the Diffie-Hellman key agreement protocol.
43The generation of shared DH parameters is described in
44L<DH_generate_parameters(3)|DH_generate_parameters(3)>; L<DH_generate_key(3)|DH_generate_key(3)> describes how
45to perform a key agreement.
46
47The 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
61L<dhparam(1)|dhparam(1)>, L<bn(3)|bn(3)>, L<dsa(3)|dsa(3)>, L<err(3)|err(3)>,
62L<rand(3)|rand(3)>, L<rsa(3)|rsa(3)>, L<DH_set_method(3)|DH_set_method(3)>,
63L<DH_new(3)|DH_new(3)>, L<DH_get_ex_new_index(3)|DH_get_ex_new_index(3)>,
64L<DH_generate_parameters(3)|DH_generate_parameters(3)>,
65L<DH_compute_key(3)|DH_compute_key(3)>, L<d2i_DHparams(3)|d2i_DHparams(3)>,
66L<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
5dsa - 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
65These functions implement the Digital Signature Algorithm (DSA). The
66generation of shared DSA parameters is described in
67L<DSA_generate_parameters(3)|DSA_generate_parameters(3)>;
68L<DSA_generate_key(3)|DSA_generate_key(3)> describes how to
69generate a signature key. Signature generation and verification are
70described in L<DSA_sign(3)|DSA_sign(3)>.
71
72The 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
85In public keys, B<priv_key> is NULL.
86
87=head1 CONFORMING TO
88
89US Federal Information Processing Standard FIPS 186 (Digital Signature
90Standard, DSS), ANSI X9.30
91
92=head1 SEE ALSO
93
94L<bn(3)|bn(3)>, L<dh(3)|dh(3)>, L<err(3)|err(3)>, L<rand(3)|rand(3)>,
95L<rsa(3)|rsa(3)>, L<sha(3)|sha(3)>, L<DSA_new(3)|DSA_new(3)>,
96L<DSA_size(3)|DSA_size(3)>,
97L<DSA_generate_parameters(3)|DSA_generate_parameters(3)>,
98L<DSA_dup_DH(3)|DSA_dup_DH(3)>,
99L<DSA_generate_key(3)|DSA_generate_key(3)>,
100L<DSA_sign(3)|DSA_sign(3)>, L<DSA_set_method(3)|DSA_set_method(3)>,
101L<DSA_get_ex_new_index(3)|DSA_get_ex_new_index(3)>,
102L<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
5err - 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
49When a call to the OpenSSL library fails, this is usually signalled
50by the return value, and an error code is stored in an error queue
51associated with the current thread. The B<err> library provides
52functions to obtain these error codes and textual error messages.
53
54The L<ERR_get_error(3)|ERR_get_error(3)> manpage describes how to
55access error codes.
56
57Error codes contain information about where the error occurred, and
58what went wrong. L<ERR_GET_LIB(3)|ERR_GET_LIB(3)> describes how to
59extract this information. A method to obtain human-readable error
60messages is described in L<ERR_error_string(3)|ERR_error_string(3)>.
61
62L<ERR_clear_error(3)|ERR_clear_error(3)> can be used to clear the
63error queue.
64
65Note that L<ERR_remove_state(3)|ERR_remove_state(3)> should be used to
66avoid memory leaks when threads are terminated.
67
68=head1 ADDING NEW ERROR CODES TO OPENSSL
69
70See L<ERR_put_error(3)> if you want to record error codes in the
71OpenSSL error system from within your application.
72
73The remainder of this section is of interest only if you want to add
74new error codes to OpenSSL or add error codes from external libraries.
75
76=head2 Reporting errors
77
78Each sub-library has a specific macro XXXerr() that is used to report
79errors. Its first argument is a function code B<XXX_F_...>, the second
80argument is a reason code B<XXX_R_...>. Function codes are derived
81from the function names; reason codes consist of textual error
82descriptions. 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
87Function and reason codes should consist of upper case characters,
88numbers and underscores only. The error file generation script translates
89function codes into function names by looking in the header files
90for an appropriate function name, if none is found it just uses
91the capitalized form such as "SSL23_READ" in the above example.
92
93The trailing section of a reason code (after the "_R_") is translated
94into lower case and underscores changed to spaces.
95
96When you are using new function or reason codes, run B<make errors>.
97The necessary B<#define>s will then automatically be added to the
98sub-library's header file.
99
100Although a library will normally report errors using its own specific
101XXXerr macro, another library's macro can be used. This is normally
102only done when a library wants to include ASN1 code which must use
103the ASN1err() macro.
104
105=head2 Adding new libraries
106
107When adding a new sub-library to OpenSSL, assign it a library number
108B<ERR_LIB_XXX>, define a macro XXXerr() (both in B<err.h>), add its
109name to B<ERR_str_libraries[]> (in B<crypto/err/err.c>), and add
110C<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
115to B<crypto/err/openssl.ec>, and add B<xxx_err.c> to the Makefile.
116Running B<make errors> will then generate a file B<xxx_err.c>, and
117add all error codes used in the library to B<xxx.h>.
118
119Additionally the library include file must have a certain form.
120Typically 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
139The B<BEGIN ERROR CODES> sequence is used by the error code
140generation script as the point to place new error codes, any text
141after this point will be overwritten when B<make errors> is run.
142The closing #endif etc will be automatically added by the script.
143
144The generated C error code file B<xxx_err.c> will load the header
145files B<stdio.h>, B<openssl/err.h> and B<openssl/xxx.h> so the
146header file must load any additional header files containg any
147definitions it uses.
148
149=head1 USING ERROR CODES IN EXTERNAL LIBRARIES
150
151It is also possible to use OpenSSL's error code scheme in external
152libraries. The library needs to load its own codes and call the OpenSSL
153error code insertion script B<mkerr.pl> explicitly to add codes to
154the header file and generate the C error code file. This will normally
155be done if the external library needs to generate new ASN1 structures
156but it can also be used to add more general purpose error code handling.
157
158TBA more details
159
160=head1 INTERNALS
161
162The error queues are stored in a hash table with one B<ERR_STATE>
163entry for each pid. ERR_get_state() returns the current thread's
164B<ERR_STATE>. An B<ERR_STATE> can hold up to B<ERR_NUM_ERRORS> error
165codes. When more error codes are added, the old ones are overwritten,
166on the assumption that the most recent errors are most important.
167
168Error strings are also stored in hash table. The hash tables can
169be obtained by calling ERR_get_err_state_table(void) and
170ERR_get_string_table(void) respectively.
171
172=head1 SEE ALSO
173
174L<CRYPTO_set_id_callback(3)|CRYPTO_set_id_callback(3)>,
175L<CRYPTO_set_locking_callback(3)|<CRYPTO_set_locking_callback(3)>,
176L<ERR_get_error(3)|ERR_get_error(3)>,
177L<ERR_GET_LIB(3)|ERR_GET_LIB(3)>,
178L<ERR_clear_error(3)|ERR_clear_error(3)>,
179L<ERR_error_string(3)|ERR_error_string(3)>,
180L<ERR_print_errors(3)|ERR_print_errors(3)>,
181L<ERR_load_crypto_strings(3)|ERR_load_crypto_strings(3)>,
182L<ERR_remove_state(3)|ERR_remove_state(3)>,
183L<ERR_put_error(3)|ERR_put_error(3)>,
184L<ERR_load_strings(3)|ERR_load_strings(3)>,
185L<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
5HMAC, 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
24HMAC is a MAC (message authentication code), i.e. a keyed hash
25function used for message authentication, which is based on a hash
26function.
27
28HMAC() computes the message authentication code of the B<n> bytes at
29B<d> using the hash function B<evp_md> and the key B<key> which is
30B<key_len> bytes long.
31
32It places the result in B<md> (which must have space for the output of
33the hash function, which is no more than B<EVP_MAX_MD_SIZE> bytes).
34If B<md> is NULL, the digest is placed in a static array. The size of
35the output is placed in B<md_len>, unless it is B<NULL>.
36
37B<evp_md> can be EVP_sha1(), EVP_ripemd160() etc.
38B<key> and B<evp_md> may be B<NULL> if a key and hash function have
39been set in a previous call to HMAC_Init() for that B<HMAC_CTX>.
40
41HMAC_cleanup() erases the key and other data from the B<HMAC_CTX>.
42
43The following functions may be used if the message is not completely
44stored in memory:
45
46HMAC_Init() initializes a B<HMAC_CTX> structure to use the hash
47function B<evp_md> and the key B<key> which is B<key_len> bytes long.
48
49HMAC_Update() can be called repeatedly with chunks of the message to
50be authenticated (B<len> bytes at B<data>).
51
52HMAC_Final() places the message authentication code in B<md>, which
53must have space for the hash function output.
54
55=head1 RETURN VALUES
56
57HMAC() returns a pointer to the message authentication code.
58
59HMAC_Init(), HMAC_Update(), HMAC_Final() and HMAC_cleanup() do not
60return values.
61
62=head1 CONFORMING TO
63
64RFC 2104
65
66=head1 SEE ALSO
67
68L<sha(3)|sha(3)>, L<evp(3)|evp(3)>
69
70=head1 HISTORY
71
72HMAC(), HMAC_Init(), HMAC_Update(), HMAC_Final() and HMAC_cleanup()
73are 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
5lh_stats, lh_node_stats, lh_node_usage_stats, lh_stats_bio,
6lh_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
22The B<LHASH> structure records statistics about most aspects of
23accessing the hash table. This is mostly a legacy of Eric Young
24writing this library for the reasons of implementing what looked like
25a nice algorithm rather than for a particular software product.
26
27lh_stats() prints out statistics on the size of the hash table, how
28many entries are in it, and the number and result of calls to the
29routines in this library.
30
31lh_node_stats() prints the number of entries for each 'bucket' in the
32hash table.
33
34lh_node_usage_stats() prints out a short summary of the state of the
35hash table. It prints the 'load' and the 'actual load'. The load is
36the 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
38for buckets which contain entries. So the 'actual load' is the
39average number of searches that will need to find an item in the hash
40table, while the 'load' is the average number that will be done to
41record a miss.
42
43lh_stats_bio(), lh_node_stats_bio() and lh_node_usage_stats_bio()
44are the same as the above, except that the output goes to a B<BIO>.
45
46=head1 RETURN VALUES
47
48These functions do not return values.
49
50=head1 SEE ALSO
51
52L<bio(3)|bio(3)>, L<lhash(3)|lhash(3)>
53
54=head1 HISTORY
55
56These functions are available in all versions of SSLeay and OpenSSL.
57
58This 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
5lh_new, lh_free, lh_insert, lh_delete, lh_retrieve, lh_doall,
6lh_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
28This library implements dynamic hash tables. The hash table entries
29can be arbitrary structures. Usually they consist of key and value
30fields.
31
32lh_new() creates a new B<LHASH> structure. B<hash> takes a pointer to
33the structure and returns an unsigned long hash value of its key
34field. The hash value is normally truncated to a power of 2, so make
35sure that your hash function returns well mixed low order
36bits. B<compare> takes two arguments, and returns 0 if their keys are
37equal, non-zero otherwise.
38
39lh_free() frees the B<LHASH> structure B<table>. Allocated hash table
40entries will not be freed; consider using lh_doall() to deallocate any
41remaining entries in the hash table.
42
43lh_insert() inserts the structure pointed to by B<data> into B<table>.
44If there already is an entry with the same key, the old value is
45replaced. Note that lh_insert() stores pointers, the data are not
46copied.
47
48lh_delete() deletes an entry from B<table>.
49
50lh_retrieve() looks up an entry in B<table>. Normally, B<data> is
51a structure with the key field(s) set; the function will return a
52pointer to a fully populated structure.
53
54lh_doall() will, for every entry in the hash table, call B<func> with
55the data item as parameters.
56This 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);
61This 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
63delete entries from the hash table in B<func>: the table may decrease
64in size, moving item that you are currently on down lower in the hash
65table. This could cause some entries to be skipped. The best
66solution to this problem is to set hash-E<gt>down_load=0 before you
67start. This will stop the hash table ever being decreased in size.
68
69lh_doall_arg() is the same as lh_doall() except that B<func> will
70be called with B<arg> as the second argument.
71
72lh_error() can be used to determine if an error occurred in the last
73operation. lh_error() is a macro.
74
75=head1 RETURN VALUES
76
77lh_new() returns B<NULL> on error, otherwise a pointer to the new
78B<LHASH> structure.
79
80When a hash table entry is replaced, lh_insert() returns the value
81being replaced. B<NULL> is returned on normal operation and on error.
82
83lh_delete() returns the entry being deleted. B<NULL> is returned if
84there is no such value in the hash table.
85
86lh_retrieve() returns the hash table entry if it has been found,
87B<NULL> otherwise.
88
89lh_error() returns 1 if an error occurred in the last operation, 0
90otherwise.
91
92lh_free(), lh_doall() and lh_doall_arg() return no values.
93
94=head1 BUGS
95
96lh_insert() returns B<NULL> both for success and error.
97
98=head1 INTERNALS
99
100The following description is based on the SSLeay documentation:
101
102The B<lhash> library implements a hash table described in the
103I<Communications of the ACM> in 1991. What makes this hash table
104different is that as the table fills, the hash table is increased (or
105decreased) in size via Realloc(). When a 'resize' is done, instead of
106all hashes being redistributed over twice as many 'buckets', one
107bucket is split. So when an 'expand' is done, there is only a minimal
108cost to redistribute some values. Subsequent inserts will cause more
109single 'bucket' redistributions but there will never be a sudden large
110cost due to redistributing all the 'buckets'.
111
112The state for a particular hash table is kept in the B<LHASH> structure.
113The decision to increase or decrease the hash table size is made
114depending on the 'load' of the hash table. The load is the number of
115items in the hash table divided by the size of the hash table. The
116default values are as follows. If (hash->up_load E<lt> load) =E<gt>
117expand. if (hash-E<gt>down_load E<gt> load) =E<gt> contract. The
118B<up_load> has a default value of 1 and B<down_load> has a default value
119of 2. These numbers can be modified by the application by just
120playing with the B<up_load> and B<down_load> variables. The 'load' is
121kept in a form which is multiplied by 256. So
122hash-E<gt>up_load=8*256; will cause a load of 8 to be set.
123
124If you are interested in performance the field to watch is
125num_comp_calls. The hash library keeps track of the 'hash' value for
126each item so when a lookup is done, the 'hashes' are compared, if
127there is a match, then a full compare is done, and
128hash-E<gt>num_comp_calls is incremented. If num_comp_calls is not equal
129to num_delete plus num_retrieve it means that your hash function is
130generating hashes that are the same for different values. It is
131probably worth changing your hash function if this is the case because
132even if your hash table has 10 items in a 'bucket', it can be searched
133with 10 B<unsigned long> compares and 10 linked list traverses. This
134will be much less expensive that 10 calls to you compare function.
135
136lh_strhash() is a demo string hashing function:
137
138 unsigned long lh_strhash(const char *c);
139
140Since the B<LHASH> routines would normally be passed structures, this
141routine would not normally be passed to lh_new(), rather it would be
142used in the function passed to lh_new().
143
144=head1 SEE ALSO
145
146L<lh_stats(3)|lh_stats(3)>
147
148=head1 HISTORY
149
150The B<lhash> library is available in all versions of SSLeay and OpenSSL.
151lh_error() was added in SSLeay 0.9.1b.
152
153This 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
5MD2, MD5, MD2_Init, MD2_Update, MD2_Final, MD5_Init, MD5_Update,
6MD5_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
33MD2 and MD5 are cryptographic hash functions with a 128 bit output.
34
35MD2() and MD5() compute the MD2 and MD5 message digest of the B<n>
36bytes at B<d> and place it in B<md> (which must have space for
37MD2_DIGEST_LENGTH == MD5_DIGEST_LENGTH == 16 bytes of output). If
38B<md> is NULL, the digest is placed in a static array.
39
40The following functions may be used if the message is not completely
41stored in memory:
42
43MD2_Init() initializes a B<MD2_CTX> structure.
44
45MD2_Update() can be called repeatedly with chunks of the message to
46be hashed (B<len> bytes at B<data>).
47
48MD2_Final() places the message digest in B<md>, which must have space
49for MD2_DIGEST_LENGTH == 16 bytes of output, and erases the B<MD2_CTX>.
50
51MD5_Init(), MD5_Update() and MD5_Final() are analogous using an
52B<MD5_CTX> structure.
53
54Applications should use the higher level functions
55L<EVP_DigestInit(3)|EVP_DigestInit(3)>
56etc. instead of calling the hash functions directly.
57
58=head1 NOTE
59
60MD2 and MD5 are recommended only for compatibility with existing
61applications. In new applications, SHA-1 or RIPEMD-160 should be
62preferred.
63
64=head1 RETURN VALUES
65
66MD2() and MD5() return pointers to the hash value.
67
68MD2_Init(), MD2_Update() MD2_Final(), MD5_Init(), MD5_Update() and
69MD5_Final() do not return values.
70
71=head1 CONFORMING TO
72
73RFC 1319, RFC 1321
74
75=head1 SEE ALSO
76
77L<sha(3)|sha(3)>, L<ripemd(3)|ripemd(3)>, L<EVP_DigestInit(3)|EVP_DigestInit(3)>
78
79=head1 HISTORY
80
81MD2(), MD2_Init(), MD2_Update() MD2_Final(), MD5(), MD5_Init(),
82MD5_Update() and MD5_Final() are available in all versions of SSLeay
83and 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
5MDC2, 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
21MDC2 is a method to construct hash functions with 128 bit output from
22block ciphers. These functions are an implementation of MDC2 with
23DES.
24
25MDC2() computes the MDC2 message digest of the B<n>
26bytes at B<d> and places it in B<md> (which must have space for
27MDC2_DIGEST_LENGTH == 16 bytes of output). If B<md> is NULL, the digest
28is placed in a static array.
29
30The following functions may be used if the message is not completely
31stored in memory:
32
33MDC2_Init() initializes a B<MDC2_CTX> structure.
34
35MDC2_Update() can be called repeatedly with chunks of the message to
36be hashed (B<len> bytes at B<data>).
37
38MDC2_Final() places the message digest in B<md>, which must have space
39for MDC2_DIGEST_LENGTH == 16 bytes of output, and erases the B<MDC2_CTX>.
40
41Applications should use the higher level functions
42L<EVP_DigestInit(3)|EVP_DigestInit(3)> etc. instead of calling the
43hash functions directly.
44
45=head1 RETURN VALUES
46
47MDC2() returns a pointer to the hash value.
48
49MDC2_Init(), MDC2_Update() and MDC2_Final() do not return values.
50
51=head1 CONFORMING TO
52
53ISO/IEC 10118-2, with DES
54
55=head1 SEE ALSO
56
57L<sha(3)|sha(3)>, L<EVP_DigestInit(3)|EVP_DigestInit(3)>
58
59=head1 HISTORY
60
61MDC2(), MDC2_Init(), MDC2_Update() and MDC2_Final() are available since
62SSLeay 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
5rand - 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
33These functions implement a cryptographically secure pseudo-random
34number generator (PRNG). It is used by other library functions for
35example to generate random keys, and applications can use it when they
36need randomness.
37
38A cryptographic PRNG must be seeded with unpredictable data such as
39mouse movements or keys pressed at random by the user. This is
40described 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
42seeding process whenever the application is started.
43
44L<RAND_bytes(3)|RAND_bytes(3)> describes how to obtain random data from the
45PRNG.
46
47=head1 INTERNALS
48
49The RAND_SSLeay() method implements a PRNG based on a cryptographic
50hash function.
51
52The following description of its design is based on the SSLeay
53documentation:
54
55First up I will state the things I believe I need for a good RNG.
56
57=over 4
58
59=item 1
60
61A good hashing algorithm to mix things up and to convert the RNG 'state'
62to random numbers.
63
64=item 2
65
66An initial source of random 'state'.
67
68=item 3
69
70The state should be very large. If the RNG is being used to generate
714096 bit RSA keys, 2 2048 bit random strings are required (at a minimum).
72If your RNG state only has 128 bits, you are obviously limiting the
73search space to 128 bits, not 2048. I'm probably getting a little
74carried away on this last point but it does indicate that it may not be
75a bad idea to keep quite a lot of RNG state. It should be easier to
76break a cipher than guess the RNG seed data.
77
78=item 4
79
80Any RNG seed data should influence all subsequent random numbers
81generated. This implies that any random seed data entered will have
82an influence on all subsequent random numbers generated.
83
84=item 5
85
86When using data to seed the RNG state, the data used should not be
87extractable from the RNG state. I believe this should be a
88requirement because one possible source of 'secret' semi random
89data would be a private key or a password. This data must
90not be disclosed by either subsequent random numbers or a
91'core' dump left by a program crash.
92
93=item 6
94
95Given 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
100Given the random number output stream, it should not be possible to determine
101the RNG state or the next random number.
102
103=back
104
105The algorithm is as follows.
106
107There is global state made up of a 1023 byte buffer (the 'state'), a
108working hash value ('md'), and a counter ('count').
109
110Whenever seed data is added, it is inserted into the 'state' as
111follows.
112
113The input is chopped up into units of 20 bytes (or less for
114the last block). Each of these blocks is run through the hash
115function as follows: The data passed to the hash function
116is the current 'md', the same number of bytes from the 'state'
117(the location determined by in incremented looping index) as
118the current 'block', the new key data 'block', and 'count'
119(which is incremented after each use).
120The 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
122hash function. I
123believe this system addresses points 1 (hash function; currently
124SHA-1), 3 (the 'state'), 4 (via the 'md'), 5 (by the use of a hash
125function and xor).
126
127When bytes are extracted from the RNG, the following process is used.
128For each group of 10 bytes (or less), we do the following:
129
130Input into the hash function the top 10 bytes from the local 'md'
131(which is initialized from the global 'md' before any bytes are
132generated), the bytes that are to be overwritten by the random bytes,
133and bytes from the 'state' (incrementing looping index). From this
134digest output (which is kept in 'md'), the top (up to) 10 bytes are
135returned to the caller and the bottom (up to) 10 bytes are xored into
136the 'state'.
137
138Finally, after we have finished 'num' random bytes for the caller,
139'count' (which is incremented) and the local and global 'md' are fed
140into the hash function and the results are kept in the global 'md'.
141
142I believe the above addressed points 1 (use of SHA-1), 6 (by hashing
143into the 'state' the 'old' data from the caller that is about to be
144overwritten) and 7 (by not using the 10 bytes given to the caller to
145update the 'state', but they are used to update 'md').
146
147So of the points raised, only 2 is not addressed (but see
148L<RAND_add(3)|RAND_add(3)>).
149
150=head1 SEE ALSO
151
152L<BN_rand(3)|BN_rand(3)>, L<RAND_add(3)|RAND_add(3)>,
153L<RAND_load_file(3)|RAND_load_file(3)>, L<RAND_egd(3)|RAND_egd(3)>,
154L<RAND_bytes(3)|RAND_bytes(3)>,
155L<RAND_set_rand_method(3)|RAND_set_rand_method(3)>,
156L<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
5RC4_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
18This library implements the Alleged RC4 cipher, which is described for
19example in I<Applied Cryptography>. It is believed to be compatible
20with RC4[TM], a proprietary cipher of RSA Security Inc.
21
22RC4 is a stream cipher with variable key length. Typically, 128 bit
23(16 byte) keys are used for strong encryption, but shorter insecure
24key sizes have been widely used due to export restrictions.
25
26RC4 consists of a key setup phase and the actual encryption or
27decryption phase.
28
29RC4_set_key() sets up the B<RC4_KEY> B<key> using the B<len> bytes long
30key at B<data>.
31
32RC4() encrypts or decrypts the B<len> bytes of data at B<indata> using
33B<key> and places the result at B<outdata>. Repeated RC4() calls with
34the same B<key> yield a continuous key stream.
35
36Since RC4 is a stream cipher (the input is XORed with a pseudo-random
37key stream to produce the output), decryption uses the same function
38calls as encryption.
39
40Applications should use the higher level functions
41L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>
42etc. instead of calling the RC4 functions directly.
43
44=head1 RETURN VALUES
45
46RC4_set_key() and RC4() do not return values.
47
48=head1 NOTE
49
50Certain conditions have to be observed to securely use stream ciphers.
51It is not permissible to perform multiple encryptions using the same
52key stream.
53
54=head1 SEE ALSO
55
56L<blowfish(3)|blowfish(3)>, L<des(3)|des(3)>, L<rc2(3)|rc2(3)>
57
58=head1 HISTORY
59
60RC4_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
5RIPEMD160, RIPEMD160_Init, RIPEMD160_Update, RIPEMD160_Final -
6RIPEMD-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
22RIPEMD-160 is a cryptographic hash function with a
23160 bit output.
24
25RIPEMD160() computes the RIPEMD-160 message digest of the B<n>
26bytes at B<d> and places it in B<md> (which must have space for
27RIPEMD160_DIGEST_LENGTH == 20 bytes of output). If B<md> is NULL, the digest
28is placed in a static array.
29
30The following functions may be used if the message is not completely
31stored in memory:
32
33RIPEMD160_Init() initializes a B<RIPEMD160_CTX> structure.
34
35RIPEMD160_Update() can be called repeatedly with chunks of the message to
36be hashed (B<len> bytes at B<data>).
37
38RIPEMD160_Final() places the message digest in B<md>, which must have
39space for RIPEMD160_DIGEST_LENGTH == 20 bytes of output, and erases
40the B<RIPEMD160_CTX>.
41
42Applications should use the higher level functions
43L<EVP_DigestInit(3)|EVP_DigestInit(3)> etc. instead of calling the
44hash functions directly.
45
46=head1 RETURN VALUES
47
48RIPEMD160() returns a pointer to the hash value.
49
50RIPEMD160_Init(), RIPEMD160_Update() and RIPEMD160_Final() do not
51return values.
52
53=head1 CONFORMING TO
54
55ISO/IEC 10118-3 (draft) (??)
56
57=head1 SEE ALSO
58
59L<sha(3)|sha(3)>, L<hmac(3)|hmac(3)>, L<EVP_DigestInit(3)|EVP_DigestInit(3)>
60
61=head1 HISTORY
62
63RIPEMD160(), RIPEMD160_Init(), RIPEMD160_Update() and
64RIPEMD160_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
5rsa - 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
66These functions implement RSA public key encryption and signatures
67as defined in PKCS #1 v2.0 [RFC 2437].
68
69The B<RSA> structure consists of several BIGNUM components. It can
70contain 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
86In public keys, the private exponent and the related secret values are
87B<NULL>.
88
89B<dmp1>, B<dmq1> and B<iqmp> may be B<NULL> in private keys, but the
90RSA operations are much faster when these values are available.
91
92=head1 CONFORMING TO
93
94SSL, PKCS #1 v2.0
95
96=head1 PATENTS
97
98RSA is covered by a US patent which expires in September 2000.
99
100=head1 SEE ALSO
101
102L<rsa(1)|rsa(1)>, L<bn(3)|bn(3)>, L<dsa(3)|dsa(3)>, L<dh(3)|dh(3)>,
103L<rand(3)|rand(3)>, L<RSA_new(3)|RSA_new(3)>,
104L<RSA_public_encrypt(3)|RSA_public_encrypt(3)>,
105L<RSA_sign(3)|RSA_sign(3)>, L<RSA_size(3)|RSA_size(3)>,
106L<RSA_generate_key(3)|RSA_generate_key(3)>,
107L<RSA_check_key(3)|RSA_check_key(3)>,
108L<RSA_blinding_on(3)|RSA_blinding_on(3)>,
109L<RSA_set_method(3)|RSA_set_method(3)>, L<RSA_print(3)|RSA_print(3)>,
110L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>,
111L<RSA_private_encrypt(3)|RSA_private_encrypt(3)>,
112L<RSA_sign_ASN_OCTET_STRING(3)|RSA_sign_ASN_OCTET_STRING(3)>,
113L<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
5SHA1, 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
21SHA-1 (Secure Hash Algorithm) is a cryptographic hash function with a
22160 bit output.
23
24SHA1() computes the SHA-1 message digest of the B<n>
25bytes at B<d> and places it in B<md> (which must have space for
26SHA_DIGEST_LENGTH == 20 bytes of output). If B<md> is NULL, the digest
27is placed in a static array.
28
29The following functions may be used if the message is not completely
30stored in memory:
31
32SHA1_Init() initializes a B<SHA_CTX> structure.
33
34SHA1_Update() can be called repeatedly with chunks of the message to
35be hashed (B<len> bytes at B<data>).
36
37SHA1_Final() places the message digest in B<md>, which must have space
38for SHA_DIGEST_LENGTH == 20 bytes of output, and erases the B<SHA_CTX>.
39
40Applications should use the higher level functions
41L<EVP_DigestInit(3)|EVP_DigestInit(3)>
42etc. instead of calling the hash functions directly.
43
44The predecessor of SHA-1, SHA, is also implemented, but it should be
45used only when backward compatibility is required.
46
47=head1 RETURN VALUES
48
49SHA1() returns a pointer to the hash value.
50
51SHA1_Init(), SHA1_Update() and SHA1_Final() do not return values.
52
53=head1 CONFORMING TO
54
55SHA: US Federal Information Processing Standard FIPS PUB 180 (Secure Hash
56Standard),
57SHA-1: US Federal Information Processing Standard FIPS PUB 180-1 (Secure Hash
58Standard),
59ANSI X9.30
60
61=head1 SEE ALSO
62
63L<ripemd(3)|ripemd(3)>, L<hmac(3)|hmac(3)>, L<EVP_DigestInit(3)|EVP_DigestInit(3)>
64
65=head1 HISTORY
66
67SHA1(), SHA1_Init(), SHA1_Update() and SHA1_Final() are available in all
68versions 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
5CRYPTO_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
20OpenSSL can safely be used in multi-threaded applications provided
21that two callback functions are set.
22
23locking_function(int mode, int n, const char *file, int line) is
24needed to perform locking on shared data stuctures. Multi-threaded
25applications will crash at random if it is not set.
26
27locking_function() must be able to handle up to CRYPTO_num_locks()
28different mutex locks. It sets the B<n>-th lock if B<mode> &
29B<CRYPTO_LOCK>, and releases it otherwise.
30
31B<file> and B<line> are the file number of the function setting the
32lock. They can be useful for debugging.
33
34id_function(void) is a function that returns a thread ID. It is not
35needed on Windows nor on platforms where getpid() returns a different
36ID for each thread (most notably Linux).
37
38=head1 RETURN VALUES
39
40CRYPTO_num_locks() returns the required number of locks.
41The other functions return no values.
42
43=head1 NOTE
44
45You 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
57B<crypto/threads/mttest.c> shows examples of the callback functions on
58Solaris, Irix and Win32.
59
60=head1 HISTORY
61
62CRYPTO_set_locking_callback() and CRYPTO_set_id_callback() are
63available in all versions of SSLeay and OpenSSL.
64CRYPTO_num_locks() was added in OpenSSL 0.9.4.
65
66=head1 SEE ALSO
67
68L<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
6openssl - OpenSSL command line tool
7
8=head1 SYNOPSIS
9
10B<openssl>
11I<command>
12[ I<command_opts> ]
13[ I<command_args> ]
14
15=head1 DESCRIPTION
16
17OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL
18v2/v3) and Transport Layer Security (TLS v1) network protocols and related
19cryptography standards required by them.
20
21The B<openssl> program is a command line tool for using the various
22cryptography functions of OpenSSL's B<crypto> library from the shell.
23It 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
33The B<openssl> program provides a rich variety of commands (I<command> in the
34SYNOPSIS 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
43Parse an ASN.1 sequence.
44
45=item B<ca>
46
47Certificate Authority (CA) Management.
48
49=item B<ciphers>
50
51Cipher Suite Description Determination.
52
53=item B<crl>
54
55Certificate Revocation List (CRL) Management.
56
57=item B<crl2pkcs7>
58
59CRL2 to PKCS#7 Conversion.
60
61=item B<dgst>
62
63Message Digest Calculation.
64
65=item B<dh>
66
67Diffie-Hellman Data Management.
68
69=item B<dsa>
70
71DSA Data Management.
72
73=item B<dsaparam>
74
75DSA Parameter Generation.
76
77=item B<enc>
78
79Encoding with Ciphers.
80
81=item B<errstr>
82
83Error Number to Error String Conversion.
84
85=item B<gendh>
86
87Generation of Diffie-Hellman Parameters.
88
89=item B<gendsa>
90
91Generation of DSA Parameters.
92
93=item B<genrsa>
94
95Generation of RSA Parameters.
96
97=item B<pkcs7>
98
99PKCS#7 Data Management.
100
101=item B<req>
102
103X.509 Certificate Signing Request (CSR) Management.
104
105=item B<rsa>
106
107RSA Data Management.
108
109=item B<s_client>
110
111This implements a generic SSL/TLS client which can establish a transparent
112connection to a remote server speaking SSL/TLS. It's intended for testing
113purposes only and provides only rudimentary interface functionality but
114internally uses mostly all functionality of the OpenSSL B<ssl> library.
115
116=item B<s_server>
117
118This implements a generic SSL/TLS server which accepts connections from remote
119clients speaking SSL/TLS. It's intended for testing purposes only and provides
120only rudimentary interface functionality but internally uses mostly all
121functionality of the OpenSSL B<ssl> library. It provides both an own command
122line oriented protocol for testing SSL functions and a simple HTTP response
123facility to emulate an SSL/TLS-aware webserver.
124
125=item B<s_time>
126
127SSL Connection Timer.
128
129=item B<sess_id>
130
131SSL Session Data Management.
132
133=item B<speed>
134
135Algorithm Speed Measurement.
136
137=item B<verify>
138
139X.509 Certificate Verification.
140
141=item B<version>
142
143OpenSSL Version Information.
144
145=item B<x509>
146
147X.509 Certificate Data Management.
148
149=back
150
151=head2 MESSAGE DIGEST COMMANDS
152
153=over 10
154
155=item B<md2>
156
157MD2 Digest
158
159=item B<md5>
160
161MD5 Digest
162
163=item B<mdc2>
164
165MDC2 Digest
166
167=item B<rmd160>
168
169RMD-160 Digest
170
171=item B<sha>
172
173SHA Digest
174
175=item B<sha1>
176
177SHA-1 Digest
178
179=back
180
181=head2 ENCODING AND CIPHER COMMANDS
182
183=over 10
184
185=item B<base64>
186
187Base64 Encoding
188
189=item B<bf bf-cbc bf-cfb bf-ecb bf-ofb>
190
191Blowfish Cipher
192
193=item B<cast cast-cbc>
194
195CAST Cipher
196
197=item B<cast5-cbc cast5-cfb cast5-ecb cast5-ofb>
198
199CAST5 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
203DES Cipher
204
205=item B<des3 desx des-ede3 des-ede3-cbc des-ede3-cfb des-ede3-ofb>
206
207Triple-DES Cipher
208
209=item B<idea idea-cbc idea-cfb idea-ecb idea-ofb>
210
211IDEA Cipher
212
213=item B<rc2 rc2-cbc rc2-cfb rc2-ecb rc2-ofb>
214
215RC2 Cipher
216
217=item B<rc4>
218
219RC4 Cipher
220
221=item B<rc5 rc5-cbc rc5-cfb rc5-ecb rc5-ofb>
222
223RC5 Cipher
224
225=back
226
227=head1 DETAILED COMMAND DESCRIPTION
228
229The 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
256The B<s_client> command implements a generic SSL/TLS client which can
257establish a transparent connection to a remote I<host> and I<port> speaking
258SSL/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
288The B<s_server> command implements a generic SSL/TLS server which accepts
289connections from remote clients on I<port> speaking SSL/TLS.
290
291=back
292
293...
294
295=head1 SEE ALSO
296
297crypto(3), ssl(3)
298
299=head1 HISTORY
300
301The 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
2This is some preliminary documentation for OpenSSL. 2This is some preliminary documentation for OpenSSL.
3 3
4============================================================================== 4Contents:
5 BUFFER Library
6==============================================================================
7
8The buffer library handles simple character arrays. Buffers are used for
9various purposes in the library, most notably memory BIOs.
10
11The library uses the BUF_MEM structure defined in buffer.h:
12
13typedef 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
21memory allocated to the buffer. There are three functions which handle these
22and one "miscellaneous" function.
23
24BUF_MEM *BUF_MEM_new()
25
26This allocates a new buffer of zero size. Returns the buffer or NULL on error.
27
28void BUF_MEM_free(BUF_MEM *a)
29
30This frees up an already existing buffer. The data is zeroed before freeing
31up in case the buffer contains sensitive data.
32
33int BUF_MEM_grow(BUF_MEM *str, int len)
34
35This changes the size of an already existing buffer. It returns zero on error
36or the new size (i.e. 'len'). Any data already in the buffer is preserved if
37it increases in size.
38
39char * BUF_strdup(char *str)
40 5
41This is the previously mentioned strdup function: like the standard library 6 OpenSSL X509V3 extension configuration
42strdup() it copies a null terminated string into a block of allocated memory 7 X509V3 Extension code: programmers guide
43and returns a pointer to the allocated block. 8 PKCS#12 Library
44 9
45Unlike the standard C library strdup() this function uses Malloc() and so
46should be used in preference to the standard library strdup() because it can
47be used for memory leak checking or replacing the malloc() function.
48
49The memory allocated from BUF_strdup() should be freed up using the Free()
50function.
51 10
52============================================================================== 11==============================================================================
53 OpenSSL X509V3 extension configuration 12 OpenSSL X509V3 extension configuration
@@ -188,7 +147,7 @@ email.1=steve@here
188email.2=steve@there 147email.2=steve@there
189 148
190This is because the configuration file code cannot handle the same name 149This is because the configuration file code cannot handle the same name
191occurring twice in the same extension. 150occurring twice in the same section.
192 151
193The syntax of raw extensions is governed by the extension code: it can 152The syntax of raw extensions is governed by the extension code: it can
194for example contain data in multiple sections. The correct syntax to 153for 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.
315According to PKIX recommendations it should exclude the extension entirely, 274According to PKIX recommendations it should exclude the extension entirely,
316however some software may require CA set to FALSE for end entity certificates. 275however some software may require CA set to FALSE for end entity certificates.
317 276
277Extended Key Usage.
278
279This extensions consists of a list of usages.
280
281These can either be object short names of the dotted numerical form of OIDs.
282While any OID can be used only certain values make sense. In particular the
283following PKIX, NS and MS values are meaningful:
284
285Value Meaning
286----- -------
287serverAuth SSL/TLS Web Server Authentication.
288clientAuth SSL/TLS Web Client Authentication.
289codeSigning Code signing.
290emailProtection E-mail Protection (S/MIME).
291timeStamping Trusted Timestamping
292msCodeInd Microsoft Individual Code Signing (authenticode)
293msCodeCom Microsoft Commercial Code Signing (authenticode)
294msCTLSign Microsoft Trust List Signing
295msSGC Microsoft Server Gated Crypto
296msEFS Microsoft Encrypted File System
297nsSGC Netscape Server Gated Crypto
298
299For example, under IE5 a CA can be used for any purpose: by including a list
300of the above usages the CA can be restricted to only authorised uses.
301
302Note: software packages may place additional interpretations on certificate
303use, in particular some usages may only work for selected CAs. Don't for example
304expect just including msSGC or nsSGC will automatically mean that a certificate
305can be used for SGC ("step up" encryption) otherwise anyone could use it.
306
307Examples:
308
309extendedKeyUsage=critical,codeSigning,1.2.3.4
310extendedKeyUsage=nsSGC,msSGC
311
318Subject Key Identifier. 312Subject Key Identifier.
319 313
320This is really a string extension and can take two possible values. Either 314This 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
4601. Initialisation and cleanup. 4541. Initialisation and cleanup.
461 455
462X509V3_add_standard_extensions(); 456No special initialisation is needed before calling the extension functions.
463 457You used to have to call X509V3_add_standard_extensions(); but this is no longer
464This function should be called before any other extension code. It adds support 458required and this function no longer does anything.
465for some common PKIX and Netscape extensions. Additional custom extensions can
466be added as well (see later).
467 459
468void X509V3_EXT_cleanup(void); 460void X509V3_EXT_cleanup(void);
469 461
470This function should be called last to cleanup the extension code. After this 462This function should be called to cleanup the extension code if any custom
471call no other extension calls should be made. 463extensions have been added. If no custom extensions have been added then this
464call does nothing. After this call all custom extension code is freed up but
465you can still use the standard extensions.
472 466
4732. Printing and parsing extensions. 4672. 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.
512In each case 'conf' is the LHASH pointer of the configuration file to use 506In each case 'conf' is the LHASH pointer of the configuration file to use
513and 'section' is the section containing the extension details. 507and 'section' is the section containing the extension details.
514 508
515See the 'context functions' section for a description of the ctx paramater. 509See the 'context functions' section for a description of the ctx parameter.
516 510
517 511
518X509_EXTENSION *X509V3_EXT_conf(LHASH *conf, X509V3_CTX *ctx, char *name, 512X509_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.
531For example to produce basicConstraints with the CA flag and a path length of 525For example to produce basicConstraints with the CA flag and a path length of
53210: 52610:
533 527
534x = X509V3_EXT_conf_nid(NULL, NULL, NID_basicConstraints, "CA:TRUE,pathlen:10"); 528x = X509V3_EXT_conf_nid(NULL, NULL, NID_basic_constraints,"CA:TRUE,pathlen:10");
535 529
536 530
537X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc); 531X509_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.
659int X509V3_add_value_bool(const char *name, int asn1_bool, 653int X509V3_add_value_bool(const char *name, int asn1_bool,
660 STACK_OF(CONF_VALUE) **extlist); 654 STACK_OF(CONF_VALUE) **extlist);
661 655
662This adds either "TRUE" or "FALSE" depending on the value of 'ans1_bool' 656This adds either "TRUE" or "FALSE" depending on the value of 'asn1_bool'
663 657
664int X509V3_add_value_bool_nf(char *name, int asn1_bool, 658int 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
686or return a STACK_OF(CONF_VALUE). 680or return a STACK_OF(CONF_VALUE).
687 681
688Raw extensions are just passed a BIO or a value and it is the extensions 682Raw extensions are just passed a BIO or a value and it is the extensions
689responsiblity to handle all the necessary printing. 683responsibility to handle all the necessary printing.
690 684
691There are two ways to add an extension. One is simply as an alias to an already 685There are two ways to add an extension. One is simply as an alias to an already
692existing extension. An alias is an extension that is identical in ASN1 structure 686existing 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
812This function is passed the internal extension structure in the ext parameter 806This function is passed the internal extension structure in the ext parameter
813and sends out a human readable version of the extension to out. The 'indent' 807and sends out a human readable version of the extension to out. The 'indent'
814paremeter should be noted to determine the necessary amount of indentation 808parameter should be noted to determine the necessary amount of indentation
815needed on the output. 809needed on the output.
816 810
817void * r2i(struct v3_ext_method *method, struct v3_ext_ctx *ctx, char *str); 811void * r2i(struct v3_ext_method *method, struct v3_ext_ctx *ctx, char *str);
@@ -882,7 +876,7 @@ d2i_PKCS12_fp(fp, p12)
882 876
883This is the same but for a FILE pointer. 877This is the same but for a FILE pointer.
884 878
8853. Parsing and creation functions. 8793. High level functions.
886 880
8873.1 Parsing with PKCS12_parse(). 8813.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);
920i2d_PKCS12_fp(fp, p12); 914i2d_PKCS12_fp(fp, p12);
921PKCS12_free(p12); 915PKCS12_free(p12);
922 916
9173.3 Changing a PKCS#12 structure password.
918
919int PKCS12_newpass(PKCS12 *p12, char *oldpass, char *newpass);
920
921This changes the password of an already existing PKCS#12 structure. oldpass
922is the old password and newpass is the new one. An error occurs if the old
923password is incorrect.
924
923LOW LEVEL FUNCTIONS. 925LOW LEVEL FUNCTIONS.
924 926
925In some cases the high level functions do not provide the necessary 927In 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
6SSL - OpenSSL SSL/TLS library
7
8=head1 SYNOPSIS
9
10=head1 DESCRIPTION
11
12The OpenSSL B<ssl> library implements the Secure Sockets Layer (SSL v2/v3) and
13Transport Layer Security (TLS v1) protocols. It provides a rich API which is
14documented here.
15
16=head1 HEADER FILES
17
18Currently the OpenSSL B<ssl> library provides the following C header files
19containing the prototypes for the data structures and and functions:
20
21=over 4
22
23=item B<ssl.h>
24
25That's the common header file for the SSL/TLS API. Include it into your
26program to make the API of the B<ssl> library available. It internally
27includes both more private SSL headers and headers from the B<crypto> library.
28Whenever you need hard-core details on the internals of the SSL API, look
29inside this header file.
30
31=item B<ssl2.h>
32
33That's the sub header file dealing with the SSLv2 protocol only.
34I<Usually you don't have to include it explicitly because
35it's already included by ssl.h>.
36
37=item B<ssl3.h>
38
39That's the sub header file dealing with the SSLv3 protocol only.
40I<Usually you don't have to include it explicitly because
41it's already included by ssl.h>.
42
43=item B<ssl23.h>
44
45That's the sub header file dealing with the combined use of the SSLv2 and
46SSLv3 protocols.
47I<Usually you don't have to include it explicitly because
48it's already included by ssl.h>.
49
50=item B<tls1.h>
51
52That's the sub header file dealing with the TLSv1 protocol only.
53I<Usually you don't have to include it explicitly because
54it's already included by ssl.h>.
55
56=back
57
58=head1 DATA STRUCTURES
59
60Currently the OpenSSL B<ssl> library functions deals with the following data
61structures:
62
63=over 4
64
65=item B<SSL_METHOD> (SSL Method)
66
67That's a dispatch structure describing the internal B<ssl> library
68methods/functions which implement the various protocol versions (SSLv1, SSLv2
69and TLSv1). It's needed to create an B<SSL_CTX>.
70
71=item B<SSL_CIPHER> (SSL Cipher)
72
73This structure holds the algorithm information for a particular cipher which
74are a core part of the SSL/TLS protocol. The available ciphers are configured
75on a B<SSL_CTX> basis and the actually used ones are then part of the
76B<SSL_SESSION>.
77
78=item B<SSL_CTX> (SSL Context)
79
80That's the global context structure which is created by a server or client
81once per program life-time and which holds mainly default values for the
82B<SSL> structures which are later created for the connections.
83
84=item B<SSL_SESSION> (SSL Session)
85
86This is a structure containing the current SSL session details for a
87connection: B<SSL_CIPHER>s, client and server certificates, keys, etc.
88
89=item B<SSL> (SSL Connection)
90
91That's the main SSL/TLS structure which is created by a server or client per
92established connection. This actually is the core structure in the SSL API.
93Under run-time the application usually deals with this structure which has
94links to mostly all other structures.
95
96=back
97
98=head1 API FUNCTIONS
99
100Currently the OpenSSL B<ssl> library exports 214 API functions.
101They are documented in the following:
102
103=head2 DEALING WITH PROTOCOL METHODS
104
105Here we document the various API functions which deal with the SSL/TLS
106protocol methods defined in B<SSL_METHOD> structures.
107
108=over 4
109
110=item SSL_METHOD *B<SSLv2_client_method>(void);
111
112Constructor for the SSLv2 SSL_METHOD structure for a dedicated client.
113
114=item SSL_METHOD *B<SSLv2_server_method>(void);
115
116Constructor for the SSLv2 SSL_METHOD structure for a dedicated server.
117
118=item SSL_METHOD *B<SSLv2_method>(void);
119
120Constructor for the SSLv2 SSL_METHOD structure for combined client and server.
121
122=item SSL_METHOD *B<SSLv3_client_method>(void);
123
124Constructor for the SSLv3 SSL_METHOD structure for a dedicated client.
125
126=item SSL_METHOD *B<SSLv3_server_method>(void);
127
128Constructor for the SSLv3 SSL_METHOD structure for a dedicated server.
129
130=item SSL_METHOD *B<SSLv3_method>(void);
131
132Constructor for the SSLv3 SSL_METHOD structure for combined client and server.
133
134=item SSL_METHOD *B<TLSv1_client_method>(void);
135
136Constructor for the TLSv1 SSL_METHOD structure for a dedicated client.
137
138=item SSL_METHOD *B<TLSv1_server_method>(void);
139
140Constructor for the TLSv1 SSL_METHOD structure for a dedicated server.
141
142=item SSL_METHOD *B<TLSv1_method>(void);
143
144Constructor for the TLSv1 SSL_METHOD structure for combined client and server.
145
146=back
147
148=head2 DEALING WITH CIPHERS
149
150Here we document the various API functions which deal with the SSL/TLS
151ciphers 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
157Write a string to I<buf> (with a maximum size of I<len>) containing a human
158readable description of I<cipher>. Returns I<buf>.
159
160=item int B<SSL_CIPHER_get_bits>(SSL_CIPHER *cipher, int *alg_bits);
161
162Determine the number of bits in I<cipher>. Because of export crippled ciphers
163there are two bits: The bits the algorithm supports in general (stored to
164I<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
168Return the internal name of I<cipher> as a string. These are the various
169strings defined by the I<SSL2_TXT_xxx>, I<SSL3_TXT_xxx> and I<TLS1_TXT_xxx>
170definitions in the header files.
171
172=item char *B<SSL_CIPHER_get_version>(SSL_CIPHER *cipher);
173
174Returns a string like "C<TLSv1/SSLv3>" or "C<SSLv2>" which indicates the
175SSL/TLS protocol version to which I<cipher> belongs (i.e. where it was defined
176in the specification the first time).
177
178=back
179
180=head2 DEALING WITH PROTOCOL CONTEXTS
181
182Here we document the various API functions which deal with the SSL/TLS
183protocol 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
315C<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
317Sets the callback which will be called when a temporary private key is
318required. The B<C<export>> flag will be set if the reason for needing
319a temp key is that an export ciphersuite is in use, in which case,
320B<C<keylength>> will contain the required keylength in bits. Generate a key of
321appropriate size (using ???) and return it.
322
323=item SSL_set_tmp_rsa_callback
324
325long B<SSL_set_tmp_rsa_callback>(SSL *ssl, RSA *(*cb)(SSL *ssl, int export, int keylength));
326
327The same as L<"SSL_CTX_set_tmp_rsa_callback">, except it operates on an SSL
328session 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
354Here we document the various API functions which deal with the SSL/TLS
355sessions 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
393Here we document the various API functions which deal with the SSL/TLS
394connection 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
626openssl(1), crypto(3)
627
628=head1 HISTORY
629
630The 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
5SSL_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
15SSL_get_error() returns a result code (suitable for the C "switch"
16statement) for a preceding call to SSL_connect(), SSL_accept(),
17SSL_read(), or SSL_write() on B<ssl>. The value returned by that
18SSL I/O function must be passed to SSL_get_error() in parameter
19B<ret>.
20
21In addition to B<ssl> and B<ret>, SSL_get_error() inspects the
22current thread's OpenSSL error queue. Thus, SSL_get_error() must be
23used in the same thread that performed the SSL I/O operation, and no
24other OpenSSL function calls should appear in between. The current
25thread's error queue must be empty before the SSL I/O operation is
26attempted, or SSL_get_error() will not work reliably.
27
28=head1 RETURN VALUES
29
30The following return values can currently occur:
31
32=over 4
33
34=item SSL_ERROR_NONE
35
36The SSL I/O operation completed. This result code is returned
37if and only if B<ret E<gt> 0>.
38
39=item SSL_ERROR_ZERO_RETURN
40
41The SSL connection has been closed. If the protocol version is SSL 3.0
42or TLS 1.0, this result code is returned only if a closure
43alerts has occurred in the protocol, i.e. if the connection has been
44closed cleanly.
45
46=item SSL_ERROR_WANT_READ, SSL_ERROR_WANT_WRITE
47
48The operation did not complete; the same SSL I/O function should be
49called again later. There will be protocol progress if, by then, the
50underlying B<BIO> has data available for reading (if the result code is
51B<SSL_ERROR_WANT_READ>) or allows writing data (B<SSL_ERROR_WANT_WRITE>).
52For socket B<BIO>s (e.g. when SSL_set_fd() was used) this means that
53select() or poll() on the underlying socket can be used to find out
54when the SSL I/O function should be retried.
55
56Caveat: Any SSL I/O function can lead to either of
57B<SSL_ERROR_WANT_READ> and B<SSL_ERROR_WANT_WRITE>, i.e. SSL_read()
58may want to write data and SSL_write() may want to read data.
59
60=item SSL_ERROR_WANT_X509_LOOKUP
61
62The operation did not complete because an application callback set by
63SSL_CTX_set_client_cert_cb() has asked to be called again.
64The SSL I/O function should be called again later.
65Details depend on the application.
66
67=item SSL_ERROR_SYSCALL
68
69Some I/O error occurred. The OpenSSL error queue may contain more
70information 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
72about the error: If B<ret == 0>, an EOF was observed that violates
73the protocol. If B<ret == -1>, the underlying B<BIO> reported an
74I/O error (for socket I/O on Unix systems, consult B<errno> for details).
75
76=item SSL_ERROR_SSL
77
78A failure in the SSL library occurred, usually a protocol error. The
79OpenSSL error queue contains more information on the error.
80
81=back
82
83=head1 SEE ALSO
84
85L<ssl(3)|ssl(3)>, L<err(3)|err(3)>
86
87=head1 HISTORY
88
89SSL_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
6SSL - OpenSSL SSL/TLS library
7
8=head1 SYNOPSIS
9
10=head1 DESCRIPTION
11
12The OpenSSL B<ssl> library implements the Secure Sockets Layer (SSL v2/v3) and
13Transport Layer Security (TLS v1) protocols. It provides a rich API which is
14documented here.
15
16=head1 HEADER FILES
17
18Currently the OpenSSL B<ssl> library provides the following C header files
19containing the prototypes for the data structures and and functions:
20
21=over 4
22
23=item B<ssl.h>
24
25That's the common header file for the SSL/TLS API. Include it into your
26program to make the API of the B<ssl> library available. It internally
27includes both more private SSL headers and headers from the B<crypto> library.
28Whenever you need hard-core details on the internals of the SSL API, look
29inside this header file.
30
31=item B<ssl2.h>
32
33That's the sub header file dealing with the SSLv2 protocol only.
34I<Usually you don't have to include it explicitly because
35it's already included by ssl.h>.
36
37=item B<ssl3.h>
38
39That's the sub header file dealing with the SSLv3 protocol only.
40I<Usually you don't have to include it explicitly because
41it's already included by ssl.h>.
42
43=item B<ssl23.h>
44
45That's the sub header file dealing with the combined use of the SSLv2 and
46SSLv3 protocols.
47I<Usually you don't have to include it explicitly because
48it's already included by ssl.h>.
49
50=item B<tls1.h>
51
52That's the sub header file dealing with the TLSv1 protocol only.
53I<Usually you don't have to include it explicitly because
54it's already included by ssl.h>.
55
56=back
57
58=head1 DATA STRUCTURES
59
60Currently the OpenSSL B<ssl> library functions deals with the following data
61structures:
62
63=over 4
64
65=item B<SSL_METHOD> (SSL Method)
66
67That's a dispatch structure describing the internal B<ssl> library
68methods/functions which implement the various protocol versions (SSLv1, SSLv2
69and TLSv1). It's needed to create an B<SSL_CTX>.
70
71=item B<SSL_CIPHER> (SSL Cipher)
72
73This structure holds the algorithm information for a particular cipher which
74are a core part of the SSL/TLS protocol. The available ciphers are configured
75on a B<SSL_CTX> basis and the actually used ones are then part of the
76B<SSL_SESSION>.
77
78=item B<SSL_CTX> (SSL Context)
79
80That's the global context structure which is created by a server or client
81once per program life-time and which holds mainly default values for the
82B<SSL> structures which are later created for the connections.
83
84=item B<SSL_SESSION> (SSL Session)
85
86This is a structure containing the current SSL session details for a
87connection: B<SSL_CIPHER>s, client and server certificates, keys, etc.
88
89=item B<SSL> (SSL Connection)
90
91That's the main SSL/TLS structure which is created by a server or client per
92established connection. This actually is the core structure in the SSL API.
93Under run-time the application usually deals with this structure which has
94links to mostly all other structures.
95
96=back
97
98=head1 API FUNCTIONS
99
100Currently the OpenSSL B<ssl> library exports 214 API functions.
101They are documented in the following:
102
103=head2 DEALING WITH PROTOCOL METHODS
104
105Here we document the various API functions which deal with the SSL/TLS
106protocol methods defined in B<SSL_METHOD> structures.
107
108=over 4
109
110=item SSL_METHOD *B<SSLv2_client_method>(void);
111
112Constructor for the SSLv2 SSL_METHOD structure for a dedicated client.
113
114=item SSL_METHOD *B<SSLv2_server_method>(void);
115
116Constructor for the SSLv2 SSL_METHOD structure for a dedicated server.
117
118=item SSL_METHOD *B<SSLv2_method>(void);
119
120Constructor for the SSLv2 SSL_METHOD structure for combined client and server.
121
122=item SSL_METHOD *B<SSLv3_client_method>(void);
123
124Constructor for the SSLv3 SSL_METHOD structure for a dedicated client.
125
126=item SSL_METHOD *B<SSLv3_server_method>(void);
127
128Constructor for the SSLv3 SSL_METHOD structure for a dedicated server.
129
130=item SSL_METHOD *B<SSLv3_method>(void);
131
132Constructor for the SSLv3 SSL_METHOD structure for combined client and server.
133
134=item SSL_METHOD *B<TLSv1_client_method>(void);
135
136Constructor for the TLSv1 SSL_METHOD structure for a dedicated client.
137
138=item SSL_METHOD *B<TLSv1_server_method>(void);
139
140Constructor for the TLSv1 SSL_METHOD structure for a dedicated server.
141
142=item SSL_METHOD *B<TLSv1_method>(void);
143
144Constructor for the TLSv1 SSL_METHOD structure for combined client and server.
145
146=back
147
148=head2 DEALING WITH CIPHERS
149
150Here we document the various API functions which deal with the SSL/TLS
151ciphers 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
157Write a string to I<buf> (with a maximum size of I<len>) containing a human
158readable description of I<cipher>. Returns I<buf>.
159
160=item int B<SSL_CIPHER_get_bits>(SSL_CIPHER *cipher, int *alg_bits);
161
162Determine the number of bits in I<cipher>. Because of export crippled ciphers
163there are two bits: The bits the algorithm supports in general (stored to
164I<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
168Return the internal name of I<cipher> as a string. These are the various
169strings defined by the I<SSL2_TXT_xxx>, I<SSL3_TXT_xxx> and I<TLS1_TXT_xxx>
170definitions in the header files.
171
172=item char *B<SSL_CIPHER_get_version>(SSL_CIPHER *cipher);
173
174Returns a string like "C<TLSv1/SSLv3>" or "C<SSLv2>" which indicates the
175SSL/TLS protocol version to which I<cipher> belongs (i.e. where it was defined
176in the specification the first time).
177
178=back
179
180=head2 DEALING WITH PROTOCOL CONTEXTS
181
182Here we document the various API functions which deal with the SSL/TLS
183protocol 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
315C<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
317Sets the callback which will be called when a temporary private key is
318required. The B<C<export>> flag will be set if the reason for needing
319a temp key is that an export ciphersuite is in use, in which case,
320B<C<keylength>> will contain the required keylength in bits. Generate a key of
321appropriate size (using ???) and return it.
322
323=item SSL_set_tmp_rsa_callback
324
325long B<SSL_set_tmp_rsa_callback>(SSL *ssl, RSA *(*cb)(SSL *ssl, int export, int keylength));
326
327The same as L<"SSL_CTX_set_tmp_rsa_callback">, except it operates on an SSL
328session 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
354Here we document the various API functions which deal with the SSL/TLS
355sessions 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
393Here we document the various API functions which deal with the SSL/TLS
394connection 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
626L<openssl(1)|openssl(1)>, L<crypto(3)|crypto(3)>,
627L<SSL_get_error(3)|SSL_get_error(3)>
628
629=head1 HISTORY
630
631The 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);
6710before any multithreading is started. 6710before any multithreading is started.
6711id_function does not need to be defined under Windows NT or 95, the 6711id_function does not need to be defined under Windows NT or 95, the
6712correct function will be called if it is not. Under unix, getpid() 6712correct function will be called if it is not. Under unix, getpid()
6713is call if the id_callback is not defined, for solaris this is wrong 6713is 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
6717The locking_callback is used to perform locking by the SSLeay library. 6717The locking_callback is used to perform locking by the SSLeay library.