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/cms.pod602
-rw-r--r--src/lib/libssl/src/doc/apps/ec.pod2
-rw-r--r--src/lib/libssl/src/doc/apps/ecparam.pod2
-rw-r--r--src/lib/libssl/src/doc/apps/genpkey.pod213
-rw-r--r--src/lib/libssl/src/doc/apps/pkey.pod135
-rw-r--r--src/lib/libssl/src/doc/apps/pkeyparam.pod69
-rw-r--r--src/lib/libssl/src/doc/apps/pkeyutl.pod222
-rw-r--r--src/lib/libssl/src/doc/apps/ts.pod594
-rw-r--r--src/lib/libssl/src/doc/apps/tsget.pod194
-rw-r--r--src/lib/libssl/src/doc/apps/x509v3_config.pod97
-rw-r--r--src/lib/libssl/src/doc/crypto/ASN1_generate_nconf.pod7
-rw-r--r--src/lib/libssl/src/doc/crypto/BIO_new_CMS.pod66
-rw-r--r--src/lib/libssl/src/doc/crypto/BN_BLINDING_new.pod20
-rw-r--r--src/lib/libssl/src/doc/crypto/CMS_add0_cert.pod66
-rw-r--r--src/lib/libssl/src/doc/crypto/CMS_add1_recipient_cert.pod62
-rw-r--r--src/lib/libssl/src/doc/crypto/CMS_compress.pod73
-rw-r--r--src/lib/libssl/src/doc/crypto/CMS_decrypt.pod65
-rw-r--r--src/lib/libssl/src/doc/crypto/CMS_encrypt.pod96
-rw-r--r--src/lib/libssl/src/doc/crypto/CMS_final.pod41
-rw-r--r--src/lib/libssl/src/doc/crypto/CMS_get0_RecipientInfos.pod106
-rw-r--r--src/lib/libssl/src/doc/crypto/CMS_get0_SignerInfos.pod75
-rw-r--r--src/lib/libssl/src/doc/crypto/CMS_get0_type.pod63
-rw-r--r--src/lib/libssl/src/doc/crypto/CMS_get1_ReceiptRequest.pod69
-rw-r--r--src/lib/libssl/src/doc/crypto/CMS_sign.pod121
-rw-r--r--src/lib/libssl/src/doc/crypto/CMS_sign_add1_signer.pod101
-rw-r--r--src/lib/libssl/src/doc/crypto/CMS_sign_receipt.pod45
-rw-r--r--src/lib/libssl/src/doc/crypto/CMS_uncompress.pod54
-rw-r--r--src/lib/libssl/src/doc/crypto/CMS_verify.pod126
-rw-r--r--src/lib/libssl/src/doc/crypto/CMS_verify_receipt.pod47
-rw-r--r--src/lib/libssl/src/doc/crypto/EVP_DigestSignInit.pod87
-rw-r--r--src/lib/libssl/src/doc/crypto/EVP_DigestVerifyInit.pod82
-rw-r--r--src/lib/libssl/src/doc/crypto/EVP_PKEY_CTX_ctrl.pod128
-rw-r--r--src/lib/libssl/src/doc/crypto/EVP_PKEY_CTX_new.pod52
-rw-r--r--src/lib/libssl/src/doc/crypto/EVP_PKEY_cmp.pod61
-rw-r--r--src/lib/libssl/src/doc/crypto/EVP_PKEY_decrypt.pod93
-rw-r--r--src/lib/libssl/src/doc/crypto/EVP_PKEY_derive.pod93
-rw-r--r--src/lib/libssl/src/doc/crypto/EVP_PKEY_encrypt.pod93
-rw-r--r--src/lib/libssl/src/doc/crypto/EVP_PKEY_get_default_digest.pod41
-rw-r--r--src/lib/libssl/src/doc/crypto/EVP_PKEY_keygen.pod161
-rw-r--r--src/lib/libssl/src/doc/crypto/EVP_PKEY_print_private.pod53
-rw-r--r--src/lib/libssl/src/doc/crypto/EVP_PKEY_sign.pod96
-rw-r--r--src/lib/libssl/src/doc/crypto/EVP_PKEY_verify.pod91
-rw-r--r--src/lib/libssl/src/doc/crypto/PEM_write_bio_CMS_stream.pod41
-rw-r--r--src/lib/libssl/src/doc/crypto/PEM_write_bio_PKCS7_stream.pod41
-rw-r--r--src/lib/libssl/src/doc/crypto/PKCS7_sign_add_signer.pod87
-rw-r--r--src/lib/libssl/src/doc/crypto/SMIME_read_CMS.pod70
-rw-r--r--src/lib/libssl/src/doc/crypto/SMIME_write_CMS.pod64
-rw-r--r--src/lib/libssl/src/doc/crypto/X509_STORE_CTX_get_error.pod303
-rw-r--r--src/lib/libssl/src/doc/crypto/X509_STORE_CTX_get_ex_new_index.pod41
-rw-r--r--src/lib/libssl/src/doc/crypto/X509_STORE_CTX_new.pod122
-rw-r--r--src/lib/libssl/src/doc/crypto/X509_STORE_CTX_set_verify_cb.pod161
-rw-r--r--src/lib/libssl/src/doc/crypto/X509_STORE_set_verify_cb_func.pod54
-rw-r--r--src/lib/libssl/src/doc/crypto/X509_VERIFY_PARAM_set_flags.pod171
-rw-r--r--src/lib/libssl/src/doc/crypto/X509_verify_cert.pod53
-rw-r--r--src/lib/libssl/src/doc/crypto/i2d_CMS_bio_stream.pod44
-rw-r--r--src/lib/libssl/src/doc/crypto/i2d_PKCS7_bio_stream.pod44
-rw-r--r--src/lib/libssl/src/doc/ssl/SSL_CTX_set_psk_client_callback.pod81
-rw-r--r--src/lib/libssl/src/doc/ssl/SSL_CTX_use_psk_identity_hint.pod102
-rw-r--r--src/lib/libssl/src/doc/ssl/SSL_get_psk_identity.pod63
59 files changed, 6083 insertions, 23 deletions
diff --git a/src/lib/libssl/src/doc/apps/cms.pod b/src/lib/libssl/src/doc/apps/cms.pod
new file mode 100644
index 0000000000..a09588a18d
--- /dev/null
+++ b/src/lib/libssl/src/doc/apps/cms.pod
@@ -0,0 +1,602 @@
1=pod
2
3=head1 NAME
4
5cms - CMS utility
6
7=head1 SYNOPSIS
8
9B<openssl> B<cms>
10[B<-encrypt>]
11[B<-decrypt>]
12[B<-sign>]
13[B<-verify>]
14[B<-cmsout>]
15[B<-resign>]
16[B<-data_create>]
17[B<-data_out>]
18[B<-digest_create>]
19[B<-digest_verify>]
20[B<-compress>]
21[B<-uncompress>]
22[B<-EncryptedData_encrypt>]
23[B<-sign_receipt>]
24[B<-verify_receipt receipt>]
25[B<-in filename>]
26[B<-inform SMIME|PEM|DER>]
27[B<-rctform SMIME|PEM|DER>]
28[B<-out filename>]
29[B<-outform SMIME|PEM|DER>]
30[B<-stream -indef -noindef>]
31[B<-noindef>]
32[B<-content filename>]
33[B<-text>]
34[B<-noout>]
35[B<-print>]
36[B<-CAfile file>]
37[B<-CApath dir>]
38[B<-md digest>]
39[B<-[cipher]>]
40[B<-nointern>]
41[B<-no_signer_cert_verify>]
42[B<-nocerts>]
43[B<-noattr>]
44[B<-nosmimecap>]
45[B<-binary>]
46[B<-nodetach>]
47[B<-certfile file>]
48[B<-certsout file>]
49[B<-signer file>]
50[B<-recip file>]
51[B<-keyid>]
52[B<-receipt_request_all -receipt_request_first>]
53[B<-receipt_request_from emailaddress>]
54[B<-receipt_request_to emailaddress>]
55[B<-receipt_request_print>]
56[B<-secretkey key>]
57[B<-secretkeyid id>]
58[B<-econtent_type type>]
59[B<-inkey file>]
60[B<-passin arg>]
61[B<-rand file(s)>]
62[B<cert.pem...>]
63[B<-to addr>]
64[B<-from addr>]
65[B<-subject subj>]
66[cert.pem]...
67
68=head1 DESCRIPTION
69
70The B<cms> command handles S/MIME v3.1 mail. It can encrypt, decrypt, sign and
71verify, compress and uncompress S/MIME messages.
72
73=head1 COMMAND OPTIONS
74
75There are fourteen operation options that set the type of operation to be
76performed. The meaning of the other options varies according to the operation
77type.
78
79=over 4
80
81=item B<-encrypt>
82
83encrypt mail for the given recipient certificates. Input file is the message
84to be encrypted. The output file is the encrypted mail in MIME format. The
85actual CMS type is <B>EnvelopedData<B>.
86
87=item B<-decrypt>
88
89decrypt mail using the supplied certificate and private key. Expects an
90encrypted mail message in MIME format for the input file. The decrypted mail
91is written to the output file.
92
93=item B<-sign>
94
95sign mail using the supplied certificate and private key. Input file is
96the message to be signed. The signed message in MIME format is written
97to the output file.
98
99=item B<-verify>
100
101verify signed mail. Expects a signed mail message on input and outputs
102the signed data. Both clear text and opaque signing is supported.
103
104=item B<-cmsout>
105
106takes an input message and writes out a PEM encoded CMS structure.
107
108=item B<-resign>
109
110resign a message: take an existing message and one or more new signers.
111
112=item B<-data_create>
113
114Create a CMS B<Data> type.
115
116=item B<-data_out>
117
118B<Data> type and output the content.
119
120=item B<-digest_create>
121
122Create a CMS B<DigestedData> type.
123
124=item B<-digest_verify>
125
126Verify a CMS B<DigestedData> type and output the content.
127
128=item B<-compress>
129
130Create a CMS B<CompressedData> type. OpenSSL must be compiled with B<zlib>
131support for this option to work, otherwise it will output an error.
132
133=item B<-uncompress>
134
135Uncompress a CMS B<CompressedData> type and output the content. OpenSSL must be
136compiled with B<zlib> support for this option to work, otherwise it will
137output an error.
138
139=item B<-EncryptedData_encrypt>
140
141Encrypt suppled content using supplied symmetric key and algorithm using a CMS
142B<EncrytedData> type and output the content.
143
144=item B<-sign_receipt>
145
146Generate and output a signed receipt for the supplied message. The input
147message B<must> contain a signed receipt request. Functionality is otherwise
148similar to the B<-sign> operation.
149
150=item B<-verify_receipt receipt>
151
152Verify a signed receipt in filename B<receipt>. The input message B<must>
153contain the original receipt request. Functionality is otherwise similar
154to the B<-verify> operation.
155
156=item B<-in filename>
157
158the input message to be encrypted or signed or the message to be decrypted
159or verified.
160
161=item B<-inform SMIME|PEM|DER>
162
163this specifies the input format for the CMS structure. The default
164is B<SMIME> which reads an S/MIME format message. B<PEM> and B<DER>
165format change this to expect PEM and DER format CMS structures
166instead. This currently only affects the input format of the CMS
167structure, if no CMS structure is being input (for example with
168B<-encrypt> or B<-sign>) this option has no effect.
169
170=item B<-rctform SMIME|PEM|DER>
171
172specify the format for a signed receipt for use with the B<-receipt_verify>
173operation.
174
175=item B<-out filename>
176
177the message text that has been decrypted or verified or the output MIME
178format message that has been signed or verified.
179
180=item B<-outform SMIME|PEM|DER>
181
182this specifies the output format for the CMS structure. The default
183is B<SMIME> which writes an S/MIME format message. B<PEM> and B<DER>
184format change this to write PEM and DER format CMS structures
185instead. This currently only affects the output format of the CMS
186structure, if no CMS structure is being output (for example with
187B<-verify> or B<-decrypt>) this option has no effect.
188
189=item B<-stream -indef -noindef>
190
191the B<-stream> and B<-indef> options are equivalent and enable streaming I/O
192for encoding operations. This permits single pass processing of data without
193the need to hold the entire contents in memory, potentially supporting very
194large files. Streaming is automatically set for S/MIME signing with detached
195data if the output format is B<SMIME> it is currently off by default for all
196other operations.
197
198=item B<-noindef>
199
200disable streaming I/O where it would produce and indefinite length constructed
201encoding. This option currently has no effect. In future streaming will be
202enabled by default on all relevant operations and this option will disable it.
203
204=item B<-content filename>
205
206This specifies a file containing the detached content, this is only
207useful with the B<-verify> command. This is only usable if the CMS
208structure is using the detached signature form where the content is
209not included. This option will override any content if the input format
210is S/MIME and it uses the multipart/signed MIME content type.
211
212=item B<-text>
213
214this option adds plain text (text/plain) MIME headers to the supplied
215message if encrypting or signing. If decrypting or verifying it strips
216off text headers: if the decrypted or verified message is not of MIME
217type text/plain then an error occurs.
218
219=item B<-noout>
220
221for the B<-cmsout> operation do not output the parsed CMS structure. This
222is useful when combined with the B<-print> option or if the syntax of the CMS
223structure is being checked.
224
225=item B<-print>
226
227for the B<-cmsout> operation print out all fields of the CMS structure. This
228is mainly useful for testing purposes.
229
230=item B<-CAfile file>
231
232a file containing trusted CA certificates, only used with B<-verify>.
233
234=item B<-CApath dir>
235
236a directory containing trusted CA certificates, only used with
237B<-verify>. This directory must be a standard certificate directory: that
238is a hash of each subject name (using B<x509 -hash>) should be linked
239to each certificate.
240
241=item B<-md digest>
242
243digest algorithm to use when signing or resigning. If not present then the
244default digest algorithm for the signing key will be used (usually SHA1).
245
246=item B<-[cipher]>
247
248the encryption algorithm to use. For example triple DES (168 bits) - B<-des3>
249or 256 bit AES - B<-aes256>. Any standard algorithm name (as used by the
250EVP_get_cipherbyname() function) can also be used preceded by a dash, for
251example B<-aes_128_cbc>. See L<B<enc>|enc(1)> for a list of ciphers
252supported by your version of OpenSSL.
253
254If not specified triple DES is used. Only used with B<-encrypt> and
255B<-EncryptedData_create> commands.
256
257=item B<-nointern>
258
259when verifying a message normally certificates (if any) included in
260the message are searched for the signing certificate. With this option
261only the certificates specified in the B<-certfile> option are used.
262The supplied certificates can still be used as untrusted CAs however.
263
264=item B<-no_signer_cert_verify>
265
266do not verify the signers certificate of a signed message.
267
268=item B<-nocerts>
269
270when signing a message the signer's certificate is normally included
271with this option it is excluded. This will reduce the size of the
272signed message but the verifier must have a copy of the signers certificate
273available locally (passed using the B<-certfile> option for example).
274
275=item B<-noattr>
276
277normally when a message is signed a set of attributes are included which
278include the signing time and supported symmetric algorithms. With this
279option they are not included.
280
281=item B<-nosmimecap>
282
283exclude the list of supported algorithms from signed attributes, other options
284such as signing time and content type are still included.
285
286=item B<-binary>
287
288normally the input message is converted to "canonical" format which is
289effectively using CR and LF as end of line: as required by the S/MIME
290specification. When this option is present no translation occurs. This
291is useful when handling binary data which may not be in MIME format.
292
293=item B<-nodetach>
294
295when signing a message use opaque signing: this form is more resistant
296to translation by mail relays but it cannot be read by mail agents that
297do not support S/MIME. Without this option cleartext signing with
298the MIME type multipart/signed is used.
299
300=item B<-certfile file>
301
302allows additional certificates to be specified. When signing these will
303be included with the message. When verifying these will be searched for
304the signers certificates. The certificates should be in PEM format.
305
306=item B<-certsout file>
307
308any certificates contained in the message are written to B<file>.
309
310=item B<-signer file>
311
312a signing certificate when signing or resigning a message, this option can be
313used multiple times if more than one signer is required. If a message is being
314verified then the signers certificates will be written to this file if the
315verification was successful.
316
317=item B<-recip file>
318
319the recipients certificate when decrypting a message. This certificate
320must match one of the recipients of the message or an error occurs.
321
322=item B<-keyid>
323
324use subject key identifier to identify certificates instead of issuer name and
325serial number. The supplied certificate B<must> include a subject key
326identifier extension. Supported by B<-sign> and B<-encrypt> options.
327
328=item B<-receipt_request_all -receipt_request_first>
329
330for B<-sign> option include a signed receipt request. Indicate requests should
331be provided by all receipient or first tier recipients (those mailed directly
332and not from a mailing list). Ignored it B<-receipt_request_from> is included.
333
334=item B<-receipt_request_from emailaddress>
335
336for B<-sign> option include a signed receipt request. Add an explicit email
337address where receipts should be supplied.
338
339=item B<-receipt_request_to emailaddress>
340
341Add an explicit email address where signed receipts should be sent to. This
342option B<must> but supplied if a signed receipt it requested.
343
344=item B<-receipt_request_print>
345
346For the B<-verify> operation print out the contents of any signed receipt
347requests.
348
349=item B<-secretkey key>
350
351specify symmetric key to use. The key must be supplied in hex format and be
352consistent with the algorithm used. Supported by the B<-EncryptedData_encrypt>
353B<-EncrryptedData_decrypt>, B<-encrypt> and B<-decrypt> options. When used
354with B<-encrypt> or B<-decrypt> the supplied key is used to wrap or unwrap the
355content encryption key using an AES key in the B<KEKRecipientInfo> type.
356
357=item B<-secretkeyid id>
358
359the key identifier for the supplied symmetric key for B<KEKRecipientInfo> type.
360This option B<must> be present if the B<-secretkey> option is used with
361B<-encrypt>. With B<-decrypt> operations the B<id> is used to locate the
362relevant key if it is not supplied then an attempt is used to decrypt any
363B<KEKRecipientInfo> structures.
364
365=item B<-econtent_type type>
366
367set the encapsulated content type to B<type> if not supplied the B<Data> type
368is used. The B<type> argument can be any valid OID name in either text or
369numerical format.
370
371=item B<-inkey file>
372
373the private key to use when signing or decrypting. This must match the
374corresponding certificate. If this option is not specified then the
375private key must be included in the certificate file specified with
376the B<-recip> or B<-signer> file. When signing this option can be used
377multiple times to specify successive keys.
378
379=item B<-passin arg>
380
381the private key password source. For more information about the format of B<arg>
382see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
383
384=item B<-rand file(s)>
385
386a file or files containing random data used to seed the random number
387generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>).
388Multiple files can be specified separated by a OS-dependent character.
389The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for
390all others.
391
392=item B<cert.pem...>
393
394one or more certificates of message recipients: used when encrypting
395a message.
396
397=item B<-to, -from, -subject>
398
399the relevant mail headers. These are included outside the signed
400portion of a message so they may be included manually. If signing
401then many S/MIME mail clients check the signers certificate's email
402address matches that specified in the From: address.
403
404=item B<-purpose, -ignore_critical, -issuer_checks, -crl_check, -crl_check_all, -policy_check, -extended_crl, -x509_strict, -policy -check_ss_sig>
405
406Set various certificate chain valiadition option. See the
407L<B<verify>|verify(1)> manual page for details.
408
409=back
410
411=head1 NOTES
412
413The MIME message must be sent without any blank lines between the
414headers and the output. Some mail programs will automatically add
415a blank line. Piping the mail directly to sendmail is one way to
416achieve the correct format.
417
418The supplied message to be signed or encrypted must include the
419necessary MIME headers or many S/MIME clients wont display it
420properly (if at all). You can use the B<-text> option to automatically
421add plain text headers.
422
423A "signed and encrypted" message is one where a signed message is
424then encrypted. This can be produced by encrypting an already signed
425message: see the examples section.
426
427This version of the program only allows one signer per message but it
428will verify multiple signers on received messages. Some S/MIME clients
429choke if a message contains multiple signers. It is possible to sign
430messages "in parallel" by signing an already signed message.
431
432The options B<-encrypt> and B<-decrypt> reflect common usage in S/MIME
433clients. Strictly speaking these process CMS enveloped data: CMS
434encrypted data is used for other purposes.
435
436The B<-resign> option uses an existing message digest when adding a new
437signer. This means that attributes must be present in at least one existing
438signer using the same message digest or this operation will fail.
439
440The B<-stream> and B<-indef> options enable experimental streaming I/O support.
441As a result the encoding is BER using indefinite length constructed encoding
442and no longer DER. Streaming is supported for the B<-encrypt> operation and the
443B<-sign> operation if the content is not detached.
444
445Streaming is always used for the B<-sign> operation with detached data but
446since the content is no longer part of the CMS structure the encoding
447remains DER.
448
449=head1 EXIT CODES
450
451=over 4
452
453=item 0
454
455the operation was completely successfully.
456
457=item 1
458
459an error occurred parsing the command options.
460
461=item 2
462
463one of the input files could not be read.
464
465=item 3
466
467an error occurred creating the CMS file or when reading the MIME
468message.
469
470=item 4
471
472an error occurred decrypting or verifying the message.
473
474=item 5
475
476the message was verified correctly but an error occurred writing out
477the signers certificates.
478
479=back
480
481=head1 COMPATIBILITY WITH PKCS#7 format.
482
483The B<smime> utility can only process the older B<PKCS#7> format. The B<cms>
484utility supports Cryptographic Message Syntax format. Use of some features
485will result in messages which cannot be processed by applications which only
486support the older format. These are detailed below.
487
488The use of the B<-keyid> option with B<-sign> or B<-encrypt>.
489
490The B<-outform PEM> option uses different headers.
491
492The B<-compress> option.
493
494The B<-secretkey> option when used with B<-encrypt>.
495
496Additionally the B<-EncryptedData_create> and B<-data_create> type cannot
497be processed by the older B<smime> command.
498
499=head1 EXAMPLES
500
501Create a cleartext signed message:
502
503 openssl cms -sign -in message.txt -text -out mail.msg \
504 -signer mycert.pem
505
506Create an opaque signed message
507
508 openssl cms -sign -in message.txt -text -out mail.msg -nodetach \
509 -signer mycert.pem
510
511Create a signed message, include some additional certificates and
512read the private key from another file:
513
514 openssl cms -sign -in in.txt -text -out mail.msg \
515 -signer mycert.pem -inkey mykey.pem -certfile mycerts.pem
516
517Create a signed message with two signers, use key identifier:
518
519 openssl cms -sign -in message.txt -text -out mail.msg \
520 -signer mycert.pem -signer othercert.pem -keyid
521
522Send a signed message under Unix directly to sendmail, including headers:
523
524 openssl cms -sign -in in.txt -text -signer mycert.pem \
525 -from steve@openssl.org -to someone@somewhere \
526 -subject "Signed message" | sendmail someone@somewhere
527
528Verify a message and extract the signer's certificate if successful:
529
530 openssl cms -verify -in mail.msg -signer user.pem -out signedtext.txt
531
532Send encrypted mail using triple DES:
533
534 openssl cms -encrypt -in in.txt -from steve@openssl.org \
535 -to someone@somewhere -subject "Encrypted message" \
536 -des3 user.pem -out mail.msg
537
538Sign and encrypt mail:
539
540 openssl cms -sign -in ml.txt -signer my.pem -text \
541 | openssl cms -encrypt -out mail.msg \
542 -from steve@openssl.org -to someone@somewhere \
543 -subject "Signed and Encrypted message" -des3 user.pem
544
545Note: the encryption command does not include the B<-text> option because the
546message being encrypted already has MIME headers.
547
548Decrypt mail:
549
550 openssl cms -decrypt -in mail.msg -recip mycert.pem -inkey key.pem
551
552The output from Netscape form signing is a PKCS#7 structure with the
553detached signature format. You can use this program to verify the
554signature by line wrapping the base64 encoded structure and surrounding
555it with:
556
557 -----BEGIN PKCS7-----
558 -----END PKCS7-----
559
560and using the command,
561
562 openssl cms -verify -inform PEM -in signature.pem -content content.txt
563
564alternatively you can base64 decode the signature and use
565
566 openssl cms -verify -inform DER -in signature.der -content content.txt
567
568Create an encrypted message using 128 bit Camellia:
569
570 openssl cms -encrypt -in plain.txt -camellia128 -out mail.msg cert.pem
571
572Add a signer to an existing message:
573
574 openssl cms -resign -in mail.msg -signer newsign.pem -out mail2.msg
575
576=head1 BUGS
577
578The MIME parser isn't very clever: it seems to handle most messages that I've
579thrown at it but it may choke on others.
580
581The code currently will only write out the signer's certificate to a file: if
582the signer has a separate encryption certificate this must be manually
583extracted. There should be some heuristic that determines the correct
584encryption certificate.
585
586Ideally a database should be maintained of a certificates for each email
587address.
588
589The code doesn't currently take note of the permitted symmetric encryption
590algorithms as supplied in the SMIMECapabilities signed attribute. this means the
591user has to manually include the correct encryption algorithm. It should store
592the list of permitted ciphers in a database and only use those.
593
594No revocation checking is done on the signer's certificate.
595
596=head1 HISTORY
597
598The use of multiple B<-signer> options and the B<-resign> command were first
599added in OpenSSL 1.0.0
600
601
602=cut
diff --git a/src/lib/libssl/src/doc/apps/ec.pod b/src/lib/libssl/src/doc/apps/ec.pod
index 1d4a36dbf4..ba6dc4689b 100644
--- a/src/lib/libssl/src/doc/apps/ec.pod
+++ b/src/lib/libssl/src/doc/apps/ec.pod
@@ -130,7 +130,7 @@ is currently not implemented in OpenSSL.
130 130
131=item B<-engine id> 131=item B<-engine id>
132 132
133specifying an engine (by it's unique B<id> string) will cause B<req> 133specifying an engine (by its unique B<id> string) will cause B<ec>
134to attempt to obtain a functional reference to the specified engine, 134to attempt to obtain a functional reference to the specified engine,
135thus initialising it if needed. The engine will then be set as the default 135thus initialising it if needed. The engine will then be set as the default
136for all available algorithms. 136for all available algorithms.
diff --git a/src/lib/libssl/src/doc/apps/ecparam.pod b/src/lib/libssl/src/doc/apps/ecparam.pod
index 1a12105da7..788c074d7b 100644
--- a/src/lib/libssl/src/doc/apps/ecparam.pod
+++ b/src/lib/libssl/src/doc/apps/ecparam.pod
@@ -121,7 +121,7 @@ all others.
121 121
122=item B<-engine id> 122=item B<-engine id>
123 123
124specifying an engine (by it's unique B<id> string) will cause B<req> 124specifying an engine (by its unique B<id> string) will cause B<ecparam>
125to attempt to obtain a functional reference to the specified engine, 125to attempt to obtain a functional reference to the specified engine,
126thus initialising it if needed. The engine will then be set as the default 126thus initialising it if needed. The engine will then be set as the default
127for all available algorithms. 127for all available algorithms.
diff --git a/src/lib/libssl/src/doc/apps/genpkey.pod b/src/lib/libssl/src/doc/apps/genpkey.pod
new file mode 100644
index 0000000000..1611b5ca78
--- /dev/null
+++ b/src/lib/libssl/src/doc/apps/genpkey.pod
@@ -0,0 +1,213 @@
1=pod
2
3=head1 NAME
4
5genpkey - generate a private key
6
7=head1 SYNOPSIS
8
9B<openssl> B<genpkey>
10[B<-out filename>]
11[B<-outform PEM|DER>]
12[B<-pass arg>]
13[B<-cipher>]
14[B<-engine id>]
15[B<-paramfile file>]
16[B<-algorithm alg>]
17[B<-pkeyopt opt:value>]
18[B<-genparam>]
19[B<-text>]
20
21=head1 DESCRIPTION
22
23The B<genpkey> command generates a private key.
24
25=head1 OPTIONS
26
27=over 4
28
29=item B<-out filename>
30
31the output filename. If this argument is not specified then standard output is
32used.
33
34=item B<-outform DER|PEM>
35
36This specifies the output format DER or PEM.
37
38=item B<-pass arg>
39
40the output file password source. For more information about the format of B<arg>
41see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
42
43=item B<-cipher>
44
45This option encrypts the private key with the supplied cipher. Any algorithm
46name accepted by EVP_get_cipherbyname() is acceptable such as B<des3>.
47
48=item B<-engine id>
49
50specifying an engine (by its unique B<id> string) will cause B<genpkey>
51to attempt to obtain a functional reference to the specified engine,
52thus initialising it if needed. The engine will then be set as the default
53for all available algorithms. If used this option should precede all other
54options.
55
56=item B<-algorithm alg>
57
58public key algorithm to use such as RSA, DSA or DH. If used this option must
59precede any B<-pkeyopt> options. The options B<-paramfile> and B<-algorithm>
60are mutually exclusive.
61
62=item B<-pkeyopt opt:value>
63
64set the public key algorithm option B<opt> to B<value>. The precise set of
65options supported depends on the public key algorithm used and its
66implementation. See B<KEY GENERATION OPTIONS> below for more details.
67
68=item B<-genparam>
69
70generate a set of parameters instead of a private key. If used this option must
71precede and B<-algorithm>, B<-paramfile> or B<-pkeyopt> options.
72
73=item B<-paramfile filename>
74
75Some public key algorithms generate a private key based on a set of parameters.
76They can be supplied using this option. If this option is used the public key
77algorithm used is determined by the parameters. If used this option must
78precede and B<-pkeyopt> options. The options B<-paramfile> and B<-algorithm>
79are mutually exclusive.
80
81=item B<-text>
82
83Print an (unencrypted) text representation of private and public keys and
84parameters along with the PEM or DER structure.
85
86=back
87
88=head1 KEY GENERATION OPTIONS
89
90The options supported by each algorith and indeed each implementation of an
91algorithm can vary. The options for the OpenSSL implementations are detailed
92below.
93
94=head1 RSA KEY GENERATION OPTIONS
95
96=over 4
97
98=item B<rsa_keygen_bits:numbits>
99
100The number of bits in the generated key. If not specified 1024 is used.
101
102=item B<rsa_keygen_pubexp:value>
103
104The RSA public exponent value. This can be a large decimal or
105hexadecimal value if preceded by B<0x>. Default value is 65537.
106
107=back
108
109=head1 DSA PARAMETER GENERATION OPTIONS
110
111=over 4
112
113=item B<dsa_paramgen_bits:numbits>
114
115The number of bits in the generated parameters. If not specified 1024 is used.
116
117=head1 DH PARAMETER GENERATION OPTIONS
118
119=over 4
120
121=item B<dh_paramgen_prime_len:numbits>
122
123The number of bits in the prime parameter B<p>.
124
125=item B<dh_paramgen_generator:value>
126
127The value to use for the generator B<g>.
128
129=back
130
131=head1 EC PARAMETER GENERATION OPTIONS
132
133=over 4
134
135=item B<ec_paramgen_curve:curve>
136
137the EC curve to use.
138
139=back
140
141=head1 GOST2001 KEY GENERATION AND PARAMETER OPTIONS
142
143Gost 2001 support is not enabled by default. To enable this algorithm,
144one should load the ccgost engine in the OpenSSL configuration file.
145See README.gost file in the engines/ccgost directiry of the source
146distribution for more details.
147
148Use of a parameter file for the GOST R 34.10 algorithm is optional.
149Parameters can be specified during key generation directly as well as
150during generation of parameter file.
151
152=over 4
153
154=item B<paramset:name>
155
156Specifies GOST R 34.10-2001 parameter set according to RFC 4357.
157Parameter set can be specified using abbreviated name, object short name or
158numeric OID. Following parameter sets are supported:
159
160 paramset OID Usage
161 A 1.2.643.2.2.35.1 Signature
162 B 1.2.643.2.2.35.2 Signature
163 C 1.2.643.2.2.35.3 Signature
164 XA 1.2.643.2.2.36.0 Key exchange
165 XB 1.2.643.2.2.36.1 Key exchange
166 test 1.2.643.2.2.35.0 Test purposes
167
168=back
169
170
171
172=head1 NOTES
173
174The use of the genpkey program is encouraged over the algorithm specific
175utilities because additional algorithm options and ENGINE provided algorithms
176can be used.
177
178=head1 EXAMPLES
179
180Generate an RSA private key using default parameters:
181
182 openssl genpkey -algorithm RSA -out key.pem
183
184Encrypt output private key using 128 bit AES and the passphrase "hello":
185
186 openssl genpkey -algorithm RSA -out key.pem -aes-128-cbc -pass pass:hello
187
188Generate a 2048 bit RSA key using 3 as the public exponent:
189
190 openssl genpkey -algorithm RSA -out key.pem -pkeyopt rsa_keygen_bits:2048 \
191 -pkeyopt rsa_keygen_pubexp:3
192
193Generate 1024 bit DSA parameters:
194
195 openssl genpkey -genparam -algorithm DSA -out dsap.pem \
196 -pkeyopt dsa_paramgen_bits:1024
197
198Generate DSA key from parameters:
199
200 openssl genpkey -paramfile dsap.pem -out dsakey.pem
201
202Generate 1024 bit DH parameters:
203
204 openssl genpkey -genparam -algorithm DH -out dhp.pem \
205 -pkeyopt dh_paramgen_prime_len:1024
206
207Generate DH key from parameters:
208
209 openssl genpkey -paramfile dhp.pem -out dhkey.pem
210
211
212=cut
213
diff --git a/src/lib/libssl/src/doc/apps/pkey.pod b/src/lib/libssl/src/doc/apps/pkey.pod
new file mode 100644
index 0000000000..4851223f3f
--- /dev/null
+++ b/src/lib/libssl/src/doc/apps/pkey.pod
@@ -0,0 +1,135 @@
1
2=pod
3
4=head1 NAME
5
6pkey - public or private key processing tool
7
8=head1 SYNOPSIS
9
10B<openssl> B<pkey>
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<-cipher>]
18[B<-text>]
19[B<-text_pub>]
20[B<-noout>]
21[B<-pubin>]
22[B<-pubout>]
23[B<-engine id>]
24
25=head1 DESCRIPTION
26
27The B<pkey> command processes public or private keys. They can be converted
28between various forms and their components printed out.
29
30=head1 COMMAND OPTIONS
31
32=over 4
33
34=item B<-inform DER|PEM>
35
36This specifies the input format DER or PEM.
37
38=item B<-outform DER|PEM>
39
40This specifies the output format, the options have the same meaning as the
41B<-inform> option.
42
43=item B<-in filename>
44
45This specifies the input filename to read a key from or standard input if this
46option is not specified. If the key is encrypted a pass phrase will be
47prompted for.
48
49=item B<-passin arg>
50
51the input file password source. For more information about the format of B<arg>
52see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
53
54=item B<-out filename>
55
56This specifies the output filename to write a key to or standard output if this
57option is not specified. If any encryption options are set then a pass phrase
58will be prompted for. The output filename should B<not> be the same as the input
59filename.
60
61=item B<-passout password>
62
63the output file password source. For more information about the format of B<arg>
64see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>.
65
66=item B<-cipher>
67
68These options encrypt the private key with the supplied cipher. Any algorithm
69name accepted by EVP_get_cipherbyname() is acceptable such as B<des3>.
70
71=item B<-text>
72
73prints out the various public or private key components in
74plain text in addition to the encoded version.
75
76=item B<-text_pub>
77
78print out only public key components even if a private key is being processed.
79
80=item B<-noout>
81
82do not output the encoded version of the key.
83
84=item B<-pubin>
85
86by default a private key is read from the input file: with this
87option a public key is read instead.
88
89=item B<-pubout>
90
91by default a private key is output: with this option a public
92key will be output instead. This option is automatically set if
93the input is a public key.
94
95=item B<-engine id>
96
97specifying an engine (by its unique B<id> string) will cause B<pkey>
98to attempt to obtain a functional reference to the specified engine,
99thus initialising it if needed. The engine will then be set as the default
100for all available algorithms.
101
102=back
103
104=head1 EXAMPLES
105
106To remove the pass phrase on an RSA private key:
107
108 openssl pkey -in key.pem -out keyout.pem
109
110To encrypt a private key using triple DES:
111
112 openssl pkey -in key.pem -des3 -out keyout.pem
113
114To convert a private key from PEM to DER format:
115
116 openssl pkey -in key.pem -outform DER -out keyout.der
117
118To print out the components of a private key to standard output:
119
120 openssl pkey -in key.pem -text -noout
121
122To print out the public components of a private key to standard output:
123
124 openssl pkey -in key.pem -text_pub -noout
125
126To just output the public part of a private key:
127
128 openssl pkey -in key.pem -pubout -out pubkey.pem
129
130=head1 SEE ALSO
131
132L<genpkey(1)|genpkey(1)>, L<rsa(1)|rsa(1)>, L<pkcs8(1)|pkcs8(1)>,
133L<dsa(1)|dsa(1)>, L<genrsa(1)|genrsa(1)>, L<gendsa(1)|gendsa(1)>
134
135=cut
diff --git a/src/lib/libssl/src/doc/apps/pkeyparam.pod b/src/lib/libssl/src/doc/apps/pkeyparam.pod
new file mode 100644
index 0000000000..154f6721af
--- /dev/null
+++ b/src/lib/libssl/src/doc/apps/pkeyparam.pod
@@ -0,0 +1,69 @@
1
2=pod
3
4=head1 NAME
5
6pkeyparam - public key algorithm parameter processing tool
7
8=head1 SYNOPSIS
9
10B<openssl> B<pkeyparam>
11[B<-in filename>]
12[B<-out filename>]
13[B<-text>]
14[B<-noout>]
15[B<-engine id>]
16
17=head1 DESCRIPTION
18
19The B<pkey> command processes public or private keys. They can be converted
20between various forms and their components printed out.
21
22=head1 COMMAND OPTIONS
23
24=over 4
25
26=item B<-in filename>
27
28This specifies the input filename to read parameters from or standard input if
29this option is not specified.
30
31=item B<-out filename>
32
33This specifies the output filename to write parameters to or standard output if
34this option is not specified.
35
36=item B<-text>
37
38prints out the parameters in plain text in addition to the encoded version.
39
40=item B<-noout>
41
42do not output the encoded version of the parameters.
43
44=item B<-engine id>
45
46specifying an engine (by its unique B<id> string) will cause B<pkeyparam>
47to attempt to obtain a functional reference to the specified engine,
48thus initialising it if needed. The engine will then be set as the default
49for all available algorithms.
50
51=back
52
53=head1 EXAMPLE
54
55Print out text version of parameters:
56
57 openssl pkeyparam -in param.pem -text
58
59=head1 NOTES
60
61There are no B<-inform> or B<-outform> options for this command because only
62PEM format is supported because the key type is determined by the PEM headers.
63
64=head1 SEE ALSO
65
66L<genpkey(1)|genpkey(1)>, L<rsa(1)|rsa(1)>, L<pkcs8(1)|pkcs8(1)>,
67L<dsa(1)|dsa(1)>, L<genrsa(1)|genrsa(1)>, L<gendsa(1)|gendsa(1)>
68
69=cut
diff --git a/src/lib/libssl/src/doc/apps/pkeyutl.pod b/src/lib/libssl/src/doc/apps/pkeyutl.pod
new file mode 100644
index 0000000000..27be9a9007
--- /dev/null
+++ b/src/lib/libssl/src/doc/apps/pkeyutl.pod
@@ -0,0 +1,222 @@
1=pod
2
3=head1 NAME
4
5pkeyutl - public key algorithm utility
6
7=head1 SYNOPSIS
8
9B<openssl> B<pkeyutl>
10[B<-in file>]
11[B<-out file>]
12[B<-sigfile file>]
13[B<-inkey file>]
14[B<-keyform PEM|DER>]
15[B<-passin arg>]
16[B<-peerkey file>]
17[B<-peerform PEM|DER>]
18[B<-pubin>]
19[B<-certin>]
20[B<-rev>]
21[B<-sign>]
22[B<-verify>]
23[B<-verifyrecover>]
24[B<-encrypt>]
25[B<-decrypt>]
26[B<-derive>]
27[B<-pkeyopt opt:value>]
28[B<-hexdump>]
29[B<-asn1parse>]
30[B<-engine id>]
31
32=head1 DESCRIPTION
33
34The B<pkeyutl> command can be used to perform public key operations using
35any supported algorithm.
36
37=head1 COMMAND OPTIONS
38
39=over 4
40
41=item B<-in filename>
42
43This specifies the input filename to read data from or standard input
44if this option is not specified.
45
46=item B<-out filename>
47
48specifies the output filename to write to or standard output by
49default.
50
51=item B<-inkey file>
52
53the input key file, by default it should be a private key.
54
55=item B<-keyform PEM|DER>
56
57the key format PEM, DER or ENGINE.
58
59=item B<-passin arg>
60
61the input key 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
65=item B<-peerkey file>
66
67the peer key file, used by key derivation (agreement) operations.
68
69=item B<-peerform PEM|DER>
70
71the peer key format PEM, DER or ENGINE.
72
73=item B<-engine id>
74
75specifying an engine (by its unique B<id> string) will cause B<pkeyutl>
76to attempt to obtain a functional reference to the specified engine,
77thus initialising it if needed. The engine will then be set as the default
78for all available algorithms.
79
80
81=item B<-pubin>
82
83the input file is a public key.
84
85=item B<-certin>
86
87the input is a certificate containing a public key.
88
89=item B<-rev>
90
91reverse the order of the input buffer. This is useful for some libraries
92(such as CryptoAPI) which represent the buffer in little endian format.
93
94=item B<-sign>
95
96sign the input data and output the signed result. This requires
97a private key.
98
99=item B<-verify>
100
101verify the input data against the signature file and indicate if the
102verification succeeded or failed.
103
104=item B<-verifyrecover>
105
106verify the input data and output the recovered data.
107
108=item B<-encrypt>
109
110encrypt the input data using a public key.
111
112=item B<-decrypt>
113
114decrypt the input data using a private key.
115
116=item B<-derive>
117
118derive a shared secret using the peer key.
119
120=item B<-hexdump>
121
122hex dump the output data.
123
124=item B<-asn1parse>
125
126asn1parse the output data, this is useful when combined with the
127B<-verifyrecover> option when an ASN1 structure is signed.
128
129=back
130
131=head1 NOTES
132
133The operations and options supported vary according to the key algorithm
134and its implementation. The OpenSSL operations and options are indicated below.
135
136Unless otherwise mentioned all algorithms support the B<digest:alg> option
137which specifies the digest in use for sign, verify and verifyrecover operations.
138The value B<alg> should represent a digest name as used in the
139EVP_get_digestbyname() function for example B<sha1>.
140
141=head1 RSA ALGORITHM
142
143The RSA algorithm supports encrypt, decrypt, sign, verify and verifyrecover
144operations in general. Some padding modes only support some of these
145operations however.
146
147=over 4
148
149=item -B<rsa_padding_mode:mode>
150
151This sets the RSA padding mode. Acceptable values for B<mode> are B<pkcs1> for
152PKCS#1 padding, B<sslv23> for SSLv23 padding, B<none> for no padding, B<oaep>
153for B<OAEP> mode, B<x931> for X9.31 mode and B<pss> for PSS.
154
155In PKCS#1 padding if the message digest is not set then the supplied data is
156signed or verified directly instead of using a B<DigestInfo> structure. If a
157digest is set then the a B<DigestInfo> structure is used and its the length
158must correspond to the digest type.
159
160For B<oeap> mode only encryption and decryption is supported.
161
162For B<x931> if the digest type is set it is used to format the block data
163otherwise the first byte is used to specify the X9.31 digest ID. Sign,
164verify and verifyrecover are can be performed in this mode.
165
166For B<pss> mode only sign and verify are supported and the digest type must be
167specified.
168
169=item B<rsa_pss_saltlen:len>
170
171For B<pss> mode only this option specifies the salt length. Two special values
172are supported: -1 sets the salt length to the digest length. When signing -2
173sets the salt length to the maximum permissible value. When verifying -2 causes
174the salt length to be automatically determined based on the B<PSS> block
175structure.
176
177=back
178
179=head1 DSA ALGORITHM
180
181The DSA algorithm supports signing and verification operations only. Currently
182there are no additional options other than B<digest>. Only the SHA1
183digest can be used and this digest is assumed by default.
184
185=head1 DH ALGORITHM
186
187The DH algorithm only supports the derivation operation and no additional
188options.
189
190=head1 EC ALGORITHM
191
192The EC algorithm supports sign, verify and derive operations. The sign and
193verify operations use ECDSA and derive uses ECDH. Currently there are no
194additional options other than B<digest>. Only the SHA1 digest can be used and
195this digest is assumed by default.
196
197=head1 EXAMPLES
198
199Sign some data using a private key:
200
201 openssl pkeyutl -sign -in file -inkey key.pem -out sig
202
203Recover the signed data (e.g. if an RSA key is used):
204
205 openssl pkeyutl -verifyrecover -in sig -inkey key.pem
206
207Verify the signature (e.g. a DSA key):
208
209 openssl pkeyutl -verify -in file -sigfile sig -inkey key.pem
210
211Sign data using a message digest value (this is currently only valid for RSA):
212
213 openssl pkeyutl -sign -in file -inkey key.pem -out sig -pkeyopt digest:sha256
214
215Derive a shared secret value:
216
217 openssl pkeyutl -derive -inkey key.pem -peerkey pubkey.pem -out secret
218
219=head1 SEE ALSO
220
221L<genpkey(1)|genpkey(1)>, L<pkey(1)|pkey(1)>, L<rsautl(1)|rsautl(1)>
222L<dgst(1)|dgst(1)>, L<rsa(1)|rsa(1)>, L<genrsa(1)|genrsa(1)>
diff --git a/src/lib/libssl/src/doc/apps/ts.pod b/src/lib/libssl/src/doc/apps/ts.pod
new file mode 100644
index 0000000000..7fb6caa96e
--- /dev/null
+++ b/src/lib/libssl/src/doc/apps/ts.pod
@@ -0,0 +1,594 @@
1=pod
2
3=head1 NAME
4
5ts - Time Stamping Authority tool (client/server)
6
7=head1 SYNOPSIS
8
9B<openssl> B<ts>
10B<-query>
11[B<-rand> file:file...]
12[B<-config> configfile]
13[B<-data> file_to_hash]
14[B<-digest> digest_bytes]
15[B<-md2>|B<-md4>|B<-md5>|B<-sha>|B<-sha1>|B<-mdc2>|B<-ripemd160>|B<...>]
16[B<-policy> object_id]
17[B<-no_nonce>]
18[B<-cert>]
19[B<-in> request.tsq]
20[B<-out> request.tsq]
21[B<-text>]
22
23B<openssl> B<ts>
24B<-reply>
25[B<-config> configfile]
26[B<-section> tsa_section]
27[B<-queryfile> request.tsq]
28[B<-passin> password_src]
29[B<-signer> tsa_cert.pem]
30[B<-inkey> private.pem]
31[B<-chain> certs_file.pem]
32[B<-policy> object_id]
33[B<-in> response.tsr]
34[B<-token_in>]
35[B<-out> response.tsr]
36[B<-token_out>]
37[B<-text>]
38[B<-engine> id]
39
40B<openssl> B<ts>
41B<-verify>
42[B<-data> file_to_hash]
43[B<-digest> digest_bytes]
44[B<-queryfile> request.tsq]
45[B<-in> response.tsr]
46[B<-token_in>]
47[B<-CApath> trusted_cert_path]
48[B<-CAfile> trusted_certs.pem]
49[B<-untrusted> cert_file.pem]
50
51=head1 DESCRIPTION
52
53The B<ts> command is a basic Time Stamping Authority (TSA) client and server
54application as specified in RFC 3161 (Time-Stamp Protocol, TSP). A
55TSA can be part of a PKI deployment and its role is to provide long
56term proof of the existence of a certain datum before a particular
57time. Here is a brief description of the protocol:
58
59=over 4
60
61=item 1.
62
63The TSA client computes a one-way hash value for a data file and sends
64the hash to the TSA.
65
66=item 2.
67
68The TSA attaches the current date and time to the received hash value,
69signs them and sends the time stamp token back to the client. By
70creating this token the TSA certifies the existence of the original
71data file at the time of response generation.
72
73=item 3.
74
75The TSA client receives the time stamp token and verifies the
76signature on it. It also checks if the token contains the same hash
77value that it had sent to the TSA.
78
79=back
80
81There is one DER encoded protocol data unit defined for transporting a time
82stamp request to the TSA and one for sending the time stamp response
83back to the client. The B<ts> command has three main functions:
84creating a time stamp request based on a data file,
85creating a time stamp response based on a request, verifying if a
86response corresponds to a particular request or a data file.
87
88There is no support for sending the requests/responses automatically
89over HTTP or TCP yet as suggested in RFC 3161. The users must send the
90requests either by ftp or e-mail.
91
92=head1 OPTIONS
93
94=head2 Time Stamp Request generation
95
96The B<-query> switch can be used for creating and printing a time stamp
97request with the following options:
98
99=over 4
100
101=item B<-rand> file:file...
102
103The files containing random data for seeding the random number
104generator. Multiple files can be specified, the separator is B<;> for
105MS-Windows, B<,> for VMS and B<:> for all other platforms. (Optional)
106
107=item B<-config> configfile
108
109The configuration file to use, this option overrides the
110B<OPENSSL_CONF> environment variable. Only the OID section
111of the config file is used with the B<-query> command. (Optional)
112
113=item B<-data> file_to_hash
114
115The data file for which the time stamp request needs to be
116created. stdin is the default if neither the B<-data> nor the B<-digest>
117parameter is specified. (Optional)
118
119=item B<-digest> digest_bytes
120
121It is possible to specify the message imprint explicitly without the data
122file. The imprint must be specified in a hexadecimal format, two characters
123per byte, the bytes optionally separated by colons (e.g. 1A:F6:01:... or
1241AF601...). The number of bytes must match the message digest algorithm
125in use. (Optional)
126
127=item B<-md2>|B<-md4>|B<-md5>|B<-sha>|B<-sha1>|B<-mdc2>|B<-ripemd160>|B<...>
128
129The message digest to apply to the data file, it supports all the message
130digest algorithms that are supported by the openssl B<dgst> command.
131The default is SHA-1. (Optional)
132
133=item B<-policy> object_id
134
135The policy that the client expects the TSA to use for creating the
136time stamp token. Either the dotted OID notation or OID names defined
137in the config file can be used. If no policy is requested the TSA will
138use its own default policy. (Optional)
139
140=item B<-no_nonce>
141
142No nonce is specified in the request if this option is
143given. Otherwise a 64 bit long pseudo-random none is
144included in the request. It is recommended to use nonce to
145protect against replay-attacks. (Optional)
146
147=item B<-cert>
148
149The TSA is expected to include its signing certificate in the
150response. (Optional)
151
152=item B<-in> request.tsq
153
154This option specifies a previously created time stamp request in DER
155format that will be printed into the output file. Useful when you need
156to examine the content of a request in human-readable
157
158format. (Optional)
159
160=item B<-out> request.tsq
161
162Name of the output file to which the request will be written. Default
163is stdout. (Optional)
164
165=item B<-text>
166
167If this option is specified the output is human-readable text format
168instead of DER. (Optional)
169
170=back
171
172=head2 Time Stamp Response generation
173
174A time stamp response (TimeStampResp) consists of a response status
175and the time stamp token itself (ContentInfo), if the token generation was
176successful. The B<-reply> command is for creating a time stamp
177response or time stamp token based on a request and printing the
178response/token in human-readable format. If B<-token_out> is not
179specified the output is always a time stamp response (TimeStampResp),
180otherwise it is a time stamp token (ContentInfo).
181
182=over 4
183
184=item B<-config> configfile
185
186The configuration file to use, this option overrides the
187B<OPENSSL_CONF> environment variable. See B<CONFIGURATION FILE
188OPTIONS> for configurable variables. (Optional)
189
190=item B<-section> tsa_section
191
192The name of the config file section conatining the settings for the
193response generation. If not specified the default TSA section is
194used, see B<CONFIGURATION FILE OPTIONS> for details. (Optional)
195
196=item B<-queryfile> request.tsq
197
198The name of the file containing a DER encoded time stamp request. (Optional)
199
200=item B<-passin> password_src
201
202Specifies the password source for the private key of the TSA. See
203B<PASS PHRASE ARGUMENTS> in L<openssl(1)|openssl(1)>. (Optional)
204
205=item B<-signer> tsa_cert.pem
206
207The signer certificate of the TSA in PEM format. The TSA signing
208certificate must have exactly one extended key usage assigned to it:
209timeStamping. The extended key usage must also be critical, otherwise
210the certificate is going to be refused. Overrides the B<signer_cert>
211variable of the config file. (Optional)
212
213=item B<-inkey> private.pem
214
215The signer private key of the TSA in PEM format. Overrides the
216B<signer_key> config file option. (Optional)
217
218=item B<-chain> certs_file.pem
219
220The collection of certificates in PEM format that will all
221be included in the response in addition to the signer certificate if
222the B<-cert> option was used for the request. This file is supposed to
223contain the certificate chain for the signer certificate from its
224issuer upwards. The B<-reply> command does not build a certificate
225chain automatically. (Optional)
226
227=item B<-policy> object_id
228
229The default policy to use for the response unless the client
230explicitly requires a particular TSA policy. The OID can be specified
231either in dotted notation or with its name. Overrides the
232B<default_policy> config file option. (Optional)
233
234=item B<-in> response.tsr
235
236Specifies a previously created time stamp response or time stamp token
237(if B<-token_in> is also specified) in DER format that will be written
238to the output file. This option does not require a request, it is
239useful e.g. when you need to examine the content of a response or
240token or you want to extract the time stamp token from a response. If
241the input is a token and the output is a time stamp response a default
242'granted' status info is added to the token. (Optional)
243
244=item B<-token_in>
245
246This flag can be used together with the B<-in> option and indicates
247that the input is a DER encoded time stamp token (ContentInfo) instead
248of a time stamp response (TimeStampResp). (Optional)
249
250=item B<-out> response.tsr
251
252The response is written to this file. The format and content of the
253file depends on other options (see B<-text>, B<-token_out>). The default is
254stdout. (Optional)
255
256=item B<-token_out>
257
258The output is a time stamp token (ContentInfo) instead of time stamp
259response (TimeStampResp). (Optional)
260
261=item B<-text>
262
263If this option is specified the output is human-readable text format
264instead of DER. (Optional)
265
266=item B<-engine> id
267
268Specifying an engine (by its unique B<id> string) will cause B<ts>
269to attempt to obtain a functional reference to the specified engine,
270thus initialising it if needed. The engine will then be set as the default
271for all available algorithms. Default is builtin. (Optional)
272
273=back
274
275=head2 Time Stamp Response verification
276
277The B<-verify> command is for verifying if a time stamp response or time
278stamp token is valid and matches a particular time stamp request or
279data file. The B<-verify> command does not use the configuration file.
280
281=over 4
282
283=item B<-data> file_to_hash
284
285The response or token must be verified against file_to_hash. The file
286is hashed with the message digest algorithm specified in the token.
287The B<-digest> and B<-queryfile> options must not be specified with this one.
288(Optional)
289
290=item B<-digest> digest_bytes
291
292The response or token must be verified against the message digest specified
293with this option. The number of bytes must match the message digest algorithm
294specified in the token. The B<-data> and B<-queryfile> options must not be
295specified with this one. (Optional)
296
297=item B<-queryfile> request.tsq
298
299The original time stamp request in DER format. The B<-data> and B<-digest>
300options must not be specified with this one. (Optional)
301
302=item B<-in> response.tsr
303
304The time stamp response that needs to be verified in DER format. (Mandatory)
305
306=item B<-token_in>
307
308This flag can be used together with the B<-in> option and indicates
309that the input is a DER encoded time stamp token (ContentInfo) instead
310of a time stamp response (TimeStampResp). (Optional)
311
312=item B<-CApath> trusted_cert_path
313
314The name of the directory containing the trused CA certificates of the
315client. See the similar option of L<verify(1)|verify(1)> for additional
316details. Either this option or B<-CAfile> must be specified. (Optional)
317
318
319=item B<-CAfile> trusted_certs.pem
320
321The name of the file containing a set of trusted self-signed CA
322certificates in PEM format. See the similar option of
323L<verify(1)|verify(1)> for additional details. Either this option
324or B<-CApath> must be specified.
325(Optional)
326
327=item B<-untrusted> cert_file.pem
328
329Set of additional untrusted certificates in PEM format which may be
330needed when building the certificate chain for the TSA's signing
331certificate. This file must contain the TSA signing certificate and
332all intermediate CA certificates unless the response includes them.
333(Optional)
334
335=back
336
337=head1 CONFIGURATION FILE OPTIONS
338
339The B<-query> and B<-reply> commands make use of a configuration file
340defined by the B<OPENSSL_CONF> environment variable. See L<config(5)|config(5)>
341for a general description of the syntax of the config file. The
342B<-query> command uses only the symbolic OID names section
343and it can work without it. However, the B<-reply> command needs the
344config file for its operation.
345
346When there is a command line switch equivalent of a variable the
347switch always overrides the settings in the config file.
348
349=over 4
350
351=item B<tsa> section, B<default_tsa>
352
353This is the main section and it specifies the name of another section
354that contains all the options for the B<-reply> command. This default
355section can be overriden with the B<-section> command line switch. (Optional)
356
357=item B<oid_file>
358
359See L<ca(1)|ca(1)> for description. (Optional)
360
361=item B<oid_section>
362
363See L<ca(1)|ca(1)> for description. (Optional)
364
365=item B<RANDFILE>
366
367See L<ca(1)|ca(1)> for description. (Optional)
368
369=item B<serial>
370
371The name of the file containing the hexadecimal serial number of the
372last time stamp response created. This number is incremented by 1 for
373each response. If the file does not exist at the time of response
374generation a new file is created with serial number 1. (Mandatory)
375
376=item B<crypto_device>
377
378Specifies the OpenSSL engine that will be set as the default for
379all available algorithms. The default value is builtin, you can specify
380any other engines supported by OpenSSL (e.g. use chil for the NCipher HSM).
381(Optional)
382
383=item B<signer_cert>
384
385TSA signing certificate in PEM format. The same as the B<-signer>
386command line option. (Optional)
387
388=item B<certs>
389
390A file containing a set of PEM encoded certificates that need to be
391included in the response. The same as the B<-chain> command line
392option. (Optional)
393
394=item B<signer_key>
395
396The private key of the TSA in PEM format. The same as the B<-inkey>
397command line option. (Optional)
398
399=item B<default_policy>
400
401The default policy to use when the request does not mandate any
402policy. The same as the B<-policy> command line option. (Optional)
403
404=item B<other_policies>
405
406Comma separated list of policies that are also acceptable by the TSA
407and used only if the request explicitly specifies one of them. (Optional)
408
409=item B<digests>
410
411The list of message digest algorithms that the TSA accepts. At least
412one algorithm must be specified. (Mandatory)
413
414=item B<accuracy>
415
416The accuracy of the time source of the TSA in seconds, milliseconds
417and microseconds. E.g. secs:1, millisecs:500, microsecs:100. If any of
418the components is missing zero is assumed for that field. (Optional)
419
420=item B<clock_precision_digits>
421
422Specifies the maximum number of digits, which represent the fraction of
423seconds, that need to be included in the time field. The trailing zeroes
424must be removed from the time, so there might actually be fewer digits,
425or no fraction of seconds at all. Supported only on UNIX platforms.
426The maximum value is 6, default is 0.
427(Optional)
428
429=item B<ordering>
430
431If this option is yes the responses generated by this TSA can always
432be ordered, even if the time difference between two responses is less
433than the sum of their accuracies. Default is no. (Optional)
434
435=item B<tsa_name>
436
437Set this option to yes if the subject name of the TSA must be included in
438the TSA name field of the response. Default is no. (Optional)
439
440=item B<ess_cert_id_chain>
441
442The SignedData objects created by the TSA always contain the
443certificate identifier of the signing certificate in a signed
444attribute (see RFC 2634, Enhanced Security Services). If this option
445is set to yes and either the B<certs> variable or the B<-chain> option
446is specified then the certificate identifiers of the chain will also
447be included in the SigningCertificate signed attribute. If this
448variable is set to no, only the signing certificate identifier is
449included. Default is no. (Optional)
450
451=back
452
453=head1 ENVIRONMENT VARIABLES
454
455B<OPENSSL_CONF> contains the path of the configuration file and can be
456overriden by the B<-config> command line option.
457
458=head1 EXAMPLES
459
460All the examples below presume that B<OPENSSL_CONF> is set to a proper
461configuration file, e.g. the example configuration file
462openssl/apps/openssl.cnf will do.
463
464=head2 Time Stamp Request
465
466To create a time stamp request for design1.txt with SHA-1
467without nonce and policy and no certificate is required in the response:
468
469 openssl ts -query -data design1.txt -no_nonce \
470 -out design1.tsq
471
472To create a similar time stamp request with specifying the message imprint
473explicitly:
474
475 openssl ts -query -digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \
476 -no_nonce -out design1.tsq
477
478To print the content of the previous request in human readable format:
479
480 openssl ts -query -in design1.tsq -text
481
482To create a time stamp request which includes the MD-5 digest
483of design2.txt, requests the signer certificate and nonce,
484specifies a policy id (assuming the tsa_policy1 name is defined in the
485OID section of the config file):
486
487 openssl ts -query -data design2.txt -md5 \
488 -policy tsa_policy1 -cert -out design2.tsq
489
490=head2 Time Stamp Response
491
492Before generating a response a signing certificate must be created for
493the TSA that contains the B<timeStamping> critical extended key usage extension
494without any other key usage extensions. You can add the
495'extendedKeyUsage = critical,timeStamping' line to the user certificate section
496of the config file to generate a proper certificate. See L<req(1)|req(1)>,
497L<ca(1)|ca(1)>, L<x509(1)|x509(1)> for instructions. The examples
498below assume that cacert.pem contains the certificate of the CA,
499tsacert.pem is the signing certificate issued by cacert.pem and
500tsakey.pem is the private key of the TSA.
501
502To create a time stamp response for a request:
503
504 openssl ts -reply -queryfile design1.tsq -inkey tsakey.pem \
505 -signer tsacert.pem -out design1.tsr
506
507If you want to use the settings in the config file you could just write:
508
509 openssl ts -reply -queryfile design1.tsq -out design1.tsr
510
511To print a time stamp reply to stdout in human readable format:
512
513 openssl ts -reply -in design1.tsr -text
514
515To create a time stamp token instead of time stamp response:
516
517 openssl ts -reply -queryfile design1.tsq -out design1_token.der -token_out
518
519To print a time stamp token to stdout in human readable format:
520
521 openssl ts -reply -in design1_token.der -token_in -text -token_out
522
523To extract the time stamp token from a response:
524
525 openssl ts -reply -in design1.tsr -out design1_token.der -token_out
526
527To add 'granted' status info to a time stamp token thereby creating a
528valid response:
529
530 openssl ts -reply -in design1_token.der -token_in -out design1.tsr
531
532=head2 Time Stamp Verification
533
534To verify a time stamp reply against a request:
535
536 openssl ts -verify -queryfile design1.tsq -in design1.tsr \
537 -CAfile cacert.pem -untrusted tsacert.pem
538
539To verify a time stamp reply that includes the certificate chain:
540
541 openssl ts -verify -queryfile design2.tsq -in design2.tsr \
542 -CAfile cacert.pem
543
544To verify a time stamp token against the original data file:
545 openssl ts -verify -data design2.txt -in design2.tsr \
546 -CAfile cacert.pem
547
548To verify a time stamp token against a message imprint:
549 openssl ts -verify -digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \
550 -in design2.tsr -CAfile cacert.pem
551
552You could also look at the 'test' directory for more examples.
553
554=head1 BUGS
555
556If you find any bugs or you have suggestions please write to
557Zoltan Glozik <zglozik@opentsa.org>. Known issues:
558
559=over 4
560
561=item * No support for time stamps over SMTP, though it is quite easy
562to implement an automatic e-mail based TSA with L<procmail(1)|procmail(1)>
563and L<perl(1)|perl(1)>. HTTP server support is provided in the form of
564a separate apache module. HTTP client support is provided by
565L<tsget(1)|tsget(1)>. Pure TCP/IP protocol is not supported.
566
567=item * The file containing the last serial number of the TSA is not
568locked when being read or written. This is a problem if more than one
569instance of L<openssl(1)|openssl(1)> is trying to create a time stamp
570response at the same time. This is not an issue when using the apache
571server module, it does proper locking.
572
573=item * Look for the FIXME word in the source files.
574
575=item * The source code should really be reviewed by somebody else, too.
576
577=item * More testing is needed, I have done only some basic tests (see
578test/testtsa).
579
580=back
581
582=cut
583
584=head1 AUTHOR
585
586Zoltan Glozik <zglozik@opentsa.org>, OpenTSA project (http://www.opentsa.org)
587
588=head1 SEE ALSO
589
590L<tsget(1)|tsget(1)>, L<openssl(1)|openssl(1)>, L<req(1)|req(1)>,
591L<x509(1)|x509(1)>, L<ca(1)|ca(1)>, L<genrsa(1)|genrsa(1)>,
592L<config(5)|config(5)>
593
594=cut
diff --git a/src/lib/libssl/src/doc/apps/tsget.pod b/src/lib/libssl/src/doc/apps/tsget.pod
new file mode 100644
index 0000000000..b05957beea
--- /dev/null
+++ b/src/lib/libssl/src/doc/apps/tsget.pod
@@ -0,0 +1,194 @@
1=pod
2
3=head1 NAME
4
5tsget - Time Stamping HTTP/HTTPS client
6
7=head1 SYNOPSIS
8
9B<tsget>
10B<-h> server_url
11[B<-e> extension]
12[B<-o> output]
13[B<-v>]
14[B<-d>]
15[B<-k> private_key.pem]
16[B<-p> key_password]
17[B<-c> client_cert.pem]
18[B<-C> CA_certs.pem]
19[B<-P> CA_path]
20[B<-r> file:file...]
21[B<-g> EGD_socket]
22[request]...
23
24=head1 DESCRIPTION
25
26The B<tsget> command can be used for sending a time stamp request, as
27specified in B<RFC 3161>, to a time stamp server over HTTP or HTTPS and storing
28the time stamp response in a file. This tool cannot be used for creating the
29requests and verifying responses, you can use the OpenSSL B<ts(1)> command to
30do that. B<tsget> can send several requests to the server without closing
31the TCP connection if more than one requests are specified on the command
32line.
33
34The tool sends the following HTTP request for each time stamp request:
35
36 POST url HTTP/1.1
37 User-Agent: OpenTSA tsget.pl/<version>
38 Host: <host>:<port>
39 Pragma: no-cache
40 Content-Type: application/timestamp-query
41 Accept: application/timestamp-reply
42 Content-Length: length of body
43
44 ...binary request specified by the user...
45
46B<tsget> expects a response of type application/timestamp-reply, which is
47written to a file without any interpretation.
48
49=head1 OPTIONS
50
51=over 4
52
53=item B<-h> server_url
54
55The URL of the HTTP/HTTPS server listening for time stamp requests.
56
57=item B<-e> extension
58
59If the B<-o> option is not given this argument specifies the extension of the
60output files. The base name of the output file will be the same as those of
61the input files. Default extension is '.tsr'. (Optional)
62
63=item B<-o> output
64
65This option can be specified only when just one request is sent to the
66server. The time stamp response will be written to the given output file. '-'
67means standard output. In case of multiple time stamp requests or the absence
68of this argument the names of the output files will be derived from the names
69of the input files and the default or specified extension argument. (Optional)
70
71=item B<-v>
72
73The name of the currently processed request is printed on standard
74error. (Optional)
75
76=item B<-d>
77
78Switches on verbose mode for the underlying B<curl> library. You can see
79detailed debug messages for the connection. (Optional)
80
81=item B<-k> private_key.pem
82
83(HTTPS) In case of certificate-based client authentication over HTTPS
84<private_key.pem> must contain the private key of the user. The private key
85file can optionally be protected by a passphrase. The B<-c> option must also
86be specified. (Optional)
87
88=item B<-p> key_password
89
90(HTTPS) Specifies the passphrase for the private key specified by the B<-k>
91argument. If this option is omitted and the key is passphrase protected B<tsget>
92will ask for it. (Optional)
93
94=item B<-c> client_cert.pem
95
96(HTTPS) In case of certificate-based client authentication over HTTPS
97<client_cert.pem> must contain the X.509 certificate of the user. The B<-k>
98option must also be specified. If this option is not specified no
99certificate-based client authentication will take place. (Optional)
100
101=item B<-C> CA_certs.pem
102
103(HTTPS) The trusted CA certificate store. The certificate chain of the peer's
104certificate must include one of the CA certificates specified in this file.
105Either option B<-C> or option B<-P> must be given in case of HTTPS. (Optional)
106
107=item B<-P> CA_path
108
109(HTTPS) The path containing the trusted CA certificates to verify the peer's
110certificate. The directory must be prepared with the B<c_rehash>
111OpenSSL utility. Either option B<-C> or option B<-P> must be given in case of
112HTTPS. (Optional)
113
114=item B<-rand> file:file...
115
116The files containing random data for seeding the random number
117generator. Multiple files can be specified, the separator is B<;> for
118MS-Windows, B<,> for VMS and B<:> for all other platforms. (Optional)
119
120=item B<-g> EGD_socket
121
122The name of an EGD socket to get random data from. (Optional)
123
124=item [request]...
125
126List of files containing B<RFC 3161> DER-encoded time stamp requests. If no
127requests are specifed only one request will be sent to the server and it will be
128read from the standard input. (Optional)
129
130=back
131
132=head1 ENVIRONMENT VARIABLES
133
134The B<TSGET> environment variable can optionally contain default
135arguments. The content of this variable is added to the list of command line
136arguments.
137
138=head1 EXAMPLES
139
140The examples below presume that B<file1.tsq> and B<file2.tsq> contain valid
141time stamp requests, tsa.opentsa.org listens at port 8080 for HTTP requests
142and at port 8443 for HTTPS requests, the TSA service is available at the /tsa
143absolute path.
144
145Get a time stamp response for file1.tsq over HTTP, output is written to
146file1.tsr:
147
148 tsget -h http://tsa.opentsa.org:8080/tsa file1.tsq
149
150Get a time stamp response for file1.tsq and file2.tsq over HTTP showing
151progress, output is written to file1.reply and file2.reply respectively:
152
153 tsget -h http://tsa.opentsa.org:8080/tsa -v -e .reply \
154 file1.tsq file2.tsq
155
156Create a time stamp request, write it to file3.tsq, send it to the server and
157write the response to file3.tsr:
158
159 openssl ts -query -data file3.txt -cert | tee file3.tsq \
160 | tsget -h http://tsa.opentsa.org:8080/tsa \
161 -o file3.tsr
162
163Get a time stamp response for file1.tsq over HTTPS without client
164authentication:
165
166 tsget -h https://tsa.opentsa.org:8443/tsa \
167 -C cacerts.pem file1.tsq
168
169Get a time stamp response for file1.tsq over HTTPS with certificate-based
170client authentication (it will ask for the passphrase if client_key.pem is
171protected):
172
173 tsget -h https://tsa.opentsa.org:8443/tsa -C cacerts.pem \
174 -k client_key.pem -c client_cert.pem file1.tsq
175
176You can shorten the previous command line if you make use of the B<TSGET>
177environment variable. The following commands do the same as the previous
178example:
179
180 TSGET='-h https://tsa.opentsa.org:8443/tsa -C cacerts.pem \
181 -k client_key.pem -c client_cert.pem'
182 export TSGET
183 tsget file1.tsq
184
185=head1 AUTHOR
186
187Zoltan Glozik <zglozik@opentsa.org>, OpenTSA project (http://www.opentsa.org)
188
189=head1 SEE ALSO
190
191L<openssl(1)|openssl(1)>, L<ts(1)|ts(1)>, L<curl(1)|curl(1)>,
192B<RFC 3161>
193
194=cut
diff --git a/src/lib/libssl/src/doc/apps/x509v3_config.pod b/src/lib/libssl/src/doc/apps/x509v3_config.pod
index 38c46e85c4..0450067cf1 100644
--- a/src/lib/libssl/src/doc/apps/x509v3_config.pod
+++ b/src/lib/libssl/src/doc/apps/x509v3_config.pod
@@ -52,7 +52,7 @@ use is defined by the extension code itself: check out the certificate
52policies extension for an example. 52policies extension for an example.
53 53
54If an extension type is unsupported then the I<arbitrary> extension syntax 54If an extension type is unsupported then the I<arbitrary> extension syntax
55must be used, see the L<ARBITRART EXTENSIONS|/"ARBITRARY EXTENSIONS"> section for more details. 55must be used, see the L<ARBITRARY EXTENSIONS|/"ARBITRARY EXTENSIONS"> section for more details.
56 56
57=head1 STANDARD EXTENSIONS 57=head1 STANDARD EXTENSIONS
58 58
@@ -178,7 +178,7 @@ preceeding the name with a B<+> character.
178 178
179otherName can include arbitrary data associated with an OID: the value 179otherName can include arbitrary data associated with an OID: the value
180should be the OID followed by a semicolon and the content in standard 180should be the OID followed by a semicolon and the content in standard
181ASN1_generate_nconf() format. 181L<ASN1_generate_nconf(3)|ASN1_generate_nconf(3)> format.
182 182
183Examples: 183Examples:
184 184
@@ -226,21 +226,82 @@ Example:
226 226
227=head2 CRL distribution points. 227=head2 CRL distribution points.
228 228
229This is a multi-valued extension that supports all the literal options of 229This is a multi-valued extension whose options can be either in name:value pair
230subject alternative name. Of the few software packages that currently interpret 230using the same form as subject alternative name or a single value representing
231this extension most only interpret the URI option. 231a section name containing all the distribution point fields.
232 232
233Currently each option will set a new DistributionPoint with the fullName 233For a name:value pair a new DistributionPoint with the fullName field set to
234field set to the given value. 234the given value both the cRLissuer and reasons fields are omitted in this case.
235 235
236Other fields like cRLissuer and reasons cannot currently be set or displayed: 236In the single option case the section indicated contains values for each
237at this time no examples were available that used these fields. 237field. In this section:
238 238
239Examples: 239If the name is "fullname" the value field should contain the full name
240of the distribution point in the same format as subject alternative name.
241
242If the name is "relativename" then the value field should contain a section
243name whose contents represent a DN fragment to be placed in this field.
244
245The name "CRLIssuer" if present should contain a value for this field in
246subject alternative name format.
247
248If the name is "reasons" the value field should consist of a comma
249separated field containing the reasons. Valid reasons are: "keyCompromise",
250"CACompromise", "affiliationChanged", "superseded", "cessationOfOperation",
251"certificateHold", "privilegeWithdrawn" and "AACompromise".
252
253
254Simple examples:
240 255
241 crlDistributionPoints=URI:http://myhost.com/myca.crl 256 crlDistributionPoints=URI:http://myhost.com/myca.crl
242 crlDistributionPoints=URI:http://my.com/my.crl,URI:http://oth.com/my.crl 257 crlDistributionPoints=URI:http://my.com/my.crl,URI:http://oth.com/my.crl
243 258
259Full distribution point example:
260
261 crlDistributionPoints=crldp1_section
262
263 [crldp1_section]
264
265 fullname=URI:http://myhost.com/myca.crl
266 CRLissuer=dirName:issuer_sect
267 reasons=keyCompromise, CACompromise
268
269 [issuer_sect]
270 C=UK
271 O=Organisation
272 CN=Some Name
273
274=head2 Issuing Distribution Point
275
276This extension should only appear in CRLs. It is a multi valued extension
277whose syntax is similar to the "section" pointed to by the CRL distribution
278points extension with a few differences.
279
280The names "reasons" and "CRLissuer" are not recognized.
281
282The name "onlysomereasons" is accepted which sets this field. The value is
283in the same format as the CRL distribution point "reasons" field.
284
285The names "onlyuser", "onlyCA", "onlyAA" and "indirectCRL" are also accepted
286the values should be a boolean value (TRUE or FALSE) to indicate the value of
287the corresponding field.
288
289Example:
290
291 issuingDistributionPoint=critical, @idp_section
292
293 [idp_section]
294
295 fullname=URI:http://myhost.com/myca.crl
296 indirectCRL=TRUE
297 onlysomereasons=keyCompromise, CACompromise
298
299 [issuer_sect]
300 C=UK
301 O=Organisation
302 CN=Some Name
303
304
244=head2 Certificate Policies. 305=head2 Certificate Policies.
245 306
246This is a I<raw> extension. All the fields of this extension can be set by 307This is a I<raw> extension. All the fields of this extension can be set by
@@ -329,6 +390,16 @@ Examples:
329 nameConstraints=permitted;email:.somedomain.com 390 nameConstraints=permitted;email:.somedomain.com
330 391
331 nameConstraints=excluded;email:.com 392 nameConstraints=excluded;email:.com
393issuingDistributionPoint = idp_section
394
395=head2 OCSP No Check
396
397The OCSP No Check extension is a string extension but its value is ignored.
398
399Example:
400
401 noCheck = ignored
402
332 403
333=head1 DEPRECATED EXTENSIONS 404=head1 DEPRECATED EXTENSIONS
334 405
@@ -370,7 +441,8 @@ the data is formatted correctly for the given extension type.
370There are two ways to encode arbitrary extensions. 441There are two ways to encode arbitrary extensions.
371 442
372The first way is to use the word ASN1 followed by the extension content 443The first way is to use the word ASN1 followed by the extension content
373using the same syntax as ASN1_generate_nconf(). For example: 444using the same syntax as L<ASN1_generate_nconf(3)|ASN1_generate_nconf(3)>.
445For example:
374 446
375 1.2.3.4=critical,ASN1:UTF8String:Some random data 447 1.2.3.4=critical,ASN1:UTF8String:Some random data
376 448
@@ -450,7 +522,8 @@ for arbitrary extensions was added in OpenSSL 0.9.8
450 522
451=head1 SEE ALSO 523=head1 SEE ALSO
452 524
453L<req(1)|req(1)>, L<ca(1)|ca(1)>, L<x509(1)|x509(1)> 525L<req(1)|req(1)>, L<ca(1)|ca(1)>, L<x509(1)|x509(1)>,
526L<ASN1_generate_nconf(3)|ASN1_generate_nconf(3)>
454 527
455 528
456=cut 529=cut
diff --git a/src/lib/libssl/src/doc/crypto/ASN1_generate_nconf.pod b/src/lib/libssl/src/doc/crypto/ASN1_generate_nconf.pod
index 1157cff510..542fd1579a 100644
--- a/src/lib/libssl/src/doc/crypto/ASN1_generate_nconf.pod
+++ b/src/lib/libssl/src/doc/crypto/ASN1_generate_nconf.pod
@@ -6,6 +6,8 @@ ASN1_generate_nconf, ASN1_generate_v3 - ASN1 generation functions
6 6
7=head1 SYNOPSIS 7=head1 SYNOPSIS
8 8
9 #include <openssl/asn1.h>
10
9 ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf); 11 ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf);
10 ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf); 12 ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);
11 13
@@ -101,7 +103,8 @@ bits is set to zero.
101=item B<UNIVERSALSTRING>, B<UNIV>, B<IA5>, B<IA5STRING>, B<UTF8>, 103=item B<UNIVERSALSTRING>, B<UNIV>, B<IA5>, B<IA5STRING>, B<UTF8>,
102B<UTF8String>, B<BMP>, B<BMPSTRING>, B<VISIBLESTRING>, 104B<UTF8String>, B<BMP>, B<BMPSTRING>, B<VISIBLESTRING>,
103B<VISIBLE>, B<PRINTABLESTRING>, B<PRINTABLE>, B<T61>, 105B<VISIBLE>, B<PRINTABLESTRING>, B<PRINTABLE>, B<T61>,
104B<T61STRING>, B<TELETEXSTRING>, B<GeneralString> 106B<T61STRING>, B<TELETEXSTRING>, B<GeneralString>, B<NUMERICSTRING>,
107B<NUMERIC>
105 108
106These encode the corresponding string types. B<value> represents the 109These encode the corresponding string types. B<value> represents the
107contents of this structure. The format can be B<ASCII> or B<UTF8>. 110contents of this structure. The format can be B<ASCII> or B<UTF8>.
@@ -175,7 +178,7 @@ An IA5String explicitly tagged using APPLICATION tagging:
175 178
176A BITSTRING with bits 1 and 5 set and all others zero: 179A BITSTRING with bits 1 and 5 set and all others zero:
177 180
178 FORMAT=BITLIST,BITSTRING:1,5 181 FORMAT:BITLIST,BITSTRING:1,5
179 182
180A more complex example using a config file to produce a 183A more complex example using a config file to produce a
181SEQUENCE consiting of a BOOL an OID and a UTF8String: 184SEQUENCE consiting of a BOOL an OID and a UTF8String:
diff --git a/src/lib/libssl/src/doc/crypto/BIO_new_CMS.pod b/src/lib/libssl/src/doc/crypto/BIO_new_CMS.pod
new file mode 100644
index 0000000000..9e3a4b7f89
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/BIO_new_CMS.pod
@@ -0,0 +1,66 @@
1=pod
2
3=head1 NAME
4
5 BIO_new_CMS - CMS streaming filter BIO
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms);
12
13=head1 DESCRIPTION
14
15BIO_new_CMS() returns a streaming filter BIO chain based on B<cms>. The output
16of the filter is written to B<out>. Any data written to the chain is
17automatically translated to a BER format CMS structure of the appropriate type.
18
19=head1 NOTES
20
21The chain returned by this function behaves like a standard filter BIO. It
22supports non blocking I/O. Content is processed and streamed on the fly and not
23all held in memory at once: so it is possible to encode very large structures.
24After all content has been written through the chain BIO_flush() must be called
25to finalise the structure.
26
27The B<CMS_STREAM> flag must be included in the corresponding B<flags>
28parameter of the B<cms> creation function.
29
30If an application wishes to write additional data to B<out> BIOs should be
31removed from the chain using BIO_pop() and freed with BIO_free() until B<out>
32is reached. If no additional data needs to be written BIO_free_all() can be
33called to free up the whole chain.
34
35Any content written through the filter is used verbatim: no canonical
36translation is performed.
37
38It is possible to chain multiple BIOs to, for example, create a triple wrapped
39signed, enveloped, signed structure. In this case it is the applications
40responsibility to set the inner content type of any outer CMS_ContentInfo
41structures.
42
43Large numbers of small writes through the chain should be avoided as this will
44produce an output consisting of lots of OCTET STRING structures. Prepending
45a BIO_f_buffer() buffering BIO will prevent this.
46
47=head1 BUGS
48
49There is currently no corresponding inverse BIO: i.e. one which can decode
50a CMS structure on the fly.
51
52=head1 RETURN VALUES
53
54BIO_new_CMS() returns a BIO chain when successful or NULL if an error
55occurred. The error can be obtained from ERR_get_error(3).
56
57=head1 SEE ALSO
58
59L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>,
60L<CMS_encrypt(3)|CMS_encrypt(3)>
61
62=head1 HISTORY
63
64BIO_new_CMS() was added to OpenSSL 1.0.0
65
66=cut
diff --git a/src/lib/libssl/src/doc/crypto/BN_BLINDING_new.pod b/src/lib/libssl/src/doc/crypto/BN_BLINDING_new.pod
index 7b087f7288..5f51fdb470 100644
--- a/src/lib/libssl/src/doc/crypto/BN_BLINDING_new.pod
+++ b/src/lib/libssl/src/doc/crypto/BN_BLINDING_new.pod
@@ -22,8 +22,11 @@ functions.
22 BN_CTX *ctx); 22 BN_CTX *ctx);
23 int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, 23 int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b,
24 BN_CTX *ctx); 24 BN_CTX *ctx);
25 #ifndef OPENSSL_NO_DEPRECATED
25 unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *); 26 unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *);
26 void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long); 27 void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long);
28 #endif
29 CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *);
27 unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); 30 unsigned long BN_BLINDING_get_flags(const BN_BLINDING *);
28 void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); 31 void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long);
29 BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, 32 BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
@@ -54,11 +57,11 @@ BN_BLINDING_convert() and BN_BLINDING_invert() are wrapper
54functions for BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() 57functions for BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex()
55with B<r> set to NULL. 58with B<r> set to NULL.
56 59
57BN_BLINDING_set_thread_id() and BN_BLINDING_get_thread_id() 60BN_BLINDING_thread_id() provides access to the B<CRYPTO_THREADID>
58set and get the "thread id" value of the B<BN_BLINDING> structure, 61object within the B<BN_BLINDING> structure. This is to help users
59a field provided to users of B<BN_BLINDING> structure to help them 62provide proper locking if needed for multi-threaded use. The "thread
60provide proper locking if needed for multi-threaded use. The 63id" object of a newly allocated B<BN_BLINDING> structure is
61"thread id" of a newly allocated B<BN_BLINDING> structure is zero. 64initialised to the thread id in which BN_BLINDING_new() was called.
62 65
63BN_BLINDING_get_flags() returns the BN_BLINDING flags. Currently 66BN_BLINDING_get_flags() returns the BN_BLINDING flags. Currently
64there are two supported flags: B<BN_BLINDING_NO_UPDATE> and 67there are two supported flags: B<BN_BLINDING_NO_UPDATE> and
@@ -83,8 +86,8 @@ BN_BLINDING_update(), BN_BLINDING_convert(), BN_BLINDING_invert(),
83BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() return 1 on 86BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() return 1 on
84success and 0 if an error occured. 87success and 0 if an error occured.
85 88
86BN_BLINDING_get_thread_id() returns the thread id (a B<unsigned long> 89BN_BLINDING_thread_id() returns a pointer to the thread id object
87value) or 0 if not set. 90within a B<BN_BLINDING> object.
88 91
89BN_BLINDING_get_flags() returns the currently set B<BN_BLINDING> flags 92BN_BLINDING_get_flags() returns the currently set B<BN_BLINDING> flags
90(a B<unsigned long> value). 93(a B<unsigned long> value).
@@ -98,6 +101,9 @@ L<bn(3)|bn(3)>
98 101
99=head1 HISTORY 102=head1 HISTORY
100 103
104BN_BLINDING_thread_id was first introduced in OpenSSL 1.0.0, and it
105deprecates BN_BLINDING_set_thread_id and BN_BLINDING_get_thread_id.
106
101BN_BLINDING_convert_ex, BN_BLINDIND_invert_ex, BN_BLINDING_get_thread_id, 107BN_BLINDING_convert_ex, BN_BLINDIND_invert_ex, BN_BLINDING_get_thread_id,
102BN_BLINDING_set_thread_id, BN_BLINDING_set_flags, BN_BLINDING_get_flags 108BN_BLINDING_set_thread_id, BN_BLINDING_set_flags, BN_BLINDING_get_flags
103and BN_BLINDING_create_param were first introduced in OpenSSL 0.9.8 109and BN_BLINDING_create_param were first introduced in OpenSSL 0.9.8
diff --git a/src/lib/libssl/src/doc/crypto/CMS_add0_cert.pod b/src/lib/libssl/src/doc/crypto/CMS_add0_cert.pod
new file mode 100644
index 0000000000..9c13f488f6
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/CMS_add0_cert.pod
@@ -0,0 +1,66 @@
1=pod
2
3=head1 NAME
4
5 CMS_add0_cert, CMS_add1_cert, CMS_get1_certs, CMS_add0_crl, CMS_get1_crls, - CMS certificate and CRL utility functions
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert);
12 int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert);
13 STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms);
14
15 int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);
16 int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl);
17 STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);
18
19
20=head1 DESCRIPTION
21
22CMS_add0_cert() and CMS_add1_cert() add certificate B<cert> to B<cms>.
23must be of type signed data or enveloped data.
24
25CMS_get1_certs() returns all certificates in B<cms>.
26
27CMS_add0_crl() and CMS_add1_crl() add CRL B<crl> to B<cms>. CMS_get1_crls()
28returns any CRLs in B<cms>.
29
30=head1 NOTES
31
32The CMS_ContentInfo structure B<cms> must be of type signed data or enveloped
33data or an error will be returned.
34
35For signed data certificates and CRLs are added to the B<certificates> and
36B<crls> fields of SignedData structure. For enveloped data they are added to
37B<OriginatorInfo>.
38
39As the B<0> implies CMS_add0_cert() adds B<cert> internally to B<cms> and it
40must not be freed up after the call as opposed to CMS_add1_cert() where B<cert>
41must be freed up.
42
43The same certificate or CRL must not be added to the same cms structure more
44than once.
45
46=head1 RETURN VALUES
47
48CMS_add0_cert(), CMS_add1_cert() and CMS_add0_crl() and CMS_add1_crl() return
491 for success and 0 for failure.
50
51CMS_get1_certs() and CMS_get1_crls() return the STACK of certificates or CRLs
52or NULL if there are none or an error occurs. The only error which will occur
53in practice is if the B<cms> type is invalid.
54
55=head1 SEE ALSO
56
57L<ERR_get_error(3)|ERR_get_error(3)>,
58L<CMS_sign(3)|CMS_sign(3)>,
59L<CMS_encrypt(3)|CMS_encrypt(3)>
60
61=head1 HISTORY
62
63CMS_add0_cert(), CMS_add1_cert(), CMS_get1_certs(), CMS_add0_crl()
64and CMS_get1_crls() were all first added to OpenSSL 0.9.8
65
66=cut
diff --git a/src/lib/libssl/src/doc/crypto/CMS_add1_recipient_cert.pod b/src/lib/libssl/src/doc/crypto/CMS_add1_recipient_cert.pod
new file mode 100644
index 0000000000..d7d8e2532c
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/CMS_add1_recipient_cert.pod
@@ -0,0 +1,62 @@
1=pod
2
3=head1 NAME
4
5 CMS_add1_recipient_cert, CMS_add0_recipient_key - add recipients to a CMS enveloped data structure
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms, X509 *recip, unsigned int flags);
12
13 CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid, unsigned char *key, size_t keylen, unsigned char *id, size_t idlen, ASN1_GENERALIZEDTIME *date, ASN1_OBJECT *otherTypeId, ASN1_TYPE *otherType);
14
15=head1 DESCRIPTION
16
17CMS_add1_recipient_cert() adds recipient B<recip> to CMS_ContentInfo enveloped
18data structure B<cms> as a KeyTransRecipientInfo structure.
19
20CMS_add0_recipient_key() adds symmetric key B<key> of length B<keylen> using
21wrapping algorithm B<nid>, identifier B<id> of length B<idlen> and optional
22values B<date>, B<otherTypeId> and B<otherType> to CMS_ContentInfo enveloped
23data structure B<cms> as a KEKRecipientInfo structure.
24
25The CMS_ContentInfo structure should be obtained from an initial call to
26CMS_encrypt() with the flag B<CMS_PARTIAL> set.
27
28=head1 NOTES
29
30The main purpose of this function is to provide finer control over a CMS
31enveloped data structure where the simpler CMS_encrypt() function defaults are
32not appropriate. For example if one or more KEKRecipientInfo structures
33need to be added. New attributes can also be added using the returned
34CMS_RecipientInfo structure and the CMS attribute utility functions.
35
36OpenSSL will by default identify recipient certificates using issuer name
37and serial number. If B<CMS_USE_KEYID> is set it will use the subject key
38identifier value instead. An error occurs if all recipient certificates do not
39have a subject key identifier extension.
40
41Currently only AES based key wrapping algorithms are supported for B<nid>,
42specifically: NID_id_aes128_wrap, NID_id_aes192_wrap and NID_id_aes256_wrap.
43If B<nid> is set to B<NID_undef> then an AES wrap algorithm will be used
44consistent with B<keylen>.
45
46=head1 RETURN VALUES
47
48CMS_add1_recipient_cert() and CMS_add0_recipient_key() return an internal
49pointer to the CMS_RecipientInfo structure just added or NULL if an error
50occurs.
51
52=head1 SEE ALSO
53
54L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_decrypt(3)|CMS_decrypt(3)>,
55L<CMS_final(3)|CMS_final(3)>,
56
57=head1 HISTORY
58
59CMS_add1_recipient_cert() and CMS_add0_recipient_key() were added to OpenSSL
600.9.8
61
62=cut
diff --git a/src/lib/libssl/src/doc/crypto/CMS_compress.pod b/src/lib/libssl/src/doc/crypto/CMS_compress.pod
new file mode 100644
index 0000000000..0a0715271d
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/CMS_compress.pod
@@ -0,0 +1,73 @@
1=pod
2
3=head1 NAME
4
5CMS_compress - create a CMS CompressedData structure
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags);
12
13=head1 DESCRIPTION
14
15CMS_compress() creates and returns a CMS CompressedData structure. B<comp_nid>
16is the compression algorithm to use or B<NID_undef> to use the default
17algorithm (zlib compression). B<in> is the content to be compressed.
18B<flags> is an optional set of flags.
19
20=head1 NOTES
21
22The only currently supported compression algorithm is zlib using the NID
23NID_zlib_compression.
24
25If zlib support is not compiled into OpenSSL then CMS_compress() will return
26an error.
27
28If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are
29prepended to the data.
30
31Normally the supplied content is translated into MIME canonical format (as
32required by the S/MIME specifications) if B<CMS_BINARY> is set no translation
33occurs. This option should be used if the supplied data is in binary format
34otherwise the translation will corrupt it. If B<CMS_BINARY> is set then
35B<CMS_TEXT> is ignored.
36
37If the B<CMS_STREAM> flag is set a partial B<CMS_ContentInfo> structure is
38returned suitable for streaming I/O: no data is read from the BIO B<in>.
39
40The compressed data is included in the CMS_ContentInfo structure, unless
41B<CMS_DETACHED> is set in which case it is omitted. This is rarely used in
42practice and is not supported by SMIME_write_CMS().
43
44=head1 NOTES
45
46If the flag B<CMS_STREAM> is set the returned B<CMS_ContentInfo> structure is
47B<not> complete and outputting its contents via a function that does not
48properly finalize the B<CMS_ContentInfo> structure will give unpredictable
49results.
50
51Several functions including SMIME_write_CMS(), i2d_CMS_bio_stream(),
52PEM_write_bio_CMS_stream() finalize the structure. Alternatively finalization
53can be performed by obtaining the streaming ASN1 B<BIO> directly using
54BIO_new_CMS().
55
56Additional compression parameters such as the zlib compression level cannot
57currently be set.
58
59=head1 RETURN VALUES
60
61CMS_compress() returns either a CMS_ContentInfo structure or NULL if an error
62occurred. The error can be obtained from ERR_get_error(3).
63
64=head1 SEE ALSO
65
66L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_uncompress(3)|CMS_uncompress(3)>
67
68=head1 HISTORY
69
70CMS_compress() was added to OpenSSL 0.9.8
71The B<CMS_STREAM> flag was first supported in OpenSSL 1.0.0.
72
73=cut
diff --git a/src/lib/libssl/src/doc/crypto/CMS_decrypt.pod b/src/lib/libssl/src/doc/crypto/CMS_decrypt.pod
new file mode 100644
index 0000000000..d857e4f93f
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/CMS_decrypt.pod
@@ -0,0 +1,65 @@
1=pod
2
3=head1 NAME
4
5 CMS_decrypt - decrypt content from a CMS envelopedData structure
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert, BIO *dcont, BIO *out, unsigned int flags);
12
13=head1 DESCRIPTION
14
15CMS_decrypt() extracts and decrypts the content from a CMS EnvelopedData
16structure. B<pkey> is the private key of the recipient, B<cert> is the
17recipient's certificate, B<out> is a BIO to write the content to and
18B<flags> is an optional set of flags.
19
20The B<dcont> parameter is used in the rare case where the encrypted content
21is detached. It will normally be set to NULL.
22
23=head1 NOTES
24
25OpenSSL_add_all_algorithms() (or equivalent) should be called before using this
26function or errors about unknown algorithms will occur.
27
28Although the recipients certificate is not needed to decrypt the data it is
29needed to locate the appropriate (of possible several) recipients in the CMS
30structure. If B<cert> is set to NULL all possible recipients are tried.
31
32It is possible to determine the correct recipient key by other means (for
33example looking them up in a database) and setting them in the CMS structure
34in advance using the CMS utility functions such as CMS_set1_pkey(). In this
35case both B<cert> and B<pkey> should be set to NULL.
36
37To process KEKRecipientInfo types CMS_set1_key() or CMS_RecipientInfo_set0_key()
38and CMS_ReceipientInfo_decrypt() should be called before CMS_decrypt() and
39B<cert> and B<pkey> set to NULL.
40
41The following flags can be passed in the B<flags> parameter.
42
43If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are deleted
44from the content. If the content is not of type B<text/plain> then an error is
45returned.
46
47=head1 RETURN VALUES
48
49CMS_decrypt() returns either 1 for success or 0 for failure.
50The error can be obtained from ERR_get_error(3)
51
52=head1 BUGS
53
54The lack of single pass processing and the need to hold all data in memory as
55mentioned in CMS_verify() also applies to CMS_decrypt().
56
57=head1 SEE ALSO
58
59L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_encrypt(3)|CMS_encrypt(3)>
60
61=head1 HISTORY
62
63CMS_decrypt() was added to OpenSSL 0.9.8
64
65=cut
diff --git a/src/lib/libssl/src/doc/crypto/CMS_encrypt.pod b/src/lib/libssl/src/doc/crypto/CMS_encrypt.pod
new file mode 100644
index 0000000000..1ee5b275ec
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/CMS_encrypt.pod
@@ -0,0 +1,96 @@
1=pod
2
3=head1 NAME
4
5 CMS_encrypt - create a CMS envelopedData structure
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, unsigned int flags);
12
13=head1 DESCRIPTION
14
15CMS_encrypt() creates and returns a CMS EnvelopedData structure. B<certs>
16is a list of recipient certificates. B<in> is the content to be encrypted.
17B<cipher> is the symmetric cipher to use. B<flags> is an optional set of flags.
18
19=head1 NOTES
20
21Only certificates carrying RSA keys are supported so the recipient certificates
22supplied to this function must all contain RSA public keys, though they do not
23have to be signed using the RSA algorithm.
24
25EVP_des_ede3_cbc() (triple DES) is the algorithm of choice for S/MIME use
26because most clients will support it.
27
28The algorithm passed in the B<cipher> parameter must support ASN1 encoding of
29its parameters.
30
31Many browsers implement a "sign and encrypt" option which is simply an S/MIME
32envelopedData containing an S/MIME signed message. This can be readily produced
33by storing the S/MIME signed message in a memory BIO and passing it to
34CMS_encrypt().
35
36The following flags can be passed in the B<flags> parameter.
37
38If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are
39prepended to the data.
40
41Normally the supplied content is translated into MIME canonical format (as
42required by the S/MIME specifications) if B<CMS_BINARY> is set no translation
43occurs. This option should be used if the supplied data is in binary format
44otherwise the translation will corrupt it. If B<CMS_BINARY> is set then
45B<CMS_TEXT> is ignored.
46
47OpenSSL will by default identify recipient certificates using issuer name
48and serial number. If B<CMS_USE_KEYID> is set it will use the subject key
49identifier value instead. An error occurs if all recipient certificates do not
50have a subject key identifier extension.
51
52If the B<CMS_STREAM> flag is set a partial B<CMS_ContentInfo> structure is
53returned suitable for streaming I/O: no data is read from the BIO B<in>.
54
55If the B<CMS_PARTIAL> flag is set a partial B<CMS_ContentInfo> structure is
56returned to which additional recipients and attributes can be added before
57finalization.
58
59The data being encrypted is included in the CMS_ContentInfo structure, unless
60B<CMS_DETACHED> is set in which case it is omitted. This is rarely used in
61practice and is not supported by SMIME_write_CMS().
62
63=head1 NOTES
64
65If the flag B<CMS_STREAM> is set the returned B<CMS_ContentInfo> structure is
66B<not> complete and outputting its contents via a function that does not
67properly finalize the B<CMS_ContentInfo> structure will give unpredictable
68results.
69
70Several functions including SMIME_write_CMS(), i2d_CMS_bio_stream(),
71PEM_write_bio_CMS_stream() finalize the structure. Alternatively finalization
72can be performed by obtaining the streaming ASN1 B<BIO> directly using
73BIO_new_CMS().
74
75The recipients specified in B<certs> use a CMS KeyTransRecipientInfo info
76structure. KEKRecipientInfo is also supported using the flag B<CMS_PARTIAL>
77and CMS_add0_recipient_key().
78
79The parameter B<certs> may be NULL if B<CMS_PARTIAL> is set and recipients
80added later using CMS_add1_recipient_cert() or CMS_add0_recipient_key().
81
82=head1 RETURN VALUES
83
84CMS_encrypt() returns either a CMS_ContentInfo structure or NULL if an error
85occurred. The error can be obtained from ERR_get_error(3).
86
87=head1 SEE ALSO
88
89L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_decrypt(3)|CMS_decrypt(3)>
90
91=head1 HISTORY
92
93CMS_decrypt() was added to OpenSSL 0.9.8
94The B<CMS_STREAM> flag was first supported in OpenSSL 1.0.0.
95
96=cut
diff --git a/src/lib/libssl/src/doc/crypto/CMS_final.pod b/src/lib/libssl/src/doc/crypto/CMS_final.pod
new file mode 100644
index 0000000000..36cf96b8a0
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/CMS_final.pod
@@ -0,0 +1,41 @@
1=pod
2
3=head1 NAME
4
5 CMS_final - finalise a CMS_ContentInfo structure
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, unsigned int flags);
12
13=head1 DESCRIPTION
14
15CMS_final() finalises the structure B<cms>. It's purpose is to perform any
16operations necessary on B<cms> (digest computation for example) and set the
17appropriate fields. The parameter B<data> contains the content to be
18processed. The B<dcont> parameter contains a BIO to write content to after
19processing: this is only used with detached data and will usually be set to
20NULL.
21
22=head1 NOTES
23
24This function will normally be called when the B<CMS_PARTIAL> flag is used. It
25should only be used when streaming is not performed because the streaming
26I/O functions perform finalisation operations internally.
27
28=head1 RETURN VALUES
29
30CMS_final() returns 1 for success or 0 for failure.
31
32=head1 SEE ALSO
33
34L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>,
35L<CMS_encrypt(3)|CMS_encrypt(3)>
36
37=head1 HISTORY
38
39CMS_final() was added to OpenSSL 0.9.8
40
41=cut
diff --git a/src/lib/libssl/src/doc/crypto/CMS_get0_RecipientInfos.pod b/src/lib/libssl/src/doc/crypto/CMS_get0_RecipientInfos.pod
new file mode 100644
index 0000000000..e0355423e6
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/CMS_get0_RecipientInfos.pod
@@ -0,0 +1,106 @@
1=pod
2
3=head1 NAME
4
5 CMS_get0_RecipientInfos, CMS_RecipientInfo_type, CMS_RecipientInfo_ktri_get0_signer_id,CMS_RecipientInfo_ktri_cert_cmp, CMS_RecipientInfo_set0_pkey, CMS_RecipientInfo_kekri_get0_id, CMS_RecipientInfo_kekri_id_cmp, CMS_RecipientInfo_set0_key, CMS_RecipientInfo_decrypt - CMS envelopedData RecipientInfo routines
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms);
12 int CMS_RecipientInfo_type(CMS_RecipientInfo *ri);
13
14 int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri, ASN1_OCTET_STRING **keyid, X509_NAME **issuer, ASN1_INTEGER **sno);
15 int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert);
16 int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey);
17
18 int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, X509_ALGOR **palg, ASN1_OCTET_STRING **pid, ASN1_GENERALIZEDTIME **pdate, ASN1_OBJECT **potherid, ASN1_TYPE **pothertype);
19 int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri, const unsigned char *id, size_t idlen);
20 int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri, unsigned char *key, size_t keylen);
21
22 int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
23
24=head1 DESCRIPTION
25
26The function CMS_get0_RecipientInfos() returns all the CMS_RecipientInfo
27structures associated with a CMS EnvelopedData structure.
28
29CMS_RecipientInfo_type() returns the type of CMS_RecipientInfo structure B<ri>.
30It will currently return CMS_RECIPINFO_TRANS, CMS_RECIPINFO_AGREE,
31CMS_RECIPINFO_KEK, CMS_RECIPINFO_PASS, or CMS_RECIPINFO_OTHER.
32
33CMS_RecipientInfo_ktri_get0_signer_id() retrieves the certificate recipient
34identifier associated with a specific CMS_RecipientInfo structure B<ri>, which
35must be of type CMS_RECIPINFO_TRANS. Either the keyidentifier will be set in
36B<keyid> or B<both> issuer name and serial number in B<issuer> and B<sno>.
37
38CMS_RecipientInfo_ktri_cert_cmp() compares the certificate B<cert> against the
39CMS_RecipientInfo structure B<ri>, which must be of type CMS_RECIPINFO_TRANS.
40It returns zero if the comparison is successful and non zero if not.
41
42CMS_RecipientInfo_set0_pkey() associates the private key B<pkey> with
43the CMS_RecipientInfo structure B<ri>, which must be of type
44CMS_RECIPINFO_TRANS.
45
46CMS_RecipientInfo_kekri_get0_id() retrieves the key information from the
47CMS_RecipientInfo structure B<ri> which must be of type CMS_RECIPINFO_KEK. Any
48of the remaining parameters can be NULL if the application is not interested in
49the value of a field. Where a field is optional and absent NULL will be written
50to the corresponding parameter. The keyEncryptionAlgorithm field is written to
51B<palg>, the B<keyIdentifier> field is written to B<pid>, the B<date> field if
52present is written to B<pdate>, if the B<other> field is present the components
53B<keyAttrId> and B<keyAttr> are written to parameters B<potherid> and
54B<pothertype>.
55
56CMS_RecipientInfo_kekri_id_cmp() compares the ID in the B<id> and B<idlen>
57parameters against the B<keyIdentifier> CMS_RecipientInfo structure B<ri>,
58which must be of type CMS_RECIPINFO_KEK. It returns zero if the comparison is
59successful and non zero if not.
60
61CMS_RecipientInfo_set0_key() associates the symmetric key B<key> of length
62B<keylen> with the CMS_RecipientInfo structure B<ri>, which must be of type
63CMS_RECIPINFO_KEK.
64
65CMS_RecipientInfo_decrypt() attempts to decrypt CMS_RecipientInfo structure
66B<ri> in structure B<cms>. A key must have been associated with the structure
67first.
68
69=head1 NOTES
70
71The main purpose of these functions is to enable an application to lookup
72recipient keys using any appropriate technique when the simpler method
73of CMS_decrypt() is not appropriate.
74
75In typical usage and application will retrieve all CMS_RecipientInfo structures
76using CMS_get0_RecipientInfos() and check the type of each using
77CMS_RecpientInfo_type(). Depending on the type the CMS_RecipientInfo structure
78can be ignored or its key identifier data retrieved using an appropriate
79function. Then if the corresponding secret or private key can be obtained by
80any appropriate means it can then associated with the structure and
81CMS_RecpientInfo_decrypt() called. If successful CMS_decrypt() can be called
82with a NULL key to decrypt the enveloped content.
83
84=head1 RETURN VALUES
85
86CMS_get0_RecipientInfos() returns all CMS_RecipientInfo structures, or NULL if
87an error occurs.
88
89CMS_RecipientInfo_ktri_get0_signer_id(), CMS_RecipientInfo_set0_pkey(),
90CMS_RecipientInfo_kekri_get0_id(), CMS_RecipientInfo_set0_key() and
91CMS_RecipientInfo_decrypt() return 1 for success or 0 if an error occurs.
92
93CMS_RecipientInfo_ktri_cert_cmp() and CMS_RecipientInfo_kekri_cmp() return 0
94for a successful comparison and non zero otherwise.
95
96Any error can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>.
97
98=head1 SEE ALSO
99
100L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_decrypt(3)|CMS_decrypt(3)>
101
102=head1 HISTORY
103
104These functions were first was added to OpenSSL 0.9.8
105
106=cut
diff --git a/src/lib/libssl/src/doc/crypto/CMS_get0_SignerInfos.pod b/src/lib/libssl/src/doc/crypto/CMS_get0_SignerInfos.pod
new file mode 100644
index 0000000000..47f6d2a047
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/CMS_get0_SignerInfos.pod
@@ -0,0 +1,75 @@
1=pod
2
3=head1 NAME
4
5 CMS_get0_SignerInfos, CMS_SignerInfo_get0_signer_id, CMS_SignerInfo_cert_cmp, CMS_set1_signer_certs - CMS signedData signer functions.
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms);
12
13 int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si, ASN1_OCTET_STRING **keyid, X509_NAME **issuer, ASN1_INTEGER **sno);
14 int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert);
15 void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer);
16
17=head1 DESCRIPTION
18
19The function CMS_get0_SignerInfos() returns all the CMS_SignerInfo structures
20associated with a CMS signedData structure.
21
22CMS_SignerInfo_get0_signer_id() retrieves the certificate signer identifier
23associated with a specific CMS_SignerInfo structure B<si>. Either the
24keyidentifier will be set in B<keyid> or B<both> issuer name and serial number
25in B<issuer> and B<sno>.
26
27CMS_SignerInfo_cert_cmp() compares the certificate B<cert> against the signer
28identifier B<si>. It returns zero if the comparison is successful and non zero
29if not.
30
31CMS_SignerInfo_set1_signer_cert() sets the signers certificate of B<si> to
32B<signer>.
33
34=head1 NOTES
35
36The main purpose of these functions is to enable an application to lookup
37signers certificates using any appropriate technique when the simpler method
38of CMS_verify() is not appropriate.
39
40In typical usage and application will retrieve all CMS_SignerInfo structures
41using CMS_get0_SignerInfo() and retrieve the identifier information using
42CMS. It will then obtain the signer certificate by some unspecified means
43(or return and error if it cannot be found) and set it using
44CMS_SignerInfo_set1_signer_cert().
45
46Once all signer certificates have been set CMS_verify() can be used.
47
48Although CMS_get0_SignerInfos() can return NULL is an error occur B<or> if
49there are no signers this is not a problem in practice because the only
50error which can occur is if the B<cms> structure is not of type signedData
51due to application error.
52
53=head1 RETURN VALUES
54
55CMS_get0_SignerInfos() returns all CMS_SignerInfo structures, or NULL there
56are no signers or an error occurs.
57
58CMS_SignerInfo_get0_signer_id() returns 1 for success and 0 for failure.
59
60CMS_SignerInfo_cert_cmp() returns 0 for a successful comparison and non
61zero otherwise.
62
63CMS_SignerInfo_set1_signer_cert() does not return a value.
64
65Any error can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>
66
67=head1 SEE ALSO
68
69L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_verify(3)|CMS_verify(3)>
70
71=head1 HISTORY
72
73These functions were first was added to OpenSSL 0.9.8
74
75=cut
diff --git a/src/lib/libssl/src/doc/crypto/CMS_get0_type.pod b/src/lib/libssl/src/doc/crypto/CMS_get0_type.pod
new file mode 100644
index 0000000000..8ff1c3115c
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/CMS_get0_type.pod
@@ -0,0 +1,63 @@
1=pod
2
3=head1 NAME
4
5 CMS_get0_type, CMS_set1_eContentType, CMS_get0_eContentType - get and set CMS content types
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 const ASN1_OBJECT *CMS_get0_type(CMS_ContentInfo *cms);
12 int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid);
13 const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms);
14
15=head1 DESCRIPTION
16
17CMS_get0_type() returns the content type of a CMS_ContentInfo structure as
18and ASN1_OBJECT pointer. An application can then decide how to process the
19CMS_ContentInfo structure based on this value.
20
21CMS_set1_eContentType() sets the embedded content type of a CMS_ContentInfo
22structure. It should be called with CMS functions with the B<CMS_PARTIAL>
23flag and B<before> the structure is finalised, otherwise the results are
24undefined.
25
26ASN1_OBJECT *CMS_get0_eContentType() returns a pointer to the embedded
27content type.
28
29=head1 NOTES
30
31As the B<0> implies CMS_get0_type() and CMS_get0_eContentType() return internal
32pointers which should B<not> be freed up. CMS_set1_eContentType() copies the
33supplied OID and it B<should> be freed up after use.
34
35The B<ASN1_OBJECT> values returned can be converted to an integer B<NID> value
36using OBJ_obj2nid(). For the currently supported content types the following
37values are returned:
38
39 NID_pkcs7_data
40 NID_pkcs7_signed
41 NID_pkcs7_digest
42 NID_id_smime_ct_compressedData:
43 NID_pkcs7_encrypted
44 NID_pkcs7_enveloped
45
46
47=head1 RETURN VALUES
48
49CMS_get0_type() and CMS_get0_eContentType() return and ASN1_OBJECT structure.
50
51CMS_set1_eContentType() returns 1 for success or 0 if an error occurred. The
52error can be obtained from ERR_get_error(3).
53
54=head1 SEE ALSO
55
56L<ERR_get_error(3)|ERR_get_error(3)>
57
58=head1 HISTORY
59
60CMS_get0_type(), CMS_set1_eContentType() and CMS_get0_eContentType() were all
61first added to OpenSSL 0.9.8
62
63=cut
diff --git a/src/lib/libssl/src/doc/crypto/CMS_get1_ReceiptRequest.pod b/src/lib/libssl/src/doc/crypto/CMS_get1_ReceiptRequest.pod
new file mode 100644
index 0000000000..f546376a1e
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/CMS_get1_ReceiptRequest.pod
@@ -0,0 +1,69 @@
1=pod
2
3=head1 NAME
4
5 CMS_ReceiptRequest_create0, CMS_add1_ReceiptRequest, CMS_get1_ReceiptRequest, CMS_ReceiptRequest_get0_values - CMS signed receipt request functions.
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 CMS_ReceiptRequest *CMS_ReceiptRequest_create0(unsigned char *id, int idlen, int allorfirst, STACK_OF(GENERAL_NAMES) *receiptList, STACK_OF(GENERAL_NAMES) *receiptsTo);
12 int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr);
13 int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr);
14 void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr, ASN1_STRING **pcid, int *pallorfirst, STACK_OF(GENERAL_NAMES) **plist, STACK_OF(GENERAL_NAMES) **prto);
15
16=head1 DESCRIPTION
17
18CMS_ReceiptRequest_create0() creates a signed receipt request structure. The
19B<signedContentIdentifier> field is set using B<id> and B<idlen>, or it is set
20to 32 bytes of pseudo random data if B<id> is NULL. If B<receiptList> is NULL
21the allOrFirstTier option in B<receiptsFrom> is used and set to the value of
22the B<allorfirst> parameter. If B<receiptList> is not NULL the B<receiptList>
23option in B<receiptsFrom> is used. The B<receiptsTo> parameter specifies the
24B<receiptsTo> field value.
25
26The CMS_add1_ReceiptRequest() function adds a signed receipt request B<rr>
27to SignerInfo structure B<si>.
28
29int CMS_get1_ReceiptRequest() looks for a signed receipt request in B<si>, if
30any is found it is decoded and written to B<prr>.
31
32CMS_ReceiptRequest_get0_values() retrieves the values of a receipt request.
33The signedContentIdentifier is copied to B<pcid>. If the B<allOrFirstTier>
34option of B<receiptsFrom> is used its value is copied to B<pallorfirst>
35otherwise the B<receiptList> field is copied to B<plist>. The B<receiptsTo>
36parameter is copied to B<prto>.
37
38=head1 NOTES
39
40For more details of the meaning of the fields see RFC2634.
41
42The contents of a signed receipt should only be considered meaningful if the
43corresponding CMS_ContentInfo structure can be successfully verified using
44CMS_verify().
45
46=head1 RETURN VALUES
47
48CMS_ReceiptRequest_create0() returns a signed receipt request structure or
49NULL if an error occurred.
50
51CMS_add1_ReceiptRequest() returns 1 for success or 0 is an error occurred.
52
53CMS_get1_ReceiptRequest() returns 1 is a signed receipt request is found and
54decoded. It returns 0 if a signed receipt request is not present and -1 if
55it is present but malformed.
56
57=head1 SEE ALSO
58
59L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>,
60L<CMS_sign_receipt(3)|CMS_sign_receipt(3)>, L<CMS_verify(3)|CMS_verify(3)>
61L<CMS_verify_receipt(3)|CMS_verify_receipt(3)>
62
63=head1 HISTORY
64
65CMS_ReceiptRequest_create0(), CMS_add1_ReceiptRequest(),
66CMS_get1_ReceiptRequest() and CMS_ReceiptRequest_get0_values() were added to
67OpenSSL 0.9.8
68
69=cut
diff --git a/src/lib/libssl/src/doc/crypto/CMS_sign.pod b/src/lib/libssl/src/doc/crypto/CMS_sign.pod
new file mode 100644
index 0000000000..2cc72de327
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/CMS_sign.pod
@@ -0,0 +1,121 @@
1=pod
2
3=head1 NAME
4
5 CMS_sign - create a CMS SignedData structure
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, BIO *data, unsigned int flags);
12
13=head1 DESCRIPTION
14
15CMS_sign() creates and returns a CMS SignedData structure. B<signcert> is
16the certificate to sign with, B<pkey> is the corresponding private key.
17B<certs> is an optional additional set of certificates to include in the CMS
18structure (for example any intermediate CAs in the chain). Any or all of
19these parameters can be B<NULL>, see B<NOTES> below.
20
21The data to be signed is read from BIO B<data>.
22
23B<flags> is an optional set of flags.
24
25=head1 NOTES
26
27Any of the following flags (ored together) can be passed in the B<flags>
28parameter.
29
30Many S/MIME clients expect the signed content to include valid MIME headers. If
31the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are prepended
32to the data.
33
34If B<CMS_NOCERTS> is set the signer's certificate will not be included in the
35CMS_ContentInfo structure, the signer's certificate must still be supplied in
36the B<signcert> parameter though. This can reduce the size of the signature if
37the signers certificate can be obtained by other means: for example a
38previously signed message.
39
40The data being signed is included in the CMS_ContentInfo structure, unless
41B<CMS_DETACHED> is set in which case it is omitted. This is used for
42CMS_ContentInfo detached signatures which are used in S/MIME plaintext signed
43messages for example.
44
45Normally the supplied content is translated into MIME canonical format (as
46required by the S/MIME specifications) if B<CMS_BINARY> is set no translation
47occurs. This option should be used if the supplied data is in binary format
48otherwise the translation will corrupt it.
49
50The SignedData structure includes several CMS signedAttributes including the
51signing time, the CMS content type and the supported list of ciphers in an
52SMIMECapabilities attribute. If B<CMS_NOATTR> is set then no signedAttributes
53will be used. If B<CMS_NOSMIMECAP> is set then just the SMIMECapabilities are
54omitted.
55
56If present the SMIMECapabilities attribute indicates support for the following
57algorithms in preference order: 256 bit AES, Gost R3411-94, Gost 28147-89, 192
58bit AES, 128 bit AES, triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2.
59If any of these algorithms is not available then it will not be included: for example the GOST algorithms will not be included if the GOST ENGINE is
60not loaded.
61
62OpenSSL will by default identify signing certificates using issuer name
63and serial number. If B<CMS_USE_KEYID> is set it will use the subject key
64identifier value instead. An error occurs if the signing certificate does not
65have a subject key identifier extension.
66
67If the flags B<CMS_STREAM> is set then the returned B<CMS_ContentInfo>
68structure is just initialized ready to perform the signing operation. The
69signing is however B<not> performed and the data to be signed is not read from
70the B<data> parameter. Signing is deferred until after the data has been
71written. In this way data can be signed in a single pass.
72
73If the B<CMS_PARTIAL> flag is set a partial B<CMS_ContentInfo> structure is
74output to which additional signers and capabilities can be added before
75finalization.
76
77If the flag B<CMS_STREAM> is set the returned B<CMS_ContentInfo> structure is
78B<not> complete and outputting its contents via a function that does not
79properly finalize the B<CMS_ContentInfo> structure will give unpredictable
80results.
81
82Several functions including SMIME_write_CMS(), i2d_CMS_bio_stream(),
83PEM_write_bio_CMS_stream() finalize the structure. Alternatively finalization
84can be performed by obtaining the streaming ASN1 B<BIO> directly using
85BIO_new_CMS().
86
87If a signer is specified it will use the default digest for the signing
88algorithm. This is B<SHA1> for both RSA and DSA keys.
89
90If B<signcert> and B<pkey> are NULL then a certificates only CMS structure is
91output.
92
93The function CMS_sign() is a basic CMS signing function whose output will be
94suitable for many purposes. For finer control of the output format the
95B<certs>, B<signcert> and B<pkey> parameters can all be B<NULL> and the
96B<CMS_PARTIAL> flag set. Then one or more signers can be added using the
97function CMS_sign_add1_signer(), non default digests can be used and custom
98attributes added. B<CMS_final()> must then be called to finalize the
99structure if streaming is not enabled.
100
101=head1 BUGS
102
103Some attributes such as counter signatures are not supported.
104
105=head1 RETURN VALUES
106
107CMS_sign() returns either a valid CMS_ContentInfo structure or NULL if an error
108occurred. The error can be obtained from ERR_get_error(3).
109
110=head1 SEE ALSO
111
112L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_verify(3)|CMS_verify(3)>
113
114=head1 HISTORY
115
116CMS_sign() was added to OpenSSL 0.9.8
117
118The B<CMS_STREAM> flag is only supported for detached data in OpenSSL 0.9.8,
119it is supported for embedded data in OpenSSL 1.0.0 and later.
120
121=cut
diff --git a/src/lib/libssl/src/doc/crypto/CMS_sign_add1_signer.pod b/src/lib/libssl/src/doc/crypto/CMS_sign_add1_signer.pod
new file mode 100644
index 0000000000..bda3ca2adb
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/CMS_sign_add1_signer.pod
@@ -0,0 +1,101 @@
1=pod
2
3=head1 NAME
4
5 CMS_sign_add1_signer, CMS_SignerInfo_sign - add a signer to a CMS_ContentInfo signed data structure.
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 CMS_SignerInfo *CMS_sign_add1_signer(CMS_ContentInfo *cms, X509 *signcert, EVP_PKEY *pkey, const EVP_MD *md, unsigned int flags);
12
13 int CMS_SignerInfo_sign(CMS_SignerInfo *si);
14
15
16=head1 DESCRIPTION
17
18CMS_sign_add1_signer() adds a signer with certificate B<signcert> and private
19key B<pkey> using message digest B<md> to CMS_ContentInfo SignedData
20structure B<cms>.
21
22The CMS_ContentInfo structure should be obtained from an initial call to
23CMS_sign() with the flag B<CMS_PARTIAL> set or in the case or re-signing a
24valid CMS_ContentInfo SignedData structure.
25
26If the B<md> parameter is B<NULL> then the default digest for the public
27key algorithm will be used.
28
29Unless the B<CMS_REUSE_DIGEST> flag is set the returned CMS_ContentInfo
30structure is not complete and must be finalized either by streaming (if
31applicable) or a call to CMS_final().
32
33The CMS_SignerInfo_sign() function will explicitly sign a CMS_SignerInfo
34structure, its main use is when B<CMS_REUSE_DIGEST> and B<CMS_PARTIAL> flags
35are both set.
36
37=head1 NOTES
38
39The main purpose of CMS_sign_add1_signer() is to provide finer control
40over a CMS signed data structure where the simpler CMS_sign() function defaults
41are not appropriate. For example if multiple signers or non default digest
42algorithms are needed. New attributes can also be added using the returned
43CMS_SignerInfo structure and the CMS attribute utility functions or the
44CMS signed receipt request functions.
45
46Any of the following flags (ored together) can be passed in the B<flags>
47parameter.
48
49If B<CMS_REUSE_DIGEST> is set then an attempt is made to copy the content
50digest value from the CMS_ContentInfo structure: to add a signer to an existing
51structure. An error occurs if a matching digest value cannot be found to copy.
52The returned CMS_ContentInfo structure will be valid and finalized when this
53flag is set.
54
55If B<CMS_PARTIAL> is set in addition to B<CMS_REUSE_DIGEST> then the
56CMS_SignerInfo structure will not be finalized so additional attributes
57can be added. In this case an explicit call to CMS_SignerInfo_sign() is
58needed to finalize it.
59
60If B<CMS_NOCERTS> is set the signer's certificate will not be included in the
61CMS_ContentInfo structure, the signer's certificate must still be supplied in
62the B<signcert> parameter though. This can reduce the size of the signature if
63the signers certificate can be obtained by other means: for example a
64previously signed message.
65
66The SignedData structure includes several CMS signedAttributes including the
67signing time, the CMS content type and the supported list of ciphers in an
68SMIMECapabilities attribute. If B<CMS_NOATTR> is set then no signedAttributes
69will be used. If B<CMS_NOSMIMECAP> is set then just the SMIMECapabilities are
70omitted.
71
72OpenSSL will by default identify signing certificates using issuer name
73and serial number. If B<CMS_USE_KEYID> is set it will use the subject key
74identifier value instead. An error occurs if the signing certificate does not
75have a subject key identifier extension.
76
77If present the SMIMECapabilities attribute indicates support for the following
78algorithms in preference order: 256 bit AES, Gost R3411-94, Gost 28147-89, 192
79bit AES, 128 bit AES, triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2.
80If any of these algorithms is not available then it will not be included: for example the GOST algorithms will not be included if the GOST ENGINE is
81not loaded.
82
83CMS_sign_add1_signer() returns an internal pointer to the CMS_SignerInfo
84structure just added, this can be used to set additional attributes
85before it is finalized.
86
87=head1 RETURN VALUES
88
89CMS_sign1_add_signers() returns an internal pointer to the CMS_SignerInfo
90structure just added or NULL if an error occurs.
91
92=head1 SEE ALSO
93
94L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>,
95L<CMS_final(3)|CMS_final(3)>,
96
97=head1 HISTORY
98
99CMS_sign_add1_signer() was added to OpenSSL 0.9.8
100
101=cut
diff --git a/src/lib/libssl/src/doc/crypto/CMS_sign_receipt.pod b/src/lib/libssl/src/doc/crypto/CMS_sign_receipt.pod
new file mode 100644
index 0000000000..cae1f83384
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/CMS_sign_receipt.pod
@@ -0,0 +1,45 @@
1=pod
2
3=head1 NAME
4
5 CMS_sign_receipt - create a CMS signed receipt
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, unsigned int flags);
12
13=head1 DESCRIPTION
14
15CMS_sign_receipt() creates and returns a CMS signed receipt structure. B<si> is
16the B<CMS_SignerInfo> structure containing the signed receipt request.
17B<signcert> is the certificate to sign with, B<pkey> is the corresponding
18private key. B<certs> is an optional additional set of certificates to include
19in the CMS structure (for example any intermediate CAs in the chain).
20
21B<flags> is an optional set of flags.
22
23=head1 NOTES
24
25This functions behaves in a similar way to CMS_sign() except the flag values
26B<CMS_DETACHED>, B<CMS_BINARY>, B<CMS_NOATTR>, B<CMS_TEXT> and B<CMS_STREAM>
27are not supported since they do not make sense in the context of signed
28receipts.
29
30=head1 RETURN VALUES
31
32CMS_sign_receipt() returns either a valid CMS_ContentInfo structure or NULL if
33an error occurred. The error can be obtained from ERR_get_error(3).
34
35=head1 SEE ALSO
36
37L<ERR_get_error(3)|ERR_get_error(3)>,
38L<CMS_verify_receipt(3)|CMS_verify_receipt(3)>,
39L<CMS_sign(3)|CMS_sign(3)>
40
41=head1 HISTORY
42
43CMS_sign_receipt() was added to OpenSSL 0.9.8
44
45=cut
diff --git a/src/lib/libssl/src/doc/crypto/CMS_uncompress.pod b/src/lib/libssl/src/doc/crypto/CMS_uncompress.pod
new file mode 100644
index 0000000000..c6056b027d
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/CMS_uncompress.pod
@@ -0,0 +1,54 @@
1=pod
2
3=head1 NAME
4
5 CMS_uncompress - uncompress a CMS CompressedData structure
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out, unsigned int flags);
12
13=head1 DESCRIPTION
14
15CMS_uncompress() extracts and uncompresses the content from a CMS
16CompressedData structure B<cms>. B<data> is a BIO to write the content to and
17B<flags> is an optional set of flags.
18
19The B<dcont> parameter is used in the rare case where the compressed content
20is detached. It will normally be set to NULL.
21
22=head1 NOTES
23
24The only currently supported compression algorithm is zlib: if the structure
25indicates the use of any other algorithm an error is returned.
26
27If zlib support is not compiled into OpenSSL then CMS_uncompress() will always
28return an error.
29
30The following flags can be passed in the B<flags> parameter.
31
32If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are deleted
33from the content. If the content is not of type B<text/plain> then an error is
34returned.
35
36=head1 RETURN VALUES
37
38CMS_uncompress() returns either 1 for success or 0 for failure. The error can
39be obtained from ERR_get_error(3)
40
41=head1 BUGS
42
43The lack of single pass processing and the need to hold all data in memory as
44mentioned in CMS_verify() also applies to CMS_decompress().
45
46=head1 SEE ALSO
47
48L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_compress(3)|CMS_compress(3)>
49
50=head1 HISTORY
51
52CMS_uncompress() was added to OpenSSL 0.9.8
53
54=cut
diff --git a/src/lib/libssl/src/doc/crypto/CMS_verify.pod b/src/lib/libssl/src/doc/crypto/CMS_verify.pod
new file mode 100644
index 0000000000..8f26fdab09
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/CMS_verify.pod
@@ -0,0 +1,126 @@
1=pod
2
3=head1 NAME
4
5 CMS_verify - verify a CMS SignedData structure
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, X509_STORE *store, BIO *indata, BIO *out, unsigned int flags);
12
13 STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms);
14
15=head1 DESCRIPTION
16
17CMS_verify() verifies a CMS SignedData structure. B<cms> is the CMS_ContentInfo
18structure to verify. B<certs> is a set of certificates in which to search for
19the signing certificate(s). B<store> is a trusted certificate store used for
20chain verification. B<indata> is the detached content if the content is not
21present in B<cms>. The content is written to B<out> if it is not NULL.
22
23B<flags> is an optional set of flags, which can be used to modify the verify
24operation.
25
26CMS_get0_signers() retrieves the signing certificate(s) from B<cms>, it must
27be called after a successful CMS_verify() operation.
28
29=head1 VERIFY PROCESS
30
31Normally the verify process proceeds as follows.
32
33Initially some sanity checks are performed on B<cms>. The type of B<cms> must
34be SignedData. There must be at least one signature on the data and if
35the content is detached B<indata> cannot be B<NULL>.
36
37An attempt is made to locate all the signing certificate(s), first looking in
38the B<certs> parameter (if it is not NULL) and then looking in any
39certificates contained in the B<cms> structure itself. If any signing
40certificate cannot be located the operation fails.
41
42Each signing certificate is chain verified using the B<smimesign> purpose and
43the supplied trusted certificate store. Any internal certificates in the message
44are used as untrusted CAs. If CRL checking is enabled in B<store> any internal
45CRLs are used in addition to attempting to look them up in B<store>. If any
46chain verify fails an error code is returned.
47
48Finally the signed content is read (and written to B<out> is it is not NULL)
49and the signature's checked.
50
51If all signature's verify correctly then the function is successful.
52
53Any of the following flags (ored together) can be passed in the B<flags>
54parameter to change the default verify behaviour.
55
56If B<CMS_NOINTERN> is set the certificates in the message itself are not
57searched when locating the signing certificate(s). This means that all the
58signing certificates must be in the B<certs> parameter.
59
60If B<CMS_NOCRL> is set and CRL checking is enabled in B<store> then any
61CRLs in the message itself are ignored.
62
63If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are deleted
64from the content. If the content is not of type B<text/plain> then an error is
65returned.
66
67If B<CMS_NO_SIGNER_CERT_VERIFY> is set the signing certificates are not
68verified.
69
70If B<CMS_NO_ATTR_VERIFY> is set the signed attributes signature is not
71verified.
72
73If B<CMS_NO_CONTENT_VERIFY> is set then the content digest is not checked.
74
75=head1 NOTES
76
77One application of B<CMS_NOINTERN> is to only accept messages signed by
78a small number of certificates. The acceptable certificates would be passed
79in the B<certs> parameter. In this case if the signer is not one of the
80certificates supplied in B<certs> then the verify will fail because the
81signer cannot be found.
82
83In some cases the standard techniques for looking up and validating
84certificates are not appropriate: for example an application may wish to
85lookup certificates in a database or perform customised verification. This
86can be achieved by setting and verifying the signers certificates manually
87using the signed data utility functions.
88
89Care should be taken when modifying the default verify behaviour, for example
90setting B<CMS_NO_CONTENT_VERIFY> will totally disable all content verification
91and any modified content will be considered valid. This combination is however
92useful if one merely wishes to write the content to B<out> and its validity
93is not considered important.
94
95Chain verification should arguably be performed using the signing time rather
96than the current time. However since the signing time is supplied by the
97signer it cannot be trusted without additional evidence (such as a trusted
98timestamp).
99
100=head1 RETURN VALUES
101
102CMS_verify() returns 1 for a successful verification and zero if an error
103occurred.
104
105CMS_get0_signers() returns all signers or NULL if an error occurred.
106
107The error can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>
108
109=head1 BUGS
110
111The trusted certificate store is not searched for the signing certificate,
112this is primarily due to the inadequacies of the current B<X509_STORE>
113functionality.
114
115The lack of single pass processing means that the signed content must all
116be held in memory if it is not detached.
117
118=head1 SEE ALSO
119
120L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>
121
122=head1 HISTORY
123
124CMS_verify() was added to OpenSSL 0.9.8
125
126=cut
diff --git a/src/lib/libssl/src/doc/crypto/CMS_verify_receipt.pod b/src/lib/libssl/src/doc/crypto/CMS_verify_receipt.pod
new file mode 100644
index 0000000000..9283e0e04b
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/CMS_verify_receipt.pod
@@ -0,0 +1,47 @@
1=pod
2
3=head1 NAME
4
5 CMS_verify_receipt - verify a CMS signed receipt
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms, STACK_OF(X509) *certs, X509_STORE *store, unsigned int flags);
12
13=head1 DESCRIPTION
14
15CMS_verify_receipt() verifies a CMS signed receipt. B<rcms> is the signed
16receipt to verify. B<ocms> is the original SignedData structure containing the
17receipt request. B<certs> is a set of certificates in which to search for the
18signing certificate. B<store> is a trusted certificate store (used for chain
19verification).
20
21B<flags> is an optional set of flags, which can be used to modify the verify
22operation.
23
24=head1 NOTES
25
26This functions behaves in a similar way to CMS_verify() except the flag values
27B<CMS_DETACHED>, B<CMS_BINARY>, B<CMS_TEXT> and B<CMS_STREAM> are not
28supported since they do not make sense in the context of signed receipts.
29
30=head1 RETURN VALUES
31
32CMS_verify_receipt() returns 1 for a successful verification and zero if an
33error occurred.
34
35The error can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>
36
37=head1 SEE ALSO
38
39L<ERR_get_error(3)|ERR_get_error(3)>,
40L<CMS_sign_receipt(3)|CMS_sign_receipt(3)>,
41L<CMS_verify(3)|CMS_verify(3)>,
42
43=head1 HISTORY
44
45CMS_verify_receipt() was added to OpenSSL 0.9.8
46
47=cut
diff --git a/src/lib/libssl/src/doc/crypto/EVP_DigestSignInit.pod b/src/lib/libssl/src/doc/crypto/EVP_DigestSignInit.pod
new file mode 100644
index 0000000000..37d960e3b2
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/EVP_DigestSignInit.pod
@@ -0,0 +1,87 @@
1=pod
2
3=head1 NAME
4
5EVP_DigestSignInit, EVP_DigestSignUpdate, EVP_DigestSignFinal - EVP signing functions
6
7=head1 SYNOPSIS
8
9 #include <openssl/evp.h>
10
11 int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
12 const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey);
13 int EVP_DigestSignUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt);
14 int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen);
15
16=head1 DESCRIPTION
17
18The EVP signature routines are a high level interface to digital signatures.
19
20EVP_DigestSignInit() sets up signing context B<ctx> to use digest B<type> from
21ENGINE B<impl> and private key B<pkey>. B<ctx> must be initialized with
22EVP_MD_CTX_init() before calling this function. If B<pctx> is not NULL the
23EVP_PKEY_CTX of the signing operation will be written to B<*pctx>: this can
24be used to set alternative signing options.
25
26EVP_DigestSignUpdate() hashes B<cnt> bytes of data at B<d> into the
27signature context B<ctx>. This function can be called several times on the
28same B<ctx> to include additional data. This function is currently implemented
29usig a macro.
30
31EVP_DigestSignFinal() signs the data in B<ctx> places the signature in B<sig>.
32If B<sig> is B<NULL> then the maximum size of the output buffer is written to
33the B<siglen> parameter. If B<sig> is not B<NULL> then before the call the
34B<siglen> parameter should contain the length of the B<sig> buffer, if the
35call is successful the signature is written to B<sig> and the amount of data
36written to B<siglen>.
37
38=head1 RETURN VALUES
39
40EVP_DigestSignInit() EVP_DigestSignUpdate() and EVP_DigestSignaFinal() return
411 for success and 0 or a negative value for failure. In particular a return
42value of -2 indicates the operation is not supported by the public key
43algorithm.
44
45The error codes can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>.
46
47=head1 NOTES
48
49The B<EVP> interface to digital signatures should almost always be used in
50preference to the low level interfaces. This is because the code then becomes
51transparent to the algorithm used and much more flexible.
52
53In previous versions of OpenSSL there was a link between message digest types
54and public key algorithms. This meant that "clone" digests such as EVP_dss1()
55needed to be used to sign using SHA1 and DSA. This is no longer necessary and
56the use of clone digest is now discouraged.
57
58For some key types and parameters the random number generator must be seeded
59or the operation will fail.
60
61The call to EVP_DigestSignFinal() internally finalizes a copy of the digest
62context. This means that calls to EVP_DigestSignUpdate() and
63EVP_DigestSignFinal() can be called later to digest and sign additional data.
64
65Since only a copy of the digest context is ever finalized the context must
66be cleaned up after use by calling EVP_MD_CTX_cleanup() or a memory leak
67will occur.
68
69The use of EVP_PKEY_size() with these functions is discouraged because some
70signature operations may have a signature length which depends on the
71parameters set. As a result EVP_PKEY_size() would have to return a value
72which indicates the maximum possible signature for any set of parameters.
73
74=head1 SEE ALSO
75
76L<EVP_DigestVerifyInit(3)|EVP_DigestVerifyInit(3)>,
77L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>,
78L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>,
79L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>,
80L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)>
81
82=head1 HISTORY
83
84EVP_DigestSignInit(), EVP_DigestSignUpdate() and EVP_DigestSignFinal()
85were first added to OpenSSL 1.0.0.
86
87=cut
diff --git a/src/lib/libssl/src/doc/crypto/EVP_DigestVerifyInit.pod b/src/lib/libssl/src/doc/crypto/EVP_DigestVerifyInit.pod
new file mode 100644
index 0000000000..f224488978
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/EVP_DigestVerifyInit.pod
@@ -0,0 +1,82 @@
1=pod
2
3=head1 NAME
4
5EVP_DigestVerifyInit, EVP_DigestVerifyUpdate, EVP_DigestVerifyFinal - EVP signature verification functions
6
7=head1 SYNOPSIS
8
9 #include <openssl/evp.h>
10
11 int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
12 const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey);
13 int EVP_DigestVerifyUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt);
14 int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t siglen);
15
16=head1 DESCRIPTION
17
18The EVP signature routines are a high level interface to digital signatures.
19
20EVP_DigestVerifyInit() sets up verification context B<ctx> to use digest
21B<type> from ENGINE B<impl> and public key B<pkey>. B<ctx> must be initialized
22with EVP_MD_CTX_init() before calling this function. If B<pctx> is not NULL the
23EVP_PKEY_CTX of the verification operation will be written to B<*pctx>: this
24can be used to set alternative verification options.
25
26EVP_DigestVerifyUpdate() hashes B<cnt> bytes of data at B<d> into the
27verification context B<ctx>. This function can be called several times on the
28same B<ctx> to include additional data. This function is currently implemented
29using a macro.
30
31EVP_DigestVerifyFinal() verifies the data in B<ctx> against the signature in
32B<sig> of length B<siglen>.
33
34=head1 RETURN VALUES
35
36EVP_DigestVerifyInit() and EVP_DigestVerifyUpdate() return 1 for success and 0
37or a negative value for failure. In particular a return value of -2 indicates
38the operation is not supported by the public key algorithm.
39
40Unlike other functions the return value 0 from EVP_DigestVerifyFinal() only
41indicates that the signature did not not verify successfully (that is tbs did
42not match the original data or the signature was of invalid form) it is not an
43indication of a more serious error.
44
45The error codes can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>.
46
47=head1 NOTES
48
49The B<EVP> interface to digital signatures should almost always be used in
50preference to the low level interfaces. This is because the code then becomes
51transparent to the algorithm used and much more flexible.
52
53In previous versions of OpenSSL there was a link between message digest types
54and public key algorithms. This meant that "clone" digests such as EVP_dss1()
55needed to be used to sign using SHA1 and DSA. This is no longer necessary and
56the use of clone digest is now discouraged.
57
58For some key types and parameters the random number generator must be seeded
59or the operation will fail.
60
61The call to EVP_DigestVerifyFinal() internally finalizes a copy of the digest
62context. This means that calls to EVP_VerifyUpdate() and EVP_VerifyFinal() can
63be called later to digest and verify additional data.
64
65Since only a copy of the digest context is ever finalized the context must
66be cleaned up after use by calling EVP_MD_CTX_cleanup() or a memory leak
67will occur.
68
69=head1 SEE ALSO
70
71L<EVP_DigestSignInit(3)|EVP_DigestSignInit(3)>,
72L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>,
73L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>,
74L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>,
75L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)>
76
77=head1 HISTORY
78
79EVP_DigestVerifyInit(), EVP_DigestVerifyUpdate() and EVP_DigestVerifyFinal()
80were first added to OpenSSL 1.0.0.
81
82=cut
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_CTX_ctrl.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_CTX_ctrl.pod
new file mode 100644
index 0000000000..f2f455990f
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_CTX_ctrl.pod
@@ -0,0 +1,128 @@
1=pod
2
3=head1 NAME
4
5EVP_PKEY_ctrl, EVP_PKEY_ctrl_str - algorithm specific control operations
6
7=head1 SYNOPSIS
8
9 #include <openssl/evp.h>
10
11 int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,
12 int cmd, int p1, void *p2);
13 int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type,
14 const char *value);
15
16 int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid);
17
18 #include <openssl/rsa.h>
19
20 int EVP_PKEY_CTX_set_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);
21
22 int EVP_PKEY_CTX_set_rsa_padding(EVP_PKEY_CTX *ctx, int pad);
23 int EVP_PKEY_CTX_set_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, int len);
24 int EVP_PKEY_CTX_set_rsa_rsa_keygen_bits(EVP_PKEY_CTX *ctx, int mbits);
25 int EVP_PKEY_CTX_set_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, BIGNUM *pubexp);
26
27 #include <openssl/dsa.h>
28 int EVP_PKEY_CTX_set_dsa_paramgen_bits(EVP_PKEY_CTX *ctx, int nbits);
29
30 #include <openssl/dh.h>
31 int EVP_PKEY_CTX_set_dh_paramgen_prime_len(EVP_PKEY_CTX *ctx, int len);
32 int EVP_PKEY_CTX_set_dh_paramgen_generator(EVP_PKEY_CTX *ctx, int gen);
33
34 #include <openssl/ec.h>
35 int EVP_PKEY_CTX_set_ec_paramgen_curve_nid(EVP_PKEY_CTX *ctx, int nid);
36
37=head1 DESCRIPTION
38
39The function EVP_PKEY_CTX_ctrl() sends a control operation to the context
40B<ctx>. The key type used must match B<keytype> if it is not -1. The parameter
41B<optype> is a mask indicating which operations the control can be applied to.
42The control command is indicated in B<cmd> and any additional arguments in
43B<p1> and B<p2>.
44
45Applications will not normally call EVP_PKEY_CTX_ctrl() directly but will
46instead call one of the algorithm specific macros below.
47
48The function EVP_PKEY_ctrl_str() allows an application to send an algorithm
49specific control operation to a context B<ctx> in string form. This is
50intended to be used for options specified on the command line or in text
51files. The commands supported are documented in the openssl utility
52command line pages for the option B<-pkeyopt> which is supported by the
53B<pkeyutl>, B<genpkey> and B<req> commands.
54
55All the remaining "functions" are implemented as macros.
56
57The EVP_PKEY_CTX_set_signature_md() macro sets the message digest type used
58in a signature. It can be used with any public key algorithm supporting
59signature operations.
60
61The macro EVP_PKEY_CTX_set_rsa_padding() sets the RSA padding mode for B<ctx>.
62The B<pad> parameter can take the value RSA_PKCS1_PADDING for PKCS#1 padding,
63RSA_SSLV23_PADDING for SSLv23 padding, RSA_NO_PADDING for no padding,
64RSA_PKCS1_OAEP_PADDING for OAEP padding (encrypt and decrypt only),
65RSA_X931_PADDING for X9.31 padding (signature operations only) and
66RSA_PKCS1_PSS_PADDING (sign and verify only).
67
68Two RSA padding modes behave differently if EVP_PKEY_CTX_set_signature_md()
69is used. If this macro is called for PKCS#1 padding the plaintext buffer is
70an actual digest value and is encapsulated in a DigestInfo structure according
71to PKCS#1 when signing and this structure is expected (and stripped off) when
72verifying. If this control is not used with RSA and PKCS#1 padding then the
73supplied data is used directly and not encapsulated. In the case of X9.31
74padding for RSA the algorithm identifier byte is added or checked and removed
75if this control is called. If it is not called then the first byte of the plaintext buffer is expected to be the algorithm identifier byte.
76
77The EVP_PKEY_CTX_set_rsa_pss_saltlen() macro sets the RSA PSS salt length to
78B<len> as its name implies it is only supported for PSS padding. Two special
79values are supported: -1 sets the salt length to the digest length. When
80signing -2 sets the salt length to the maximum permissible value. When
81verifying -2 causes the salt length to be automatically determined based on the
82B<PSS> block structure. If this macro is not called a salt length value of -2
83is used by default.
84
85The EVP_PKEY_CTX_set_rsa_rsa_keygen_bits() macro sets the RSA key length for
86RSA key genration to B<bits>. If not specified 1024 bits is used.
87
88The EVP_PKEY_CTX_set_rsa_keygen_pubexp() macro sets the public exponent value
89for RSA key generation to B<pubexp> currently it should be an odd integer. The
90B<pubexp> pointer is used internally by this function so it should not be
91modified or free after the call. If this macro is not called then 65537 is used.
92
93The macro EVP_PKEY_CTX_set_dsa_paramgen_bits() sets the number of bits used
94for DSA parameter generation to B<bits>. If not specified 1024 is used.
95
96The macro EVP_PKEY_CTX_set_dh_paramgen_prime_len() sets the length of the DH
97prime parameter B<p> for DH parameter generation. If this macro is not called
98then 1024 is used.
99
100The EVP_PKEY_CTX_set_dh_paramgen_generator() macro sets DH generator to B<gen>
101for DH parameter generation. If not specified 2 is used.
102
103The EVP_PKEY_CTX_set_ec_paramgen_curve_nid() sets the EC curve for EC parameter
104generation to B<nid>. For EC parameter generation this macro must be called
105or an error occurs because there is no default curve.
106
107=head1 RETURN VALUES
108
109EVP_PKEY_CTX_ctrl() and its macros return a positive value for success and 0
110or a negative value for failure. In particular a return value of -2
111indicates the operation is not supported by the public key algorithm.
112
113=head1 SEE ALSO
114
115L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
116L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>,
117L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>,
118L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>,
119L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>,
120L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>,
121L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)>
122L<EVP_PKEY_keygen(3)|EVP_PKEY_keygen(3)>
123
124=head1 HISTORY
125
126These functions were first added to OpenSSL 1.0.0.
127
128=cut
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_CTX_new.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_CTX_new.pod
new file mode 100644
index 0000000000..a9af867580
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_CTX_new.pod
@@ -0,0 +1,52 @@
1=pod
2
3=head1 NAME
4
5EVP_PKEY_CTX_new, EVP_PKEY_CTX_new_id, EVP_PKEY_CTX_dup, EVP_PKEY_CTX_free - public key algorithm context functions.
6
7=head1 SYNOPSIS
8
9 #include <openssl/evp.h>
10
11 EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e);
12 EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e);
13 EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx);
14 void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx);
15
16=head1 DESCRIPTION
17
18The EVP_PKEY_CTX_new() function allocates public key algorithm context using
19the algorithm specified in B<pkey> and ENGINE B<e>.
20
21The EVP_PKEY_CTX_new_id() function allocates public key algorithm context
22using the algorithm specified by B<id> and ENGINE B<e>. It is normally used
23when no B<EVP_PKEY> structure is associated with the operations, for example
24during parameter generation of key genration for some algorithms.
25
26EVP_PKEY_CTX_dup() duplicates the context B<ctx>.
27
28EVP_PKEY_CTX_free() frees up the context B<ctx>.
29
30=head1 NOTES
31
32The B<EVP_PKEY_CTX> structure is an opaque public key algorithm context used
33by the OpenSSL high level public key API. Contexts B<MUST NOT> be shared between
34threads: that is it is not permissible to use the same context simultaneously
35in two threads.
36
37=head1 RETURN VALUES
38
39EVP_PKEY_CTX_new(), EVP_PKEY_CTX_new_id(), EVP_PKEY_CTX_dup() returns either
40the newly allocated B<EVP_PKEY_CTX> structure of B<NULL> if an error occurred.
41
42EVP_PKEY_CTX_free() does not return a value.
43
44=head1 SEE ALSO
45
46L<EVP_PKEY_new(3)|EVP_PKEY_new(3)>
47
48=head1 HISTORY
49
50These functions were first added to OpenSSL 1.0.0.
51
52=cut
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_cmp.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_cmp.pod
new file mode 100644
index 0000000000..4f8185e36c
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_cmp.pod
@@ -0,0 +1,61 @@
1=pod
2
3=head1 NAME
4
5EVP_PKEY_copy_parameters, EVP_PKEY_missing_parameters, EVP_PKEY_cmp_parameters, EVP_PKEY_cmp - public key parameter and comparison functions
6
7=head1 SYNOPSIS
8
9 #include <openssl/evp.h>
10
11 int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey);
12 int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from);
13
14 int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b);
15 int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b);
16
17=head1 DESCRIPTION
18
19The function EVP_PKEY_missing_parameters() returns 1 if the public key
20parameters of B<pkey> are missing and 0 if they are present or the algorithm
21doesn't use parameters.
22
23The function EVP_PKEY_copy_parameters() copies the parameters from key
24B<from> to key B<to>.
25
26The funcion EVP_PKEY_cmp_parameters() compares the parameters of keys
27B<a> and B<b>.
28
29The funcion EVP_PKEY_cmp() compares the public key components and paramters
30(if present) of keys B<a> and B<b>.
31
32=head1 NOTES
33
34The main purpose of the functions EVP_PKEY_missing_parameters() and
35EVP_PKEY_copy_parameters() is to handle public keys in certificates where the
36parameters are sometimes omitted from a public key if they are inherited from
37the CA that signed it.
38
39Since OpenSSL private keys contain public key components too the function
40EVP_PKEY_cmp() can also be used to determine if a private key matches
41a public key.
42
43=head1 RETURN VALUES
44
45The function EVP_PKEY_missing_parameters() returns 1 if the public key
46parameters of B<pkey> are missing and 0 if they are present or the algorithm
47doesn't use parameters.
48
49These functions EVP_PKEY_copy_parameters() returns 1 for success and 0 for
50failure.
51
52The function EVP_PKEY_cmp_parameters() and EVP_PKEY_cmp() return 1 if the
53keys match, 0 if they don't match, -1 if the key types are different and
54-2 if the operation is not supported.
55
56=head1 SEE ALSO
57
58L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
59L<EVP_PKEY_keygen(3)|EVP_PKEY_keygen(3)>
60
61=cut
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_decrypt.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_decrypt.pod
new file mode 100644
index 0000000000..42b2a8c44e
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_decrypt.pod
@@ -0,0 +1,93 @@
1=pod
2
3=head1 NAME
4
5EVP_PKEY_decrypt_init, EVP_PKEY_decrypt - decrypt using a public key algorithm
6
7=head1 SYNOPSIS
8
9 #include <openssl/evp.h>
10
11 int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx);
12 int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx,
13 unsigned char *out, size_t *outlen,
14 const unsigned char *in, size_t inlen);
15
16=head1 DESCRIPTION
17
18The EVP_PKEY_decrypt_init() function initializes a public key algorithm
19context using key B<pkey> for a decryption operation.
20
21The EVP_PKEY_decrypt() function performs a public key decryption operation
22using B<ctx>. The data to be decrypted is specified using the B<in> and
23B<inlen> parameters. If B<out> is B<NULL> then the maximum size of the output
24buffer is written to the B<outlen> parameter. If B<out> is not B<NULL> then
25before the call the B<outlen> parameter should contain the length of the
26B<out> buffer, if the call is successful the decrypted data is written to
27B<out> and the amount of data written to B<outlen>.
28
29=head1 NOTES
30
31After the call to EVP_PKEY_decrypt_init() algorithm specific control
32operations can be performed to set any appropriate parameters for the
33operation.
34
35The function EVP_PKEY_decrypt() can be called more than once on the same
36context if several operations are performed using the same parameters.
37
38=head1 RETURN VALUES
39
40EVP_PKEY_decrypt_init() and EVP_PKEY_decrypt() return 1 for success and 0
41or a negative value for failure. In particular a return value of -2
42indicates the operation is not supported by the public key algorithm.
43
44=head1 EXAMPLE
45
46Decrypt data using OAEP (for RSA keys):
47
48 #include <openssl/evp.h>
49 #include <openssl/rsa.h>
50
51 EVP_PKEY_CTX *ctx;
52 unsigned char *out, *in;
53 size_t outlen, inlen;
54 EVP_PKEY *key;
55 /* NB: assumes key in, inlen are already set up
56 * and that key is an RSA private key
57 */
58 ctx = EVP_PKEY_CTX_new(key);
59 if (!ctx)
60 /* Error occurred */
61 if (EVP_PKEY_decrypt_init(ctx) <= 0)
62 /* Error */
63 if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_OAEP_PADDING) <= 0)
64 /* Error */
65
66 /* Determine buffer length */
67 if (EVP_PKEY_decrypt(ctx, NULL, &outlen, in, inlen) <= 0)
68 /* Error */
69
70 out = OPENSSL_malloc(outlen);
71
72 if (!out)
73 /* malloc failure */
74
75 if (EVP_PKEY_decrypt(ctx, out, &outlen, in, inlen) <= 0)
76 /* Error */
77
78 /* Decrypted data is outlen bytes written to buffer out */
79
80=head1 SEE ALSO
81
82L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
83L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>,
84L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>,
85L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>,
86L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>,
87L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)>
88
89=head1 HISTORY
90
91These functions were first added to OpenSSL 1.0.0.
92
93=cut
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_derive.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_derive.pod
new file mode 100644
index 0000000000..d9d6d76c72
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_derive.pod
@@ -0,0 +1,93 @@
1=pod
2
3=head1 NAME
4
5EVP_PKEY_derive_init, EVP_PKEY_derive_set_peer, EVP_PKEY_derive - derive public key algorithm shared secret.
6
7=head1 SYNOPSIS
8
9 #include <openssl/evp.h>
10
11 int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx);
12 int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer);
13 int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen);
14
15=head1 DESCRIPTION
16
17The EVP_PKEY_derive_init() function initializes a public key algorithm
18context using key B<pkey> for shared secret derivation.
19
20The EVP_PKEY_derive_set_peer() function sets the peer key: this will normally
21be a public key.
22
23The EVP_PKEY_derive() derives a shared secret using B<ctx>.
24If B<key> is B<NULL> then the maximum size of the output buffer is written to
25the B<keylen> parameter. If B<key> is not B<NULL> then before the call the
26B<keylen> parameter should contain the length of the B<key> buffer, if the call
27is successful the shared secret is written to B<key> and the amount of data
28written to B<keylen>.
29
30=head1 NOTES
31
32After the call to EVP_PKEY_derive_init() algorithm specific control
33operations can be performed to set any appropriate parameters for the
34operation.
35
36The function EVP_PKEY_derive() can be called more than once on the same
37context if several operations are performed using the same parameters.
38
39=head1 RETURN VALUES
40
41EVP_PKEY_derive_init() and EVP_PKEY_derive() return 1 for success and 0
42or a negative value for failure. In particular a return value of -2
43indicates the operation is not supported by the public key algorithm.
44
45=head1 EXAMPLE
46
47Derive shared secret (for example DH or EC keys):
48
49 #include <openssl/evp.h>
50 #include <openssl/rsa.h>
51
52 EVP_PKEY_CTX *ctx;
53 unsigned char *skey;
54 size_t skeylen;
55 EVP_PKEY *pkey, *peerkey;
56 /* NB: assumes pkey, peerkey have been already set up */
57
58 ctx = EVP_PKEY_CTX_new(pkey);
59 if (!ctx)
60 /* Error occurred */
61 if (EVP_PKEY_derive_init(ctx) <= 0)
62 /* Error */
63 if (EVP_PKEY_derive_set_peer(ctx, peerkey) <= 0)
64 /* Error */
65
66 /* Determine buffer length */
67 if (EVP_PKEY_derive(ctx, NULL, &skeylen) <= 0)
68 /* Error */
69
70 skey = OPENSSL_malloc(skeylen);
71
72 if (!skey)
73 /* malloc failure */
74
75 if (EVP_PKEY_derive(ctx, skey, &skeylen) <= 0)
76 /* Error */
77
78 /* Shared secret is skey bytes written to buffer skey */
79
80=head1 SEE ALSO
81
82L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
83L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>,
84L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>,
85L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>,
86L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>,
87L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>,
88
89=head1 HISTORY
90
91These functions were first added to OpenSSL 1.0.0.
92
93=cut
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_encrypt.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_encrypt.pod
new file mode 100644
index 0000000000..91c9c5d0a5
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_encrypt.pod
@@ -0,0 +1,93 @@
1=pod
2
3=head1 NAME
4
5EVP_PKEY_encrypt_init, EVP_PKEY_encrypt - encrypt using a public key algorithm
6
7=head1 SYNOPSIS
8
9 #include <openssl/evp.h>
10
11 int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx);
12 int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx,
13 unsigned char *out, size_t *outlen,
14 const unsigned char *in, size_t inlen);
15
16=head1 DESCRIPTION
17
18The EVP_PKEY_encrypt_init() function initializes a public key algorithm
19context using key B<pkey> for an encryption operation.
20
21The EVP_PKEY_encrypt() function performs a public key encryption operation
22using B<ctx>. The data to be encrypted is specified using the B<in> and
23B<inlen> parameters. If B<out> is B<NULL> then the maximum size of the output
24buffer is written to the B<outlen> parameter. If B<out> is not B<NULL> then
25before the call the B<outlen> parameter should contain the length of the
26B<out> buffer, if the call is successful the encrypted data is written to
27B<out> and the amount of data written to B<outlen>.
28
29=head1 NOTES
30
31After the call to EVP_PKEY_encrypt_init() algorithm specific control
32operations can be performed to set any appropriate parameters for the
33operation.
34
35The function EVP_PKEY_encrypt() can be called more than once on the same
36context if several operations are performed using the same parameters.
37
38=head1 RETURN VALUES
39
40EVP_PKEY_encrypt_init() and EVP_PKEY_encrypt() return 1 for success and 0
41or a negative value for failure. In particular a return value of -2
42indicates the operation is not supported by the public key algorithm.
43
44=head1 EXAMPLE
45
46Encrypt data using OAEP (for RSA keys):
47
48 #include <openssl/evp.h>
49 #include <openssl/rsa.h>
50
51 EVP_PKEY_CTX *ctx;
52 unsigned char *out, *in;
53 size_t outlen, inlen;
54 EVP_PKEY *key;
55 /* NB: assumes key in, inlen are already set up
56 * and that key is an RSA public key
57 */
58 ctx = EVP_PKEY_CTX_new(key);
59 if (!ctx)
60 /* Error occurred */
61 if (EVP_PKEY_encrypt_init(ctx) <= 0)
62 /* Error */
63 if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_OAEP_PADDING) <= 0)
64 /* Error */
65
66 /* Determine buffer length */
67 if (EVP_PKEY_encrypt(ctx, NULL, &outlen, in, inlen) <= 0)
68 /* Error */
69
70 out = OPENSSL_malloc(outlen);
71
72 if (!out)
73 /* malloc failure */
74
75 if (EVP_PKEY_encrypt(ctx, out, &outlen, in, inlen) <= 0)
76 /* Error */
77
78 /* Encrypted data is outlen bytes written to buffer out */
79
80=head1 SEE ALSO
81
82L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
83L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>,
84L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>,
85L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>,
86L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>,
87L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)>
88
89=head1 HISTORY
90
91These functions were first added to OpenSSL 1.0.0.
92
93=cut
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_get_default_digest.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_get_default_digest.pod
new file mode 100644
index 0000000000..1a9c7954c5
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_get_default_digest.pod
@@ -0,0 +1,41 @@
1=pod
2
3=head1 NAME
4
5EVP_PKEY_get_default_digest_nid - get default signature digest
6
7=head1 SYNOPSIS
8
9 #include <openssl/evp.h>
10 int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid);
11
12=head1 DESCRIPTION
13
14The EVP_PKEY_get_default_digest_nid() function sets B<pnid> to the default
15message digest NID for the public key signature operations associated with key
16B<pkey>.
17
18=head1 NOTES
19
20For all current standard OpenSSL public key algorithms SHA1 is returned.
21
22=head1 RETURN VALUES
23
24The EVP_PKEY_get_default_digest_nid() function returns 1 if the message digest
25is advisory (that is other digests can be used) and 2 if it is mandatory (other
26digests can not be used). It returns 0 or a negative value for failure. In
27particular a return value of -2 indicates the operation is not supported by the
28public key algorithm.
29
30=head1 SEE ALSO
31
32L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
33L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>,
34L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>,
35L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>,
36
37=head1 HISTORY
38
39This function was first added to OpenSSL 1.0.0.
40
41=cut
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_keygen.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_keygen.pod
new file mode 100644
index 0000000000..37c6fe9503
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_keygen.pod
@@ -0,0 +1,161 @@
1=pod
2
3=head1 NAME
4
5EVP_PKEY_keygen_init, EVP_PKEY_keygen, EVP_PKEY_paramgen_init, EVP_PKEY_paramgen, EVP_PKEY_CTX_set_cb, EVP_PKEY_CTX_get_cb, EVP_PKEY_CTX_get_keygen_info, EVP_PKEVP_PKEY_CTX_set_app_data, EVP_PKEY_CTX_get_app_data - key and parameter generation functions
6
7=head1 SYNOPSIS
8
9 #include <openssl/evp.h>
10
11 int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx);
12 int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);
13 int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx);
14 int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);
15
16 typedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx);
17
18 void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb);
19 EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx);
20
21 int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx);
22
23 void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data);
24 void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx);
25
26=head1 DESCRIPTION
27
28The EVP_PKEY_keygen_init() function initializes a public key algorithm
29context using key B<pkey> for a key genration operation.
30
31The EVP_PKEY_keygen() function performs a key generation operation, the
32generated key is written to B<ppkey>.
33
34The functions EVP_PKEY_paramgen_init() and EVP_PKEY_paramgen() are similar
35except parameters are generated.
36
37The function EVP_PKEY_set_cb() sets the key or parameter generation callback
38to B<cb>. The function EVP_PKEY_CTX_get_cb() returns the key or parameter
39generation callback.
40
41The function EVP_PKEY_CTX_get_keygen_info() returns parameters associated
42with the generation operation. If B<idx> is -1 the total number of
43parameters available is returned. Any non negative value returns the value of
44that parameter. EVP_PKEY_CTX_gen_keygen_info() with a non-negative value for
45B<idx> should only be called within the generation callback.
46
47If the callback returns 0 then the key genration operation is aborted and an
48error occurs. This might occur during a time consuming operation where
49a user clicks on a "cancel" button.
50
51The functions EVP_PKEY_CTX_set_app_data() and EVP_PKEY_CTX_get_app_data() set
52and retrieve an opaque pointer. This can be used to set some application
53defined value which can be retrieved in the callback: for example a handle
54which is used to update a "progress dialog".
55
56=head1 NOTES
57
58After the call to EVP_PKEY_keygen_init() or EVP_PKEY_paramgen_init() algorithm
59specific control operations can be performed to set any appropriate parameters
60for the operation.
61
62The functions EVP_PKEY_keygen() and EVP_PKEY_paramgen() can be called more than
63once on the same context if several operations are performed using the same
64parameters.
65
66The meaning of the parameters passed to the callback will depend on the
67algorithm and the specifiic implementation of the algorithm. Some might not
68give any useful information at all during key or parameter generation. Others
69might not even call the callback.
70
71The operation performed by key or parameter generation depends on the algorithm
72used. In some cases (e.g. EC with a supplied named curve) the "generation"
73option merely sets the appropriate fields in an EVP_PKEY structure.
74
75In OpenSSL an EVP_PKEY structure containing a private key also contains the
76public key components and parameters (if any). An OpenSSL private key is
77equivalent to what some libraries call a "key pair". A private key can be used
78in functions which require the use of a public key or parameters.
79
80=head1 RETURN VALUES
81
82EVP_PKEY_keygen_init(), EVP_PKEY_paramgen_init(), EVP_PKEY_keygen() and
83EVP_PKEY_paramgen() return 1 for success and 0 or a negative value for failure.
84In particular a return value of -2 indicates the operation is not supported by
85the public key algorithm.
86
87=head1 EXAMPLES
88
89Generate a 2048 bit RSA key:
90
91 #include <openssl/evp.h>
92 #include <openssl/rsa.h>
93
94 EVP_PKEY_CTX *ctx;
95 EVP_PKEY *pkey = NULL;
96 ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL);
97 if (!ctx)
98 /* Error occurred */
99 if (EVP_PKEY_keygen_init(ctx) <= 0)
100 /* Error */
101 if (EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, 2048) <= 0)
102 /* Error */
103
104 /* Generate key */
105 if (EVP_PKEY_keygen(ctx, &pkey) <= 0)
106 /* Error */
107
108Generate a key from a set of parameters:
109
110 #include <openssl/evp.h>
111 #include <openssl/rsa.h>
112
113 EVP_PKEY_CTX *ctx;
114 EVP_PKEY *pkey = NULL, *param;
115 /* Assumed param is set up already */
116 ctx = EVP_PKEY_CTX_new(param);
117 if (!ctx)
118 /* Error occurred */
119 if (EVP_PKEY_keygen_init(ctx) <= 0)
120 /* Error */
121
122 /* Generate key */
123 if (EVP_PKEY_keygen(ctx, &pkey) <= 0)
124 /* Error */
125
126Example of generation callback for OpenSSL public key implementations:
127
128 /* Application data is a BIO to output status to */
129
130 EVP_PKEY_CTX_set_app_data(ctx, status_bio);
131
132 static int genpkey_cb(EVP_PKEY_CTX *ctx)
133 {
134 char c='*';
135 BIO *b = EVP_PKEY_CTX_get_app_data(ctx);
136 int p;
137 p = EVP_PKEY_CTX_get_keygen_info(ctx, 0);
138 if (p == 0) c='.';
139 if (p == 1) c='+';
140 if (p == 2) c='*';
141 if (p == 3) c='\n';
142 BIO_write(b,&c,1);
143 (void)BIO_flush(b);
144 return 1;
145 }
146
147=head1 SEE ALSO
148
149L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
150L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>,
151L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>,
152L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>,
153L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>,
154L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>,
155L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)>
156
157=head1 HISTORY
158
159These functions were first added to OpenSSL 1.0.0.
160
161=cut
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_print_private.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_print_private.pod
new file mode 100644
index 0000000000..ce9d70d7a7
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_print_private.pod
@@ -0,0 +1,53 @@
1=pod
2
3=head1 NAME
4
5EVP_PKEY_print_public, EVP_PKEY_print_private, EVP_PKEY_print_params - public key algorithm printing routines.
6
7=head1 SYNOPSIS
8
9 #include <openssl/evp.h>
10
11 int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey,
12 int indent, ASN1_PCTX *pctx);
13 int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey,
14 int indent, ASN1_PCTX *pctx);
15 int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey,
16 int indent, ASN1_PCTX *pctx);
17
18=head1 DESCRIPTION
19
20The functions EVP_PKEY_print_public(), EVP_PKEY_print_private() and
21EVP_PKEY_print_params() print out the public, private or parameter components
22of key B<pkey> respectively. The key is sent to BIO B<out> in human readable
23form. The parameter B<indent> indicated how far the printout should be indented.
24
25The B<pctx> parameter allows the print output to be finely tuned by using
26ASN1 printing options. If B<pctx> is set to NULL then default values will
27be used.
28
29=head1 NOTES
30
31Currently no public key algorithms include any options in the B<pctx> parameter
32parameter.
33
34If the key does not include all the components indicated by the function then
35only those contained in the key will be printed. For example passing a public
36key to EVP_PKEY_print_private() will only print the public components.
37
38=head1 RETURN VALUES
39
40These functions all return 1 for success and 0 or a negative value for failure.
41In particular a return value of -2 indicates the operation is not supported by
42the public key algorithm.
43
44=head1 SEE ALSO
45
46L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
47L<EVP_PKEY_keygen(3)|EVP_PKEY_keygen(3)>
48
49=head1 HISTORY
50
51These functions were first added to OpenSSL 1.0.0.
52
53=cut
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_sign.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_sign.pod
new file mode 100644
index 0000000000..2fb52c3486
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_sign.pod
@@ -0,0 +1,96 @@
1=pod
2
3=head1 NAME
4
5EVP_PKEY_sign_init, EVP_PKEY_sign - sign using a public key algorithm
6
7=head1 SYNOPSIS
8
9 #include <openssl/evp.h>
10
11 int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx);
12 int EVP_PKEY_sign(EVP_PKEY_CTX *ctx,
13 unsigned char *sig, size_t *siglen,
14 const unsigned char *tbs, size_t tbslen);
15
16=head1 DESCRIPTION
17
18The EVP_PKEY_sign_init() function initializes a public key algorithm
19context using key B<pkey> for a signing operation.
20
21The EVP_PKEY_sign() function performs a public key signing operation
22using B<ctx>. The data to be signed is specified using the B<tbs> and
23B<tbslen> parameters. If B<sig> is B<NULL> then the maximum size of the output
24buffer is written to the B<siglen> parameter. If B<sig> is not B<NULL> then
25before the call the B<siglen> parameter should contain the length of the
26B<sig> buffer, if the call is successful the signature is written to
27B<sig> and the amount of data written to B<siglen>.
28
29=head1 NOTES
30
31After the call to EVP_PKEY_sign_init() algorithm specific control
32operations can be performed to set any appropriate parameters for the
33operation.
34
35The function EVP_PKEY_sign() can be called more than once on the same
36context if several operations are performed using the same parameters.
37
38=head1 RETURN VALUES
39
40EVP_PKEY_sign_init() and EVP_PKEY_sign() return 1 for success and 0
41or a negative value for failure. In particular a return value of -2
42indicates the operation is not supported by the public key algorithm.
43
44=head1 EXAMPLE
45
46Sign data using RSA with PKCS#1 padding and SHA256 digest:
47
48 #include <openssl/evp.h>
49 #include <openssl/rsa.h>
50
51 EVP_PKEY_CTX *ctx;
52 unsigned char *md, *sig;
53 size_t mdlen, siglen;
54 EVP_PKEY *signing_key;
55 /* NB: assumes signing_key, md and mdlen are already set up
56 * and that signing_key is an RSA private key
57 */
58 ctx = EVP_PKEY_CTX_new(signing_key);
59 if (!ctx)
60 /* Error occurred */
61 if (EVP_PKEY_sign_init(ctx) <= 0)
62 /* Error */
63 if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <= 0)
64 /* Error */
65 if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0)
66 /* Error */
67
68 /* Determine buffer length */
69 if (EVP_PKEY_sign(ctx, NULL, &siglen, md, mdlen) <= 0)
70 /* Error */
71
72 sig = OPENSSL_malloc(siglen);
73
74 if (!sig)
75 /* malloc failure */
76
77 if (EVP_PKEY_sign(ctx, sig, &siglen, md, mdlen) <= 0)
78 /* Error */
79
80 /* Signature is siglen bytes written to buffer sig */
81
82
83=head1 SEE ALSO
84
85L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
86L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>,
87L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>,
88L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>,
89L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>,
90L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)>
91
92=head1 HISTORY
93
94These functions were first added to OpenSSL 1.0.0.
95
96=cut
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_verify.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_verify.pod
new file mode 100644
index 0000000000..10633da3f2
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_verify.pod
@@ -0,0 +1,91 @@
1=pod
2
3=head1 NAME
4
5EVP_PKEY_verify_init, EVP_PKEY_verify - signature verification using a public key algorithm
6
7=head1 SYNOPSIS
8
9 #include <openssl/evp.h>
10
11 int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx);
12 int EVP_PKEY_verify(EVP_PKEY_CTX *ctx,
13 const unsigned char *sig, size_t siglen,
14 const unsigned char *tbs, size_t tbslen);
15
16=head1 DESCRIPTION
17
18The EVP_PKEY_verify_init() function initializes a public key algorithm
19context using key B<pkey> for a signature verification operation.
20
21The EVP_PKEY_verify() function performs a public key verification operation
22using B<ctx>. The signature is specified using the B<sig> and
23B<siglen> parameters. The verified data (i.e. the data believed originally
24signed) is specified using the B<tbs> and B<tbslen> parameters.
25
26=head1 NOTES
27
28After the call to EVP_PKEY_verify_init() algorithm specific control
29operations can be performed to set any appropriate parameters for the
30operation.
31
32The function EVP_PKEY_verify() can be called more than once on the same
33context if several operations are performed using the same parameters.
34
35=head1 RETURN VALUES
36
37EVP_PKEY_verify_init() and EVP_PKEY_verify() return 1 if the verification was
38successful and 0 if it failed. Unlike other functions the return value 0 from
39EVP_PKEY_verify() only indicates that the signature did not not verify
40successfully (that is tbs did not match the original data or the signature was
41of invalid form) it is not an indication of a more serious error.
42
43A negative value indicates an error other that signature verification failure.
44In particular a return value of -2 indicates the operation is not supported by
45the public key algorithm.
46
47=head1 EXAMPLE
48
49Verify signature using PKCS#1 and SHA256 digest:
50
51 #include <openssl/evp.h>
52 #include <openssl/rsa.h>
53
54 EVP_PKEY_CTX *ctx;
55 unsigned char *md, *sig;
56 size_t mdlen, siglen;
57 EVP_PKEY *verify_key;
58 /* NB: assumes verify_key, sig, siglen md and mdlen are already set up
59 * and that verify_key is an RSA public key
60 */
61 ctx = EVP_PKEY_CTX_new(verify_key);
62 if (!ctx)
63 /* Error occurred */
64 if (EVP_PKEY_verify_init(ctx) <= 0)
65 /* Error */
66 if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <= 0)
67 /* Error */
68 if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0)
69 /* Error */
70
71 /* Perform operation */
72 ret = EVP_PKEY_verify(ctx, md, mdlen, sig, siglen);
73
74 /* ret == 1 indicates success, 0 verify failure and < 0 for some
75 * other error.
76 */
77
78=head1 SEE ALSO
79
80L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>,
81L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>,
82L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>,
83L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>,
84L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>,
85L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)>
86
87=head1 HISTORY
88
89These functions were first added to OpenSSL 1.0.0.
90
91=cut
diff --git a/src/lib/libssl/src/doc/crypto/PEM_write_bio_CMS_stream.pod b/src/lib/libssl/src/doc/crypto/PEM_write_bio_CMS_stream.pod
new file mode 100644
index 0000000000..e070c45c2e
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/PEM_write_bio_CMS_stream.pod
@@ -0,0 +1,41 @@
1=pod
2
3=head1 NAME
4
5 PEM_write_bio_CMS_stream - output CMS_ContentInfo structure in PEM format.
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10 #include <openssl/pem.h>
11
12 int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *data, int flags);
13
14=head1 DESCRIPTION
15
16PEM_write_bio_CMS_stream() outputs a CMS_ContentInfo structure in PEM format.
17
18It is otherwise identical to the function SMIME_write_CMS().
19
20=head1 NOTES
21
22This function is effectively a version of the PEM_write_bio_CMS() supporting
23streaming.
24
25=head1 RETURN VALUES
26
27PEM_write_bio_CMS_stream() returns 1 for success or 0 for failure.
28
29=head1 SEE ALSO
30
31L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>,
32L<CMS_verify(3)|CMS_verify(3)>, L<CMS_encrypt(3)|CMS_encrypt(3)>
33L<CMS_decrypt(3)|CMS_decrypt(3)>,
34L<SMIME_write_CMS(3)|SMIME_write_CMS(3)>,
35L<i2d_CMS_bio_stream(3)|i2d_CMS_bio_stream(3)>
36
37=head1 HISTORY
38
39PEM_write_bio_CMS_stream() was added to OpenSSL 1.0.0
40
41=cut
diff --git a/src/lib/libssl/src/doc/crypto/PEM_write_bio_PKCS7_stream.pod b/src/lib/libssl/src/doc/crypto/PEM_write_bio_PKCS7_stream.pod
new file mode 100644
index 0000000000..16fc9b6845
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/PEM_write_bio_PKCS7_stream.pod
@@ -0,0 +1,41 @@
1=pod
2
3=head1 NAME
4
5PEM_write_bio_PKCS7_stream - output PKCS7 structure in PEM format.
6
7=head1 SYNOPSIS
8
9 #include <openssl/pkcs7.h>
10 #include <openssl/pem.h>
11
12 int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *data, int flags);
13
14=head1 DESCRIPTION
15
16PEM_write_bio_PKCS7_stream() outputs a PKCS7 structure in PEM format.
17
18It is otherwise identical to the function SMIME_write_PKCS7().
19
20=head1 NOTES
21
22This function is effectively a version of the PEM_write_bio_PKCS7() supporting
23streaming.
24
25=head1 RETURN VALUES
26
27PEM_write_bio_PKCS7_stream() returns 1 for success or 0 for failure.
28
29=head1 SEE ALSO
30
31L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>,
32L<PKCS7_verify(3)|PKCS7_verify(3)>, L<PKCS7_encrypt(3)|PKCS7_encrypt(3)>
33L<PKCS7_decrypt(3)|PKCS7_decrypt(3)>,
34L<SMIME_write_PKCS7(3)|SMIME_write_PKCS7(3)>,
35L<i2d_PKCS7_bio_stream(3)|i2d_PKCS7_bio_stream(3)>
36
37=head1 HISTORY
38
39PEM_write_bio_PKCS7_stream() was added to OpenSSL 1.0.0
40
41=cut
diff --git a/src/lib/libssl/src/doc/crypto/PKCS7_sign_add_signer.pod b/src/lib/libssl/src/doc/crypto/PKCS7_sign_add_signer.pod
new file mode 100644
index 0000000000..ebec4d57de
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/PKCS7_sign_add_signer.pod
@@ -0,0 +1,87 @@
1=pod
2
3=head1 NAME
4
5PKCS7_sign_add_signer - add a signer PKCS7 signed data structure.
6
7=head1 SYNOPSIS
8
9 #include <openssl/pkcs7.h>
10
11 PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, X509 *signcert, EVP_PKEY *pkey, const EVP_MD *md, int flags);
12
13
14=head1 DESCRIPTION
15
16PKCS7_sign_add_signer() adds a signer with certificate B<signcert> and private
17key B<pkey> using message digest B<md> to a PKCS7 signed data structure
18B<p7>.
19
20The PKCS7 structure should be obtained from an initial call to PKCS7_sign()
21with the flag B<PKCS7_PARTIAL> set or in the case or re-signing a valid PKCS7
22signed data structure.
23
24If the B<md> parameter is B<NULL> then the default digest for the public
25key algorithm will be used.
26
27Unless the B<PKCS7_REUSE_DIGEST> flag is set the returned PKCS7 structure
28is not complete and must be finalized either by streaming (if applicable) or
29a call to PKCS7_final().
30
31
32=head1 NOTES
33
34The main purpose of this function is to provide finer control over a PKCS#7
35signed data structure where the simpler PKCS7_sign() function defaults are
36not appropriate. For example if multiple signers or non default digest
37algorithms are needed.
38
39Any of the following flags (ored together) can be passed in the B<flags>
40parameter.
41
42If B<PKCS7_REUSE_DIGEST> is set then an attempt is made to copy the content
43digest value from the PKCS7 struture: to add a signer to an existing structure.
44An error occurs if a matching digest value cannot be found to copy. The
45returned PKCS7 structure will be valid and finalized when this flag is set.
46
47If B<PKCS7_PARTIAL> is set in addition to B<PKCS7_REUSE_DIGEST> then the
48B<PKCS7_SIGNER_INO> structure will not be finalized so additional attributes
49can be added. In this case an explicit call to PKCS7_SIGNER_INFO_sign() is
50needed to finalize it.
51
52If B<PKCS7_NOCERTS> is set the signer's certificate will not be included in the
53PKCS7 structure, the signer's certificate must still be supplied in the
54B<signcert> parameter though. This can reduce the size of the signature if the
55signers certificate can be obtained by other means: for example a previously
56signed message.
57
58The signedData structure includes several PKCS#7 autenticatedAttributes
59including the signing time, the PKCS#7 content type and the supported list of
60ciphers in an SMIMECapabilities attribute. If B<PKCS7_NOATTR> is set then no
61authenticatedAttributes will be used. If B<PKCS7_NOSMIMECAP> is set then just
62the SMIMECapabilities are omitted.
63
64If present the SMIMECapabilities attribute indicates support for the following
65algorithms: triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any of
66these algorithms is disabled then it will not be included.
67
68
69PKCS7_sign_add_signers() returns an internal pointer to the PKCS7_SIGNER_INFO
70structure just added, this can be used to set additional attributes
71before it is finalized.
72
73=head1 RETURN VALUES
74
75PKCS7_sign_add_signers() returns an internal pointer to the PKCS7_SIGNER_INFO
76structure just added or NULL if an error occurs.
77
78=head1 SEE ALSO
79
80L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>,
81L<PKCS7_final(3)|PKCS7_final(3)>,
82
83=head1 HISTORY
84
85PPKCS7_sign_add_signer() was added to OpenSSL 1.0.0
86
87=cut
diff --git a/src/lib/libssl/src/doc/crypto/SMIME_read_CMS.pod b/src/lib/libssl/src/doc/crypto/SMIME_read_CMS.pod
new file mode 100644
index 0000000000..acc5524c14
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/SMIME_read_CMS.pod
@@ -0,0 +1,70 @@
1=pod
2
3=head1 NAME
4
5 SMIME_read_CMS - parse S/MIME message.
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 CMS_ContentInfo *SMIME_read_CMS(BIO *in, BIO **bcont);
12
13=head1 DESCRIPTION
14
15SMIME_read_CMS() parses a message in S/MIME format.
16
17B<in> is a BIO to read the message from.
18
19If cleartext signing is used then the content is saved in a memory bio which is
20written to B<*bcont>, otherwise B<*bcont> is set to NULL.
21
22The parsed CMS_ContentInfo structure is returned or NULL if an
23error occurred.
24
25=head1 NOTES
26
27If B<*bcont> is not NULL then the message is clear text signed. B<*bcont> can
28then be passed to CMS_verify() with the B<CMS_DETACHED> flag set.
29
30Otherwise the type of the returned structure can be determined
31using CMS_get0_type().
32
33To support future functionality if B<bcont> is not NULL B<*bcont> should be
34initialized to NULL. For example:
35
36 BIO *cont = NULL;
37 CMS_ContentInfo *cms;
38
39 cms = SMIME_read_CMS(in, &cont);
40
41=head1 BUGS
42
43The MIME parser used by SMIME_read_CMS() is somewhat primitive. While it will
44handle most S/MIME messages more complex compound formats may not work.
45
46The parser assumes that the CMS_ContentInfo structure is always base64 encoded
47and will not handle the case where it is in binary format or uses quoted
48printable format.
49
50The use of a memory BIO to hold the signed content limits the size of message
51which can be processed due to memory restraints: a streaming single pass option
52should be available.
53
54=head1 RETURN VALUES
55
56SMIME_read_CMS() returns a valid B<CMS_ContentInfo> structure or B<NULL>
57if an error occurred. The error can be obtained from ERR_get_error(3).
58
59=head1 SEE ALSO
60
61L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_type(3)|CMS_type(3)>
62L<SMIME_read_CMS(3)|SMIME_read_CMS(3)>, L<CMS_sign(3)|CMS_sign(3)>,
63L<CMS_verify(3)|CMS_verify(3)>, L<CMS_encrypt(3)|CMS_encrypt(3)>
64L<CMS_decrypt(3)|CMS_decrypt(3)>
65
66=head1 HISTORY
67
68SMIME_read_CMS() was added to OpenSSL 0.9.8
69
70=cut
diff --git a/src/lib/libssl/src/doc/crypto/SMIME_write_CMS.pod b/src/lib/libssl/src/doc/crypto/SMIME_write_CMS.pod
new file mode 100644
index 0000000000..04bedfb429
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/SMIME_write_CMS.pod
@@ -0,0 +1,64 @@
1=pod
2
3=head1 NAME
4
5 SMIME_write_CMS - convert CMS structure to S/MIME format.
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 int SMIME_write_CMS(BIO *out, CMS_ContentInfo *cms, BIO *data, int flags);
12
13=head1 DESCRIPTION
14
15SMIME_write_CMS() adds the appropriate MIME headers to a CMS
16structure to produce an S/MIME message.
17
18B<out> is the BIO to write the data to. B<cms> is the appropriate
19B<CMS_ContentInfo> structure. If streaming is enabled then the content must be
20supplied in the B<data> argument. B<flags> is an optional set of flags.
21
22=head1 NOTES
23
24The following flags can be passed in the B<flags> parameter.
25
26If B<CMS_DETACHED> is set then cleartext signing will be used, this option only
27makes sense for SignedData where B<CMS_DETACHED> is also set when CMS_sign() is
28called.
29
30If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are added to
31the content, this only makes sense if B<CMS_DETACHED> is also set.
32
33If the B<CMS_STREAM> flag is set streaming is performed. This flag should only
34be set if B<CMS_STREAM> was also set in the previous call to a CMS_ContentInfo
35creation function.
36
37If cleartext signing is being used and B<CMS_STREAM> not set then the data must
38be read twice: once to compute the signature in CMS_sign() and once to output
39the S/MIME message.
40
41If streaming is performed the content is output in BER format using indefinite
42length constructed encoding except in the case of signed data with detached
43content where the content is absent and DER format is used.
44
45=head1 BUGS
46
47SMIME_write_CMS() always base64 encodes CMS structures, there should be an
48option to disable this.
49
50=head1 RETURN VALUES
51
52SMIME_write_CMS() returns 1 for success or 0 for failure.
53
54=head1 SEE ALSO
55
56L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>,
57L<CMS_verify(3)|CMS_verify(3)>, L<CMS_encrypt(3)|CMS_encrypt(3)>
58L<CMS_decrypt(3)|CMS_decrypt(3)>
59
60=head1 HISTORY
61
62SMIME_write_CMS() was added to OpenSSL 0.9.8
63
64=cut
diff --git a/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_get_error.pod b/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_get_error.pod
new file mode 100644
index 0000000000..a883f6c097
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_get_error.pod
@@ -0,0 +1,303 @@
1=pod
2
3=head1 NAME
4
5X509_STORE_CTX_get_error, X509_STORE_CTX_set_error, X509_STORE_CTX_get_error_depth, X509_STORE_CTX_get_current_cert, X509_STORE_CTX_get1_chain, X509_verify_cert_error_string - get or set certificate verification status information
6
7=head1 SYNOPSIS
8
9 #include <openssl/x509.h>
10 #include <openssl/x509_vfy.h>
11
12 int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx);
13 void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s);
14 int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx);
15 X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx);
16
17 STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx);
18
19 const char *X509_verify_cert_error_string(long n);
20
21=head1 DESCRIPTION
22
23These functions are typically called after X509_verify_cert() has indicated
24an error or in a verification callback to determine the nature of an error.
25
26X509_STORE_CTX_get_error() returns the error code of B<ctx>, see
27the B<ERROR CODES> section for a full description of all error codes.
28
29X509_STORE_CTX_set_error() sets the error code of B<ctx> to B<s>. For example
30it might be used in a verification callback to set an error based on additional
31checks.
32
33X509_STORE_CTX_get_error_depth() returns the B<depth> of the error. This is a
34non-negative integer representing where in the certificate chain the error
35occurred. If it is zero it occured in the end entity certificate, one if
36it is the certificate which signed the end entity certificate and so on.
37
38X509_STORE_CTX_get_current_cert() returns the certificate in B<ctx> which
39caused the error or B<NULL> if no certificate is relevant.
40
41X509_STORE_CTX_get1_chain() returns a complete validate chain if a previous
42call to X509_verify_cert() is successful. If the call to X509_verify_cert()
43is B<not> successful the returned chain may be incomplete or invalid. The
44returned chain persists after the B<ctx> structure is freed, when it is
45no longer needed it should be free up using:
46
47 sk_X509_pop_free(chain, X509_free);
48
49X509_verify_cert_error_string() returns a human readable error string for
50verification error B<n>.
51
52=head1 RETURN VALUES
53
54X509_STORE_CTX_get_error() returns B<X509_V_OK> or an error code.
55
56X509_STORE_CTX_get_error_depth() returns a non-negative error depth.
57
58X509_STORE_CTX_get_current_cert() returns the cerificate which caused the
59error or B<NULL> if no certificate is relevant to the error.
60
61X509_verify_cert_error_string() returns a human readable error string for
62verification error B<n>.
63
64=head1 ERROR CODES
65
66A list of error codes and messages is shown below. Some of the
67error codes are defined but currently never returned: these are described as
68"unused".
69
70=over 4
71
72=item B<X509_V_OK: ok>
73
74the operation was successful.
75
76=item B<X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certificate>
77
78the issuer certificate could not be found: this occurs if the issuer certificate
79of an untrusted certificate cannot be found.
80
81=item B<X509_V_ERR_UNABLE_TO_GET_CRL: unable to get certificate CRL>
82
83the CRL of a certificate could not be found.
84
85=item B<X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: unable to decrypt certificate's signature>
86
87the certificate signature could not be decrypted. This means that the actual
88signature value could not be determined rather than it not matching the
89expected value, this is only meaningful for RSA keys.
90
91=item B<X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE: unable to decrypt CRL's signature>
92
93the CRL signature could not be decrypted: this means that the actual signature
94value could not be determined rather than it not matching the expected value.
95Unused.
96
97=item B<X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY: unable to decode issuer public key>
98
99the public key in the certificate SubjectPublicKeyInfo could not be read.
100
101=item B<X509_V_ERR_CERT_SIGNATURE_FAILURE: certificate signature failure>
102
103the signature of the certificate is invalid.
104
105=item B<X509_V_ERR_CRL_SIGNATURE_FAILURE: CRL signature failure>
106
107the signature of the certificate is invalid.
108
109=item B<X509_V_ERR_CERT_NOT_YET_VALID: certificate is not yet valid>
110
111the certificate is not yet valid: the notBefore date is after the current time.
112
113=item B<X509_V_ERR_CERT_HAS_EXPIRED: certificate has expired>
114
115the certificate has expired: that is the notAfter date is before the current time.
116
117=item B<X509_V_ERR_CRL_NOT_YET_VALID: CRL is not yet valid>
118
119the CRL is not yet valid.
120
121=item B<X509_V_ERR_CRL_HAS_EXPIRED: CRL has expired>
122
123the CRL has expired.
124
125=item B<X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: format error in certificate's notBefore field>
126
127the certificate notBefore field contains an invalid time.
128
129=item B<X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: format error in certificate's notAfter field>
130
131the certificate notAfter field contains an invalid time.
132
133=item B<X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: format error in CRL's lastUpdate field>
134
135the CRL lastUpdate field contains an invalid time.
136
137=item B<X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: format error in CRL's nextUpdate field>
138
139the CRL nextUpdate field contains an invalid time.
140
141=item B<X509_V_ERR_OUT_OF_MEM: out of memory>
142
143an error occurred trying to allocate memory. This should never happen.
144
145=item B<X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: self signed certificate>
146
147the passed certificate is self signed and the same certificate cannot be found
148in the list of trusted certificates.
149
150=item B<X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: self signed certificate in certificate chain>
151
152the certificate chain could be built up using the untrusted certificates but
153the root could not be found locally.
154
155=item B<X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: unable to get local issuer certificate>
156
157the issuer certificate of a locally looked up certificate could not be found.
158This normally means the list of trusted certificates is not complete.
159
160=item B<X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: unable to verify the first certificate>
161
162no signatures could be verified because the chain contains only one certificate
163and it is not self signed.
164
165=item B<X509_V_ERR_CERT_CHAIN_TOO_LONG: certificate chain too long>
166
167the certificate chain length is greater than the supplied maximum depth. Unused.
168
169=item B<X509_V_ERR_CERT_REVOKED: certificate revoked>
170
171the certificate has been revoked.
172
173=item B<X509_V_ERR_INVALID_CA: invalid CA certificate>
174
175a CA certificate is invalid. Either it is not a CA or its extensions are not
176consistent with the supplied purpose.
177
178=item B<X509_V_ERR_PATH_LENGTH_EXCEEDED: path length constraint exceeded>
179
180the basicConstraints pathlength parameter has been exceeded.
181
182=item B<X509_V_ERR_INVALID_PURPOSE: unsupported certificate purpose>
183
184the supplied certificate cannot be used for the specified purpose.
185
186=item B<X509_V_ERR_CERT_UNTRUSTED: certificate not trusted>
187
188the root CA is not marked as trusted for the specified purpose.
189
190=item B<X509_V_ERR_CERT_REJECTED: certificate rejected>
191
192the root CA is marked to reject the specified purpose.
193
194=item B<X509_V_ERR_SUBJECT_ISSUER_MISMATCH: subject issuer mismatch>
195
196the current candidate issuer certificate was rejected because its subject name
197did not match the issuer name of the current certificate. This is only set
198if issuer check debugging is enabled it is used for status notification and
199is B<not> in itself an error.
200
201=item B<X509_V_ERR_AKID_SKID_MISMATCH: authority and subject key identifier mismatch>
202
203the current candidate issuer certificate was rejected because its subject key
204identifier was present and did not match the authority key identifier current
205certificate. This is only set if issuer check debugging is enabled it is used
206for status notification and is B<not> in itself an error.
207
208=item B<X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH: authority and issuer serial number mismatch>
209
210the current candidate issuer certificate was rejected because its issuer name
211and serial number was present and did not match the authority key identifier of
212the current certificate. This is only set if issuer check debugging is enabled
213it is used for status notification and is B<not> in itself an error.
214
215=item B<X509_V_ERR_KEYUSAGE_NO_CERTSIGN:key usage does not include certificate signing>
216
217the current candidate issuer certificate was rejected because its keyUsage
218extension does not permit certificate signing. This is only set if issuer check
219debugging is enabled it is used for status notification and is B<not> in itself
220an error.
221
222=item B<X509_V_ERR_INVALID_EXTENSION: invalid or inconsistent certificate extension>
223
224A certificate extension had an invalid value (for example an incorrect
225encoding) or some value inconsistent with other extensions.
226
227
228=item B<X509_V_ERR_INVALID_POLICY_EXTENSION: invalid or inconsistent certificate policy extension>
229
230A certificate policies extension had an invalid value (for example an incorrect
231encoding) or some value inconsistent with other extensions. This error only
232occurs if policy processing is enabled.
233
234=item B<X509_V_ERR_NO_EXPLICIT_POLICY: no explicit policy>
235
236The verification flags were set to require and explicit policy but none was
237present.
238
239=item B<X509_V_ERR_DIFFERENT_CRL_SCOPE: Different CRL scope>
240
241The only CRLs that could be found did not match the scope of the certificate.
242
243=item B<X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE: Unsupported extension feature>
244
245Some feature of a certificate extension is not supported. Unused.
246
247=item B<X509_V_ERR_PERMITTED_VIOLATION: permitted subtree violation>
248
249A name constraint violation occured in the permitted subtrees.
250
251=item B<X509_V_ERR_EXCLUDED_VIOLATION: excluded subtree violation>
252
253A name constraint violation occured in the excluded subtrees.
254
255=item B<X509_V_ERR_SUBTREE_MINMAX: name constraints minimum and maximum not supported>
256
257A certificate name constraints extension included a minimum or maximum field:
258this is not supported.
259
260=item B<X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE: unsupported name constraint type>
261
262An unsupported name constraint type was encountered. OpenSSL currently only
263supports directory name, DNS name, email and URI types.
264
265=item B<X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX: unsupported or invalid name constraint syntax>
266
267The format of the name constraint is not recognised: for example an email
268address format of a form not mentioned in RFC3280. This could be caused by
269a garbage extension or some new feature not currently supported.
270
271=item B<X509_V_ERR_CRL_PATH_VALIDATION_ERROR: CRL path validation error>
272
273An error occured when attempting to verify the CRL path. This error can only
274happen if extended CRL checking is enabled.
275
276=item B<X509_V_ERR_APPLICATION_VERIFICATION: application verification failure>
277
278an application specific error. This will never be returned unless explicitly
279set by an application.
280
281=head1 NOTES
282
283The above functions should be used instead of directly referencing the fields
284in the B<X509_VERIFY_CTX> structure.
285
286In versions of OpenSSL before 1.0 the current certificate returned by
287X509_STORE_CTX_get_current_cert() was never B<NULL>. Applications should
288check the return value before printing out any debugging information relating
289to the current certificate.
290
291If an unrecognised error code is passed to X509_verify_cert_error_string() the
292numerical value of the unknown code is returned in a static buffer. This is not
293thread safe but will never happen unless an invalid code is passed.
294
295=head1 SEE ALSO
296
297L<X509_verify_cert(3)|X509_verify_cert(3)>
298
299=head1 HISTORY
300
301TBA
302
303=cut
diff --git a/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_get_ex_new_index.pod b/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_get_ex_new_index.pod
new file mode 100644
index 0000000000..8d6b9dda47
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_get_ex_new_index.pod
@@ -0,0 +1,41 @@
1=pod
2
3=head1 NAME
4
5X509_STORE_CTX_get_ex_new_index, X509_STORE_CTX_set_ex_data, X509_STORE_CTX_get_ex_data - add application specific data to X509_STORE_CTX structures
6
7=head1 SYNOPSIS
8
9 #include <openssl/x509_vfy.h>
10
11 int X509_STORE_CTX_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 X509_STORE_CTX_set_ex_data(X509_STORE_CTX *d, int idx, void *arg);
17
18 char *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *d, int idx);
19
20=head1 DESCRIPTION
21
22These functions handle application specific data in X509_STORE_CTX structures.
23Their usage is identical to that of RSA_get_ex_new_index(), RSA_set_ex_data()
24and RSA_get_ex_data() as described in L<RSA_get_ex_new_index(3)>.
25
26=head1 NOTES
27
28This mechanism is used internally by the B<ssl> library to store the B<SSL>
29structure associated with a verification operation in an B<X509_STORE_CTX>
30structure.
31
32=head1 SEE ALSO
33
34L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>
35
36=head1 HISTORY
37
38X509_STORE_CTX_get_ex_new_index(), X509_STORE_CTX_set_ex_data() and
39X509_STORE_CTX_get_ex_data() are available since OpenSSL 0.9.5.
40
41=cut
diff --git a/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_new.pod b/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_new.pod
new file mode 100644
index 0000000000..b17888f149
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_new.pod
@@ -0,0 +1,122 @@
1=pod
2
3=head1 NAME
4
5X509_STORE_CTX_new, X509_STORE_CTX_cleanup, X509_STORE_CTX_free, X509_STORE_CTX_init, X509_STORE_CTX_trusted_stack, X509_STORE_CTX_set_cert, X509_STORE_CTX_set_chain, X509_STORE_CTX_set0_crls, X509_STORE_CTX_get0_param, X509_STORE_CTX_set0_param, X509_STORE_CTX_set_default - X509_STORE_CTX initialisation
6
7=head1 SYNOPSIS
8
9 #include <openssl/x509_vfy.h>
10
11 X509_STORE_CTX *X509_STORE_CTX_new(void);
12 void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);
13 void X509_STORE_CTX_free(X509_STORE_CTX *ctx);
14
15 int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store,
16 X509 *x509, STACK_OF(X509) *chain);
17
18 void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);
19
20 void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx,X509 *x);
21 void X509_STORE_CTX_set_chain(X509_STORE_CTX *ctx,STACK_OF(X509) *sk);
22 void X509_STORE_CTX_set0_crls(X509_STORE_CTX *ctx, STACK_OF(X509_CRL) *sk);
23
24 X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx);
25 void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param);
26 int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name);
27
28=head1 DESCRIPTION
29
30These functions initialise an B<X509_STORE_CTX> structure for subsequent use
31by X509_verify_cert().
32
33X509_STORE_CTX_new() returns a newly initialised B<X509_STORE_CTX> structure.
34
35X509_STORE_CTX_cleanup() internally cleans up an B<X509_STORE_CTX> structure.
36The context can then be reused with an new call to X509_STORE_CTX_init().
37
38X509_STORE_CTX_free() completely frees up B<ctx>. After this call B<ctx>
39is no longer valid.
40
41X509_STORE_CTX_init() sets up B<ctx> for a subsequent verification operation.
42The trusted certificate store is set to B<store>, the end entity certificate
43to be verified is set to B<x509> and a set of additional certificates (which
44will be untrusted but may be used to build the chain) in B<chain>. Any or
45all of the B<store>, B<x509> and B<chain> parameters can be B<NULL>.
46
47X509_STORE_CTX_trusted_stack() sets the set of trusted certificates of B<ctx>
48to B<sk>. This is an alternative way of specifying trusted certificates
49instead of using an B<X509_STORE>.
50
51X509_STORE_CTX_set_cert() sets the certificate to be vertified in B<ctx> to
52B<x>.
53
54X509_STORE_CTX_set_chain() sets the additional certificate chain used by B<ctx>
55to B<sk>.
56
57X509_STORE_CTX_set0_crls() sets a set of CRLs to use to aid certificate
58verification to B<sk>. These CRLs will only be used if CRL verification is
59enabled in the associated B<X509_VERIFY_PARAM> structure. This might be
60used where additional "useful" CRLs are supplied as part of a protocol,
61for example in a PKCS#7 structure.
62
63X509_VERIFY_PARAM *X509_STORE_CTX_get0_param() retrieves an intenal pointer
64to the verification parameters associated with B<ctx>.
65
66X509_STORE_CTX_set0_param() sets the intenal verification parameter pointer
67to B<param>. After this call B<param> should not be used.
68
69X509_STORE_CTX_set_default() looks up and sets the default verification
70method to B<name>. This uses the function X509_VERIFY_PARAM_lookup() to
71find an appropriate set of parameters from B<name>.
72
73=head1 NOTES
74
75The certificates and CRLs in a store are used internally and should B<not>
76be freed up until after the associated B<X509_STORE_CTX> is freed. Legacy
77applications might implicitly use an B<X509_STORE_CTX> like this:
78
79 X509_STORE_CTX ctx;
80 X509_STORE_CTX_init(&ctx, store, cert, chain);
81
82this is B<not> recommended in new applications they should instead do:
83
84 X509_STORE_CTX *ctx;
85 ctx = X509_STORE_CTX_new();
86 if (ctx == NULL)
87 /* Bad error */
88 X509_STORE_CTX_init(ctx, store, cert, chain);
89
90=head1 BUGS
91
92The certificates and CRLs in a context are used internally and should B<not>
93be freed up until after the associated B<X509_STORE_CTX> is freed. Copies
94should be made or reference counts increased instead.
95
96=head1 RETURN VALUES
97
98X509_STORE_CTX_new() returns an newly allocates context or B<NULL> is an
99error occurred.
100
101X509_STORE_CTX_init() returns 1 for success or 0 if an error occurred.
102
103X509_STORE_CTX_get0_param() returns a pointer to an B<X509_VERIFY_PARAM>
104structure or B<NULL> if an error occurred.
105
106X509_STORE_CTX_cleanup(), X509_STORE_CTX_free(), X509_STORE_CTX_trusted_stack(),
107X509_STORE_CTX_set_cert(), X509_STORE_CTX_set_chain(),
108X509_STORE_CTX_set0_crls() and X509_STORE_CTX_set0_param() do not return
109values.
110
111X509_STORE_CTX_set_default() returns 1 for success or 0 if an error occurred.
112
113=head1 SEE ALSO
114
115L<X509_verify_cert(3)|X509_verify_cert(3)>
116L<X509_VERIFY_PARAM_set_flags(3)|X509_VERIFY_PARAM_set_flags(3)>
117
118=head1 HISTORY
119
120X509_STORE_CTX_set0_crls() was first added to OpenSSL 1.0.0
121
122=cut
diff --git a/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_set_verify_cb.pod b/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_set_verify_cb.pod
new file mode 100644
index 0000000000..b9787a6ca6
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_set_verify_cb.pod
@@ -0,0 +1,161 @@
1=pod
2
3=head1 NAME
4
5X509_STORE_CTX_set_verify_cb - set verification callback
6
7=head1 SYNOPSIS
8
9 #include <openssl/x509_vfy.h>
10
11 void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx,
12 int (*verify_cb)(int ok, X509_STORE_CTX *ctx));
13
14=head1 DESCRIPTION
15
16X509_STORE_CTX_set_verify_cb() sets the verification callback of B<ctx> to
17B<verify_cb> overwriting any existing callback.
18
19The verification callback can be used to customise the operation of certificate
20verification, either by overriding error conditions or logging errors for
21debugging purposes.
22
23However a verification callback is B<not> essential and the default operation
24is often sufficient.
25
26The B<ok> parameter to the callback indicates the value the callback should
27return to retain the default behaviour. If it is zero then and error condition
28is indicated. If it is 1 then no error occurred. If the flag
29B<X509_V_FLAG_NOTIFY_POLICY> is set then B<ok> is set to 2 to indicate the
30policy checking is complete.
31
32The B<ctx> parameter to the callback is the B<X509_STORE_CTX> structure that
33is performing the verification operation. A callback can examine this
34structure and receive additional information about the error, for example
35by calling X509_STORE_CTX_get_current_cert(). Additional application data can
36be passed to the callback via the B<ex_data> mechanism.
37
38=head1 WARNING
39
40In general a verification callback should B<NOT> unconditionally return 1 in
41all circumstances because this will allow verification to succeed no matter
42what the error. This effectively removes all security from the application
43because B<any> certificate (including untrusted generated ones) will be
44accepted.
45
46=head1 NOTES
47
48The verification callback can be set and inherited from the parent structure
49performing the operation. In some cases (such as S/MIME verification) the
50B<X509_STORE_CTX> structure is created and destroyed internally and the
51only way to set a custom verification callback is by inheriting it from the
52associated B<X509_STORE>.
53
54=head1 RETURN VALUES
55
56X509_STORE_CTX_set_verify_cb() does not return a value.
57
58=head1 EXAMPLES
59
60Default callback operation:
61
62 int verify_callback(int ok, X509_STORE_CTX *ctx)
63 {
64 return ok;
65 }
66
67Simple example, suppose a certificate in the chain is expired and we wish
68to continue after this error:
69
70 int verify_callback(int ok, X509_STORE_CTX *ctx)
71 {
72 /* Tolerate certificate expiration */
73 if (X509_STORE_CTX_get_error(ctx) == X509_V_ERR_CERT_HAS_EXPIRED)
74 return 1;
75 /* Otherwise don't override */
76 return ok;
77 }
78
79More complex example, we don't wish to continue after B<any> certificate has
80expired just one specific case:
81
82 int verify_callback(int ok, X509_STORE_CTX *ctx)
83 {
84 int err = X509_STORE_CTX_get_error(ctx);
85 X509 *err_cert = X509_STORE_CTX_get_current_cert(ctx);
86 if (err == X509_V_ERR_CERT_HAS_EXPIRED)
87 {
88 if (check_is_acceptable_expired_cert(err_cert)
89 return 1;
90 }
91 return ok;
92 }
93
94Full featured logging callback. In this case the B<bio_err> is assumed to be
95a global logging B<BIO>, an alternative would to store a BIO in B<ctx> using
96B<ex_data>.
97
98 int verify_callback(int ok, X509_STORE_CTX *ctx)
99 {
100 X509 *err_cert;
101 int err,depth;
102
103 err_cert = X509_STORE_CTX_get_current_cert(ctx);
104 err = X509_STORE_CTX_get_error(ctx);
105 depth = X509_STORE_CTX_get_error_depth(ctx);
106
107 BIO_printf(bio_err,"depth=%d ",depth);
108 if (err_cert)
109 {
110 X509_NAME_print_ex(bio_err, X509_get_subject_name(err_cert),
111 0, XN_FLAG_ONELINE);
112 BIO_puts(bio_err, "\n");
113 }
114 else
115 BIO_puts(bio_err, "<no cert>\n");
116 if (!ok)
117 BIO_printf(bio_err,"verify error:num=%d:%s\n",err,
118 X509_verify_cert_error_string(err));
119 switch (err)
120 {
121 case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
122 BIO_puts(bio_err,"issuer= ");
123 X509_NAME_print_ex(bio_err, X509_get_issuer_name(err_cert),
124 0, XN_FLAG_ONELINE);
125 BIO_puts(bio_err, "\n");
126 break;
127 case X509_V_ERR_CERT_NOT_YET_VALID:
128 case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
129 BIO_printf(bio_err,"notBefore=");
130 ASN1_TIME_print(bio_err,X509_get_notBefore(err_cert));
131 BIO_printf(bio_err,"\n");
132 break;
133 case X509_V_ERR_CERT_HAS_EXPIRED:
134 case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
135 BIO_printf(bio_err,"notAfter=");
136 ASN1_TIME_print(bio_err,X509_get_notAfter(err_cert));
137 BIO_printf(bio_err,"\n");
138 break;
139 case X509_V_ERR_NO_EXPLICIT_POLICY:
140 policies_print(bio_err, ctx);
141 break;
142 }
143 if (err == X509_V_OK && ok == 2)
144 /* print out policies */
145
146 BIO_printf(bio_err,"verify return:%d\n",ok);
147 return(ok);
148 }
149
150=head1 SEE ALSO
151
152L<X509_STORE_CTX_get_error(3)|X509_STORE_CTX_get_error(3)>
153L<X509_STORE_set_verify_cb_func(3)|X509_STORE_set_verify_cb_func(3)>
154L<X509_STORE_CTX_get_ex_new_index(3)|X509_STORE_CTX_get_ex_new_index(3)>
155
156=head1 HISTORY
157
158X509_STORE_CTX_set_verify_cb() is available in all versions of SSLeay and
159OpenSSL.
160
161=cut
diff --git a/src/lib/libssl/src/doc/crypto/X509_STORE_set_verify_cb_func.pod b/src/lib/libssl/src/doc/crypto/X509_STORE_set_verify_cb_func.pod
new file mode 100644
index 0000000000..29e3bbe3bc
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/X509_STORE_set_verify_cb_func.pod
@@ -0,0 +1,54 @@
1=pod
2
3=head1 NAME
4
5X509_STORE_set_verify_cb_func, X509_STORE_set_verify_cb - set verification callback
6
7=head1 SYNOPSIS
8
9 #include <openssl/x509_vfy.h>
10
11 void X509_STORE_set_verify_cb(X509_STORE *st,
12 int (*verify_cb)(int ok, X509_STORE_CTX *ctx));
13
14 void X509_STORE_set_verify_cb_func(X509_STORE *st,
15 int (*verify_cb)(int ok, X509_STORE_CTX *ctx));
16
17=head1 DESCRIPTION
18
19X509_STORE_set_verify_cb() sets the verification callback of B<ctx> to
20B<verify_cb> overwriting any existing callback.
21
22X509_STORE_set_verify_cb_func() also sets the verification callback but it
23is implemented as a macro.
24
25=head1 NOTES
26
27The verification callback from an B<X509_STORE> is inherited by
28the corresponding B<X509_STORE_CTX> structure when it is initialized. This can
29be used to set the verification callback when the B<X509_STORE_CTX> is
30otherwise inaccessible (for example during S/MIME verification).
31
32=head1 BUGS
33
34The macro version of this function was the only one available before
35OpenSSL 1.0.0.
36
37=head1 RETURN VALUES
38
39X509_STORE_set_verify_cb() and X509_STORE_set_verify_cb_func() do not return
40a value.
41
42=head1 SEE ALSO
43
44L<X509_STORE_CTX_set_verify_cb(3)|X509_STORE_CTX_set_verify_cb(3)>
45L<CMS_verify(3)|CMS_verify(3)>
46
47=head1 HISTORY
48
49X509_STORE_set_verify_cb_func() is available in all versions of SSLeay and
50OpenSSL.
51
52X509_STORE_set_verify_cb() was added to OpenSSL 1.0.0.
53
54=cut
diff --git a/src/lib/libssl/src/doc/crypto/X509_VERIFY_PARAM_set_flags.pod b/src/lib/libssl/src/doc/crypto/X509_VERIFY_PARAM_set_flags.pod
new file mode 100644
index 0000000000..b68eece033
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/X509_VERIFY_PARAM_set_flags.pod
@@ -0,0 +1,171 @@
1=pod
2
3=head1 NAME
4
5X509_VERIFY_PARAM_set_flags, X509_VERIFY_PARAM_clear_flags, X509_VERIFY_PARAM_get_flags, X509_VERIFY_PARAM_set_purpose, X509_VERIFY_PARAM_set_trust, X509_VERIFY_PARAM_set_depth, X509_VERIFY_PARAM_get_depth, X509_VERIFY_PARAM_set_time, X509_VERIFY_PARAM_add0_policy, X509_VERIFY_PARAM_set1_policies - X509 verification parameters
6
7=head1 SYNOPSIS
8
9 #include <openssl/x509_vfy.h>
10
11 int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags);
12 int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,
13 unsigned long flags);
14 unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param);
15
16 int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose);
17 int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust);
18
19 void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t);
20
21 int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,
22 ASN1_OBJECT *policy);
23 int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param,
24 STACK_OF(ASN1_OBJECT) *policies);
25
26 void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth);
27 int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param);
28
29=head1 DESCRIPTION
30
31These functions manipulate the B<X509_VERIFY_PARAM> structure associated with
32a certificate verification operation.
33
34The X509_VERIFY_PARAM_set_flags() function sets the flags in B<param> by oring
35it with B<flags>. See the B<VERIFICATION FLAGS> section for a complete
36description of values the B<flags> parameter can take.
37
38X509_VERIFY_PARAM_get_flags() returns the flags in B<param>.
39
40X509_VERIFY_PARAM_clear_flags() clears the flags B<flags> in B<param>.
41
42X509_VERIFY_PARAM_set_purpose() sets the verification purpose in B<param>
43to B<purpose>. This determines the acceptable purpose of the certificate
44chain, for example SSL client or SSL server.
45
46X509_VERIFY_PARAM_set_trust() sets the trust setting in B<param> to
47B<trust>.
48
49X509_VERIFY_PARAM_set_time() sets the verification time in B<param> to
50B<t>. Normally the current time is used.
51
52X509_VERIFY_PARAM_add0_policy() enables policy checking (it is disabled
53by default) and adds B<policy> to the acceptable policy set.
54
55X509_VERIFY_PARAM_set1_policies() enables policy checking (it is disabled
56by default) and sets the acceptable policy set to B<policies>. Any existing
57policy set is cleared. The B<policies> parameter can be B<NULL> to clear
58an existing policy set.
59
60X509_VERIFY_PARAM_set_depth() sets the maximum verification depth to B<depth>.
61That is the maximum number of untrusted CA certificates that can appear in a
62chain.
63
64=head1 RETURN VALUES
65
66X509_VERIFY_PARAM_set_flags(), X509_VERIFY_PARAM_clear_flags(),
67X509_VERIFY_PARAM_set_purpose(), X509_VERIFY_PARAM_set_trust(),
68X509_VERIFY_PARAM_add0_policy() and X509_VERIFY_PARAM_set1_policies() return 1
69for success and 0 for failure.
70
71X509_VERIFY_PARAM_get_flags() returns the current verification flags.
72
73X509_VERIFY_PARAM_set_time() and X509_VERIFY_PARAM_set_depth() do not return
74values.
75
76X509_VERIFY_PARAM_get_depth() returns the current verification depth.
77
78=head1 VERIFICATION FLAGS
79
80The verification flags consists of zero or more of the following flags
81ored together.
82
83B<X509_V_FLAG_CRL_CHECK> enables CRL checking for the certificate chain leaf
84certificate. An error occurs if a suitable CRL cannot be found.
85
86B<X509_V_FLAG_CRL_CHECK_ALL> enables CRL checking for the entire certificate
87chain.
88
89B<X509_V_FLAG_IGNORE_CRITICAL> disabled critical extension checking. By default
90any unhandled critical extensions in certificates or (if checked) CRLs results
91in a fatal error. If this flag is set unhandled critical extensions are
92ignored. B<WARNING> setting this option for anything other than debugging
93purposes can be a security risk. Finer control over which extensions are
94supported can be performed in the verification callback.
95
96THe B<X509_V_FLAG_X509_STRICT> flag disables workarounds for some broken
97certificates and makes the verification strictly apply B<X509> rules.
98
99B<X509_V_FLAG_ALLOW_PROXY_CERTS> enables proxy certificate verification.
100
101B<X509_V_FLAG_POLICY_CHECK> enables certificate policy checking, by default
102no policy checking is peformed. Additional information is sent to the
103verification callback relating to policy checking.
104
105B<X509_V_FLAG_EXPLICIT_POLICY>, B<X509_V_FLAG_INHIBIT_ANY> and
106B<X509_V_FLAG_INHIBIT_MAP> set the B<require explicit policy>, B<inhibit any
107policy> and B<inhibit policy mapping> flags respectively as defined in
108B<RFC3280>. Policy checking is automatically enabled if any of these flags
109are set.
110
111If B<X509_V_FLAG_NOTIFY_POLICY> is set and the policy checking is successful
112a special status code is set to the verification callback. This permits it
113to examine the valid policy tree and perform additional checks or simply
114log it for debugging purposes.
115
116By default some addtional features such as indirect CRLs and CRLs signed by
117different keys are disabled. If B<X509_V_FLAG_EXTENDED_CRL_SUPPORT> is set
118they are enabled.
119
120If B<X509_V_FLAG_USE_DELTAS> ise set delta CRLs (if present) are used to
121determine certificate status. If not set deltas are ignored.
122
123B<X509_V_FLAG_CHECK_SS_SIGNATURE> enables checking of the root CA self signed
124cerificate signature. By default this check is disabled because it doesn't
125add any additional security but in some cases applications might want to
126check the signature anyway. A side effect of not checking the root CA
127signature is that disabled or unsupported message digests on the root CA
128are not treated as fatal errors.
129
130The B<X509_V_FLAG_CB_ISSUER_CHECK> flag enables debugging of certificate
131issuer checks. It is B<not> needed unless you are logging certificate
132verification. If this flag is set then additional status codes will be sent
133to the verification callback and it B<must> be prepared to handle such cases
134without assuming they are hard errors.
135
136=head1 NOTES
137
138The above functions should be used to manipulate verification parameters
139instead of legacy functions which work in specific structures such as
140X509_STORE_CTX_set_flags().
141
142=head1 BUGS
143
144Delta CRL checking is currently primitive. Only a single delta can be used and
145(partly due to limitations of B<X509_STORE>) constructed CRLs are not
146maintained.
147
148If CRLs checking is enable CRLs are expected to be available in the
149corresponding B<X509_STORE> structure. No attempt is made to download
150CRLs from the CRL distribution points extension.
151
152=head1 EXAMPLE
153
154Enable CRL checking when performing certificate verification during SSL
155connections associated with an B<SSL_CTX> structure B<ctx>:
156
157 X509_VERIFY_PARAM *param;
158 param = X509_VERIFY_PARAM_new();
159 X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK);
160 SSL_CTX_set1_param(ctx, param);
161 X509_VERIFY_PARAM_free(param);
162
163=head1 SEE ALSO
164
165L<X509_verify_cert(3)|X509_verify_cert(3)>
166
167=head1 HISTORY
168
169TBA
170
171=cut
diff --git a/src/lib/libssl/src/doc/crypto/X509_verify_cert.pod b/src/lib/libssl/src/doc/crypto/X509_verify_cert.pod
new file mode 100644
index 0000000000..5253bdcd70
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/X509_verify_cert.pod
@@ -0,0 +1,53 @@
1=pod
2
3=head1 NAME
4
5X509_verify_cert - discover and verify X509 certificte chain
6
7=head1 SYNOPSIS
8
9 #include <openssl/x509.h>
10
11 int X509_verify_cert(X509_STORE_CTX *ctx);
12
13=head1 DESCRIPTION
14
15The X509_verify_cert() function attempts to discover and validate a
16certificate chain based on parameters in B<ctx>. A complete description of
17the process is contained in the L<verify(1)|verify(1)> manual page.
18
19=head1 RETURN VALUES
20
21If a complete chain can be built and validated this function returns 1,
22otherwise it return zero, in exceptional circumstances it can also
23return a negative code.
24
25If the function fails additional error information can be obtained by
26examining B<ctx> using, for example X509_STORE_CTX_get_error().
27
28=head1 NOTES
29
30Applications rarely call this function directly but it is used by
31OpenSSL internally for certificate validation, in both the S/MIME and
32SSL/TLS code.
33
34The negative return value from X509_verify_cert() can only occur if no
35certificate is set in B<ctx> (due to a programming error) or if a retry
36operation is requested during internal lookups (which never happens with
37standard lookup methods). It is however recommended that application check
38for <= 0 return value on error.
39
40=head1 BUGS
41
42This function uses the header B<x509.h> as opposed to most chain verification
43functiosn which use B<x509_vfy.h>.
44
45=head1 SEE ALSO
46
47L<X509_STORE_CTX_get_error(3)|X509_STORE_CTX_get_error(3)>
48
49=head1 HISTORY
50
51X509_verify_cert() is available in all versions of SSLeay and OpenSSL.
52
53=cut
diff --git a/src/lib/libssl/src/doc/crypto/i2d_CMS_bio_stream.pod b/src/lib/libssl/src/doc/crypto/i2d_CMS_bio_stream.pod
new file mode 100644
index 0000000000..558bdd0812
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/i2d_CMS_bio_stream.pod
@@ -0,0 +1,44 @@
1=pod
2
3=head1 NAME
4
5 i2d_CMS_bio_stream - output CMS_ContentInfo structure in BER format.
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *data, int flags);
12
13=head1 DESCRIPTION
14
15i2d_CMS_bio_stream() outputs a CMS_ContentInfo structure in BER format.
16
17It is otherwise identical to the function SMIME_write_CMS().
18
19=head1 NOTES
20
21This function is effectively a version of the i2d_CMS_bio() supporting
22streaming.
23
24=head1 BUGS
25
26The prefix "i2d" is arguably wrong because the function outputs BER format.
27
28=head1 RETURN VALUES
29
30i2d_CMS_bio_stream() returns 1 for success or 0 for failure.
31
32=head1 SEE ALSO
33
34L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>,
35L<CMS_verify(3)|CMS_verify(3)>, L<CMS_encrypt(3)|CMS_encrypt(3)>
36L<CMS_decrypt(3)|CMS_decrypt(3)>,
37L<SMIME_write_CMS(3)|SMIME_write_CMS(3)>,
38L<PEM_write_bio_CMS_stream(3)|PEM_write_bio_CMS_stream(3)>
39
40=head1 HISTORY
41
42i2d_CMS_bio_stream() was added to OpenSSL 1.0.0
43
44=cut
diff --git a/src/lib/libssl/src/doc/crypto/i2d_PKCS7_bio_stream.pod b/src/lib/libssl/src/doc/crypto/i2d_PKCS7_bio_stream.pod
new file mode 100644
index 0000000000..dc4d884c59
--- /dev/null
+++ b/src/lib/libssl/src/doc/crypto/i2d_PKCS7_bio_stream.pod
@@ -0,0 +1,44 @@
1=pod
2
3=head1 NAME
4
5i2d_PKCS7_bio_stream - output PKCS7 structure in BER format.
6
7=head1 SYNOPSIS
8
9 #include <openssl/pkcs7.h>
10
11 int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *data, int flags);
12
13=head1 DESCRIPTION
14
15i2d_PKCS7_bio_stream() outputs a PKCS7 structure in BER format.
16
17It is otherwise identical to the function SMIME_write_PKCS7().
18
19=head1 NOTES
20
21This function is effectively a version of the d2i_PKCS7_bio() supporting
22streaming.
23
24=head1 BUGS
25
26The prefix "d2i" is arguably wrong because the function outputs BER format.
27
28=head1 RETURN VALUES
29
30i2d_PKCS7_bio_stream() returns 1 for success or 0 for failure.
31
32=head1 SEE ALSO
33
34L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>,
35L<PKCS7_verify(3)|PKCS7_verify(3)>, L<PKCS7_encrypt(3)|PKCS7_encrypt(3)>
36L<PKCS7_decrypt(3)|PKCS7_decrypt(3)>,
37L<SMIME_write_PKCS7(3)|SMIME_write_PKCS7(3)>,
38L<PEM_write_bio_PKCS7_stream(3)|PEM_write_bio_PKCS7_stream(3)>
39
40=head1 HISTORY
41
42i2d_PKCS7_bio_stream() was added to OpenSSL 1.0.0
43
44=cut
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_psk_client_callback.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_psk_client_callback.pod
new file mode 100644
index 0000000000..573f89a922
--- /dev/null
+++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_psk_client_callback.pod
@@ -0,0 +1,81 @@
1=pod
2
3=begin comment
4
5Copyright 2005 Nokia. All rights reserved.
6
7The portions of the attached software ("Contribution") is developed by
8Nokia Corporation and is licensed pursuant to the OpenSSL open source
9license.
10
11The Contribution, originally written by Mika Kousa and Pasi Eronen of
12Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
13support (see RFC 4279) to OpenSSL.
14
15No patent licenses or other rights except those expressly stated in
16the OpenSSL open source license shall be deemed granted or received
17expressly, by implication, estoppel, or otherwise.
18
19No assurances are provided by Nokia that the Contribution does not
20infringe the patent or other intellectual property rights of any third
21party or that the license provides you with all the necessary rights
22to make use of the Contribution.
23
24THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
25ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
26SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
27OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
28OTHERWISE.
29
30=end comment
31
32=head1 NAME
33
34SSL_CTX_set_psk_client_callback, SSL_set_psk_client_callback - set PSK client callback
35
36=head1 SYNOPSIS
37
38 #include <openssl/ssl.h>
39
40 void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx,
41 unsigned int (*callback)(SSL *ssl, const char *hint,
42 char *identity, unsigned int max_identity_len,
43 unsigned char *psk, unsigned int max_psk_len));
44 void SSL_set_psk_client_callback(SSL *ssl,
45 unsigned int (*callback)(SSL *ssl, const char *hint,
46 char *identity, unsigned int max_identity_len,
47 unsigned char *psk, unsigned int max_psk_len));
48
49
50=head1 DESCRIPTION
51
52A client application must provide a callback function which is called
53when the client is sending the ClientKeyExchange message to the server.
54
55The purpose of the callback function is to select the PSK identity and
56the pre-shared key to use during the connection setup phase.
57
58The callback is set using functions SSL_CTX_set_psk_client_callback()
59or SSL_set_psk_client_callback(). The callback function is given the
60connection in parameter B<ssl>, a B<NULL>-terminated PSK identity hint
61sent by the server in parameter B<hint>, a buffer B<identity> of
62length B<max_identity_len> bytes where the the resulting
63B<NULL>-terminated identity is to be stored, and a buffer B<psk> of
64length B<max_psk_len> bytes where the resulting pre-shared key is to
65be stored.
66
67=head1 NOTES
68
69Note that parameter B<hint> given to the callback may be B<NULL>.
70
71=head1 RETURN VALUES
72
73Return values from the client callback are interpreted as follows:
74
75On success (callback found a PSK identity and a pre-shared key to use)
76the length (> 0) of B<psk> in bytes is returned.
77
78Otherwise or on errors callback should return 0. In this case
79the connection setup fails.
80
81=cut
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_use_psk_identity_hint.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_use_psk_identity_hint.pod
new file mode 100644
index 0000000000..b80e25be7e
--- /dev/null
+++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_use_psk_identity_hint.pod
@@ -0,0 +1,102 @@
1=pod
2
3=begin comment
4
5Copyright 2005 Nokia. All rights reserved.
6
7The portions of the attached software ("Contribution") is developed by
8Nokia Corporation and is licensed pursuant to the OpenSSL open source
9license.
10
11The Contribution, originally written by Mika Kousa and Pasi Eronen of
12Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
13support (see RFC 4279) to OpenSSL.
14
15No patent licenses or other rights except those expressly stated in
16the OpenSSL open source license shall be deemed granted or received
17expressly, by implication, estoppel, or otherwise.
18
19No assurances are provided by Nokia that the Contribution does not
20infringe the patent or other intellectual property rights of any third
21party or that the license provides you with all the necessary rights
22to make use of the Contribution.
23
24THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
25ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
26SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
27OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
28OTHERWISE.
29
30=end comment
31
32=head1 NAME
33
34SSL_CTX_use_psk_identity_hint, SSL_use_psk_identity_hint,
35SSL_CTX_set_psk_server_callback, SSL_set_psk_server_callback - set PSK
36identity hint to use
37
38
39=head1 SYNOPSIS
40
41 #include <openssl/ssl.h>
42
43 int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *hint);
44 int SSL_use_psk_identity_hint(SSL *ssl, const char *hint);
45
46 void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx,
47 unsigned int (*callback)(SSL *ssl, const char *identity,
48 unsigned char *psk, int max_psk_len));
49 void SSL_set_psk_server_callback(SSL *ssl,
50 unsigned int (*callback)(SSL *ssl, const char *identity,
51 unsigned char *psk, int max_psk_len));
52
53
54=head1 DESCRIPTION
55
56SSL_CTX_use_psk_identity_hint() sets the given B<NULL>-terminated PSK
57identity hint B<hint> to SSL context object
58B<ctx>. SSL_use_psk_identity_hint() sets the given B<NULL>-terminated
59PSK identity hint B<hint> to SSL connection object B<ssl>. If B<hint>
60is B<NULL> the current hint from B<ctx> or B<ssl> is deleted.
61
62In the case where PSK identity hint is B<NULL>, the server
63does not send the ServerKeyExchange message to the client.
64
65A server application must provide a callback function which is called
66when the server receives the ClientKeyExchange message from the
67client. The purpose of the callback function is to validate the
68received PSK identity and to fetch the pre-shared key used during the
69connection setup phase. The callback is set using functions
70SSL_CTX_set_psk_server_callback() or
71SSL_set_psk_server_callback(). The callback function is given the
72connection in parameter B<ssl>, B<NULL>-terminated PSK identity sent
73by the client in parameter B<identity>, and a buffer B<psk> of length
74B<max_psk_len> bytes where the pre-shared key is to be stored.
75
76
77=head1 RETURN VALUES
78
79SSL_CTX_use_psk_identity_hint() and SSL_use_psk_identity_hint() return
801 on success, 0 otherwise.
81
82Return values from the server callback are interpreted as follows:
83
84=item > 0
85
86PSK identity was found and the server callback has provided the PSK
87successfully in parameter B<psk>. Return value is the length of
88B<psk> in bytes. It is an error to return a value greater than
89B<max_psk_len>.
90
91If the PSK identity was not found but the callback instructs the
92protocol to continue anyway, the callback must provide some random
93data to B<psk> and return the length of the random data, so the
94connection will fail with decryption_error before it will be finished
95completely.
96
97=item 0
98
99PSK identity was not found. An "unknown_psk_identity" alert message
100will be sent and the connection setup fails.
101
102=cut
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_psk_identity.pod b/src/lib/libssl/src/doc/ssl/SSL_get_psk_identity.pod
new file mode 100644
index 0000000000..fe6291649c
--- /dev/null
+++ b/src/lib/libssl/src/doc/ssl/SSL_get_psk_identity.pod
@@ -0,0 +1,63 @@
1=pod
2
3=begin comment
4
5Copyright 2005 Nokia. All rights reserved.
6
7The portions of the attached software ("Contribution") is developed by
8Nokia Corporation and is licensed pursuant to the OpenSSL open source
9license.
10
11The Contribution, originally written by Mika Kousa and Pasi Eronen of
12Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites
13support (see RFC 4279) to OpenSSL.
14
15No patent licenses or other rights except those expressly stated in
16the OpenSSL open source license shall be deemed granted or received
17expressly, by implication, estoppel, or otherwise.
18
19No assurances are provided by Nokia that the Contribution does not
20infringe the patent or other intellectual property rights of any third
21party or that the license provides you with all the necessary rights
22to make use of the Contribution.
23
24THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN
25ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA
26SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY
27OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR
28OTHERWISE.
29
30=end comment
31
32=head1 NAME
33
34SSL_get_psk_identity, SSL_get_psk_identity_hint - get PSK client identity and hint
35
36
37=head1 SYNOPSIS
38
39 #include <openssl/ssl.h>
40
41 const char *SSL_get_psk_identity_hint(const SSL *ssl);
42 const char *SSL_get_psk_identity(const SSL *ssl);
43
44
45=head1 DESCRIPTION
46
47SSL_get_psk_identity_hint() is used to retrieve the PSK identity hint
48used during the connection setup related to SSL object
49B<ssl>. Similarly, SSL_get_psk_identity() is used to retrieve the PSK
50identity used during the connection setup.
51
52
53=head1 RETURN VALUES
54
55If non-B<NULL>, SSL_get_psk_identity_hint() returns the PSK identity
56hint and SSL_get_psk_identity() returns the PSK identity. Both are
57B<NULL>-terminated. SSL_get_psk_identity_hint() may return B<NULL> if
58no PSK identity hint was used during the connection setup.
59
60Note that the return value is valid only during the lifetime of the
61SSL object B<ssl>.
62
63=cut