diff options
Diffstat (limited to 'src/lib/libcrypto/doc')
| -rw-r--r-- | src/lib/libcrypto/doc/ERR_set_mark.pod | 38 | ||||
| -rw-r--r-- | src/lib/libcrypto/doc/PKCS12_create.pod | 18 | ||||
| -rw-r--r-- | src/lib/libcrypto/doc/PKCS7_sign.pod | 24 | ||||
| -rw-r--r-- | src/lib/libcrypto/doc/SMIME_write_PKCS7.pod | 14 | ||||
| -rw-r--r-- | src/lib/libcrypto/doc/X509_NAME_print_ex.pod | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/doc/d2i_X509.pod | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/doc/d2i_X509_CRL.pod | 2 | ||||
| -rw-r--r-- | src/lib/libcrypto/doc/d2i_X509_REQ.pod | 2 | ||||
| -rw-r--r-- | src/lib/libcrypto/doc/engine.pod | 212 | ||||
| -rw-r--r-- | src/lib/libcrypto/doc/x509.pod | 64 |
10 files changed, 250 insertions, 134 deletions
diff --git a/src/lib/libcrypto/doc/ERR_set_mark.pod b/src/lib/libcrypto/doc/ERR_set_mark.pod new file mode 100644 index 0000000000..d3ca4f2e77 --- /dev/null +++ b/src/lib/libcrypto/doc/ERR_set_mark.pod | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | ERR_set_mark, ERR_pop_to_mark - set marks and pop errors until mark | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/err.h> | ||
| 10 | |||
| 11 | int ERR_set_mark(void); | ||
| 12 | |||
| 13 | int ERR_pop_to_mark(void); | ||
| 14 | |||
| 15 | =head1 DESCRIPTION | ||
| 16 | |||
| 17 | ERR_set_mark() sets a mark on the current topmost error record if there | ||
| 18 | is one. | ||
| 19 | |||
| 20 | ERR_pop_to_mark() will pop the top of the error stack until a mark is found. | ||
| 21 | The mark is then removed. If there is no mark, the whole stack is removed. | ||
| 22 | |||
| 23 | =head1 RETURN VALUES | ||
| 24 | |||
| 25 | ERR_set_mark() returns 0 if the error stack is empty, otherwise 1. | ||
| 26 | |||
| 27 | ERR_pop_to_mark() returns 0 if there was no mark in the error stack, which | ||
| 28 | implies that the stack became empty, otherwise 1. | ||
| 29 | |||
| 30 | =head1 SEE ALSO | ||
| 31 | |||
| 32 | L<err(3)|err(3)> | ||
| 33 | |||
| 34 | =head1 HISTORY | ||
| 35 | |||
| 36 | ERR_set_mark() and ERR_pop_to_mark() were added in OpenSSL 0.9.8. | ||
| 37 | |||
| 38 | =cut | ||
diff --git a/src/lib/libcrypto/doc/PKCS12_create.pod b/src/lib/libcrypto/doc/PKCS12_create.pod index 48f3bb8cb8..de7cab2bdf 100644 --- a/src/lib/libcrypto/doc/PKCS12_create.pod +++ b/src/lib/libcrypto/doc/PKCS12_create.pod | |||
| @@ -46,6 +46,24 @@ export grade software which could use signing only keys of arbitrary size but | |||
| 46 | had restrictions on the permissible sizes of keys which could be used for | 46 | had restrictions on the permissible sizes of keys which could be used for |
| 47 | encryption. | 47 | encryption. |
| 48 | 48 | ||
| 49 | =head1 NEW FUNCTIONALITY IN OPENSSL 0.9.8 | ||
| 50 | |||
| 51 | Some additional functionality was added to PKCS12_create() in OpenSSL | ||
| 52 | 0.9.8. These extensions are detailed below. | ||
| 53 | |||
| 54 | If a certificate contains an B<alias> or B<keyid> then this will be | ||
| 55 | used for the corresponding B<friendlyName> or B<localKeyID> in the | ||
| 56 | PKCS12 structure. | ||
| 57 | |||
| 58 | Either B<pkey>, B<cert> or both can be B<NULL> to indicate that no key or | ||
| 59 | certficate is required. In previous versions both had to be present or | ||
| 60 | a fatal error is returned. | ||
| 61 | |||
| 62 | B<nid_key> or B<nid_cert> can be set to -1 indicating that no encryption | ||
| 63 | should be used. | ||
| 64 | |||
| 65 | B<mac_iter> can be set to -1 and the MAC will then be omitted entirely. | ||
| 66 | |||
| 49 | =head1 SEE ALSO | 67 | =head1 SEE ALSO |
| 50 | 68 | ||
| 51 | L<d2i_PKCS12(3)|d2i_PKCS12(3)> | 69 | L<d2i_PKCS12(3)|d2i_PKCS12(3)> |
diff --git a/src/lib/libcrypto/doc/PKCS7_sign.pod b/src/lib/libcrypto/doc/PKCS7_sign.pod index fc7e649b34..ffd0c734b0 100644 --- a/src/lib/libcrypto/doc/PKCS7_sign.pod +++ b/src/lib/libcrypto/doc/PKCS7_sign.pod | |||
| @@ -51,6 +51,24 @@ If present the SMIMECapabilities attribute indicates support for the following | |||
| 51 | algorithms: triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any | 51 | algorithms: triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any |
| 52 | of these algorithms is disabled then it will not be included. | 52 | of these algorithms is disabled then it will not be included. |
| 53 | 53 | ||
| 54 | If the flags B<PKCS7_PARTSIGN> is set then the returned B<PKCS7> structure | ||
| 55 | is just initialized ready to perform the signing operation. The signing | ||
| 56 | is however B<not> performed and the data to be signed is not read from | ||
| 57 | the B<data> parameter. Signing is deferred until after the data has been | ||
| 58 | written. In this way data can be signed in a single pass. Currently the | ||
| 59 | flag B<PKCS7_DETACHED> B<must> also be set. | ||
| 60 | |||
| 61 | =head1 NOTES | ||
| 62 | |||
| 63 | Currently the flag B<PKCS7_PARTSIGN> is only supported for detached | ||
| 64 | data. If this flag is set the returned B<PKCS7> structure is B<not> | ||
| 65 | complete and outputting its contents via a function that does not | ||
| 66 | properly finalize the B<PKCS7> structure will give unpredictable | ||
| 67 | results. | ||
| 68 | |||
| 69 | At present only the SMIME_write_PKCS7() function properly finalizes the | ||
| 70 | structure. | ||
| 71 | |||
| 54 | =head1 BUGS | 72 | =head1 BUGS |
| 55 | 73 | ||
| 56 | PKCS7_sign() is somewhat limited. It does not support multiple signers, some | 74 | PKCS7_sign() is somewhat limited. It does not support multiple signers, some |
| @@ -64,10 +82,6 @@ signed due to memory restraints. There should be a way to sign data without | |||
| 64 | having to hold it all in memory, this would however require fairly major | 82 | having to hold it all in memory, this would however require fairly major |
| 65 | revisions of the OpenSSL ASN1 code. | 83 | revisions of the OpenSSL ASN1 code. |
| 66 | 84 | ||
| 67 | Clear text signing does not store the content in memory but the way PKCS7_sign() | ||
| 68 | operates means that two passes of the data must typically be made: one to compute | ||
| 69 | the signatures and a second to output the data along with the signature. There | ||
| 70 | should be a way to process the data with only a single pass. | ||
| 71 | 85 | ||
| 72 | =head1 RETURN VALUES | 86 | =head1 RETURN VALUES |
| 73 | 87 | ||
| @@ -82,4 +96,6 @@ L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_verify(3)|PKCS7_verify(3)> | |||
| 82 | 96 | ||
| 83 | PKCS7_sign() was added to OpenSSL 0.9.5 | 97 | PKCS7_sign() was added to OpenSSL 0.9.5 |
| 84 | 98 | ||
| 99 | The B<PKCS7_PARTSIGN> flag was added in OpenSSL 0.9.8 | ||
| 100 | |||
| 85 | =cut | 101 | =cut |
diff --git a/src/lib/libcrypto/doc/SMIME_write_PKCS7.pod b/src/lib/libcrypto/doc/SMIME_write_PKCS7.pod index 2cfad2e049..61945b3887 100644 --- a/src/lib/libcrypto/doc/SMIME_write_PKCS7.pod +++ b/src/lib/libcrypto/doc/SMIME_write_PKCS7.pod | |||
| @@ -30,18 +30,20 @@ If the B<PKCS7_TEXT> flag is set MIME headers for type B<text/plain> | |||
| 30 | are added to the content, this only makes sense if B<PKCS7_DETACHED> | 30 | are added to the content, this only makes sense if B<PKCS7_DETACHED> |
| 31 | is also set. | 31 | is also set. |
| 32 | 32 | ||
| 33 | If cleartext signing is being used then the data must be read twice: | 33 | If the B<PKCS7_PARTSIGN> flag is set the signed data is finalized |
| 34 | once to compute the signature in PKCS7_sign() and once to output the | 34 | and output along with the content. This flag should only be set |
| 35 | S/MIME message. | 35 | if B<PKCS7_DETACHED> is also set and the previous call to PKCS7_sign() |
| 36 | also set these flags. | ||
| 37 | |||
| 38 | If cleartext signing is being used and B<PKCS7_PARTSIGN> not set then | ||
| 39 | the data must be read twice: once to compute the signature in PKCS7_sign() | ||
| 40 | and once to output the S/MIME message. | ||
| 36 | 41 | ||
| 37 | =head1 BUGS | 42 | =head1 BUGS |
| 38 | 43 | ||
| 39 | SMIME_write_PKCS7() always base64 encodes PKCS#7 structures, there | 44 | SMIME_write_PKCS7() always base64 encodes PKCS#7 structures, there |
| 40 | should be an option to disable this. | 45 | should be an option to disable this. |
| 41 | 46 | ||
| 42 | There should really be a way to produce cleartext signing using only | ||
| 43 | a single pass of the data. | ||
| 44 | |||
| 45 | =head1 RETURN VALUES | 47 | =head1 RETURN VALUES |
| 46 | 48 | ||
| 47 | SMIME_write_PKCS7() returns 1 for success or 0 for failure. | 49 | SMIME_write_PKCS7() returns 1 for success or 0 for failure. |
diff --git a/src/lib/libcrypto/doc/X509_NAME_print_ex.pod b/src/lib/libcrypto/doc/X509_NAME_print_ex.pod index 919b908919..2579a5dc9d 100644 --- a/src/lib/libcrypto/doc/X509_NAME_print_ex.pod +++ b/src/lib/libcrypto/doc/X509_NAME_print_ex.pod | |||
| @@ -86,10 +86,10 @@ is equivalent to: | |||
| 86 | B<ASN1_STRFLGS_RFC2253 | XN_FLAG_SEP_COMMA_PLUS | XN_FLAG_DN_REV | XN_FLAG_FN_SN | XN_FLAG_DUMP_UNKNOWN_FIELDS> | 86 | B<ASN1_STRFLGS_RFC2253 | XN_FLAG_SEP_COMMA_PLUS | XN_FLAG_DN_REV | XN_FLAG_FN_SN | XN_FLAG_DUMP_UNKNOWN_FIELDS> |
| 87 | 87 | ||
| 88 | 88 | ||
| 89 | B<XN_FLAG_ONELINE> is a more readable one line format it is the same as: | 89 | B<XN_FLAG_ONELINE> is a more readable one line format which is the same as: |
| 90 | B<ASN1_STRFLGS_RFC2253 | ASN1_STRFLGS_ESC_QUOTE | XN_FLAG_SEP_CPLUS_SPC | XN_FLAG_SPC_EQ | XN_FLAG_FN_SN> | 90 | B<ASN1_STRFLGS_RFC2253 | ASN1_STRFLGS_ESC_QUOTE | XN_FLAG_SEP_CPLUS_SPC | XN_FLAG_SPC_EQ | XN_FLAG_FN_SN> |
| 91 | 91 | ||
| 92 | B<XN_FLAG_MULTILINE> is a multiline format is is the same as: | 92 | B<XN_FLAG_MULTILINE> is a multiline format which is the same as: |
| 93 | B<ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | XN_FLAG_SEP_MULTILINE | XN_FLAG_SPC_EQ | XN_FLAG_FN_LN | XN_FLAG_FN_ALIGN> | 93 | B<ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | XN_FLAG_SEP_MULTILINE | XN_FLAG_SPC_EQ | XN_FLAG_FN_LN | XN_FLAG_FN_ALIGN> |
| 94 | 94 | ||
| 95 | B<XN_FLAG_COMPAT> uses a format identical to X509_NAME_print(): in fact it calls X509_NAME_print() internally. | 95 | B<XN_FLAG_COMPAT> uses a format identical to X509_NAME_print(): in fact it calls X509_NAME_print() internally. |
diff --git a/src/lib/libcrypto/doc/d2i_X509.pod b/src/lib/libcrypto/doc/d2i_X509.pod index 5e3c3d0985..5bfa18afbb 100644 --- a/src/lib/libcrypto/doc/d2i_X509.pod +++ b/src/lib/libcrypto/doc/d2i_X509.pod | |||
| @@ -9,7 +9,7 @@ i2d_X509_fp - X509 encode and decode functions | |||
| 9 | 9 | ||
| 10 | #include <openssl/x509.h> | 10 | #include <openssl/x509.h> |
| 11 | 11 | ||
| 12 | X509 *d2i_X509(X509 **px, unsigned char **in, int len); | 12 | X509 *d2i_X509(X509 **px, const unsigned char **in, int len); |
| 13 | int i2d_X509(X509 *x, unsigned char **out); | 13 | int i2d_X509(X509 *x, unsigned char **out); |
| 14 | 14 | ||
| 15 | X509 *d2i_X509_bio(BIO *bp, X509 **x); | 15 | X509 *d2i_X509_bio(BIO *bp, X509 **x); |
| @@ -23,13 +23,13 @@ i2d_X509_fp - X509 encode and decode functions | |||
| 23 | The X509 encode and decode routines encode and parse an | 23 | The X509 encode and decode routines encode and parse an |
| 24 | B<X509> structure, which represents an X509 certificate. | 24 | B<X509> structure, which represents an X509 certificate. |
| 25 | 25 | ||
| 26 | d2i_X509() attempts to decode B<len> bytes at B<*out>. If | 26 | d2i_X509() attempts to decode B<len> bytes at B<*in>. If |
| 27 | successful a pointer to the B<X509> structure is returned. If an error | 27 | successful a pointer to the B<X509> structure is returned. If an error |
| 28 | occurred then B<NULL> is returned. If B<px> is not B<NULL> then the | 28 | occurred then B<NULL> is returned. If B<px> is not B<NULL> then the |
| 29 | returned structure is written to B<*px>. If B<*px> is not B<NULL> | 29 | returned structure is written to B<*px>. If B<*px> is not B<NULL> |
| 30 | then it is assumed that B<*px> contains a valid B<X509> | 30 | then it is assumed that B<*px> contains a valid B<X509> |
| 31 | structure and an attempt is made to reuse it. If the call is | 31 | structure and an attempt is made to reuse it. If the call is |
| 32 | successful B<*out> is incremented to the byte following the | 32 | successful B<*in> is incremented to the byte following the |
| 33 | parsed data. | 33 | parsed data. |
| 34 | 34 | ||
| 35 | i2d_X509() encodes the structure pointed to by B<x> into DER format. | 35 | i2d_X509() encodes the structure pointed to by B<x> into DER format. |
diff --git a/src/lib/libcrypto/doc/d2i_X509_CRL.pod b/src/lib/libcrypto/doc/d2i_X509_CRL.pod index 06c5b23c09..e7295a5d61 100644 --- a/src/lib/libcrypto/doc/d2i_X509_CRL.pod +++ b/src/lib/libcrypto/doc/d2i_X509_CRL.pod | |||
| @@ -9,7 +9,7 @@ i2d_X509_CRL_bio, i2d_X509_CRL_fp - PKCS#10 certificate request functions. | |||
| 9 | 9 | ||
| 10 | #include <openssl/x509.h> | 10 | #include <openssl/x509.h> |
| 11 | 11 | ||
| 12 | X509_CRL *d2i_X509_CRL(X509_CRL **a, unsigned char **pp, long length); | 12 | X509_CRL *d2i_X509_CRL(X509_CRL **a, const unsigned char **pp, long length); |
| 13 | int i2d_X509_CRL(X509_CRL *a, unsigned char **pp); | 13 | int i2d_X509_CRL(X509_CRL *a, unsigned char **pp); |
| 14 | 14 | ||
| 15 | X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **x); | 15 | X509_CRL *d2i_X509_CRL_bio(BIO *bp, X509_CRL **x); |
diff --git a/src/lib/libcrypto/doc/d2i_X509_REQ.pod b/src/lib/libcrypto/doc/d2i_X509_REQ.pod index be4ad68257..ae32a3891d 100644 --- a/src/lib/libcrypto/doc/d2i_X509_REQ.pod +++ b/src/lib/libcrypto/doc/d2i_X509_REQ.pod | |||
| @@ -9,7 +9,7 @@ i2d_X509_REQ_bio, i2d_X509_REQ_fp - PKCS#10 certificate request functions. | |||
| 9 | 9 | ||
| 10 | #include <openssl/x509.h> | 10 | #include <openssl/x509.h> |
| 11 | 11 | ||
| 12 | X509_REQ *d2i_X509_REQ(X509_REQ **a, unsigned char **pp, long length); | 12 | X509_REQ *d2i_X509_REQ(X509_REQ **a, const unsigned char **pp, long length); |
| 13 | int i2d_X509_REQ(X509_REQ *a, unsigned char **pp); | 13 | int i2d_X509_REQ(X509_REQ *a, unsigned char **pp); |
| 14 | 14 | ||
| 15 | X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **x); | 15 | X509_REQ *d2i_X509_REQ_bio(BIO *bp, X509_REQ **x); |
diff --git a/src/lib/libcrypto/doc/engine.pod b/src/lib/libcrypto/doc/engine.pod index c77dad5562..f5ab1c3e50 100644 --- a/src/lib/libcrypto/doc/engine.pod +++ b/src/lib/libcrypto/doc/engine.pod | |||
| @@ -23,21 +23,26 @@ engine - ENGINE cryptographic module support | |||
| 23 | 23 | ||
| 24 | void ENGINE_load_openssl(void); | 24 | void ENGINE_load_openssl(void); |
| 25 | void ENGINE_load_dynamic(void); | 25 | void ENGINE_load_dynamic(void); |
| 26 | void ENGINE_load_cswift(void); | 26 | #ifndef OPENSSL_NO_STATIC_ENGINE |
| 27 | void ENGINE_load_chil(void); | 27 | void ENGINE_load_4758cca(void); |
| 28 | void ENGINE_load_aep(void); | ||
| 28 | void ENGINE_load_atalla(void); | 29 | void ENGINE_load_atalla(void); |
| 30 | void ENGINE_load_chil(void); | ||
| 31 | void ENGINE_load_cswift(void); | ||
| 32 | void ENGINE_load_gmp(void); | ||
| 29 | void ENGINE_load_nuron(void); | 33 | void ENGINE_load_nuron(void); |
| 30 | void ENGINE_load_ubsec(void); | ||
| 31 | void ENGINE_load_aep(void); | ||
| 32 | void ENGINE_load_sureware(void); | 34 | void ENGINE_load_sureware(void); |
| 33 | void ENGINE_load_4758cca(void); | 35 | void ENGINE_load_ubsec(void); |
| 34 | void ENGINE_load_openbsd_dev_crypto(void); | 36 | #endif |
| 37 | void ENGINE_load_cryptodev(void); | ||
| 35 | void ENGINE_load_builtin_engines(void); | 38 | void ENGINE_load_builtin_engines(void); |
| 36 | 39 | ||
| 37 | void ENGINE_cleanup(void); | 40 | void ENGINE_cleanup(void); |
| 38 | 41 | ||
| 39 | ENGINE *ENGINE_get_default_RSA(void); | 42 | ENGINE *ENGINE_get_default_RSA(void); |
| 40 | ENGINE *ENGINE_get_default_DSA(void); | 43 | ENGINE *ENGINE_get_default_DSA(void); |
| 44 | ENGINE *ENGINE_get_default_ECDH(void); | ||
| 45 | ENGINE *ENGINE_get_default_ECDSA(void); | ||
| 41 | ENGINE *ENGINE_get_default_DH(void); | 46 | ENGINE *ENGINE_get_default_DH(void); |
| 42 | ENGINE *ENGINE_get_default_RAND(void); | 47 | ENGINE *ENGINE_get_default_RAND(void); |
| 43 | ENGINE *ENGINE_get_cipher_engine(int nid); | 48 | ENGINE *ENGINE_get_cipher_engine(int nid); |
| @@ -45,6 +50,8 @@ engine - ENGINE cryptographic module support | |||
| 45 | 50 | ||
| 46 | int ENGINE_set_default_RSA(ENGINE *e); | 51 | int ENGINE_set_default_RSA(ENGINE *e); |
| 47 | int ENGINE_set_default_DSA(ENGINE *e); | 52 | int ENGINE_set_default_DSA(ENGINE *e); |
| 53 | int ENGINE_set_default_ECDH(ENGINE *e); | ||
| 54 | int ENGINE_set_default_ECDSA(ENGINE *e); | ||
| 48 | int ENGINE_set_default_DH(ENGINE *e); | 55 | int ENGINE_set_default_DH(ENGINE *e); |
| 49 | int ENGINE_set_default_RAND(ENGINE *e); | 56 | int ENGINE_set_default_RAND(ENGINE *e); |
| 50 | int ENGINE_set_default_ciphers(ENGINE *e); | 57 | int ENGINE_set_default_ciphers(ENGINE *e); |
| @@ -62,12 +69,21 @@ engine - ENGINE cryptographic module support | |||
| 62 | int ENGINE_register_DSA(ENGINE *e); | 69 | int ENGINE_register_DSA(ENGINE *e); |
| 63 | void ENGINE_unregister_DSA(ENGINE *e); | 70 | void ENGINE_unregister_DSA(ENGINE *e); |
| 64 | void ENGINE_register_all_DSA(void); | 71 | void ENGINE_register_all_DSA(void); |
| 72 | int ENGINE_register_ECDH(ENGINE *e); | ||
| 73 | void ENGINE_unregister_ECDH(ENGINE *e); | ||
| 74 | void ENGINE_register_all_ECDH(void); | ||
| 75 | int ENGINE_register_ECDSA(ENGINE *e); | ||
| 76 | void ENGINE_unregister_ECDSA(ENGINE *e); | ||
| 77 | void ENGINE_register_all_ECDSA(void); | ||
| 65 | int ENGINE_register_DH(ENGINE *e); | 78 | int ENGINE_register_DH(ENGINE *e); |
| 66 | void ENGINE_unregister_DH(ENGINE *e); | 79 | void ENGINE_unregister_DH(ENGINE *e); |
| 67 | void ENGINE_register_all_DH(void); | 80 | void ENGINE_register_all_DH(void); |
| 68 | int ENGINE_register_RAND(ENGINE *e); | 81 | int ENGINE_register_RAND(ENGINE *e); |
| 69 | void ENGINE_unregister_RAND(ENGINE *e); | 82 | void ENGINE_unregister_RAND(ENGINE *e); |
| 70 | void ENGINE_register_all_RAND(void); | 83 | void ENGINE_register_all_RAND(void); |
| 84 | int ENGINE_register_STORE(ENGINE *e); | ||
| 85 | void ENGINE_unregister_STORE(ENGINE *e); | ||
| 86 | void ENGINE_register_all_STORE(void); | ||
| 71 | int ENGINE_register_ciphers(ENGINE *e); | 87 | int ENGINE_register_ciphers(ENGINE *e); |
| 72 | void ENGINE_unregister_ciphers(ENGINE *e); | 88 | void ENGINE_unregister_ciphers(ENGINE *e); |
| 73 | void ENGINE_register_all_ciphers(void); | 89 | void ENGINE_register_all_ciphers(void); |
| @@ -77,12 +93,12 @@ engine - ENGINE cryptographic module support | |||
| 77 | int ENGINE_register_complete(ENGINE *e); | 93 | int ENGINE_register_complete(ENGINE *e); |
| 78 | int ENGINE_register_all_complete(void); | 94 | int ENGINE_register_all_complete(void); |
| 79 | 95 | ||
| 80 | int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()); | 96 | int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void)); |
| 81 | int ENGINE_cmd_is_executable(ENGINE *e, int cmd); | 97 | int ENGINE_cmd_is_executable(ENGINE *e, int cmd); |
| 82 | int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, | 98 | int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, |
| 83 | long i, void *p, void (*f)(), int cmd_optional); | 99 | long i, void *p, void (*f)(void), int cmd_optional); |
| 84 | int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, | 100 | int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, |
| 85 | int cmd_optional); | 101 | int cmd_optional); |
| 86 | 102 | ||
| 87 | int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg); | 103 | int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg); |
| 88 | void *ENGINE_get_ex_data(const ENGINE *e, int idx); | 104 | void *ENGINE_get_ex_data(const ENGINE *e, int idx); |
| @@ -92,13 +108,17 @@ engine - ENGINE cryptographic module support | |||
| 92 | 108 | ||
| 93 | ENGINE *ENGINE_new(void); | 109 | ENGINE *ENGINE_new(void); |
| 94 | int ENGINE_free(ENGINE *e); | 110 | int ENGINE_free(ENGINE *e); |
| 111 | int ENGINE_up_ref(ENGINE *e); | ||
| 95 | 112 | ||
| 96 | int ENGINE_set_id(ENGINE *e, const char *id); | 113 | int ENGINE_set_id(ENGINE *e, const char *id); |
| 97 | int ENGINE_set_name(ENGINE *e, const char *name); | 114 | int ENGINE_set_name(ENGINE *e, const char *name); |
| 98 | int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); | 115 | int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); |
| 99 | int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth); | 116 | int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth); |
| 117 | int ENGINE_set_ECDH(ENGINE *e, const ECDH_METHOD *dh_meth); | ||
| 118 | int ENGINE_set_ECDSA(ENGINE *e, const ECDSA_METHOD *dh_meth); | ||
| 100 | int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth); | 119 | int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth); |
| 101 | int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth); | 120 | int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth); |
| 121 | int ENGINE_set_STORE(ENGINE *e, const STORE_METHOD *rand_meth); | ||
| 102 | int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f); | 122 | int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f); |
| 103 | int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f); | 123 | int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f); |
| 104 | int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f); | 124 | int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f); |
| @@ -114,8 +134,11 @@ engine - ENGINE cryptographic module support | |||
| 114 | const char *ENGINE_get_name(const ENGINE *e); | 134 | const char *ENGINE_get_name(const ENGINE *e); |
| 115 | const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e); | 135 | const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e); |
| 116 | const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e); | 136 | const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e); |
| 137 | const ECDH_METHOD *ENGINE_get_ECDH(const ENGINE *e); | ||
| 138 | const ECDSA_METHOD *ENGINE_get_ECDSA(const ENGINE *e); | ||
| 117 | const DH_METHOD *ENGINE_get_DH(const ENGINE *e); | 139 | const DH_METHOD *ENGINE_get_DH(const ENGINE *e); |
| 118 | const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); | 140 | const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); |
| 141 | const STORE_METHOD *ENGINE_get_STORE(const ENGINE *e); | ||
| 119 | ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e); | 142 | ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e); |
| 120 | ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e); | 143 | ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e); |
| 121 | ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e); | 144 | ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e); |
| @@ -148,7 +171,8 @@ The cryptographic functionality that can be provided by an B<ENGINE> | |||
| 148 | implementation includes the following abstractions; | 171 | implementation includes the following abstractions; |
| 149 | 172 | ||
| 150 | RSA_METHOD - for providing alternative RSA implementations | 173 | RSA_METHOD - for providing alternative RSA implementations |
| 151 | DSA_METHOD, DH_METHOD, RAND_METHOD - alternative DSA, DH, and RAND | 174 | DSA_METHOD, DH_METHOD, RAND_METHOD, ECDH_METHOD, ECDSA_METHOD, |
| 175 | STORE_METHOD - similarly for other OpenSSL APIs | ||
| 152 | EVP_CIPHER - potentially multiple cipher algorithms (indexed by 'nid') | 176 | EVP_CIPHER - potentially multiple cipher algorithms (indexed by 'nid') |
| 153 | EVP_DIGEST - potentially multiple hash algorithms (indexed by 'nid') | 177 | EVP_DIGEST - potentially multiple hash algorithms (indexed by 'nid') |
| 154 | key-loading - loading public and/or private EVP_PKEY keys | 178 | key-loading - loading public and/or private EVP_PKEY keys |
| @@ -157,52 +181,45 @@ implementation includes the following abstractions; | |||
| 157 | 181 | ||
| 158 | Due to the modular nature of the ENGINE API, pointers to ENGINEs need to be | 182 | Due to the modular nature of the ENGINE API, pointers to ENGINEs need to be |
| 159 | treated as handles - ie. not only as pointers, but also as references to | 183 | treated as handles - ie. not only as pointers, but also as references to |
| 160 | the underlying ENGINE object. Ie. you should obtain a new reference when | 184 | the underlying ENGINE object. Ie. one should obtain a new reference when |
| 161 | making copies of an ENGINE pointer if the copies will be used (and | 185 | making copies of an ENGINE pointer if the copies will be used (and |
| 162 | released) independantly. | 186 | released) independently. |
| 163 | 187 | ||
| 164 | ENGINE objects have two levels of reference-counting to match the way in | 188 | ENGINE objects have two levels of reference-counting to match the way in |
| 165 | which the objects are used. At the most basic level, each ENGINE pointer is | 189 | which the objects are used. At the most basic level, each ENGINE pointer is |
| 166 | inherently a B<structural> reference - you need a structural reference | 190 | inherently a B<structural> reference - a structural reference is required |
| 167 | simply to refer to the pointer value at all, as this kind of reference is | 191 | to use the pointer value at all, as this kind of reference is a guarantee |
| 168 | your guarantee that the structure can not be deallocated until you release | 192 | that the structure can not be deallocated until the reference is released. |
| 169 | your reference. | 193 | |
| 170 | 194 | However, a structural reference provides no guarantee that the ENGINE is | |
| 171 | However, a structural reference provides no guarantee that the ENGINE has | 195 | initiliased and able to use any of its cryptographic |
| 172 | been initiliased to be usable to perform any of its cryptographic | 196 | implementations. Indeed it's quite possible that most ENGINEs will not |
| 173 | implementations - and indeed it's quite possible that most ENGINEs will not | 197 | initialise at all in typical environments, as ENGINEs are typically used to |
| 174 | initialised at all on standard setups, as ENGINEs are typically used to | ||
| 175 | support specialised hardware. To use an ENGINE's functionality, you need a | 198 | support specialised hardware. To use an ENGINE's functionality, you need a |
| 176 | B<functional> reference. This kind of reference can be considered a | 199 | B<functional> reference. This kind of reference can be considered a |
| 177 | specialised form of structural reference, because each functional reference | 200 | specialised form of structural reference, because each functional reference |
| 178 | implicitly contains a structural reference as well - however to avoid | 201 | implicitly contains a structural reference as well - however to avoid |
| 179 | difficult-to-find programming bugs, it is recommended to treat the two | 202 | difficult-to-find programming bugs, it is recommended to treat the two |
| 180 | kinds of reference independantly. If you have a functional reference to an | 203 | kinds of reference independently. If you have a functional reference to an |
| 181 | ENGINE, you have a guarantee that the ENGINE has been initialised ready to | 204 | ENGINE, you have a guarantee that the ENGINE has been initialised ready to |
| 182 | perform cryptographic operations and will not be uninitialised or cleaned | 205 | perform cryptographic operations and will remain uninitialised |
| 183 | up until after you have released your reference. | 206 | until after you have released your reference. |
| 184 | |||
| 185 | We will discuss the two kinds of reference separately, including how to | ||
| 186 | tell which one you are dealing with at any given point in time (after all | ||
| 187 | they are both simply (ENGINE *) pointers, the difference is in the way they | ||
| 188 | are used). | ||
| 189 | 207 | ||
| 190 | I<Structural references> | 208 | I<Structural references> |
| 191 | 209 | ||
| 192 | This basic type of reference is typically used for creating new ENGINEs | 210 | This basic type of reference is used for instantiating new ENGINEs, |
| 193 | dynamically, iterating across OpenSSL's internal linked-list of loaded | 211 | iterating across OpenSSL's internal linked-list of loaded |
| 194 | ENGINEs, reading information about an ENGINE, etc. Essentially a structural | 212 | ENGINEs, reading information about an ENGINE, etc. Essentially a structural |
| 195 | reference is sufficient if you only need to query or manipulate the data of | 213 | reference is sufficient if you only need to query or manipulate the data of |
| 196 | an ENGINE implementation rather than use its functionality. | 214 | an ENGINE implementation rather than use its functionality. |
| 197 | 215 | ||
| 198 | The ENGINE_new() function returns a structural reference to a new (empty) | 216 | The ENGINE_new() function returns a structural reference to a new (empty) |
| 199 | ENGINE object. Other than that, structural references come from return | 217 | ENGINE object. There are other ENGINE API functions that return structural |
| 200 | values to various ENGINE API functions such as; ENGINE_by_id(), | 218 | references such as; ENGINE_by_id(), ENGINE_get_first(), ENGINE_get_last(), |
| 201 | ENGINE_get_first(), ENGINE_get_last(), ENGINE_get_next(), | 219 | ENGINE_get_next(), ENGINE_get_prev(). All structural references should be |
| 202 | ENGINE_get_prev(). All structural references should be released by a | 220 | released by a corresponding to call to the ENGINE_free() function - the |
| 203 | corresponding to call to the ENGINE_free() function - the ENGINE object | 221 | ENGINE object itself will only actually be cleaned up and deallocated when |
| 204 | itself will only actually be cleaned up and deallocated when the last | 222 | the last structural reference is released. |
| 205 | structural reference is released. | ||
| 206 | 223 | ||
| 207 | It should also be noted that many ENGINE API function calls that accept a | 224 | It should also be noted that many ENGINE API function calls that accept a |
| 208 | structural reference will internally obtain another reference - typically | 225 | structural reference will internally obtain another reference - typically |
| @@ -237,15 +254,9 @@ call the ENGINE_init() function. This returns zero if the ENGINE was not | |||
| 237 | already operational and couldn't be successfully initialised (eg. lack of | 254 | already operational and couldn't be successfully initialised (eg. lack of |
| 238 | system drivers, no special hardware attached, etc), otherwise it will | 255 | system drivers, no special hardware attached, etc), otherwise it will |
| 239 | return non-zero to indicate that the ENGINE is now operational and will | 256 | return non-zero to indicate that the ENGINE is now operational and will |
| 240 | have allocated a new B<functional> reference to the ENGINE. In this case, | 257 | have allocated a new B<functional> reference to the ENGINE. All functional |
| 241 | the supplied ENGINE pointer is, from the point of the view of the caller, | 258 | references are released by calling ENGINE_finish() (which removes the |
| 242 | both a structural reference and a functional reference - so if the caller | 259 | implicit structural reference as well). |
| 243 | intends to use it as a functional reference it should free the structural | ||
| 244 | reference with ENGINE_free() first. If the caller wishes to use it only as | ||
| 245 | a structural reference (eg. if the ENGINE_init() call was simply to test if | ||
| 246 | the ENGINE seems available/online), then it should free the functional | ||
| 247 | reference; all functional references are released by the ENGINE_finish() | ||
| 248 | function. | ||
| 249 | 260 | ||
| 250 | The second way to get a functional reference is by asking OpenSSL for a | 261 | The second way to get a functional reference is by asking OpenSSL for a |
| 251 | default implementation for a given task, eg. by ENGINE_get_default_RSA(), | 262 | default implementation for a given task, eg. by ENGINE_get_default_RSA(), |
| @@ -259,26 +270,21 @@ algorithm-specific types in OpenSSL, such as RSA, DSA, EVP_CIPHER_CTX, etc. | |||
| 259 | For each supported abstraction, the ENGINE code maintains an internal table | 270 | For each supported abstraction, the ENGINE code maintains an internal table |
| 260 | of state to control which implementations are available for a given | 271 | of state to control which implementations are available for a given |
| 261 | abstraction and which should be used by default. These implementations are | 272 | abstraction and which should be used by default. These implementations are |
| 262 | registered in the tables separated-out by an 'nid' index, because | 273 | registered in the tables and indexed by an 'nid' value, because |
| 263 | abstractions like EVP_CIPHER and EVP_DIGEST support many distinct | 274 | abstractions like EVP_CIPHER and EVP_DIGEST support many distinct |
| 264 | algorithms and modes - ENGINEs will support different numbers and | 275 | algorithms and modes, and ENGINEs can support arbitrarily many of them. |
| 265 | combinations of these. In the case of other abstractions like RSA, DSA, | 276 | In the case of other abstractions like RSA, DSA, etc, there is only one |
| 266 | etc, there is only one "algorithm" so all implementations implicitly | 277 | "algorithm" so all implementations implicitly register using the same 'nid' |
| 267 | register using the same 'nid' index. ENGINEs can be B<registered> into | 278 | index. |
| 268 | these tables to make themselves available for use automatically by the | 279 | |
| 269 | various abstractions, eg. RSA. For illustrative purposes, we continue with | 280 | When a default ENGINE is requested for a given abstraction/algorithm/mode, (eg. |
| 270 | the RSA example, though all comments apply similarly to the other | 281 | when calling RSA_new_method(NULL)), a "get_default" call will be made to the |
| 271 | abstractions (they each get their own table and linkage to the | 282 | ENGINE subsystem to process the corresponding state table and return a |
| 272 | corresponding section of openssl code). | 283 | functional reference to an initialised ENGINE whose implementation should be |
| 273 | 284 | used. If no ENGINE should (or can) be used, it will return NULL and the caller | |
| 274 | When a new RSA key is being created, ie. in RSA_new_method(), a | 285 | will operate with a NULL ENGINE handle - this usually equates to using the |
| 275 | "get_default" call will be made to the ENGINE subsystem to process the RSA | 286 | conventional software implementation. In the latter case, OpenSSL will from |
| 276 | state table and return a functional reference to an initialised ENGINE | 287 | then on behave the way it used to before the ENGINE API existed. |
| 277 | whose RSA_METHOD should be used. If no ENGINE should (or can) be used, it | ||
| 278 | will return NULL and the RSA key will operate with a NULL ENGINE handle by | ||
| 279 | using the conventional RSA implementation in OpenSSL (and will from then on | ||
| 280 | behave the way it used to before the ENGINE API existed - for details see | ||
| 281 | L<RSA_new_method(3)|RSA_new_method(3)>). | ||
| 282 | 288 | ||
| 283 | Each state table has a flag to note whether it has processed this | 289 | Each state table has a flag to note whether it has processed this |
| 284 | "get_default" query since the table was last modified, because to process | 290 | "get_default" query since the table was last modified, because to process |
| @@ -295,36 +301,9 @@ instead the only way for the state table to return a non-NULL ENGINE to the | |||
| 295 | "get_default" query will be if one is expressly set in the table. Eg. | 301 | "get_default" query will be if one is expressly set in the table. Eg. |
| 296 | ENGINE_set_default_RSA() does the same job as ENGINE_register_RSA() except | 302 | ENGINE_set_default_RSA() does the same job as ENGINE_register_RSA() except |
| 297 | that it also sets the state table's cached response for the "get_default" | 303 | that it also sets the state table's cached response for the "get_default" |
| 298 | query. | 304 | query. In the case of abstractions like EVP_CIPHER, where implementations are |
| 299 | 305 | indexed by 'nid', these flags and cached-responses are distinct for each 'nid' | |
| 300 | In the case of abstractions like EVP_CIPHER, where implementations are | 306 | value. |
| 301 | indexed by 'nid', these flags and cached-responses are distinct for each | ||
| 302 | 'nid' value. | ||
| 303 | |||
| 304 | It is worth illustrating the difference between "registration" of ENGINEs | ||
| 305 | into these per-algorithm state tables and using the alternative | ||
| 306 | "set_default" functions. The latter handles both "registration" and also | ||
| 307 | setting the cached "default" ENGINE in each relevant state table - so | ||
| 308 | registered ENGINEs will only have a chance to be initialised for use as a | ||
| 309 | default if a default ENGINE wasn't already set for the same state table. | ||
| 310 | Eg. if ENGINE X supports cipher nids {A,B} and RSA, ENGINE Y supports | ||
| 311 | ciphers {A} and DSA, and the following code is executed; | ||
| 312 | |||
| 313 | ENGINE_register_complete(X); | ||
| 314 | ENGINE_set_default(Y, ENGINE_METHOD_ALL); | ||
| 315 | e1 = ENGINE_get_default_RSA(); | ||
| 316 | e2 = ENGINE_get_cipher_engine(A); | ||
| 317 | e3 = ENGINE_get_cipher_engine(B); | ||
| 318 | e4 = ENGINE_get_default_DSA(); | ||
| 319 | e5 = ENGINE_get_cipher_engine(C); | ||
| 320 | |||
| 321 | The results would be as follows; | ||
| 322 | |||
| 323 | assert(e1 == X); | ||
| 324 | assert(e2 == Y); | ||
| 325 | assert(e3 == X); | ||
| 326 | assert(e4 == Y); | ||
| 327 | assert(e5 == NULL); | ||
| 328 | 307 | ||
| 329 | =head2 Application requirements | 308 | =head2 Application requirements |
| 330 | 309 | ||
| @@ -360,7 +339,7 @@ mention an important API function; | |||
| 360 | 339 | ||
| 361 | If no ENGINE API functions are called at all in an application, then there | 340 | If no ENGINE API functions are called at all in an application, then there |
| 362 | are no inherent memory leaks to worry about from the ENGINE functionality, | 341 | are no inherent memory leaks to worry about from the ENGINE functionality, |
| 363 | however if any ENGINEs are "load"ed, even if they are never registered or | 342 | however if any ENGINEs are loaded, even if they are never registered or |
| 364 | used, it is necessary to use the ENGINE_cleanup() function to | 343 | used, it is necessary to use the ENGINE_cleanup() function to |
| 365 | correspondingly cleanup before program exit, if the caller wishes to avoid | 344 | correspondingly cleanup before program exit, if the caller wishes to avoid |
| 366 | memory leaks. This mechanism uses an internal callback registration table | 345 | memory leaks. This mechanism uses an internal callback registration table |
| @@ -375,7 +354,7 @@ linker. | |||
| 375 | The fact that ENGINEs are made visible to OpenSSL (and thus are linked into | 354 | The fact that ENGINEs are made visible to OpenSSL (and thus are linked into |
| 376 | the program and loaded into memory at run-time) does not mean they are | 355 | the program and loaded into memory at run-time) does not mean they are |
| 377 | "registered" or called into use by OpenSSL automatically - that behaviour | 356 | "registered" or called into use by OpenSSL automatically - that behaviour |
| 378 | is something for the application to have control over. Some applications | 357 | is something for the application to control. Some applications |
| 379 | will want to allow the user to specify exactly which ENGINE they want used | 358 | will want to allow the user to specify exactly which ENGINE they want used |
| 380 | if any is to be used at all. Others may prefer to load all support and have | 359 | if any is to be used at all. Others may prefer to load all support and have |
| 381 | OpenSSL automatically use at run-time any ENGINE that is able to | 360 | OpenSSL automatically use at run-time any ENGINE that is able to |
| @@ -433,7 +412,7 @@ it should be used. The following code illustrates how this can work; | |||
| 433 | That's all that's required. Eg. the next time OpenSSL tries to set up an | 412 | That's all that's required. Eg. the next time OpenSSL tries to set up an |
| 434 | RSA key, any bundled ENGINEs that implement RSA_METHOD will be passed to | 413 | RSA key, any bundled ENGINEs that implement RSA_METHOD will be passed to |
| 435 | ENGINE_init() and if any of those succeed, that ENGINE will be set as the | 414 | ENGINE_init() and if any of those succeed, that ENGINE will be set as the |
| 436 | default for use with RSA from then on. | 415 | default for RSA use from then on. |
| 437 | 416 | ||
| 438 | =head2 Advanced configuration support | 417 | =head2 Advanced configuration support |
| 439 | 418 | ||
| @@ -441,7 +420,7 @@ There is a mechanism supported by the ENGINE framework that allows each | |||
| 441 | ENGINE implementation to define an arbitrary set of configuration | 420 | ENGINE implementation to define an arbitrary set of configuration |
| 442 | "commands" and expose them to OpenSSL and any applications based on | 421 | "commands" and expose them to OpenSSL and any applications based on |
| 443 | OpenSSL. This mechanism is entirely based on the use of name-value pairs | 422 | OpenSSL. This mechanism is entirely based on the use of name-value pairs |
| 444 | and and assumes ASCII input (no unicode or UTF for now!), so it is ideal if | 423 | and assumes ASCII input (no unicode or UTF for now!), so it is ideal if |
| 445 | applications want to provide a transparent way for users to provide | 424 | applications want to provide a transparent way for users to provide |
| 446 | arbitrary configuration "directives" directly to such ENGINEs. It is also | 425 | arbitrary configuration "directives" directly to such ENGINEs. It is also |
| 447 | possible for the application to dynamically interrogate the loaded ENGINE | 426 | possible for the application to dynamically interrogate the loaded ENGINE |
| @@ -450,8 +429,8 @@ available "control commands", providing a more flexible configuration | |||
| 450 | scheme. However, if the user is expected to know which ENGINE device he/she | 429 | scheme. However, if the user is expected to know which ENGINE device he/she |
| 451 | is using (in the case of specialised hardware, this goes without saying) | 430 | is using (in the case of specialised hardware, this goes without saying) |
| 452 | then applications may not need to concern themselves with discovering the | 431 | then applications may not need to concern themselves with discovering the |
| 453 | supported control commands and simply prefer to allow settings to passed | 432 | supported control commands and simply prefer to pass settings into ENGINEs |
| 454 | into ENGINEs exactly as they are provided by the user. | 433 | exactly as they are provided by the user. |
| 455 | 434 | ||
| 456 | Before illustrating how control commands work, it is worth mentioning what | 435 | Before illustrating how control commands work, it is worth mentioning what |
| 457 | they are typically used for. Broadly speaking there are two uses for | 436 | they are typically used for. Broadly speaking there are two uses for |
| @@ -459,13 +438,13 @@ control commands; the first is to provide the necessary details to the | |||
| 459 | implementation (which may know nothing at all specific to the host system) | 438 | implementation (which may know nothing at all specific to the host system) |
| 460 | so that it can be initialised for use. This could include the path to any | 439 | so that it can be initialised for use. This could include the path to any |
| 461 | driver or config files it needs to load, required network addresses, | 440 | driver or config files it needs to load, required network addresses, |
| 462 | smart-card identifiers, passwords to initialise password-protected devices, | 441 | smart-card identifiers, passwords to initialise protected devices, |
| 463 | logging information, etc etc. This class of commands typically needs to be | 442 | logging information, etc etc. This class of commands typically needs to be |
| 464 | passed to an ENGINE B<before> attempting to initialise it, ie. before | 443 | passed to an ENGINE B<before> attempting to initialise it, ie. before |
| 465 | calling ENGINE_init(). The other class of commands consist of settings or | 444 | calling ENGINE_init(). The other class of commands consist of settings or |
| 466 | operations that tweak certain behaviour or cause certain operations to take | 445 | operations that tweak certain behaviour or cause certain operations to take |
| 467 | place, and these commands may work either before or after ENGINE_init(), or | 446 | place, and these commands may work either before or after ENGINE_init(), or |
| 468 | in same cases both. ENGINE implementations should provide indications of | 447 | in some cases both. ENGINE implementations should provide indications of |
| 469 | this in the descriptions attached to builtin control commands and/or in | 448 | this in the descriptions attached to builtin control commands and/or in |
| 470 | external product documentation. | 449 | external product documentation. |
| 471 | 450 | ||
| @@ -529,14 +508,14 @@ FALSE. | |||
| 529 | I<Discovering supported control commands> | 508 | I<Discovering supported control commands> |
| 530 | 509 | ||
| 531 | It is possible to discover at run-time the names, numerical-ids, descriptions | 510 | It is possible to discover at run-time the names, numerical-ids, descriptions |
| 532 | and input parameters of the control commands supported from a structural | 511 | and input parameters of the control commands supported by an ENGINE using a |
| 533 | reference to any ENGINE. It is first important to note that some control | 512 | structural reference. Note that some control commands are defined by OpenSSL |
| 534 | commands are defined by OpenSSL itself and it will intercept and handle these | 513 | itself and it will intercept and handle these control commands on behalf of the |
| 535 | control commands on behalf of the ENGINE, ie. the ENGINE's ctrl() handler is not | 514 | ENGINE, ie. the ENGINE's ctrl() handler is not used for the control command. |
| 536 | used for the control command. openssl/engine.h defines a symbol, | 515 | openssl/engine.h defines an index, ENGINE_CMD_BASE, that all control commands |
| 537 | ENGINE_CMD_BASE, that all control commands implemented by ENGINEs from. Any | 516 | implemented by ENGINEs should be numbered from. Any command value lower than |
| 538 | command value lower than this symbol is considered a "generic" command is | 517 | this symbol is considered a "generic" command is handled directly by the |
| 539 | handled directly by the OpenSSL core routines. | 518 | OpenSSL core routines. |
| 540 | 519 | ||
| 541 | It is using these "core" control commands that one can discover the the control | 520 | It is using these "core" control commands that one can discover the the control |
| 542 | commands implemented by a given ENGINE, specifically the commands; | 521 | commands implemented by a given ENGINE, specifically the commands; |
| @@ -552,8 +531,8 @@ commands implemented by a given ENGINE, specifically the commands; | |||
| 552 | #define ENGINE_CTRL_GET_CMD_FLAGS 18 | 531 | #define ENGINE_CTRL_GET_CMD_FLAGS 18 |
| 553 | 532 | ||
| 554 | Whilst these commands are automatically processed by the OpenSSL framework code, | 533 | Whilst these commands are automatically processed by the OpenSSL framework code, |
| 555 | they use various properties exposed by each ENGINE by which to process these | 534 | they use various properties exposed by each ENGINE to process these |
| 556 | queries. An ENGINE has 3 properties it exposes that can affect this behaviour; | 535 | queries. An ENGINE has 3 properties it exposes that can affect how this behaves; |
| 557 | it can supply a ctrl() handler, it can specify ENGINE_FLAGS_MANUAL_CMD_CTRL in | 536 | it can supply a ctrl() handler, it can specify ENGINE_FLAGS_MANUAL_CMD_CTRL in |
| 558 | the ENGINE's flags, and it can expose an array of control command descriptions. | 537 | the ENGINE's flags, and it can expose an array of control command descriptions. |
| 559 | If an ENGINE specifies the ENGINE_FLAGS_MANUAL_CMD_CTRL flag, then it will | 538 | If an ENGINE specifies the ENGINE_FLAGS_MANUAL_CMD_CTRL flag, then it will |
| @@ -608,14 +587,13 @@ extension). | |||
| 608 | The ENGINE API and internal architecture is currently being reviewed. Slated for | 587 | The ENGINE API and internal architecture is currently being reviewed. Slated for |
| 609 | possible release in 0.9.8 is support for transparent loading of "dynamic" | 588 | possible release in 0.9.8 is support for transparent loading of "dynamic" |
| 610 | ENGINEs (built as self-contained shared-libraries). This would allow ENGINE | 589 | ENGINEs (built as self-contained shared-libraries). This would allow ENGINE |
| 611 | implementations to be provided independantly of OpenSSL libraries and/or | 590 | implementations to be provided independently of OpenSSL libraries and/or |
| 612 | OpenSSL-based applications, and would also remove any requirement for | 591 | OpenSSL-based applications, and would also remove any requirement for |
| 613 | applications to explicitly use the "dynamic" ENGINE to bind to shared-library | 592 | applications to explicitly use the "dynamic" ENGINE to bind to shared-library |
| 614 | implementations. | 593 | implementations. |
| 615 | 594 | ||
| 616 | =head1 SEE ALSO | 595 | =head1 SEE ALSO |
| 617 | 596 | ||
| 618 | L<rsa(3)|rsa(3)>, L<dsa(3)|dsa(3)>, L<dh(3)|dh(3)>, L<rand(3)|rand(3)>, | 597 | L<rsa(3)|rsa(3)>, L<dsa(3)|dsa(3)>, L<dh(3)|dh(3)>, L<rand(3)|rand(3)> |
| 619 | L<RSA_new_method(3)|RSA_new_method(3)> | ||
| 620 | 598 | ||
| 621 | =cut | 599 | =cut |
diff --git a/src/lib/libcrypto/doc/x509.pod b/src/lib/libcrypto/doc/x509.pod new file mode 100644 index 0000000000..f9e58e0e41 --- /dev/null +++ b/src/lib/libcrypto/doc/x509.pod | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | x509 - X.509 certificate handling | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/x509.h> | ||
| 10 | |||
| 11 | =head1 DESCRIPTION | ||
| 12 | |||
| 13 | A X.509 certificate is a structured grouping of information about | ||
| 14 | an individual, a device, or anything one can imagine. A X.509 CRL | ||
| 15 | (certificate revocation list) is a tool to help determine if a | ||
| 16 | certificate is still valid. The exact definition of those can be | ||
| 17 | found in the X.509 document from ITU-T, or in RFC3280 from PKIX. | ||
| 18 | In OpenSSL, the type X509 is used to express such a certificate, and | ||
| 19 | the type X509_CRL is used to express a CRL. | ||
| 20 | |||
| 21 | A related structure is a certificate request, defined in PKCS#10 from | ||
| 22 | RSA Security, Inc, also reflected in RFC2896. In OpenSSL, the type | ||
| 23 | X509_REQ is used to express such a certificate request. | ||
| 24 | |||
| 25 | To handle some complex parts of a certificate, there are the types | ||
| 26 | X509_NAME (to express a certificate name), X509_ATTRIBUTE (to express | ||
| 27 | a certificate attributes), X509_EXTENSION (to express a certificate | ||
| 28 | extension) and a few more. | ||
| 29 | |||
| 30 | Finally, there's the supertype X509_INFO, which can contain a CRL, a | ||
| 31 | certificate and a corresponding private key. | ||
| 32 | |||
| 33 | B<X509_>I<...>, B<d2i_X509_>I<...> and B<i2d_X509_>I<...> handle X.509 | ||
| 34 | certificates, with some exceptions, shown below. | ||
| 35 | |||
| 36 | B<X509_CRL_>I<...>, B<d2i_X509_CRL_>I<...> and B<i2d_X509_CRL_>I<...> | ||
| 37 | handle X.509 CRLs. | ||
| 38 | |||
| 39 | B<X509_REQ_>I<...>, B<d2i_X509_REQ_>I<...> and B<i2d_X509_REQ_>I<...> | ||
| 40 | handle PKCS#10 certificate requests. | ||
| 41 | |||
| 42 | B<X509_NAME_>I<...> handle certificate names. | ||
| 43 | |||
| 44 | B<X509_ATTRIBUTE_>I<...> handle certificate attributes. | ||
| 45 | |||
| 46 | B<X509_EXTENSION_>I<...> handle certificate extensions. | ||
| 47 | |||
| 48 | =head1 SEE ALSO | ||
| 49 | |||
| 50 | L<X509_NAME_ENTRY_get_object(3)|X509_NAME_ENTRY_get_object(3)>, | ||
| 51 | L<X509_NAME_add_entry_by_txt(3)|X509_NAME_add_entry_by_txt(3)>, | ||
| 52 | L<X509_NAME_add_entry_by_NID(3)|X509_NAME_add_entry_by_NID(3)>, | ||
| 53 | L<X509_NAME_print_ex(3)|X509_NAME_print_ex(3)>, | ||
| 54 | L<X509_NAME_new(3)|X509_NAME_new(3)>, | ||
| 55 | L<d2i_X509(3)|d2i_X509(3)>, | ||
| 56 | L<d2i_X509_ALGOR(3)|d2i_X509_ALGOR(3)>, | ||
| 57 | L<d2i_X509_CRL(3)|d2i_X509_CRL(3)>, | ||
| 58 | L<d2i_X509_NAME(3)|d2i_X509_NAME(3)>, | ||
| 59 | L<d2i_X509_REQ(3)|d2i_X509_REQ(3)>, | ||
| 60 | L<d2i_X509_SIG(3)|d2i_X509_SIG(3)>, | ||
| 61 | L<crypto(3)|crypto(3)>, | ||
| 62 | L<x509v3(3)|x509v3(3)> | ||
| 63 | |||
| 64 | =cut | ||
