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/apps/CA.pl.pod29
-rw-r--r--src/lib/libssl/src/doc/apps/dgst.pod2
-rw-r--r--src/lib/libssl/src/doc/apps/dhparam.pod40
-rw-r--r--src/lib/libssl/src/doc/apps/genrsa.pod3
-rw-r--r--src/lib/libssl/src/doc/apps/openssl.pod33
-rw-r--r--src/lib/libssl/src/doc/apps/rand.pod50
-rw-r--r--src/lib/libssl/src/doc/apps/s_client.pod16
-rw-r--r--src/lib/libssl/src/doc/apps/x509.pod7
-rw-r--r--src/lib/libssl/src/doc/crypto/DH_set_method.pod2
-rw-r--r--src/lib/libssl/src/doc/crypto/DSA_set_method.pod5
-rw-r--r--src/lib/libssl/src/doc/crypto/EVP_OpenInit.pod51
-rw-r--r--src/lib/libssl/src/doc/crypto/EVP_SealInit.pod70
-rw-r--r--src/lib/libssl/src/doc/crypto/EVP_SignInit.pod85
-rw-r--r--src/lib/libssl/src/doc/crypto/EVP_VerifyInit.pod71
-rw-r--r--src/lib/libssl/src/doc/crypto/RAND_add.pod25
-rw-r--r--src/lib/libssl/src/doc/crypto/RAND_set_rand_method.pod4
-rw-r--r--src/lib/libssl/src/doc/crypto/RSA_set_method.pod5
-rw-r--r--src/lib/libssl/src/doc/crypto/blowfish.pod15
-rw-r--r--src/lib/libssl/src/doc/crypto/des.pod376
-rw-r--r--src/lib/libssl/src/doc/crypto/des_modes.pod3
-rw-r--r--src/lib/libssl/src/doc/crypto/rsa.pod5
21 files changed, 853 insertions, 44 deletions
diff --git a/src/lib/libssl/src/doc/apps/CA.pl.pod b/src/lib/libssl/src/doc/apps/CA.pl.pod
index 83e4c0af81..9d287f0c4d 100644
--- a/src/lib/libssl/src/doc/apps/CA.pl.pod
+++ b/src/lib/libssl/src/doc/apps/CA.pl.pod
@@ -102,6 +102,35 @@ the request and finally create a PKCS#12 file containing it.
102 CA.pl -signreq 102 CA.pl -signreq
103 CA.pl -pkcs12 "My Test Certificate" 103 CA.pl -pkcs12 "My Test Certificate"
104 104
105=head1 DSA CERTIFICATES
106
107Although the B<CA.pl> creates RSA CAs and requests it is still possible to
108use it with DSA certificates and requests using the L<req(1)|req(1)> command
109directly. The following example shows the steps that would typically be taken.
110
111Create some DSA parameters:
112
113 openssl dsaparam -out dsap.pem 1024
114
115Create a DSA CA certificate and private key:
116
117 openssl req -x509 -newkey dsa:dsap.pem -keyout cacert.pem -out cacert.pem
118
119Create the CA directories and files:
120
121 CA.pl -newca
122
123enter cacert.pem when prompted for the CA file name.
124
125Create a DSA certificate request and privat key (a different set of parameters
126can optionally be created first):
127
128 openssl req -out newreq.pem -newkey dsa:dsap.pem
129
130Sign the request:
131
132 CA.pl -signreq
133
105=head1 NOTES 134=head1 NOTES
106 135
107Most of the filenames mentioned can be modified by editing the B<CA.pl> script. 136Most of the filenames mentioned can be modified by editing the B<CA.pl> script.
diff --git a/src/lib/libssl/src/doc/apps/dgst.pod b/src/lib/libssl/src/doc/apps/dgst.pod
index cbf2cc529a..fcfd3ecf23 100644
--- a/src/lib/libssl/src/doc/apps/dgst.pod
+++ b/src/lib/libssl/src/doc/apps/dgst.pod
@@ -6,7 +6,7 @@ dgst, md5, md2, sha1, sha, mdc2, ripemd160 - message digests
6 6
7=head1 SYNOPSIS 7=head1 SYNOPSIS
8 8
9[B<dgst>] 9B<openssl> B<dgst>
10[B<-md5|-md2|-sha1|-sha|mdc2|-ripemd160>] 10[B<-md5|-md2|-sha1|-sha|mdc2|-ripemd160>]
11[B<-c>] 11[B<-c>]
12[B<-d>] 12[B<-d>]
diff --git a/src/lib/libssl/src/doc/apps/dhparam.pod b/src/lib/libssl/src/doc/apps/dhparam.pod
index 6b237ec05a..15aabf4ac8 100644
--- a/src/lib/libssl/src/doc/apps/dhparam.pod
+++ b/src/lib/libssl/src/doc/apps/dhparam.pod
@@ -6,18 +6,19 @@ dhparam - DH parameter manipulation and generation
6 6
7=head1 SYNOPSIS 7=head1 SYNOPSIS
8 8
9B<openssl dh> 9B<openssl dhparam>
10[B<-inform DER|PEM>] 10[B<-inform DER|PEM>]
11[B<-outform DER|PEM>] 11[B<-outform DER|PEM>]
12[B<-in filename>] 12[B<-in> I<filename>]
13[B<-out filename>] 13[B<-out> I<filename>]
14[B<-dsaparam>]
14[B<-noout>] 15[B<-noout>]
15[B<-text>] 16[B<-text>]
16[B<-C>] 17[B<-C>]
17[B<-2>] 18[B<-2>]
18[B<-5>] 19[B<-5>]
19[B<-rand file(s)>] 20[B<-rand> I<file(s)>]
20[numbits] 21[I<numbits>]
21 22
22=head1 DESCRIPTION 23=head1 DESCRIPTION
23 24
@@ -39,23 +40,35 @@ additional header and footer lines.
39This specifies the output format, the options have the same meaning as the 40This specifies the output format, the options have the same meaning as the
40B<-inform> option. 41B<-inform> option.
41 42
42=item B<-in filename> 43=item B<-in> I<filename>
43 44
44This specifies the input filename to read parameters from or standard input if 45This specifies the input filename to read parameters from or standard input if
45this option is not specified. 46this option is not specified.
46 47
47=item B<-out filename> 48=item B<-out> I<filename>
48 49
49This specifies the output filename parameters to. Standard output is used 50This 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 51if this option is not present. The output filename should B<not> be the same
51as the input filename. 52as the input filename.
52 53
54=item B<-dsaparam>
55
56If this option is used, DSA rather than DH parameters are read or created;
57they are converted to DH format. Otherwise, "strong" primes (such
58that (p-1)/2 is also prime) will be used for DH parameter generation.
59
60DH parameter generation with the B<-dsaparam> option is much faster,
61and the recommended exponent length is shorter, which makes DH key
62exchange more efficient. Beware that with such DSA-style DH
63parameters, a fresh DH key should be created for each use to
64avoid small-subgroup attacks that may be possible otherwise.
65
53=item B<-2>, B<-5> 66=item B<-2>, B<-5>
54 67
55The generator to use, either 2 or 5. 2 is the default. If present then the 68The generator to use, either 2 or 5. 2 is the default. If present then the
56input file is ignored and parameters are generated instead. 69input file is ignored and parameters are generated instead.
57 70
58=item B<-rand file(s)> 71=item B<-rand> I<file(s)>
59 72
60a file or files containing random data used to seed the random number 73a 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)>). 74generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>).
@@ -63,10 +76,10 @@ Multiple files can be specified separated by a OS-dependent character.
63The separator is B<;> for MS-Windows, B<,> for OpenVSM, and B<:> for 76The separator is B<;> for MS-Windows, B<,> for OpenVSM, and B<:> for
64all others. 77all others.
65 78
66=item B<numbits> 79=item I<numbits>
67 80
68this option specifies that a parameter set should be generated of size 81this 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 82I<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 83is used. If this option is present then the input file is ignored and
71parameters are generated instead. 84parameters are generated instead.
72 85
@@ -81,7 +94,7 @@ this option prints out the DH parameters in human readable form.
81=item B<-C> 94=item B<-C>
82 95
83this option converts the parameters into C code. The parameters can then 96this option converts the parameters into C code. The parameters can then
84be loaded by calling the B<get_dhXXX()> function. 97be loaded by calling the B<get_dh>I<numbits>B<()> function.
85 98
86=back 99=back
87 100
@@ -112,4 +125,9 @@ There should be a way to generate and manipulate DH keys.
112 125
113L<dsaparam(1)|dsaparam(1)> 126L<dsaparam(1)|dsaparam(1)>
114 127
128=head1 HISTORY
129
130The B<dhparam> command was added in OpenSSL 0.9.5.
131The B<-dsaparam> option was added in OpenSSL 0.9.6.
132
115=cut 133=cut
diff --git a/src/lib/libssl/src/doc/apps/genrsa.pod b/src/lib/libssl/src/doc/apps/genrsa.pod
index a2d878410b..70d35fef0a 100644
--- a/src/lib/libssl/src/doc/apps/genrsa.pod
+++ b/src/lib/libssl/src/doc/apps/genrsa.pod
@@ -83,3 +83,6 @@ be much larger (typically 1024 bits).
83=head1 SEE ALSO 83=head1 SEE ALSO
84 84
85L<gendsa(1)|gendsa(1)> 85L<gendsa(1)|gendsa(1)>
86
87=cut
88
diff --git a/src/lib/libssl/src/doc/apps/openssl.pod b/src/lib/libssl/src/doc/apps/openssl.pod
index 9b1320606b..2fc61b6c21 100644
--- a/src/lib/libssl/src/doc/apps/openssl.pod
+++ b/src/lib/libssl/src/doc/apps/openssl.pod
@@ -12,6 +12,10 @@ I<command>
12[ I<command_opts> ] 12[ I<command_opts> ]
13[ I<command_args> ] 13[ I<command_args> ]
14 14
15B<openssl> [ B<list-standard-commands> | B<list-message-digest-commands> | B<list-cipher-commands> ]
16
17B<openssl> B<no->I<XXX> [ I<arbitrary options> ]
18
15=head1 DESCRIPTION 19=head1 DESCRIPTION
16 20
17OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL 21OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL
@@ -35,6 +39,22 @@ The 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 39SYNOPSIS above), each of which often has a wealth of options and arguments
36(I<command_opts> and I<command_args> in the SYNOPSIS). 40(I<command_opts> and I<command_args> in the SYNOPSIS).
37 41
42The pseudo-commands B<list-standard-commands>, B<list-message-digest-commands>,
43and B<list-cipher-commands> output a list (one entry per line) of the names
44of all standard commands, message digest commands, or cipher commands,
45respectively, that are available in the present B<openssl> utility.
46
47The pseudo-command B<no->I<XXX> tests whether a command of the
48specified name is available. If no command named I<XXX> exists, it
49returns 0 (success) and prints B<no->I<XXX>; otherwise it returns 1
50and prints I<XXX>. In both cases, the output goes to B<stdout> and
51nothing is printed to B<stderr>. Additional command line arguments
52are always ignored. Since for each cipher there is a command of the
53same name, this provides an easy way for shell scripts to test for the
54availability of ciphers in the B<openssl> program. (B<no->I<XXX> is
55not able to detect pseudo-commands such as B<quit>,
56B<list->I<...>B<-commands>, or B<no->I<XXX> itself.)
57
38=head2 STANDARD COMMANDS 58=head2 STANDARD COMMANDS
39 59
40=over 10 60=over 10
@@ -103,6 +123,10 @@ Generation of hashed passwords.
103 123
104PKCS#7 Data Management. 124PKCS#7 Data Management.
105 125
126=item L<B<rand>|rand(1)>
127
128Generate pseudo-random bytes.
129
106=item L<B<req>|req(1)> 130=item L<B<req>|req(1)>
107 131
108X.509 Certificate Signing Request (CSR) Management. 132X.509 Certificate Signing Request (CSR) Management.
@@ -285,14 +309,17 @@ L<enc(1)|enc(1)>, L<gendsa(1)|gendsa(1)>,
285L<genrsa(1)|genrsa(1)>, L<nseq(1)|nseq(1)>, L<openssl(1)|openssl(1)>, 309L<genrsa(1)|genrsa(1)>, L<nseq(1)|nseq(1)>, L<openssl(1)|openssl(1)>,
286L<passwd(1)|passwd(1)>, 310L<passwd(1)|passwd(1)>,
287L<pkcs12(1)|pkcs12(1)>, L<pkcs7(1)|pkcs7(1)>, L<pkcs8(1)|pkcs8(1)>, 311L<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)>, 312L<rand(1)|rand(1)>, L<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)>, 313L<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)>, 314L<verify(1)|verify(1)>, L<version(1)|version(1)>, L<x509(1)|x509(1)>,
291L<crypto(3)|crypto(3)>, L<ssl(3)|ssl(3)> 315L<crypto(3)|crypto(3)>, L<ssl(3)|ssl(3)>
292 316
293=head1 HISTORY 317=head1 HISTORY
294 318
295The openssl(1) document appeared in OpenSSL 0.9.2 319The openssl(1) document appeared in OpenSSL 0.9.2.
320The B<list->I<XXX>B<-commands> pseudo-commands were added in OpenSSL 0.9.3;
321the B<no->I<XXX> pseudo-commands were added in OpenSSL 0.9.5a.
322For notes on the availability of other commands, see their individual
323manual pages.
296 324
297=cut 325=cut
298
diff --git a/src/lib/libssl/src/doc/apps/rand.pod b/src/lib/libssl/src/doc/apps/rand.pod
new file mode 100644
index 0000000000..f81eab0457
--- /dev/null
+++ b/src/lib/libssl/src/doc/apps/rand.pod
@@ -0,0 +1,50 @@
1=pod
2
3=head1 NAME
4
5rand - generate pseudo-random bytes
6
7=head1 SYNOPSIS
8
9B<openssl rand>
10[B<-out> I<file>]
11[B<-rand> I<file(s)>]
12[B<-base64>]
13I<num>
14
15=head1 DESCRIPTION
16
17The B<rand> command outputs I<num> pseudo-random bytes after seeding
18the random number generater once. As in other B<openssl> command
19line tools, PRNG seeding uses the file I<$HOME/>B<.rnd> or B<.rnd>
20in addition to the files given in the B<-rand> option. A new
21I<$HOME>/B<.rnd> or B<.rnd> file will be written back if enough
22seeding was obtained from these sources.
23
24=head1 OPTIONS
25
26=over 4
27
28=item B<-out> I<file>
29
30Write to I<file> instead of standard output.
31
32=item B<-rand> I<file(s)>
33
34Use specified file or files or EGD socket (see L<RAND_egd(3)|RAND_egd(3)>)
35for seeding the random number generator.
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<-base64>
41
42Perform base64 encoding on the output.
43
44=back
45
46=head1 SEE ALSO
47
48L<RAND_bytes(3)|RAND_bytes(3)>
49
50=cut
diff --git a/src/lib/libssl/src/doc/apps/s_client.pod b/src/lib/libssl/src/doc/apps/s_client.pod
index 3ede134164..2f80375319 100644
--- a/src/lib/libssl/src/doc/apps/s_client.pod
+++ b/src/lib/libssl/src/doc/apps/s_client.pod
@@ -22,6 +22,7 @@ B<openssl> B<s_client>
22[B<-state>] 22[B<-state>]
23[B<-nbio>] 23[B<-nbio>]
24[B<-crlf>] 24[B<-crlf>]
25[B<-ign_eof>]
25[B<-quiet>] 26[B<-quiet>]
26[B<-ssl2>] 27[B<-ssl2>]
27[B<-ssl3>] 28[B<-ssl3>]
@@ -122,9 +123,15 @@ turns on non-blocking I/O
122this option translated a line feed from the terminal into CR+LF as required 123this option translated a line feed from the terminal into CR+LF as required
123by some servers. 124by some servers.
124 125
126=item B<-ign_eof>
127
128inhibit shutting down the connection when end of file is reached in the
129input.
130
125=item B<-quiet> 131=item B<-quiet>
126 132
127inhibit printing of session and certificate information. 133inhibit printing of session and certificate information. This implicitely
134turns on B<-ign_eof> as well.
128 135
129=item B<-ssl2>, B<-ssl3>, B<-tls1>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1> 136=item B<-ssl2>, B<-ssl3>, B<-tls1>, B<-no_ssl2>, B<-no_ssl3>, B<-no_tls1>
130 137
@@ -155,9 +162,10 @@ command for more information.
155 162
156If a connection is established with an SSL server then any data received 163If 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 164from 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 165server. When used interactively (which means neither B<-quiet> nor B<-ign_eof>
159renegotiated. If the line begins with a B<Q> the connection will be closed 166have been given), the session will be renegociated if the line begins with an
160down. 167B<R>, and if the line begins with a B<Q> or if end of file is reached, the
168connection will be closed down.
161 169
162=head1 NOTES 170=head1 NOTES
163 171
diff --git a/src/lib/libssl/src/doc/apps/x509.pod b/src/lib/libssl/src/doc/apps/x509.pod
index b127182bbb..e4ae5468da 100644
--- a/src/lib/libssl/src/doc/apps/x509.pod
+++ b/src/lib/libssl/src/doc/apps/x509.pod
@@ -212,9 +212,10 @@ clears all the prohibited or rejected uses of the certificate.
212 212
213=item B<-addtrust arg> 213=item B<-addtrust arg>
214 214
215adds a trusted certificate use. Currently acceptable values 215adds a trusted certificate use. Any object name can be used here
216are B<all> (any purpose), B<sslclient> (SSL client use), B<sslserver> 216but currently only B<clientAuth> (SSL client use), B<serverAuth>
217(SSL server use) B<email> (S/MIME email) and B<objsign> (Object signing). 217(SSL server use) and B<emailProtection> (S/MIME email) are used.
218Other OpenSSL applications may define additional uses.
218 219
219=item B<-addreject arg> 220=item B<-addreject arg>
220 221
diff --git a/src/lib/libssl/src/doc/crypto/DH_set_method.pod b/src/lib/libssl/src/doc/crypto/DH_set_method.pod
index dca41d8dbc..a8f75bdd9d 100644
--- a/src/lib/libssl/src/doc/crypto/DH_set_method.pod
+++ b/src/lib/libssl/src/doc/crypto/DH_set_method.pod
@@ -56,7 +56,7 @@ the default method is used.
56 /* compute shared secret */ 56 /* compute shared secret */
57 int (*compute_key)(unsigned char *key, BIGNUM *pub_key, DH *dh); 57 int (*compute_key)(unsigned char *key, BIGNUM *pub_key, DH *dh);
58 58
59 /* compute r = a ^ p mod m. May be NULL */ 59 /* compute r = a ^ p mod m (May be NULL for some implementations) */
60 int (*bn_mod_exp)(DH *dh, BIGNUM *r, BIGNUM *a, const BIGNUM *p, 60 int (*bn_mod_exp)(DH *dh, BIGNUM *r, BIGNUM *a, const BIGNUM *p,
61 const BIGNUM *m, BN_CTX *ctx, 61 const BIGNUM *m, BN_CTX *ctx,
62 BN_MONT_CTX *m_ctx); 62 BN_MONT_CTX *m_ctx);
diff --git a/src/lib/libssl/src/doc/crypto/DSA_set_method.pod b/src/lib/libssl/src/doc/crypto/DSA_set_method.pod
index 0b13ec9237..edec46413d 100644
--- a/src/lib/libssl/src/doc/crypto/DSA_set_method.pod
+++ b/src/lib/libssl/src/doc/crypto/DSA_set_method.pod
@@ -62,12 +62,13 @@ struct
62 int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len, 62 int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len,
63 DSA_SIG *sig, DSA *dsa); 63 DSA_SIG *sig, DSA *dsa);
64 64
65 /* compute rr = a1^p1 * a2^p2 mod m. May be NULL */ 65 /* compute rr = a1^p1 * a2^p2 mod m (May be NULL for some
66 implementations) */
66 int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1, 67 int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1,
67 BIGNUM *a2, BIGNUM *p2, BIGNUM *m, 68 BIGNUM *a2, BIGNUM *p2, BIGNUM *m,
68 BN_CTX *ctx, BN_MONT_CTX *in_mont); 69 BN_CTX *ctx, BN_MONT_CTX *in_mont);
69 70
70 /* compute r = a ^ p mod m. May be NULL */ 71 /* compute r = a ^ p mod m (May be NULL for some implementations) */
71 int (*bn_mod_exp)(DSA *dsa, BIGNUM *r, BIGNUM *a, 72 int (*bn_mod_exp)(DSA *dsa, BIGNUM *r, BIGNUM *a,
72 const BIGNUM *p, const BIGNUM *m, 73 const BIGNUM *p, const BIGNUM *m,
73 BN_CTX *ctx, BN_MONT_CTX *m_ctx); 74 BN_CTX *ctx, BN_MONT_CTX *m_ctx);
diff --git a/src/lib/libssl/src/doc/crypto/EVP_OpenInit.pod b/src/lib/libssl/src/doc/crypto/EVP_OpenInit.pod
new file mode 100644
index 0000000000..9707a4b399
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/EVP_OpenInit.pod
@@ -0,0 +1,51 @@
1=pod
2
3=head1 NAME
4
5EVP_OpenInit, EVP_OpenUpdate, EVP_OpenFinal - EVP envelope decryption
6
7=head1 SYNOPSIS
8
9 #include <openssl/evp.h>
10
11 int EVP_OpenInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type,unsigned char *ek,
12 int ekl,unsigned char *iv,EVP_PKEY *priv);
13 void EVP_OpenUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
14 int *outl, unsigned char *in, int inl);
15 void EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out,
16 int *outl);
17
18=head1 DESCRIPTION
19
20The EVP envelope routines are a high level interface to envelope
21decryption. They decrypt a public key encrypted symmetric key and
22then decrypt data using it.
23
24EVP_OpenInit() initialises a cipher context B<ctx> for decryption
25with cipher B<type>. It decrypts the encrypted symmetric key of length
26B<ekl> bytes passed in the B<ek> parameter using the private key B<priv>.
27The IV is supplied in the B<iv> parameter.
28
29EVP_OpenUpdate() and EVP_OpenFinal() have exactly the same properties
30as the EVP_DecryptUpdate() and EVP_DecryptFinal() routines, as
31documented on the L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> manual
32page.
33
34=head1 RETURN VALUES
35
36EVP_OpenInit() returns -1 on error or an non zero integer (actually the
37recovered secret key size) if successful.
38
39EVP_SealUpdate() does not return a value.
40
41EVP_SealFinal() returns 0 if the decrypt failed or 1 for success.
42
43=head1 SEE ALSO
44
45L<evp(3)|evp(3)>,L<rand(3)|rand(3)>
46L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>,
47L<EVP_SealInit(3)|EVP_SealInit(3)>
48
49=head1 HISTORY
50
51=cut
diff --git a/src/lib/libssl/src/doc/crypto/EVP_SealInit.pod b/src/lib/libssl/src/doc/crypto/EVP_SealInit.pod
new file mode 100644
index 0000000000..1579d110fa
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/EVP_SealInit.pod
@@ -0,0 +1,70 @@
1=pod
2
3=head1 NAME
4
5EVP_SealInit, EVP_SealUpdate, EVP_SealFinal - EVP envelope encryption
6
7=head1 SYNOPSIS
8
9 #include <openssl/evp.h>
10
11 int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek,
12 int *ekl, unsigned char *iv,EVP_PKEY **pubk, int npubk);
13 void EVP_SealUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
14 int *outl, unsigned char *in, int inl);
15 void EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out,
16 int *outl);
17
18=head1 DESCRIPTION
19
20The EVP envelope routines are a high level interface to envelope
21encryption. They generate a random key and then "envelope" it by
22using public key encryption. Data can then be encrypted using this
23key.
24
25EVP_SealInit() initialises a cipher context B<ctx> for encryption
26with cipher B<type> using a random secret key and IV supplied in
27the B<iv> parameter. B<type> is normally supplied by a function such
28as EVP_des_cbc(). The secret key is encrypted using one or more public
29keys, this allows the same encrypted data to be decrypted using any
30of the corresponding private keys. B<ek> is an array of buffers where
31the public key encrypted secret key will be written, each buffer must
32contain enough room for the corresponding encrypted key: that is
33B<ek[i]> must have room for B<EVP_PKEY_size(pubk[i])> bytes. The actual
34size of each encrypted secret key is written to the array B<ekl>. B<pubk> is
35an array of B<npubk> public keys.
36
37EVP_SealUpdate() and EVP_SealFinal() have exactly the same properties
38as the EVP_EncryptUpdate() and EVP_EncryptFinal() routines, as
39documented on the L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> manual
40page.
41
42=head1 RETURN VALUES
43
44EVP_SealInit() returns -1 on error or B<npubk> if successful.
45
46EVP_SealUpdate() and EVP_SealFinal() do not return values.
47
48=head1 NOTES
49
50Because a random secret key is generated the random number generator
51must be seeded before calling EVP_SealInit().
52
53The public key must be RSA because it is the only OpenSSL public key
54algorithm that supports key transport.
55
56Envelope encryption is the usual method of using public key encryption
57on large amounts of data, this is because public key encryption is slow
58but symmetric encryption is fast. So symmetric encryption is used for
59bulk encryption and the small random symmetric key used is transferred
60using public key encryption.
61
62=head1 SEE ALSO
63
64L<evp(3)|evp(3)>,L<rand(3)|rand(3)>
65L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>,
66L<EVP_OpenInit(3)|EVP_OpenInit(3)>
67
68=head1 HISTORY
69
70=cut
diff --git a/src/lib/libssl/src/doc/crypto/EVP_SignInit.pod b/src/lib/libssl/src/doc/crypto/EVP_SignInit.pod
new file mode 100644
index 0000000000..bbc9203c9c
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/EVP_SignInit.pod
@@ -0,0 +1,85 @@
1=pod
2
3=head1 NAME
4
5EVP_SignInit, EVP_SignUpdate, EVP_SignFinal - EVP signing functions
6
7=head1 SYNOPSIS
8
9 #include <openssl/evp.h>
10
11 void EVP_SignInit(EVP_MD_CTX *ctx, const EVP_MD *type);
12 void EVP_SignUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt);
13 int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *sig,unsigned int *s, EVP_PKEY *pkey);
14
15 int EVP_PKEY_size(EVP_PKEY *pkey);
16
17=head1 DESCRIPTION
18
19The EVP signature routines are a high level interface to digital
20signatures.
21
22EVP_SignInit() initialises a signing context B<ctx> to using digest
23B<type>: this will typically be supplied by a function such as
24EVP_sha1().
25
26EVP_SignUpdate() hashes B<cnt> bytes of data at B<d> into the
27signature context B<ctx>. This funtion can be called several times on the
28same B<ctx> to include additional data.
29
30EVP_SignFinal() signs the data in B<ctx> using the private key B<pkey>
31and places the signature in B<sig>. If the B<s> parameter is not NULL
32then the number of bytes of data written (i.e. the length of the signature)
33will be written to the integer at B<s>, at most EVP_PKEY_size(pkey) bytes
34will be written. After calling EVP_SignFinal() no additional calls to
35EVP_SignUpdate() can be made, but EVP_SignInit() can be called to initialiase
36a new signature operation.
37
38EVP_PKEY_size() returns the maximum size of a signature in bytes. The actual
39signature returned by EVP_SignFinal() may be smaller.
40
41=head1 RETURN VALUES
42
43EVP_SignInit() and EVP_SignUpdate() do not return values.
44
45EVP_SignFinal() returns 1 for success and 0 for failure.
46
47EVP_PKEY_size() returns the maximum size of a signature in bytes.
48
49The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
50
51=head1 NOTES
52
53The B<EVP> interface to digital signatures should almost always be used in
54preference to the low level interfaces. This is because the code then becomes
55transparent to the algorithm used and much more flexible.
56
57Due to the link between message digests and public key algorithms the correct
58digest algorithm must be used with the correct public key type. A list of
59algorithms and associated public key algorithms appears in
60L<EVP_DigestInit(3)|EVP_DigestInit(3)>.
61
62When signing with DSA private keys the random number generator must be seeded
63or the operation will fail. The random number generator does not need to be
64seeded for RSA signatures.
65
66=head1 BUGS
67
68Several of the functions do not return values: maybe they should. Although the
69internal digest operations will never fail some future hardware based operations
70might.
71
72=head1 SEE ALSO
73
74L<EVP_VerifyInit(3)|EVP_VerifyInit(3)>,
75L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>,
76L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>,
77L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>,
78L<sha(3)|sha(3)>, L<digest(1)|digest(1)>
79
80=head1 HISTORY
81
82EVP_SignInit(), EVP_SignUpdate() and EVP_SignFinal() are
83available in all versions of SSLeay and OpenSSL.
84
85=cut
diff --git a/src/lib/libssl/src/doc/crypto/EVP_VerifyInit.pod b/src/lib/libssl/src/doc/crypto/EVP_VerifyInit.pod
new file mode 100644
index 0000000000..3b5e07f4ad
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/EVP_VerifyInit.pod
@@ -0,0 +1,71 @@
1=pod
2
3=head1 NAME
4
5EVP_VerifyInit, EVP_VerifyUpdate, EVP_VerifyFinal - EVP signature verification functions
6
7=head1 SYNOPSIS
8
9 #include <openssl/evp.h>
10
11 void EVP_VerifyInit(EVP_MD_CTX *ctx, const EVP_MD *type);
12 void EVP_VerifyUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt);
13 int EVP_VerifyFinal(EVP_MD_CTX *ctx,unsigned char *sigbuf, unsigned int siglen,EVP_PKEY *pkey);
14
15=head1 DESCRIPTION
16
17The EVP signature verification routines are a high level interface to digital
18signatures.
19
20EVP_VerifyInit() initialises a verification context B<ctx> to using digest
21B<type>: this will typically be supplied by a function such as EVP_sha1().
22
23EVP_VerifyUpdate() hashes B<cnt> bytes of data at B<d> into the
24verification context B<ctx>. This funtion can be called several times on the
25same B<ctx> to include additional data.
26
27EVP_VerifyFinal() verifies the data in B<ctx> using the public key B<pkey>
28and against the B<siglen> bytes at B<sigbuf>. After calling EVP_VerifyFinal()
29no additional calls to EVP_VerifyUpdate() can be made, but EVP_VerifyInit()
30can be called to initialiase a new verification operation.
31
32=head1 RETURN VALUES
33
34EVP_VerifyInit() and EVP_VerifyUpdate() do not return values.
35
36EVP_VerifyFinal() returns 1 for a correct signature, 0 for failure and -1 if some
37other error occurred.
38
39The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
40
41=head1 NOTES
42
43The B<EVP> interface to digital signatures should almost always be used in
44preference to the low level interfaces. This is because the code then becomes
45transparent to the algorithm used and much more flexible.
46
47Due to the link between message digests and public key algorithms the correct
48digest algorithm must be used with the correct public key type. A list of
49algorithms and associated public key algorithms appears in
50L<EVP_DigestInit(3)|EVP_DigestInit(3)>.
51
52=head1 BUGS
53
54Several of the functions do not return values: maybe they should. Although the
55internal digest operations will never fail some future hardware based operations
56might.
57
58=head1 SEE ALSO
59
60L<EVP_SignInit(3)|EVP_SignInit(3)>,
61L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>,
62L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>,
63L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>,
64L<sha(3)|sha(3)>, L<digest(1)|digest(1)>
65
66=head1 HISTORY
67
68EVP_VerifyInit(), EVP_VerifyUpdate() and EVP_VerifyFinal() are
69available in all versions of SSLeay and OpenSSL.
70
71=cut
diff --git a/src/lib/libssl/src/doc/crypto/RAND_add.pod b/src/lib/libssl/src/doc/crypto/RAND_add.pod
index 0a13ec2a92..67c66f3e0c 100644
--- a/src/lib/libssl/src/doc/crypto/RAND_add.pod
+++ b/src/lib/libssl/src/doc/crypto/RAND_add.pod
@@ -2,7 +2,8 @@
2 2
3=head1 NAME 3=head1 NAME
4 4
5RAND_add, RAND_seed, RAND_screen - add entropy to the PRNG 5RAND_add, RAND_seed, RAND_status, RAND_event, RAND_screen - add
6entropy to the PRNG
6 7
7=head1 SYNOPSIS 8=head1 SYNOPSIS
8 9
@@ -14,6 +15,7 @@ RAND_add, RAND_seed, RAND_screen - add entropy to the PRNG
14 15
15 int RAND_status(void); 16 int RAND_status(void);
16 17
18 int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam);
17 void RAND_screen(void); 19 void RAND_screen(void);
18 20
19=head1 DESCRIPTION 21=head1 DESCRIPTION
@@ -40,17 +42,24 @@ or L<RAND_load_file(3)|RAND_load_file(3)>.
40 42
41RAND_seed() is equivalent to RAND_add() when B<num == entropy>. 43RAND_seed() is equivalent to RAND_add() when B<num == entropy>.
42 44
45RAND_event() collects the entropy from Windows events such as mouse
46movements and other user interaction. It should be called with the
47B<iMsg>, B<wParam> and B<lParam> arguments of I<all> messages sent to
48the window procedure. It will estimate the entropy contained in the
49event message (if any), and add it to the PRNG. The program can then
50process the messages as usual.
51
43The RAND_screen() function is available for the convenience of Windows 52The RAND_screen() function is available for the convenience of Windows
44programmers. It adds the current contents of the screen to the PRNG. 53programmers. It adds the current contents of the screen to the PRNG.
45For applications that can catch Windows events, seeding the PRNG with 54For applications that can catch Windows events, seeding the PRNG by
46the parameters of B<WM_MOUSEMOVE> events is a significantly better 55calling RAND_event() is a significantly better source of
47source of randomness. It should be noted that both methods cannot be 56randomness. It should be noted that both methods cannot be used on
48used on servers that run without user interaction. 57servers that run without user interaction.
49 58
50=head1 RETURN VALUES 59=head1 RETURN VALUES
51 60
52RAND_status() returns 1 if the PRNG has been seeded with enough data, 61RAND_status() and RAND_event() return 1 if the PRNG has been seeded
530 otherwise. 62with enough data, 0 otherwise.
54 63
55The other functions do not return values. 64The other functions do not return values.
56 65
@@ -63,6 +72,6 @@ L<RAND_load_file(3)|RAND_load_file(3)>, L<RAND_cleanup(3)|RAND_cleanup(3)>
63 72
64RAND_seed() and RAND_screen() are available in all versions of SSLeay 73RAND_seed() and RAND_screen() are available in all versions of SSLeay
65and OpenSSL. RAND_add() and RAND_status() have been added in OpenSSL 74and OpenSSL. RAND_add() and RAND_status() have been added in OpenSSL
660.9.5. 750.9.5, RAND_event() in OpenSSL 0.9.5a.
67 76
68=cut 77=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
index 466e9b8767..464eba416d 100644
--- a/src/lib/libssl/src/doc/crypto/RAND_set_rand_method.pod
+++ b/src/lib/libssl/src/doc/crypto/RAND_set_rand_method.pod
@@ -34,10 +34,12 @@ RAND_get_rand_method() returns a pointer to the current method.
34 void (*cleanup)(void); 34 void (*cleanup)(void);
35 void (*add)(const void *buf, int num, int entropy); 35 void (*add)(const void *buf, int num, int entropy);
36 int (*pseudorand)(unsigned char *buf, int num); 36 int (*pseudorand)(unsigned char *buf, int num);
37 int (*status)(void);
37 } RAND_METHOD; 38 } RAND_METHOD;
38 39
39The components point to the implementation of RAND_seed(), 40The components point to the implementation of RAND_seed(),
40RAND_bytes(), RAND_cleanup(), RAND_add() and RAND_pseudo_rand(). 41RAND_bytes(), RAND_cleanup(), RAND_add(), RAND_pseudo_rand()
42and RAND_status().
41Each component may be NULL if the function is not implemented. 43Each component may be NULL if the function is not implemented.
42 44
43=head1 RETURN VALUES 45=head1 RETURN VALUES
diff --git a/src/lib/libssl/src/doc/crypto/RSA_set_method.pod b/src/lib/libssl/src/doc/crypto/RSA_set_method.pod
index deb1183a23..14b0b4cf35 100644
--- a/src/lib/libssl/src/doc/crypto/RSA_set_method.pod
+++ b/src/lib/libssl/src/doc/crypto/RSA_set_method.pod
@@ -87,10 +87,11 @@ the default method is used.
87 int (*rsa_priv_dec)(int flen, unsigned char *from, 87 int (*rsa_priv_dec)(int flen, unsigned char *from,
88 unsigned char *to, RSA *rsa, int padding); 88 unsigned char *to, RSA *rsa, int padding);
89 89
90 /* compute r0 = r0 ^ I mod rsa->n. May be NULL */ 90 /* compute r0 = r0 ^ I mod rsa->n (May be NULL for some
91 implementations) */
91 int (*rsa_mod_exp)(BIGNUM *r0, BIGNUM *I, RSA *rsa); 92 int (*rsa_mod_exp)(BIGNUM *r0, BIGNUM *I, RSA *rsa);
92 93
93 /* compute r = a ^ p mod m. May be NULL */ 94 /* compute r = a ^ p mod m (May be NULL for some implementations) */
94 int (*bn_mod_exp)(BIGNUM *r, BIGNUM *a, const BIGNUM *p, 95 int (*bn_mod_exp)(BIGNUM *r, BIGNUM *a, const BIGNUM *p,
95 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); 96 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
96 97
diff --git a/src/lib/libssl/src/doc/crypto/blowfish.pod b/src/lib/libssl/src/doc/crypto/blowfish.pod
index e8c7114311..e0b777418f 100644
--- a/src/lib/libssl/src/doc/crypto/blowfish.pod
+++ b/src/lib/libssl/src/doc/crypto/blowfish.pod
@@ -57,28 +57,31 @@ everything after the first 64 bits is ignored.
57 57
58The mode functions BF_cbc_encrypt(), BF_cfb64_encrypt() and BF_ofb64_encrypt() 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 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 60B<ivec> which needs to be passed along into the next call of the same function
61passed along into the next call of the same function for the same message. 61for the same message. B<ivec> may be initialised with anything, but the
62recipient needs to know what it was initialised with, or it won't be able
63to decrypt. Some programs and protocols simplify this, like SSH, where
64B<ivec> is simply initialised to zero.
62BF_cbc_encrypt() operates of data that is a multiple of 8 bytes long, while 65BF_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 66BF_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 67number 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 68purpose 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 69need 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 70offset in B<ivec> is stored between calls. This integer must be initialised
68to zero when B<ivec> is filled with zeros. 71to zero when B<ivec> is initialised.
69 72
70BF_cbc_encrypt() is the Cipher Block Chaining function for Blowfish. It 73BF_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>, 74encrypts 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 75putting 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 76decryption (BF_DECRYPT) shall be performed. B<ivec> must point at an 8 byte
74long initialisation vector, which must be initially filled with zeros. 77long initialisation vector.
75 78
76BF_cfb64_encrypt() is the CFB mode for Blowfish with 64 bit feedback. 79BF_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>, 80It 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>) 81putting 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 82or 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. 838 byte long initialisation vector. B<num> must point at an integer which must
81B<num> must point at an integer which must be initially zero. 84be initially zero.
82 85
83BF_ofb64_encrypt() is the OFB mode for Blowfish with 64 bit feedback. 86BF_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 87It uses the same parameters as BF_cfb64_encrypt(), which must be initialised
diff --git a/src/lib/libssl/src/doc/crypto/des.pod b/src/lib/libssl/src/doc/crypto/des.pod
new file mode 100644
index 0000000000..c553210ef2
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/des.pod
@@ -0,0 +1,376 @@
1=pod
2
3=head1 NAME
4
5des_random_key, des_set_key, des_key_sched, des_set_key_checked,
6des_set_key_unchecked, des_set_odd_parity, des_is_weak_key,
7des_ecb_encrypt, des_ecb2_encrypt, des_ecb3_encrypt, des_ncbc_encrypt,
8des_cfb_encrypt, des_ofb_encrypt, des_pcbc_encrypt, des_cfb64_encrypt,
9des_ofb64_encrypt, des_xcbc_encrypt, des_ede2_cbc_encrypt,
10des_ede2_cfb64_encrypt, des_ede2_ofb64_encrypt, des_ede3_cbc_encrypt,
11des_ede3_cbcm_encrypt, des_ede3_cfb64_encrypt, des_ede3_ofb64_encrypt,
12des_read_password, des_read_2passwords, des_read_pw_string,
13des_cbc_cksum, des_quad_cksum, des_string_to_key, des_string_to_2keys,
14des_fcrypt, des_crypt, des_enc_read, des_enc_write - DES encryption
15
16=head1 SYNOPSIS
17
18 #include <openssl/des.h>
19
20 void des_random_key(des_cblock *ret);
21
22 int des_set_key(const_des_cblock *key, des_key_schedule schedule);
23 int des_key_sched(const_des_cblock *key, des_key_schedule schedule);
24 int des_set_key_checked(const_des_cblock *key,
25 des_key_schedule schedule);
26 void des_set_key_unchecked(const_des_cblock *key,
27 des_key_schedule schedule);
28
29 void des_set_odd_parity(des_cblock *key);
30 int des_is_weak_key(const_des_cblock *key);
31
32 void des_ecb_encrypt(const_des_cblock *input, des_cblock *output,
33 des_key_schedule ks, int enc);
34 void des_ecb2_encrypt(const_des_cblock *input, des_cblock *output,
35 des_key_schedule ks1, des_key_schedule ks2, int enc);
36 void des_ecb3_encrypt(const_des_cblock *input, des_cblock *output,
37 des_key_schedule ks1, des_key_schedule ks2,
38 des_key_schedule ks3, int enc);
39
40 void des_ncbc_encrypt(const unsigned char *input, unsigned char *output,
41 long length, des_key_schedule schedule, des_cblock *ivec,
42 int enc);
43 void des_cfb_encrypt(const unsigned char *in, unsigned char *out,
44 int numbits, long length, des_key_schedule schedule,
45 des_cblock *ivec, int enc);
46 void des_ofb_encrypt(const unsigned char *in, unsigned char *out,
47 int numbits, long length, des_key_schedule schedule,
48 des_cblock *ivec);
49 void des_pcbc_encrypt(const unsigned char *input, unsigned char *output,
50 long length, des_key_schedule schedule, des_cblock *ivec,
51 int enc);
52 void des_cfb64_encrypt(const unsigned char *in, unsigned char *out,
53 long length, des_key_schedule schedule, des_cblock *ivec,
54 int *num, int enc);
55 void des_ofb64_encrypt(const unsigned char *in, unsigned char *out,
56 long length, des_key_schedule schedule, des_cblock *ivec,
57 int *num);
58
59 void des_xcbc_encrypt(const unsigned char *input, unsigned char *output,
60 long length, des_key_schedule schedule, des_cblock *ivec,
61 const_des_cblock *inw, const_des_cblock *outw, int enc);
62
63 void des_ede2_cbc_encrypt(const unsigned char *input,
64 unsigned char *output, long length, des_key_schedule ks1,
65 des_key_schedule ks2, des_cblock *ivec, int enc);
66 void des_ede2_cfb64_encrypt(const unsigned char *in,
67 unsigned char *out, long length, des_key_schedule ks1,
68 des_key_schedule ks2, des_cblock *ivec, int *num, int enc);
69 void des_ede2_ofb64_encrypt(const unsigned char *in,
70 unsigned char *out, long length, des_key_schedule ks1,
71 des_key_schedule ks2, des_cblock *ivec, int *num);
72
73 void des_ede3_cbc_encrypt(const unsigned char *input,
74 unsigned char *output, long length, des_key_schedule ks1,
75 des_key_schedule ks2, des_key_schedule ks3, des_cblock *ivec,
76 int enc);
77 void des_ede3_cbcm_encrypt(const unsigned char *in, unsigned char *out,
78 long length, des_key_schedule ks1, des_key_schedule ks2,
79 des_key_schedule ks3, des_cblock *ivec1, des_cblock *ivec2,
80 int enc);
81 void des_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out,
82 long length, des_key_schedule ks1, des_key_schedule ks2,
83 des_key_schedule ks3, des_cblock *ivec, int *num, int enc);
84 void des_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out,
85 long length, des_key_schedule ks1,
86 des_key_schedule ks2, des_key_schedule ks3,
87 des_cblock *ivec, int *num);
88
89 int des_read_password(des_cblock *key, const char *prompt, int verify);
90 int des_read_2passwords(des_cblock *key1, des_cblock *key2,
91 const char *prompt, int verify);
92 int des_read_pw_string(char *buf, int length, const char *prompt,
93 int verify);
94
95 DES_LONG des_cbc_cksum(const unsigned char *input, des_cblock *output,
96 long length, des_key_schedule schedule,
97 const_des_cblock *ivec);
98 DES_LONG des_quad_cksum(const unsigned char *input, des_cblock output[],
99 long length, int out_count, des_cblock *seed);
100 void des_string_to_key(const char *str, des_cblock *key);
101 void des_string_to_2keys(const char *str, des_cblock *key1,
102 des_cblock *key2);
103
104 char *des_fcrypt(const char *buf, const char *salt, char *ret);
105 char *des_crypt(const char *buf, const char *salt);
106 char *crypt(const char *buf, const char *salt);
107
108 int des_enc_read(int fd, void *buf, int len, des_key_schedule sched,
109 des_cblock *iv);
110 int des_enc_write(int fd, const void *buf, int len,
111 des_key_schedule sched, des_cblock *iv);
112
113=head1 DESCRIPTION
114
115This library contains a fast implementation of the DES encryption
116algorithm.
117
118There are two phases to the use of DES encryption. The first is the
119generation of a I<des_key_schedule> from a key, the second is the
120actual encryption. A DES key is of type I<des_cblock>. This type is
121consists of 8 bytes with odd parity. The least significant bit in
122each byte is the parity bit. The key schedule is an expanded form of
123the key; it is used to speed the encryption process.
124
125des_random_key() generates a random key. The PRNG must be seeded
126prior to using this function (see L<rand(3)|rand(3)>; for backward
127compatibility the function des_random_seed() is available as well).
128If the PRNG could not generate a secure key, 0 is returned. In
129earlier versions of the library, des_random_key() did not generate
130secure keys.
131
132Before a DES key can be used, it must be converted into the
133architecture dependant I<des_key_schedule> via the
134des_set_key_checked() or des_set_key_unchecked() function.
135
136des_set_key_checked() will check that the key passed is of odd parity
137and is not a week or semi-weak key. If the parity is wrong, then -1
138is returned. If the key is a weak key, then -2 is returned. If an
139error is returned, the key schedule is not generated.
140
141des_set_key() (called des_key_sched() in the MIT library) works like
142des_set_key_checked() if the I<des_check_key> flag is non-zero,
143otherwise like des_set_key_unchecked(). These functions are available
144for compatibility; it is recommended to use a function that does not
145depend on a global variable.
146
147des_set_odd_parity() (called des_fixup_key_parity() in the MIT
148library) sets the parity of the passed I<key> to odd.
149
150des_is_weak_key() returns 1 is the passed key is a weak key, 0 if it
151is ok. The probability that a randomly generated key is weak is
1521/2^52, so it is not really worth checking for them.
153
154The following routines mostly operate on an input and output stream of
155I<des_cblock>s.
156
157des_ecb_encrypt() is the basic DES encryption routine that encrypts or
158decrypts a single 8-byte I<des_cblock> in I<electronic code book>
159(ECB) mode. It always transforms the input data, pointed to by
160I<input>, into the output data, pointed to by the I<output> argument.
161If the I<encrypt> argument is non-zero (DES_ENCRYPT), the I<input>
162(cleartext) is encrypted in to the I<output> (ciphertext) using the
163key_schedule specified by the I<schedule> argument, previously set via
164I<des_set_key>. If I<encrypt> is zero (DES_DECRYPT), the I<input> (now
165ciphertext) is decrypted into the I<output> (now cleartext). Input
166and output may overlap. des_ecb_encrypt() does not return a value.
167
168des_ecb3_encrypt() encrypts/decrypts the I<input> block by using
169three-key Triple-DES encryption in ECB mode. This involves encrypting
170the input with I<ks1>, decrypting with the key schedule I<ks2>, and
171then encrypting with I<ks3>. This routine greatly reduces the chances
172of brute force breaking of DES and has the advantage of if I<ks1>,
173I<ks2> and I<ks3> are the same, it is equivalent to just encryption
174using ECB mode and I<ks1> as the key.
175
176The macro des_ecb2_encrypt() is provided to perform two-key Triple-DES
177encryption by using I<ks1> for the final encryption.
178
179des_ncbc_encrypt() encrypts/decrypts using the I<cipher-block-chaining>
180(CBC) mode of DES. If the I<encrypt> argument is non-zero, the
181routine cipher-block-chain encrypts the cleartext data pointed to by
182the I<input> argument into the ciphertext pointed to by the I<output>
183argument, using the key schedule provided by the I<schedule> argument,
184and initialization vector provided by the I<ivec> argument. If the
185I<length> argument is not an integral multiple of eight bytes, the
186last block is copied to a temporary area and zero filled. The output
187is always an integral multiple of eight bytes.
188
189des_xcbc_encrypt() is RSA's DESX mode of DES. It uses I<inw> and
190I<outw> to 'whiten' the encryption. I<inw> and I<outw> are secret
191(unlike the iv) and are as such, part of the key. So the key is sort
192of 24 bytes. This is much better than CBC DES.
193
194des_ede3_cbc_encrypt() implements outer triple CBC DES encryption with
195three keys. This means that each DES operation inside the CBC mode is
196really an C<C=E(ks3,D(ks2,E(ks1,M)))>. This mode is used by SSL.
197
198The des_ede2_cbc_encrypt() macro implements two-key Triple-DES by
199reusing I<ks1> for the final encryption. C<C=E(ks1,D(ks2,E(ks1,M)))>.
200This form of Triple-DES is used by the RSAREF library.
201
202des_pcbc_encrypt() encrypt/decrypts using the propagating cipher block
203chaing mode used by Kerberos v4. Its parameters are the same as
204des_ncbc_encrypt().
205
206des_cfb_encrypt() encrypt/decrypts using cipher feedback mode. This
207method takes an array of characters as input and outputs and array of
208characters. It does not require any padding to 8 character groups.
209Note: the I<ivec> variable is changed and the new changed value needs to
210be passed to the next call to this function. Since this function runs
211a complete DES ECB encryption per I<numbits>, this function is only
212suggested for use when sending small numbers of characters.
213
214des_cfb64_encrypt()
215implements CFB mode of DES with 64bit feedback. Why is this
216useful you ask? Because this routine will allow you to encrypt an
217arbitrary number of bytes, no 8 byte padding. Each call to this
218routine will encrypt the input bytes to output and then update ivec
219and num. num contains 'how far' we are though ivec. If this does
220not make much sense, read more about cfb mode of DES :-).
221
222des_ede3_cfb64_encrypt() and des_ede2_cfb64_encrypt() is the same as
223des_cfb64_encrypt() except that Triple-DES is used.
224
225des_ofb_encrypt() encrypts using output feedback mode. This method
226takes an array of characters as input and outputs and array of
227characters. It does not require any padding to 8 character groups.
228Note: the I<ivec> variable is changed and the new changed value needs to
229be passed to the next call to this function. Since this function runs
230a complete DES ECB encryption per numbits, this function is only
231suggested for use when sending small numbers of characters.
232
233des_ofb64_encrypt() is the same as des_cfb64_encrypt() using Output
234Feed Back mode.
235
236des_ede3_ofb64_encrypt() and des_ede2_ofb64_encrypt() is the same as
237des_ofb64_encrypt(), using Triple-DES.
238
239The following functions are included in the DES library for
240compatibility with the MIT Kerberos library. des_read_pw_string()
241is also available under the name EVP_read_pw_string().
242
243des_read_pw_string() writes the string specified by I<prompt> to
244standarf output, turns echo off and reads in input string from the
245terminal. The string is returned in I<buf>, which must have space for
246at least I<length> bytes. If I<verify> is set, the user is asked for
247the password twice and unless the two copies match, an error is
248returned. A return code of -1 indicates a system error, 1 failure due
249to use interaction, and 0 is success.
250
251des_read_password() does the same and converts the password to a DES
252key by calling des_string_to_key(); des_read_2password() operates in
253the same way as des_read_password() except that it generates two keys
254by using the des_string_to_2key() function. des_string_to_key() is
255available for backward compatibility with the MIT library. New
256applications should use a cryptographic hash function. The same
257applies for des_string_to_2key().
258
259des_cbc_cksum() produces an 8 byte checksum based on the input stream
260(via CBC encryption). The last 4 bytes of the checksum are returned
261and the complete 8 bytes are placed in I<output>. This function is
262used by Kerberos v4. Other applications should use
263L<EVP_DigestInit(3)|EVP_DigestInit(3)> etc. instead.
264
265des_quad_cksum() is a Kerberos v4 function. It returns a 4 byte
266checksum from the input bytes. The algorithm can be iterated over the
267input, depending on I<out_count>, 1, 2, 3 or 4 times. If I<output> is
268non-NULL, the 8 bytes generated by each pass are written into
269I<output>.
270
271The following are DES-based tranformations:
272
273des_fcrypt() is a fast version of the unix crypt(3) function. This
274version takes only a small amount of space relative to other fast
275crypt() implementations. This is different to the normal crypt in
276that the third parameter is the buffer that the return value is
277written into. It needs to be at least 14 bytes long. This function
278is thread safe, unlike the normal crypt.
279
280des_crypt() is a faster replacement for the normal system crypt().
281This function calls des_fcrypt() with a static array passed as the
282third parameter. This emulates the normal non-thread safe semantics
283of crypt(3).
284
285des_enc_write() writes I<len> bytes to file descriptor I<fd> from
286buffer I<buf>. The data is encrypted via I<pcbc_encrypt> (default)
287using I<sched> for the key and I<iv> as a starting vector. The actual
288data send down I<fd> consists of 4 bytes (in network byte order)
289containing the length of the following encrypted data. The encrypted
290data then follows, padded with random data out to a multiple of 8
291bytes.
292
293des_enc_read() is used to read I<len> bytes from file descriptor
294I<fd> into buffer I<buf>. The data being read from I<fd> is assumed to
295have come from des_enc_write() and is decrypted using I<sched> for
296the key schedule and I<iv> for the initial vector.
297
298B<Warning:> The data format used by des_enc_write() and des_enc_read()
299has a cryptographic weakness: When asked to write more than MAXWRITE
300bytes, des_enc_write() will split the data into several chunks that
301are all encrypted using the same IV. So don't use these functions
302unless you are sure you know what you do (in which case you might not
303want to use them anyway). They cannot handle non-blocking sockets.
304des_enc_read() uses an internal state and thus cannot be used on
305multiple files.
306
307I<des_rw_mode> is used to specify the encryption mode to use with
308des_enc_read() and des_end_write(). If set to I<DES_PCBC_MODE> (the
309default), des_pcbc_encrypt is used. If set to I<DES_CBC_MODE>
310des_cbc_encrypt is used.
311
312=head1 NOTES
313
314Single-key DES is insecure due to its short key size. ECB mode is
315not suitable for most applications; see L<des_modes(7)|des_modes(7)>.
316
317The L<evp(3)|evp(3)> library provides higher-level encryption functions.
318
319=head1 BUGS
320
321des_3cbc_encrypt() is flawed and must not be used in applications.
322
323des_cbc_encrypt() does not modify B<ivec>; use des_ncbc_encrypt()
324instead.
325
326des_cfb_encrypt() and des_ofb_encrypt() operates on input of 8 bits.
327What this means is that if you set numbits to 12, and length to 2, the
328first 12 bits will come from the 1st input byte and the low half of
329the second input byte. The second 12 bits will have the low 8 bits
330taken from the 3rd input byte and the top 4 bits taken from the 4th
331input byte. The same holds for output. This function has been
332implemented this way because most people will be using a multiple of 8
333and because once you get into pulling bytes input bytes apart things
334get ugly!
335
336des_read_pw_string() is the most machine/OS dependent function and
337normally generates the most problems when porting this code.
338
339=head1 CONFORMING TO
340
341ANSI X3.106
342
343The B<des> library was written to be source code compatible with
344the MIT Kerberos library.
345
346=head1 SEE ALSO
347
348crypt(3), L<des_modes(3)|des_modes(3)>, L<evp(3)|evp(3)>, L<rand(3)|rand(3)>
349
350=head1 HISTORY
351
352des_cbc_cksum(), des_cbc_encrypt(), des_ecb_encrypt(),
353des_is_weak_key(), des_key_sched(), des_pcbc_encrypt(),
354des_quad_cksum(), des_random_key(), des_read_password() and
355des_string_to_key() are available in the MIT Kerberos library;
356des_check_key_parity(), des_fixup_key_parity() and des_is_weak_key()
357are available in newer versions of that library.
358
359des_set_key_checked() and des_set_key_unchecked() were added in
360OpenSSL 0.9.5.
361
362des_generate_random_block(), des_init_random_number_generator(),
363des_new_random_key(), des_set_random_generator_seed() and
364des_set_sequence_number() and des_rand_data() are used in newer
365versions of Kerberos but are not implemented here.
366
367des_random_key() generated cryptographically weak random data in
368SSLeay and in OpenSSL prior version 0.9.5, as well as in the original
369MIT library.
370
371=head1 AUTHOR
372
373Eric Young (eay@cryptsoft.com). Modified for the OpenSSL project
374(http://www.openssl.org).
375
376=cut
diff --git a/src/lib/libssl/src/doc/crypto/des_modes.pod b/src/lib/libssl/src/doc/crypto/des_modes.pod
index d8148c86fc..1aa3ac763b 100644
--- a/src/lib/libssl/src/doc/crypto/des_modes.pod
+++ b/src/lib/libssl/src/doc/crypto/des_modes.pod
@@ -248,3 +248,6 @@ it to:
248 248
249L<blowfish(3)|blowfish(3)>, L<des(3)|des(3)>, L<idea(3)|idea(3)>, 249L<blowfish(3)|blowfish(3)>, L<des(3)|des(3)>, L<idea(3)|idea(3)>,
250L<rc2(3)|rc2(3)> 250L<rc2(3)|rc2(3)>
251
252=cut
253
diff --git a/src/lib/libssl/src/doc/crypto/rsa.pod b/src/lib/libssl/src/doc/crypto/rsa.pod
index 0486c044a6..eb8ba612c4 100644
--- a/src/lib/libssl/src/doc/crypto/rsa.pod
+++ b/src/lib/libssl/src/doc/crypto/rsa.pod
@@ -86,8 +86,9 @@ contain public as well as private RSA keys:
86In public keys, the private exponent and the related secret values are 86In public keys, the private exponent and the related secret values are
87B<NULL>. 87B<NULL>.
88 88
89B<dmp1>, B<dmq1> and B<iqmp> may be B<NULL> in private keys, but the 89B<p>, B<q>, B<dmp1>, B<dmq1> and B<iqmp> may be B<NULL> in private
90RSA operations are much faster when these values are available. 90keys, but the RSA operations are much faster when these values are
91available.
91 92
92=head1 CONFORMING TO 93=head1 CONFORMING TO
93 94