diff options
Diffstat (limited to 'src/lib/libcrypto/doc/DH_set_method.pod')
| -rw-r--r-- | src/lib/libcrypto/doc/DH_set_method.pod | 102 |
1 files changed, 60 insertions, 42 deletions
diff --git a/src/lib/libcrypto/doc/DH_set_method.pod b/src/lib/libcrypto/doc/DH_set_method.pod index d990bf8786..73261fc467 100644 --- a/src/lib/libcrypto/doc/DH_set_method.pod +++ b/src/lib/libcrypto/doc/DH_set_method.pod | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | =head1 NAME | 3 | =head1 NAME |
| 4 | 4 | ||
| 5 | DH_set_default_openssl_method, DH_get_default_openssl_method, | 5 | DH_set_default_method, DH_get_default_method, |
| 6 | DH_set_method, DH_new_method, DH_OpenSSL - select DH method | 6 | DH_set_method, DH_new_method, DH_OpenSSL - select DH method |
| 7 | 7 | ||
| 8 | =head1 SYNOPSIS | 8 | =head1 SYNOPSIS |
| @@ -10,45 +10,47 @@ DH_set_method, DH_new_method, DH_OpenSSL - select DH method | |||
| 10 | #include <openssl/dh.h> | 10 | #include <openssl/dh.h> |
| 11 | #include <openssl/engine.h> | 11 | #include <openssl/engine.h> |
| 12 | 12 | ||
| 13 | void DH_set_default_openssl_method(DH_METHOD *meth); | 13 | void DH_set_default_method(const DH_METHOD *meth); |
| 14 | 14 | ||
| 15 | DH_METHOD *DH_get_default_openssl_method(void); | 15 | const DH_METHOD *DH_get_default_method(void); |
| 16 | 16 | ||
| 17 | int DH_set_method(DH *dh, ENGINE *engine); | 17 | int DH_set_method(DH *dh, const DH_METHOD *meth); |
| 18 | 18 | ||
| 19 | DH *DH_new_method(ENGINE *engine); | 19 | DH *DH_new_method(ENGINE *engine); |
| 20 | 20 | ||
| 21 | DH_METHOD *DH_OpenSSL(void); | 21 | const DH_METHOD *DH_OpenSSL(void); |
| 22 | 22 | ||
| 23 | =head1 DESCRIPTION | 23 | =head1 DESCRIPTION |
| 24 | 24 | ||
| 25 | A B<DH_METHOD> specifies the functions that OpenSSL uses for Diffie-Hellman | 25 | A B<DH_METHOD> specifies the functions that OpenSSL uses for Diffie-Hellman |
| 26 | operations. By modifying the method, alternative implementations | 26 | operations. By modifying the method, alternative implementations |
| 27 | such as hardware accelerators may be used. | 27 | such as hardware accelerators may be used. IMPORTANT: See the NOTES section for |
| 28 | 28 | important information about how these DH API functions are affected by the use | |
| 29 | Initially, the default is to use the OpenSSL internal implementation. | 29 | of B<ENGINE> API calls. |
| 30 | DH_OpenSSL() returns a pointer to that method. | 30 | |
| 31 | 31 | Initially, the default DH_METHOD is the OpenSSL internal implementation, as | |
| 32 | DH_set_default_openssl_method() makes B<meth> the default method for all DH | 32 | returned by DH_OpenSSL(). |
| 33 | structures created later. B<NB:> This is true only whilst the default engine | 33 | |
| 34 | for Diffie-Hellman operations remains as "openssl". ENGINEs provide an | 34 | DH_set_default_method() makes B<meth> the default method for all DH |
| 35 | encapsulation for implementations of one or more algorithms, and all the DH | 35 | structures created later. B<NB>: This is true only whilst no ENGINE has been set |
| 36 | functions mentioned here operate within the scope of the default | 36 | as a default for DH, so this function is no longer recommended. |
| 37 | "openssl" engine. | 37 | |
| 38 | 38 | DH_get_default_method() returns a pointer to the current default DH_METHOD. | |
| 39 | DH_get_default_openssl_method() returns a pointer to the current default | 39 | However, the meaningfulness of this result is dependant on whether the ENGINE |
| 40 | method for the "openssl" engine. | 40 | API is being used, so this function is no longer recommended. |
| 41 | 41 | ||
| 42 | DH_set_method() selects B<engine> as the engine that will be responsible for | 42 | DH_set_method() selects B<meth> to perform all operations using the key B<dh>. |
| 43 | all operations using the structure B<dh>. If this function completes successfully, | 43 | This will replace the DH_METHOD used by the DH key and if the previous method |
| 44 | then the B<dh> structure will have its own functional reference of B<engine>, so | 44 | was supplied by an ENGINE, the handle to that ENGINE will be released during the |
| 45 | the caller should remember to free their own reference to B<engine> when they are | 45 | change. It is possible to have DH keys that only work with certain DH_METHOD |
| 46 | finished with it. NB: An ENGINE's DH_METHOD can be retrieved (or set) by | 46 | implementations (eg. from an ENGINE module that supports embedded |
| 47 | ENGINE_get_DH() or ENGINE_set_DH(). | 47 | hardware-protected keys), and in such cases attempting to change the DH_METHOD |
| 48 | 48 | for the key can have unexpected results. | |
| 49 | DH_new_method() allocates and initializes a DH structure so that | 49 | |
| 50 | B<engine> will be used for the DH operations. If B<engine> is NULL, | 50 | DH_new_method() allocates and initializes a DH structure so that B<engine> will |
| 51 | the default engine for Diffie-Hellman opertaions is used. | 51 | be used for the DH operations. If B<engine> is NULL, the default ENGINE for DH |
| 52 | operations is used, and if no default ENGINE is set, the DH_METHOD controlled by | ||
| 53 | DH_set_default_method() is used. | ||
| 52 | 54 | ||
| 53 | =head1 THE DH_METHOD STRUCTURE | 55 | =head1 THE DH_METHOD STRUCTURE |
| 54 | 56 | ||
| @@ -82,17 +84,28 @@ the default engine for Diffie-Hellman opertaions is used. | |||
| 82 | 84 | ||
| 83 | =head1 RETURN VALUES | 85 | =head1 RETURN VALUES |
| 84 | 86 | ||
| 85 | DH_OpenSSL() and DH_get_default_openssl_method() return pointers to the | 87 | DH_OpenSSL() and DH_get_default_method() return pointers to the respective |
| 86 | respective B<DH_METHOD>s. | 88 | B<DH_METHOD>s. |
| 89 | |||
| 90 | DH_set_default_method() returns no value. | ||
| 91 | |||
| 92 | DH_set_method() returns non-zero if the provided B<meth> was successfully set as | ||
| 93 | the method for B<dh> (including unloading the ENGINE handle if the previous | ||
| 94 | method was supplied by an ENGINE). | ||
| 87 | 95 | ||
| 88 | DH_set_default_openssl_method() returns no value. | 96 | DH_new_method() returns NULL and sets an error code that can be obtained by |
| 97 | L<ERR_get_error(3)|ERR_get_error(3)> if the allocation fails. Otherwise it | ||
| 98 | returns a pointer to the newly allocated structure. | ||
| 89 | 99 | ||
| 90 | DH_set_method() returns non-zero if the ENGINE associated with B<dh> | 100 | =head1 NOTES |
| 91 | was successfully changed to B<engine>. | ||
| 92 | 101 | ||
| 93 | DH_new_method() returns NULL and sets an error code that can be | 102 | As of version 0.9.7, DH_METHOD implementations are grouped together with other |
| 94 | obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation fails. | 103 | algorithmic APIs (eg. RSA_METHOD, EVP_CIPHER, etc) in B<ENGINE> modules. If a |
| 95 | Otherwise it returns a pointer to the newly allocated structure. | 104 | default ENGINE is specified for DH functionality using an ENGINE API function, |
| 105 | that will override any DH defaults set using the DH API (ie. | ||
| 106 | DH_set_default_method()). For this reason, the ENGINE API is the recommended way | ||
| 107 | to control default implementations for use in DH and other cryptographic | ||
| 108 | algorithms. | ||
| 96 | 109 | ||
| 97 | =head1 SEE ALSO | 110 | =head1 SEE ALSO |
| 98 | 111 | ||
| @@ -103,9 +116,14 @@ L<dh(3)|dh(3)>, L<DH_new(3)|DH_new(3)> | |||
| 103 | DH_set_default_method(), DH_get_default_method(), DH_set_method(), | 116 | DH_set_default_method(), DH_get_default_method(), DH_set_method(), |
| 104 | DH_new_method() and DH_OpenSSL() were added in OpenSSL 0.9.4. | 117 | DH_new_method() and DH_OpenSSL() were added in OpenSSL 0.9.4. |
| 105 | 118 | ||
| 106 | DH_set_default_openssl_method() and DH_get_default_openssl_method() | 119 | DH_set_default_openssl_method() and DH_get_default_openssl_method() replaced |
| 107 | replaced DH_set_default_method() and DH_get_default_method() respectively, | 120 | DH_set_default_method() and DH_get_default_method() respectively, and |
| 108 | and DH_set_method() and DH_new_method() were altered to use B<ENGINE>s | 121 | DH_set_method() and DH_new_method() were altered to use B<ENGINE>s rather than |
| 109 | rather than B<DH_METHOD>s during development of OpenSSL 0.9.6. | 122 | B<DH_METHOD>s during development of the engine version of OpenSSL 0.9.6. For |
| 123 | 0.9.7, the handling of defaults in the ENGINE API was restructured so that this | ||
| 124 | change was reversed, and behaviour of the other functions resembled more closely | ||
| 125 | the previous behaviour. The behaviour of defaults in the ENGINE API now | ||
| 126 | transparently overrides the behaviour of defaults in the DH API without | ||
| 127 | requiring changing these function prototypes. | ||
| 110 | 128 | ||
| 111 | =cut | 129 | =cut |
