diff options
Diffstat (limited to 'src/lib/libcrypto/doc')
21 files changed, 452 insertions, 170 deletions
diff --git a/src/lib/libcrypto/doc/DH_set_method.pod b/src/lib/libcrypto/doc/DH_set_method.pod index a8f75bdd9d..62088eea1b 100644 --- a/src/lib/libcrypto/doc/DH_set_method.pod +++ b/src/lib/libcrypto/doc/DH_set_method.pod | |||
@@ -2,20 +2,21 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | DH_set_default_method, DH_get_default_method, DH_set_method, | 5 | DH_set_default_openssl_method, DH_get_default_openssl_method, |
6 | 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 |
9 | 9 | ||
10 | #include <openssl/dh.h> | 10 | #include <openssl/dh.h> |
11 | #include <openssl/engine.h> | ||
11 | 12 | ||
12 | void DH_set_default_method(DH_METHOD *meth); | 13 | void DH_set_default_openssl_method(DH_METHOD *meth); |
13 | 14 | ||
14 | DH_METHOD *DH_get_default_method(void); | 15 | DH_METHOD *DH_get_default_openssl_method(void); |
15 | 16 | ||
16 | DH_METHOD *DH_set_method(DH *dh, DH_METHOD *meth); | 17 | int DH_set_method(DH *dh, ENGINE *engine); |
17 | 18 | ||
18 | DH *DH_new_method(DH_METHOD *meth); | 19 | DH *DH_new_method(ENGINE *engine); |
19 | 20 | ||
20 | DH_METHOD *DH_OpenSSL(void); | 21 | DH_METHOD *DH_OpenSSL(void); |
21 | 22 | ||
@@ -28,20 +29,26 @@ such as hardware accelerators may be used. | |||
28 | Initially, the default is to use the OpenSSL internal implementation. | 29 | Initially, the default is to use the OpenSSL internal implementation. |
29 | DH_OpenSSL() returns a pointer to that method. | 30 | DH_OpenSSL() returns a pointer to that method. |
30 | 31 | ||
31 | DH_set_default_method() makes B<meth> the default method for all B<DH> | 32 | DH_set_default_openssl_method() makes B<meth> the default method for all DH |
32 | structures created later. | 33 | structures created later. B<NB:> This is true only whilst the default engine |
34 | for Diffie-Hellman operations remains as "openssl". ENGINEs provide an | ||
35 | encapsulation for implementations of one or more algorithms, and all the DH | ||
36 | functions mentioned here operate within the scope of the default | ||
37 | "openssl" engine. | ||
33 | 38 | ||
34 | DH_get_default_method() returns a pointer to the current default | 39 | DH_get_default_openssl_method() returns a pointer to the current default |
35 | method. | 40 | method for the "openssl" engine. |
36 | 41 | ||
37 | DH_set_method() selects B<meth> for all operations using the structure B<dh>. | 42 | DH_set_method() selects B<engine> as the engine that will be responsible for |
43 | all operations using the structure B<dh>. If this function completes successfully, | ||
44 | then the B<dh> structure will have its own functional reference of B<engine>, so | ||
45 | the caller should remember to free their own reference to B<engine> when they are | ||
46 | finished with it. NB: An ENGINE's DH_METHOD can be retrieved (or set) by | ||
47 | ENGINE_get_DH() or ENGINE_set_DH(). | ||
38 | 48 | ||
39 | DH_get_method() returns a pointer to the method currently selected | 49 | DH_new_method() allocates and initializes a DH structure so that |
40 | for B<dh>. | 50 | B<engine> will be used for the DH operations. If B<engine> is NULL, |
41 | 51 | the default engine for Diffie-Hellman opertaions is used. | |
42 | DH_new_method() allocates and initializes a B<DH> structure so that | ||
43 | B<method> will be used for the DH operations. If B<method> is B<NULL>, | ||
44 | the default method is used. | ||
45 | 52 | ||
46 | =head1 THE DH_METHOD STRUCTURE | 53 | =head1 THE DH_METHOD STRUCTURE |
47 | 54 | ||
@@ -75,17 +82,17 @@ the default method is used. | |||
75 | 82 | ||
76 | =head1 RETURN VALUES | 83 | =head1 RETURN VALUES |
77 | 84 | ||
78 | DH_OpenSSL(), DH_get_default_method() and DH_get_method() return | 85 | DH_OpenSSL() and DH_get_default_method() return pointers to the respective |
79 | pointers to the respective B<DH_METHOD>s. | 86 | DH_METHODs. |
80 | 87 | ||
81 | DH_set_default_method() returns no value. | 88 | DH_set_default_openssl_method() returns no value. |
82 | 89 | ||
83 | DH_set_method() returns a pointer to the B<DH_METHOD> previously | 90 | DH_set_method() returns non-zero if the ENGINE associated with B<dh> |
84 | associated with B<dh>. | 91 | was successfully changed to B<engine>. |
85 | 92 | ||
86 | DH_new_method() returns B<NULL> and sets an error code that can be | 93 | DH_new_method() returns NULL and sets an error code that can be |
87 | obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation fails. Otherwise it | 94 | obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation fails. |
88 | returns a pointer to the newly allocated structure. | 95 | Otherwise it returns a pointer to the newly allocated structure. |
89 | 96 | ||
90 | =head1 SEE ALSO | 97 | =head1 SEE ALSO |
91 | 98 | ||
@@ -96,4 +103,9 @@ L<dh(3)|dh(3)>, L<DH_new(3)|DH_new(3)> | |||
96 | DH_set_default_method(), DH_get_default_method(), DH_set_method(), | 103 | DH_set_default_method(), DH_get_default_method(), DH_set_method(), |
97 | DH_new_method() and DH_OpenSSL() were added in OpenSSL 0.9.4. | 104 | DH_new_method() and DH_OpenSSL() were added in OpenSSL 0.9.4. |
98 | 105 | ||
106 | DH_set_default_openssl_method() and DH_get_default_openssl_method() | ||
107 | replaced DH_set_default_method() and DH_get_default_method() respectively, | ||
108 | and DH_set_method() and DH_new_method() were altered to use B<ENGINE>s | ||
109 | rather than B<DH_METHOD>s during development of OpenSSL 0.9.6. | ||
110 | |||
99 | =cut | 111 | =cut |
diff --git a/src/lib/libcrypto/doc/DSA_set_method.pod b/src/lib/libcrypto/doc/DSA_set_method.pod index edec46413d..c56dfd0f47 100644 --- a/src/lib/libcrypto/doc/DSA_set_method.pod +++ b/src/lib/libcrypto/doc/DSA_set_method.pod | |||
@@ -2,20 +2,21 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | DSA_set_default_method, DSA_get_default_method, DSA_set_method, | 5 | DSA_set_default_openssl_method, DSA_get_default_openssl_method, |
6 | DSA_new_method, DSA_OpenSSL - select RSA method | 6 | DSA_set_method, DSA_new_method, DSA_OpenSSL - select DSA method |
7 | 7 | ||
8 | =head1 SYNOPSIS | 8 | =head1 SYNOPSIS |
9 | 9 | ||
10 | #include <openssl/DSA.h> | 10 | #include <openssl/dsa.h> |
11 | #include <openssl/engine.h> | ||
11 | 12 | ||
12 | void DSA_set_default_method(DSA_METHOD *meth); | 13 | void DSA_set_default_openssl_method(DSA_METHOD *meth); |
13 | 14 | ||
14 | DSA_METHOD *DSA_get_default_method(void); | 15 | DSA_METHOD *DSA_get_default_openssl_method(void); |
15 | 16 | ||
16 | DSA_METHOD *DSA_set_method(DSA *dsa, DSA_METHOD *meth); | 17 | int DSA_set_method(DSA *dsa, ENGINE *engine); |
17 | 18 | ||
18 | DSA *DSA_new_method(DSA_METHOD *meth); | 19 | DSA *DSA_new_method(ENGINE *engine); |
19 | 20 | ||
20 | DSA_METHOD *DSA_OpenSSL(void); | 21 | DSA_METHOD *DSA_OpenSSL(void); |
21 | 22 | ||
@@ -28,20 +29,21 @@ such as hardware accelerators may be used. | |||
28 | Initially, the default is to use the OpenSSL internal implementation. | 29 | Initially, the default is to use the OpenSSL internal implementation. |
29 | DSA_OpenSSL() returns a pointer to that method. | 30 | DSA_OpenSSL() returns a pointer to that method. |
30 | 31 | ||
31 | DSA_set_default_method() makes B<meth> the default method for all B<DSA> | 32 | DSA_set_default_openssl_method() makes B<meth> the default method for |
32 | structures created later. | 33 | all DSA structures created later. B<NB:> This is true only whilst the |
34 | default engine for DSA operations remains as "openssl". ENGINEs | ||
35 | provide an encapsulation for implementations of one or more algorithms at a | ||
36 | time, and all the DSA functions mentioned here operate within the scope | ||
37 | of the default "openssl" engine. | ||
33 | 38 | ||
34 | DSA_get_default_method() returns a pointer to the current default | 39 | DSA_get_default_openssl_method() returns a pointer to the current default |
35 | method. | 40 | method for the "openssl" engine. |
36 | 41 | ||
37 | DSA_set_method() selects B<meth> for all operations using the structure B<DSA>. | 42 | DSA_set_method() selects B<engine> for all operations using the structure B<dsa>. |
38 | 43 | ||
39 | DSA_get_method() returns a pointer to the method currently selected | 44 | DSA_new_method() allocates and initializes a DSA structure so that |
40 | for B<DSA>. | 45 | B<engine> will be used for the DSA operations. If B<engine> is NULL, |
41 | 46 | the default engine for DSA operations is used. | |
42 | DSA_new_method() allocates and initializes a B<DSA> structure so that | ||
43 | B<method> will be used for the DSA operations. If B<method> is B<NULL>, | ||
44 | the default method is used. | ||
45 | 47 | ||
46 | =head1 THE DSA_METHOD STRUCTURE | 48 | =head1 THE DSA_METHOD STRUCTURE |
47 | 49 | ||
@@ -87,18 +89,17 @@ struct | |||
87 | 89 | ||
88 | =head1 RETURN VALUES | 90 | =head1 RETURN VALUES |
89 | 91 | ||
90 | DSA_OpenSSL(), DSA_get_default_method() and DSA_get_method() return | 92 | DSA_OpenSSL() and DSA_get_default_openssl_method() return pointers to the |
91 | pointers to the respective B<DSA_METHOD>s. | 93 | respective DSA_METHODs. |
92 | 94 | ||
93 | DSA_set_default_method() returns no value. | 95 | DSA_set_default_openssl_method() returns no value. |
94 | 96 | ||
95 | DSA_set_method() returns a pointer to the B<DSA_METHOD> previously | 97 | DSA_set_method() returns non-zero if the ENGINE associated with B<dsa> |
96 | associated with B<dsa>. | 98 | was successfully changed to B<engine>. |
97 | 99 | ||
98 | DSA_new_method() returns B<NULL> and sets an error code that can be | 100 | DSA_new_method() returns NULL and sets an error code that can be |
99 | obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation | 101 | obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation |
100 | fails. Otherwise it returns a pointer to the newly allocated | 102 | fails. Otherwise it returns a pointer to the newly allocated structure. |
101 | structure. | ||
102 | 103 | ||
103 | =head1 SEE ALSO | 104 | =head1 SEE ALSO |
104 | 105 | ||
@@ -109,4 +110,9 @@ L<dsa(3)|dsa(3)>, L<DSA_new(3)|DSA_new(3)> | |||
109 | DSA_set_default_method(), DSA_get_default_method(), DSA_set_method(), | 110 | DSA_set_default_method(), DSA_get_default_method(), DSA_set_method(), |
110 | DSA_new_method() and DSA_OpenSSL() were added in OpenSSL 0.9.4. | 111 | DSA_new_method() and DSA_OpenSSL() were added in OpenSSL 0.9.4. |
111 | 112 | ||
113 | DSA_set_default_openssl_method() and DSA_get_default_openssl_method() | ||
114 | replaced DSA_set_default_method() and DSA_get_default_method() respectively, | ||
115 | and DSA_set_method() and DSA_new_method() were altered to use B<ENGINE>s | ||
116 | rather than B<DSA_METHOD>s during development of OpenSSL 0.9.6. | ||
117 | |||
112 | =cut | 118 | =cut |
diff --git a/src/lib/libcrypto/doc/ERR_error_string.pod b/src/lib/libcrypto/doc/ERR_error_string.pod index 0d2417599c..e01beb817a 100644 --- a/src/lib/libcrypto/doc/ERR_error_string.pod +++ b/src/lib/libcrypto/doc/ERR_error_string.pod | |||
@@ -2,13 +2,16 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | ERR_error_string - obtain human-readable error message | 5 | ERR_error_string, ERR_error_string_n, ERR_lib_error_string, |
6 | ERR_func_error_string, ERR_reason_error_string - obtain human-readable | ||
7 | error message | ||
6 | 8 | ||
7 | =head1 SYNOPSIS | 9 | =head1 SYNOPSIS |
8 | 10 | ||
9 | #include <openssl/err.h> | 11 | #include <openssl/err.h> |
10 | 12 | ||
11 | char *ERR_error_string(unsigned long e, char *buf); | 13 | char *ERR_error_string(unsigned long e, char *buf); |
14 | char *ERR_error_string_n(unsigned long e, char *buf, size_t len); | ||
12 | 15 | ||
13 | const char *ERR_lib_error_string(unsigned long e); | 16 | const char *ERR_lib_error_string(unsigned long e); |
14 | const char *ERR_func_error_string(unsigned long e); | 17 | const char *ERR_func_error_string(unsigned long e); |
@@ -17,9 +20,13 @@ ERR_error_string - obtain human-readable error message | |||
17 | =head1 DESCRIPTION | 20 | =head1 DESCRIPTION |
18 | 21 | ||
19 | ERR_error_string() generates a human-readable string representing the | 22 | ERR_error_string() generates a human-readable string representing the |
20 | error code B<e>, and places it at B<buf>. B<buf> must be at least 120 | 23 | error code I<e>, and places it at I<buf>. I<buf> must be at least 120 |
21 | bytes long. If B<buf> is B<NULL>, the error string is placed in a | 24 | bytes long. If I<buf> is B<NULL>, the error string is placed in a |
22 | static buffer. | 25 | static buffer. |
26 | ERR_error_string_n() is a variant of ERR_error_string() that writes | ||
27 | at most I<len> characters (including the terminating 0) | ||
28 | and truncates the string if necessary. | ||
29 | For ERR_error_string_n(), I<buf> may not be B<NULL>. | ||
23 | 30 | ||
24 | The string will have the following format: | 31 | The string will have the following format: |
25 | 32 | ||
@@ -45,7 +52,7 @@ all error codes currently in the queue. | |||
45 | =head1 RETURN VALUES | 52 | =head1 RETURN VALUES |
46 | 53 | ||
47 | ERR_error_string() returns a pointer to a static buffer containing the | 54 | ERR_error_string() returns a pointer to a static buffer containing the |
48 | string if B<buf == NULL>, B<buf> otherwise. | 55 | string if I<buf> B<== NULL>, I<buf> otherwise. |
49 | 56 | ||
50 | ERR_lib_error_string(), ERR_func_error_string() and | 57 | ERR_lib_error_string(), ERR_func_error_string() and |
51 | ERR_reason_error_string() return the strings, and B<NULL> if | 58 | ERR_reason_error_string() return the strings, and B<NULL> if |
@@ -61,5 +68,6 @@ L<ERR_print_errors(3)|ERR_print_errors(3)> | |||
61 | =head1 HISTORY | 68 | =head1 HISTORY |
62 | 69 | ||
63 | ERR_error_string() is available in all versions of SSLeay and OpenSSL. | 70 | ERR_error_string() is available in all versions of SSLeay and OpenSSL. |
71 | ERR_error_string_n() was added in OpenSSL 0.9.6. | ||
64 | 72 | ||
65 | =cut | 73 | =cut |
diff --git a/src/lib/libcrypto/doc/ERR_get_error.pod b/src/lib/libcrypto/doc/ERR_get_error.pod index 75ece00d97..3551bacb8d 100644 --- a/src/lib/libcrypto/doc/ERR_get_error.pod +++ b/src/lib/libcrypto/doc/ERR_get_error.pod | |||
@@ -2,7 +2,8 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | ERR_get_error, ERR_peek_error - obtain error code | 5 | ERR_get_error, ERR_peek_error, ERR_get_error_line, ERR_peek_error_line, |
6 | ERR_get_error_line_data, ERR_peek_error_line_data - obtain error code and data | ||
6 | 7 | ||
7 | =head1 SYNOPSIS | 8 | =head1 SYNOPSIS |
8 | 9 | ||
@@ -40,7 +41,7 @@ the error occurred in *B<file> and *B<line>, unless these are B<NULL>. | |||
40 | ERR_get_error_line_data() and ERR_peek_error_line_data() store | 41 | ERR_get_error_line_data() and ERR_peek_error_line_data() store |
41 | additional data and flags associated with the error code in *B<data> | 42 | additional data and flags associated with the error code in *B<data> |
42 | and *B<flags>, unless these are B<NULL>. *B<data> contains a string | 43 | and *B<flags>, unless these are B<NULL>. *B<data> contains a string |
43 | if *B<flags>&B<ERR_TXT_STRING>. If it has been allocated by Malloc(), | 44 | if *B<flags>&B<ERR_TXT_STRING>. If it has been allocated by OPENSSL_malloc(), |
44 | *B<flags>&B<ERR_TXT_MALLOCED> is true. | 45 | *B<flags>&B<ERR_TXT_MALLOCED> is true. |
45 | 46 | ||
46 | =head1 RETURN VALUES | 47 | =head1 RETURN VALUES |
diff --git a/src/lib/libcrypto/doc/ERR_remove_state.pod b/src/lib/libcrypto/doc/ERR_remove_state.pod index ebcdc0f5a5..72925fb9f4 100644 --- a/src/lib/libcrypto/doc/ERR_remove_state.pod +++ b/src/lib/libcrypto/doc/ERR_remove_state.pod | |||
@@ -16,7 +16,7 @@ ERR_remove_state() frees the error queue associated with thread B<pid>. | |||
16 | If B<pid> == 0, the current thread will have its error queue removed. | 16 | If B<pid> == 0, the current thread will have its error queue removed. |
17 | 17 | ||
18 | Since error queue data structures are allocated automatically for new | 18 | Since error queue data structures are allocated automatically for new |
19 | threads, they must be freed when threads are terminated in oder to | 19 | threads, they must be freed when threads are terminated in order to |
20 | avoid memory leaks. | 20 | avoid memory leaks. |
21 | 21 | ||
22 | =head1 RETURN VALUE | 22 | =head1 RETURN VALUE |
diff --git a/src/lib/libcrypto/doc/EVP_DigestInit.pod b/src/lib/libcrypto/doc/EVP_DigestInit.pod index 6d4e156ae3..fefc858f7e 100644 --- a/src/lib/libcrypto/doc/EVP_DigestInit.pod +++ b/src/lib/libcrypto/doc/EVP_DigestInit.pod | |||
@@ -2,7 +2,12 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | EVP_DigestInit, EVP_DigestUpdate, EVP_DigestFinal - EVP digest routines | 5 | EVP_DigestInit, EVP_DigestUpdate, EVP_DigestFinal, EVP_MAX_MD_SIZE, |
6 | EVP_MD_CTX_copy, EVP_MD_type, EVP_MD_pkey_type, EVP_MD_size, EVP_MD_block_size, | ||
7 | EVP_MD_CTX_md, EVP_MD_CTX_size, EVP_MD_CTX_block_size, EVP_MD_CTX_type, | ||
8 | EVP_md_null, EVP_md2, EVP_md5, EVP_sha, EVP_sha1, EVP_dss, EVP_dss1, EVP_mdc2, | ||
9 | EVP_ripemd160, EVP_get_digestbyname, EVP_get_digestbynid, EVP_get_digestbyobj - | ||
10 | EVP digest routines | ||
6 | 11 | ||
7 | =head1 SYNOPSIS | 12 | =head1 SYNOPSIS |
8 | 13 | ||
@@ -45,12 +50,12 @@ EVP_DigestInit, EVP_DigestUpdate, EVP_DigestFinal - EVP digest routines | |||
45 | 50 | ||
46 | The EVP digest routines are a high level interface to message digests. | 51 | The EVP digest routines are a high level interface to message digests. |
47 | 52 | ||
48 | EVP_DigestInit() initialises a digest context B<ctx> to use a digest | 53 | EVP_DigestInit() initializes a digest context B<ctx> to use a digest |
49 | B<type>: this will typically be supplied by a function such as | 54 | B<type>: this will typically be supplied by a function such as |
50 | EVP_sha1(). | 55 | EVP_sha1(). |
51 | 56 | ||
52 | EVP_DigestUpdate() hashes B<cnt> bytes of data at B<d> into the | 57 | EVP_DigestUpdate() hashes B<cnt> bytes of data at B<d> into the |
53 | digest context B<ctx>. This funtion can be called several times on the | 58 | digest context B<ctx>. This function can be called several times on the |
54 | same B<ctx> to hash additional data. | 59 | same B<ctx> to hash additional data. |
55 | 60 | ||
56 | EVP_DigestFinal() retrieves the digest value from B<ctx> and places | 61 | EVP_DigestFinal() retrieves the digest value from B<ctx> and places |
@@ -58,7 +63,7 @@ it in B<md>. If the B<s> parameter is not NULL then the number of | |||
58 | bytes of data written (i.e. the length of the digest) will be written | 63 | bytes of data written (i.e. the length of the digest) will be written |
59 | to the integer at B<s>, at most B<EVP_MAX_MD_SIZE> bytes will be written. | 64 | to the integer at B<s>, at most B<EVP_MAX_MD_SIZE> bytes will be written. |
60 | After calling EVP_DigestFinal() no additional calls to EVP_DigestUpdate() | 65 | After calling EVP_DigestFinal() no additional calls to EVP_DigestUpdate() |
61 | can be made, but EVP_DigestInit() can be called to initialiase a new | 66 | can be made, but EVP_DigestInit() can be called to initialize a new |
62 | digest operation. | 67 | digest operation. |
63 | 68 | ||
64 | EVP_MD_CTX_copy() can be used to copy the message digest state from | 69 | EVP_MD_CTX_copy() can be used to copy the message digest state from |
@@ -97,7 +102,7 @@ returns is of zero length. | |||
97 | 102 | ||
98 | EVP_get_digestbyname(), EVP_get_digestbynid() and EVP_get_digestbyobj() | 103 | EVP_get_digestbyname(), EVP_get_digestbynid() and EVP_get_digestbyobj() |
99 | return an B<EVP_MD> structure when passed a digest name, a digest NID or | 104 | return an B<EVP_MD> structure when passed a digest name, a digest NID or |
100 | an ASN1_OBJECT structure respectively. The digest table must be initialised | 105 | an ASN1_OBJECT structure respectively. The digest table must be initialized |
101 | using, for example, OpenSSL_add_all_digests() for these functions to work. | 106 | using, for example, OpenSSL_add_all_digests() for these functions to work. |
102 | 107 | ||
103 | =head1 RETURN VALUES | 108 | =head1 RETURN VALUES |
diff --git a/src/lib/libcrypto/doc/EVP_EncryptInit.pod b/src/lib/libcrypto/doc/EVP_EncryptInit.pod index 77ed4ccdba..9afe2396e2 100644 --- a/src/lib/libcrypto/doc/EVP_EncryptInit.pod +++ b/src/lib/libcrypto/doc/EVP_EncryptInit.pod | |||
@@ -2,34 +2,46 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | EVP_EncryptInit, EVP_EncryptUpdate, EVP_EncryptFinal - EVP cipher routines | 5 | EVP_EncryptInit, EVP_EncryptUpdate, EVP_EncryptFinal, EVP_DecryptInit, |
6 | EVP_DecryptUpdate, EVP_DecryptFinal, EVP_CipherInit, EVP_CipherUpdate, | ||
7 | EVP_CipherFinal, EVP_CIPHER_CTX_set_key_length, EVP_CIPHER_CTX_ctrl, | ||
8 | EVP_CIPHER_CTX_cleanup, EVP_get_cipherbyname, EVP_get_cipherbynid, | ||
9 | EVP_get_cipherbyobj, EVP_CIPHER_nid, EVP_CIPHER_block_size, | ||
10 | EVP_CIPHER_key_length, EVP_CIPHER_iv_length, EVP_CIPHER_flags, | ||
11 | EVP_CIPHER_mode, EVP_CIPHER_type, EVP_CIPHER_CTX_cipher, EVP_CIPHER_CTX_nid, | ||
12 | EVP_CIPHER_CTX_block_size, EVP_CIPHER_CTX_key_length, EVP_CIPHER_CTX_iv_length, | ||
13 | EVP_CIPHER_CTX_get_app_data, EVP_CIPHER_CTX_set_app_data, EVP_CIPHER_CTX_type, | ||
14 | EVP_CIPHER_CTX_flags, EVP_CIPHER_CTX_mode, EVP_CIPHER_param_to_asn1, | ||
15 | EVP_CIPHER_asn1_to_param - EVP cipher routines | ||
6 | 16 | ||
7 | =head1 SYNOPSIS | 17 | =head1 SYNOPSIS |
8 | 18 | ||
9 | #include <openssl/evp.h> | 19 | #include <openssl/evp.h> |
10 | 20 | ||
11 | void EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | 21 | int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, |
12 | unsigned char *key, unsigned char *iv); | 22 | unsigned char *key, unsigned char *iv); |
13 | void EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 23 | int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, |
14 | int *outl, unsigned char *in, int inl); | 24 | int *outl, unsigned char *in, int inl); |
15 | void EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, | 25 | int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, |
16 | int *outl); | 26 | int *outl); |
17 | 27 | ||
18 | void EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | 28 | int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, |
19 | unsigned char *key, unsigned char *iv); | 29 | unsigned char *key, unsigned char *iv); |
20 | void EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 30 | int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, |
21 | int *outl, unsigned char *in, int inl); | 31 | int *outl, unsigned char *in, int inl); |
22 | int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, | 32 | int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, |
23 | int *outl); | 33 | int *outl); |
24 | 34 | ||
25 | void EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, | 35 | int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, |
26 | unsigned char *key, unsigned char *iv, int enc); | 36 | unsigned char *key, unsigned char *iv, int enc); |
27 | void EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 37 | int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, |
28 | int *outl, unsigned char *in, int inl); | 38 | int *outl, unsigned char *in, int inl); |
29 | int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, | 39 | int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, |
30 | int *outl); | 40 | int *outl); |
31 | 41 | ||
32 | void EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); | 42 | int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen); |
43 | int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr); | ||
44 | int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a); | ||
33 | 45 | ||
34 | const EVP_CIPHER *EVP_get_cipherbyname(const char *name); | 46 | const EVP_CIPHER *EVP_get_cipherbyname(const char *name); |
35 | #define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) | 47 | #define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a)) |
@@ -38,15 +50,21 @@ EVP_EncryptInit, EVP_EncryptUpdate, EVP_EncryptFinal - EVP cipher routines | |||
38 | #define EVP_CIPHER_nid(e) ((e)->nid) | 50 | #define EVP_CIPHER_nid(e) ((e)->nid) |
39 | #define EVP_CIPHER_block_size(e) ((e)->block_size) | 51 | #define EVP_CIPHER_block_size(e) ((e)->block_size) |
40 | #define EVP_CIPHER_key_length(e) ((e)->key_len) | 52 | #define EVP_CIPHER_key_length(e) ((e)->key_len) |
41 | #define EVP_CIPHER_iv_length(e) ((e)->iv_len) | 53 | #define EVP_CIPHER_iv_length(e) ((e)->iv_len) |
42 | 54 | #define EVP_CIPHER_flags(e) ((e)->flags) | |
55 | #define EVP_CIPHER_mode(e) ((e)->flags) & EVP_CIPH_MODE) | ||
43 | int EVP_CIPHER_type(const EVP_CIPHER *ctx); | 56 | int EVP_CIPHER_type(const EVP_CIPHER *ctx); |
57 | |||
44 | #define EVP_CIPHER_CTX_cipher(e) ((e)->cipher) | 58 | #define EVP_CIPHER_CTX_cipher(e) ((e)->cipher) |
45 | #define EVP_CIPHER_CTX_nid(e) ((e)->cipher->nid) | 59 | #define EVP_CIPHER_CTX_nid(e) ((e)->cipher->nid) |
46 | #define EVP_CIPHER_CTX_block_size(e) ((e)->cipher->block_size) | 60 | #define EVP_CIPHER_CTX_block_size(e) ((e)->cipher->block_size) |
47 | #define EVP_CIPHER_CTX_key_length(e) ((e)->cipher->key_len) | 61 | #define EVP_CIPHER_CTX_key_length(e) ((e)->key_len) |
48 | #define EVP_CIPHER_CTX_iv_length(e) ((e)->cipher->iv_len) | 62 | #define EVP_CIPHER_CTX_iv_length(e) ((e)->cipher->iv_len) |
63 | #define EVP_CIPHER_CTX_get_app_data(e) ((e)->app_data) | ||
64 | #define EVP_CIPHER_CTX_set_app_data(e,d) ((e)->app_data=(char *)(d)) | ||
49 | #define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) | 65 | #define EVP_CIPHER_CTX_type(c) EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c)) |
66 | #define EVP_CIPHER_CTX_flags(e) ((e)->cipher->flags) | ||
67 | #define EVP_CIPHER_CTX_mode(e) ((e)->cipher->flags & EVP_CIPH_MODE) | ||
50 | 68 | ||
51 | int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | 69 | int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type); |
52 | int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); | 70 | int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type); |
@@ -56,16 +74,14 @@ EVP_EncryptInit, EVP_EncryptUpdate, EVP_EncryptFinal - EVP cipher routines | |||
56 | The EVP cipher routines are a high level interface to certain | 74 | The EVP cipher routines are a high level interface to certain |
57 | symmetric ciphers. | 75 | symmetric ciphers. |
58 | 76 | ||
59 | EVP_EncryptInit() initialises a cipher context B<ctx> for encryption | 77 | EVP_EncryptInit() initializes a cipher context B<ctx> for encryption |
60 | with cipher B<type>. B<type> is normally supplied by a function such | 78 | with cipher B<type>. B<type> is normally supplied by a function such |
61 | as EVP_des_cbc() . B<key> is the symmetric key to use and B<iv> is the | 79 | as EVP_des_cbc() . B<key> is the symmetric key to use and B<iv> is the |
62 | IV to use (if necessary), the actual number of bytes used for the | 80 | IV to use (if necessary), the actual number of bytes used for the |
63 | key and IV depends on the cipher. It is possible to set all parameters | 81 | key and IV depends on the cipher. It is possible to set all parameters |
64 | to NULL except B<type> in an initial call and supply the remaining | 82 | to NULL except B<type> in an initial call and supply the remaining |
65 | parameters in subsequent calls. This is normally done when the | 83 | parameters in subsequent calls, all of which have B<type> set to NULL. |
66 | EVP_CIPHER_asn1_to_param() function is called to set the cipher | 84 | This is done when the default cipher parameters are not appropriate. |
67 | parameters from an ASN1 AlgorithmIdentifier and the key from a | ||
68 | different source. | ||
69 | 85 | ||
70 | EVP_EncryptUpdate() encrypts B<inl> bytes from the buffer B<in> and | 86 | EVP_EncryptUpdate() encrypts B<inl> bytes from the buffer B<in> and |
71 | writes the encrypted version to B<out>. This function can be called | 87 | writes the encrypted version to B<out>. This function can be called |
@@ -93,7 +109,8 @@ cipher block size is 1 in which case B<inl> bytes is sufficient. | |||
93 | EVP_CipherInit(), EVP_CipherUpdate() and EVP_CipherFinal() are functions | 109 | EVP_CipherInit(), EVP_CipherUpdate() and EVP_CipherFinal() are functions |
94 | that can be used for decryption or encryption. The operation performed | 110 | that can be used for decryption or encryption. The operation performed |
95 | depends on the value of the B<enc> parameter. It should be set to 1 for | 111 | depends on the value of the B<enc> parameter. It should be set to 1 for |
96 | encryption and 0 for decryption. | 112 | encryption, 0 for decryption and -1 to leave the value unchanged (the |
113 | actual value of 'enc' being supplied in a previous call). | ||
97 | 114 | ||
98 | EVP_CIPHER_CTX_cleanup() clears all information from a cipher context. | 115 | EVP_CIPHER_CTX_cleanup() clears all information from a cipher context. |
99 | It should be called after all operations using a cipher are complete | 116 | It should be called after all operations using a cipher are complete |
@@ -111,7 +128,13 @@ IDENTIFIER. | |||
111 | EVP_CIPHER_key_length() and EVP_CIPHER_CTX_key_length() return the key | 128 | EVP_CIPHER_key_length() and EVP_CIPHER_CTX_key_length() return the key |
112 | length of a cipher when passed an B<EVP_CIPHER> or B<EVP_CIPHER_CTX> | 129 | length of a cipher when passed an B<EVP_CIPHER> or B<EVP_CIPHER_CTX> |
113 | structure. The constant B<EVP_MAX_KEY_LENGTH> is the maximum key length | 130 | structure. The constant B<EVP_MAX_KEY_LENGTH> is the maximum key length |
114 | for all ciphers. | 131 | for all ciphers. Note: although EVP_CIPHER_key_length() is fixed for a |
132 | given cipher, the value of EVP_CIPHER_CTX_key_length() may be different | ||
133 | for variable key length ciphers. | ||
134 | |||
135 | EVP_CIPHER_CTX_set_key_length() sets the key length of the cipher ctx. | ||
136 | If the cipher is a fixed length cipher then attempting to set the key | ||
137 | length to any value other than the fixed value is an error. | ||
115 | 138 | ||
116 | EVP_CIPHER_iv_length() and EVP_CIPHER_CTX_iv_length() return the IV | 139 | EVP_CIPHER_iv_length() and EVP_CIPHER_CTX_iv_length() return the IV |
117 | length of a cipher when passed an B<EVP_CIPHER> or B<EVP_CIPHER_CTX>. | 140 | length of a cipher when passed an B<EVP_CIPHER> or B<EVP_CIPHER_CTX>. |
@@ -133,6 +156,11 @@ B<NID_undef>. | |||
133 | EVP_CIPHER_CTX_cipher() returns the B<EVP_CIPHER> structure when passed | 156 | EVP_CIPHER_CTX_cipher() returns the B<EVP_CIPHER> structure when passed |
134 | an B<EVP_CIPHER_CTX> structure. | 157 | an B<EVP_CIPHER_CTX> structure. |
135 | 158 | ||
159 | EVP_CIPHER_mode() and EVP_CIPHER_CTX_mode() return the block cipher mode: | ||
160 | EVP_CIPH_ECB_MODE, EVP_CIPH_CBC_MODE, EVP_CIPH_CFB_MODE or | ||
161 | EVP_CIPH_OFB_MODE. If the cipher is a stream cipher then | ||
162 | EVP_CIPH_STREAM_CIPHER is returned. | ||
163 | |||
136 | EVP_CIPHER_param_to_asn1() sets the AlgorithmIdentifier "parameter" based | 164 | EVP_CIPHER_param_to_asn1() sets the AlgorithmIdentifier "parameter" based |
137 | on the passed cipher. This will typically include any parameters and an | 165 | on the passed cipher. This will typically include any parameters and an |
138 | IV. The cipher IV (if any) must be set when this call is made. This call | 166 | IV. The cipher IV (if any) must be set when this call is made. This call |
@@ -149,21 +177,24 @@ key set to NULL, EVP_CIPHER_asn1_to_param() will be called and finally | |||
149 | EVP_CipherInit() again with all parameters except the key set to NULL. It is | 177 | EVP_CipherInit() again with all parameters except the key set to NULL. It is |
150 | possible for this function to fail if the cipher does not have any ASN1 support | 178 | possible for this function to fail if the cipher does not have any ASN1 support |
151 | or the parameters cannot be set (for example the RC2 effective key length | 179 | or the parameters cannot be set (for example the RC2 effective key length |
152 | does not have an B<EVP_CIPHER> structure). | 180 | is not supported. |
181 | |||
182 | EVP_CIPHER_CTX_ctrl() allows various cipher specific parameters to be determined | ||
183 | and set. Currently only the RC2 effective key length and the number of rounds of | ||
184 | RC5 can be set. | ||
153 | 185 | ||
154 | =head1 RETURN VALUES | 186 | =head1 RETURN VALUES |
155 | 187 | ||
156 | EVP_EncryptInit(), EVP_EncryptUpdate() and EVP_EncryptFinal() do not return | 188 | EVP_EncryptInit(), EVP_EncryptUpdate() and EVP_EncryptFinal() return 1 for success |
157 | values. | 189 | and 0 for failure. |
158 | 190 | ||
159 | EVP_DecryptInit() and EVP_DecryptUpdate() do not return values. | 191 | EVP_DecryptInit() and EVP_DecryptUpdate() return 1 for success and 0 for failure. |
160 | EVP_DecryptFinal() returns 0 if the decrypt failed or 1 for success. | 192 | EVP_DecryptFinal() returns 0 if the decrypt failed or 1 for success. |
161 | 193 | ||
162 | EVP_CipherInit() and EVP_CipherUpdate() do not return values. | 194 | EVP_CipherInit() and EVP_CipherUpdate() return 1 for success and 0 for failure. |
163 | EVP_CipherFinal() returns 1 for a decryption failure or 1 for success, if | 195 | EVP_CipherFinal() returns 1 for a decryption failure or 1 for success. |
164 | the operation is encryption then it always returns 1. | ||
165 | 196 | ||
166 | EVP_CIPHER_CTX_cleanup() does not return a value. | 197 | EVP_CIPHER_CTX_cleanup() returns 1 for success and 0 for failure. |
167 | 198 | ||
168 | EVP_get_cipherbyname(), EVP_get_cipherbynid() and EVP_get_cipherbyobj() | 199 | EVP_get_cipherbyname(), EVP_get_cipherbynid() and EVP_get_cipherbyobj() |
169 | return an B<EVP_CIPHER> structure or NULL on error. | 200 | return an B<EVP_CIPHER> structure or NULL on error. |
@@ -187,6 +218,75 @@ EVP_CIPHER_CTX_cipher() returns an B<EVP_CIPHER> structure. | |||
187 | EVP_CIPHER_param_to_asn1() and EVP_CIPHER_asn1_to_param() return 1 for | 218 | EVP_CIPHER_param_to_asn1() and EVP_CIPHER_asn1_to_param() return 1 for |
188 | success or zero for failure. | 219 | success or zero for failure. |
189 | 220 | ||
221 | =head1 CIPHER LISTING | ||
222 | |||
223 | All algorithms have a fixed key length unless otherwise stated. | ||
224 | |||
225 | =over 4 | ||
226 | |||
227 | =item EVP_enc_null() | ||
228 | |||
229 | Null cipher: does nothing. | ||
230 | |||
231 | =item EVP_des_cbc(void), EVP_des_ecb(void), EVP_des_cfb(void), EVP_des_ofb(void) | ||
232 | |||
233 | DES in CBC, ECB, CFB and OFB modes respectively. | ||
234 | |||
235 | =item EVP_des_ede_cbc(void), EVP_des_ede(), EVP_des_ede_ofb(void), EVP_des_ede_cfb(void) | ||
236 | |||
237 | Two key triple DES in CBC, ECB, CFB and OFB modes respectively. | ||
238 | |||
239 | =item EVP_des_ede3_cbc(void), EVP_des_ede3(), EVP_des_ede3_ofb(void), EVP_des_ede3_cfb(void) | ||
240 | |||
241 | Three key triple DES in CBC, ECB, CFB and OFB modes respectively. | ||
242 | |||
243 | =item EVP_desx_cbc(void) | ||
244 | |||
245 | DESX algorithm in CBC mode. | ||
246 | |||
247 | =item EVP_rc4(void) | ||
248 | |||
249 | RC4 stream cipher. This is a variable key length cipher with default key length 128 bits. | ||
250 | |||
251 | =item EVP_rc4_40(void) | ||
252 | |||
253 | RC4 stream cipher with 40 bit key length. This is obsolete and new code should use EVP_rc4() | ||
254 | and the EVP_CIPHER_CTX_set_key_length() function. | ||
255 | |||
256 | =item EVP_idea_cbc() EVP_idea_ecb(void), EVP_idea_cfb(void), EVP_idea_ofb(void), EVP_idea_cbc(void) | ||
257 | |||
258 | IDEA encryption algorithm in CBC, ECB, CFB and OFB modes respectively. | ||
259 | |||
260 | =item EVP_rc2_cbc(void), EVP_rc2_ecb(void), EVP_rc2_cfb(void), EVP_rc2_ofb(void) | ||
261 | |||
262 | RC2 encryption algorithm in CBC, ECB, CFB and OFB modes respectively. This is a variable key | ||
263 | length cipher with an additional parameter called "effective key bits" or "effective key length". | ||
264 | By default both are set to 128 bits. | ||
265 | |||
266 | =item EVP_rc2_40_cbc(void), EVP_rc2_64_cbc(void) | ||
267 | |||
268 | RC2 algorithm in CBC mode with a default key length and effective key length of 40 and 64 bits. | ||
269 | These are obsolete and new code should use EVP_rc2_cbc(), EVP_CIPHER_CTX_set_key_length() and | ||
270 | EVP_CIPHER_CTX_ctrl() to set the key length and effective key length. | ||
271 | |||
272 | =item EVP_bf_cbc(void), EVP_bf_ecb(void), EVP_bf_cfb(void), EVP_bf_ofb(void); | ||
273 | |||
274 | Blowfish encryption algorithm in CBC, ECB, CFB and OFB modes respectively. This is a variable key | ||
275 | length cipher. | ||
276 | |||
277 | =item EVP_cast5_cbc(void), EVP_cast5_ecb(void), EVP_cast5_cfb(void), EVP_cast5_ofb(void) | ||
278 | |||
279 | CAST encryption algorithm in CBC, ECB, CFB and OFB modes respectively. This is a variable key | ||
280 | length cipher. | ||
281 | |||
282 | =item EVP_rc5_32_12_16_cbc(void), EVP_rc5_32_12_16_ecb(void), EVP_rc5_32_12_16_cfb(void), EVP_rc5_32_12_16_ofb(void) | ||
283 | |||
284 | RC5 encryption algorithm in CBC, ECB, CFB and OFB modes respectively. This is a variable key length | ||
285 | cipher with an additional "number of rounds" parameter. By default the key length is set to 128 | ||
286 | bits and 12 rounds. | ||
287 | |||
288 | =back | ||
289 | |||
190 | =head1 NOTES | 290 | =head1 NOTES |
191 | 291 | ||
192 | Where possible the B<EVP> interface to symmetric ciphers should be used in | 292 | Where possible the B<EVP> interface to symmetric ciphers should be used in |
@@ -206,14 +306,49 @@ test that the input data or key is correct. A random block has better than | |||
206 | 1 in 256 chance of being of the correct format and problems with the | 306 | 1 in 256 chance of being of the correct format and problems with the |
207 | input data earlier on will not produce a final decrypt error. | 307 | input data earlier on will not produce a final decrypt error. |
208 | 308 | ||
309 | The functions EVP_EncryptInit(), EVP_EncryptUpdate(), EVP_EncryptFinal(), | ||
310 | EVP_DecryptInit(), EVP_DecryptUpdate(), EVP_CipherInit() and EVP_CipherUpdate() | ||
311 | and EVP_CIPHER_CTX_cleanup() did not return errors in OpenSSL version 0.9.5a or | ||
312 | earlier. Software only versions of encryption algorithms will never return | ||
313 | error codes for these functions, unless there is a programming error (for example | ||
314 | and attempt to set the key before the cipher is set in EVP_EncryptInit() ). | ||
315 | |||
209 | =head1 BUGS | 316 | =head1 BUGS |
210 | 317 | ||
211 | The current B<EVP> cipher interface is not as flexible as it should be. Only | 318 | For RC5 the number of rounds can currently only be set to 8, 12 or 16. This is |
212 | certain "spot" encryption algorithms can be used for ciphers which have various | 319 | a limitation of the current RC5 code rather than the EVP interface. |
213 | parameters associated with them (RC2, RC5 for example) this is inadequate. | 320 | |
321 | It should be possible to disable PKCS padding: currently it isn't. | ||
322 | |||
323 | EVP_MAX_KEY_LENGTH and EVP_MAX_IV_LENGTH only refer to the internal ciphers with | ||
324 | default key lengths. If custom ciphers exceed these values the results are | ||
325 | unpredictable. This is because it has become standard practice to define a | ||
326 | generic key as a fixed unsigned char array containing EVP_MAX_KEY_LENGTH bytes. | ||
327 | |||
328 | The ASN1 code is incomplete (and sometimes inaccurate) it has only been tested | ||
329 | for certain common S/MIME ciphers (RC2, DES, triple DES) in CBC mode. | ||
330 | |||
331 | =head1 EXAMPLES | ||
332 | |||
333 | Get the number of rounds used in RC5: | ||
334 | |||
335 | int nrounds; | ||
336 | EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GET_RC5_ROUNDS, 0, &i); | ||
337 | |||
338 | Get the RC2 effective key length: | ||
339 | |||
340 | int key_bits; | ||
341 | EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GET_RC2_KEY_BITS, 0, &i); | ||
342 | |||
343 | Set the number of rounds used in RC5: | ||
344 | |||
345 | int nrounds; | ||
346 | EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_RC5_ROUNDS, i, NULL); | ||
347 | |||
348 | Set the number of rounds used in RC2: | ||
214 | 349 | ||
215 | Several of the functions do not return error codes because the software versions | 350 | int nrounds; |
216 | can never fail. This is not true of hardware versions. | 351 | EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_RC2_KEY_BITS, i, NULL); |
217 | 352 | ||
218 | =head1 SEE ALSO | 353 | =head1 SEE ALSO |
219 | 354 | ||
diff --git a/src/lib/libcrypto/doc/EVP_OpenInit.pod b/src/lib/libcrypto/doc/EVP_OpenInit.pod index 50edb124e4..2e710da945 100644 --- a/src/lib/libcrypto/doc/EVP_OpenInit.pod +++ b/src/lib/libcrypto/doc/EVP_OpenInit.pod | |||
@@ -10,9 +10,9 @@ EVP_OpenInit, EVP_OpenUpdate, EVP_OpenFinal - EVP envelope decryption | |||
10 | 10 | ||
11 | int EVP_OpenInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type,unsigned char *ek, | 11 | int EVP_OpenInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type,unsigned char *ek, |
12 | int ekl,unsigned char *iv,EVP_PKEY *priv); | 12 | int ekl,unsigned char *iv,EVP_PKEY *priv); |
13 | void EVP_OpenUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 13 | int EVP_OpenUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, |
14 | int *outl, unsigned char *in, int inl); | 14 | int *outl, unsigned char *in, int inl); |
15 | void EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, | 15 | int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, |
16 | int *outl); | 16 | int *outl); |
17 | 17 | ||
18 | =head1 DESCRIPTION | 18 | =head1 DESCRIPTION |
@@ -21,7 +21,7 @@ The EVP envelope routines are a high level interface to envelope | |||
21 | decryption. They decrypt a public key encrypted symmetric key and | 21 | decryption. They decrypt a public key encrypted symmetric key and |
22 | then decrypt data using it. | 22 | then decrypt data using it. |
23 | 23 | ||
24 | EVP_OpenInit() initialises a cipher context B<ctx> for decryption | 24 | EVP_OpenInit() initializes a cipher context B<ctx> for decryption |
25 | with cipher B<type>. It decrypts the encrypted symmetric key of length | 25 | with cipher B<type>. It decrypts the encrypted symmetric key of length |
26 | B<ekl> bytes passed in the B<ek> parameter using the private key B<priv>. | 26 | B<ekl> bytes passed in the B<ek> parameter using the private key B<priv>. |
27 | The IV is supplied in the B<iv> parameter. | 27 | The IV is supplied in the B<iv> parameter. |
@@ -29,20 +29,32 @@ The IV is supplied in the B<iv> parameter. | |||
29 | EVP_OpenUpdate() and EVP_OpenFinal() have exactly the same properties | 29 | EVP_OpenUpdate() and EVP_OpenFinal() have exactly the same properties |
30 | as the EVP_DecryptUpdate() and EVP_DecryptFinal() routines, as | 30 | as the EVP_DecryptUpdate() and EVP_DecryptFinal() routines, as |
31 | documented on the L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> manual | 31 | documented on the L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> manual |
32 | page. | 32 | page. |
33 | |||
34 | =head1 NOTES | ||
35 | |||
36 | It is possible to call EVP_OpenInit() twice in the same way as | ||
37 | EVP_DecryptInit(). The first call should have B<priv> set to NULL | ||
38 | and (after setting any cipher parameters) it should be called again | ||
39 | with B<type> set to NULL. | ||
40 | |||
41 | If the cipher passed in the B<type> parameter is a variable length | ||
42 | cipher then the key length will be set to the value of the recovered | ||
43 | key length. If the cipher is a fixed length cipher then the recovered | ||
44 | key length must match the fixed cipher length. | ||
33 | 45 | ||
34 | =head1 RETURN VALUES | 46 | =head1 RETURN VALUES |
35 | 47 | ||
36 | EVP_OpenInit() returns -1 on error or an non zero integer (actually the | 48 | EVP_OpenInit() returns 0 on error or a non zero integer (actually the |
37 | recovered secret key size) if successful. | 49 | recovered secret key size) if successful. |
38 | 50 | ||
39 | EVP_SealUpdate() does not return a value. | 51 | EVP_OpenUpdate() returns 1 for success or 0 for failure. |
40 | 52 | ||
41 | EVP_SealFinal() returns 0 if the decrypt failed or 1 for success. | 53 | EVP_OpenFinal() returns 0 if the decrypt failed or 1 for success. |
42 | 54 | ||
43 | =head1 SEE ALSO | 55 | =head1 SEE ALSO |
44 | 56 | ||
45 | L<evp(3)|evp(3)>, | 57 | L<evp(3)|evp(3)>, L<rand(3)|rand(3)>, |
46 | L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>, | 58 | L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>, |
47 | L<EVP_SealInit(3)|EVP_SealInit(3)> | 59 | L<EVP_SealInit(3)|EVP_SealInit(3)> |
48 | 60 | ||
diff --git a/src/lib/libcrypto/doc/EVP_SealInit.pod b/src/lib/libcrypto/doc/EVP_SealInit.pod index 42beed33bd..0451eb648a 100644 --- a/src/lib/libcrypto/doc/EVP_SealInit.pod +++ b/src/lib/libcrypto/doc/EVP_SealInit.pod | |||
@@ -10,9 +10,9 @@ EVP_SealInit, EVP_SealUpdate, EVP_SealFinal - EVP envelope encryption | |||
10 | 10 | ||
11 | int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek, | 11 | int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek, |
12 | int *ekl, unsigned char *iv,EVP_PKEY **pubk, int npubk); | 12 | int *ekl, unsigned char *iv,EVP_PKEY **pubk, int npubk); |
13 | void EVP_SealUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | 13 | int EVP_SealUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, |
14 | int *outl, unsigned char *in, int inl); | 14 | int *outl, unsigned char *in, int inl); |
15 | void EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, | 15 | int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, |
16 | int *outl); | 16 | int *outl); |
17 | 17 | ||
18 | =head1 DESCRIPTION | 18 | =head1 DESCRIPTION |
@@ -22,7 +22,7 @@ encryption. They generate a random key and then "envelope" it by | |||
22 | using public key encryption. Data can then be encrypted using this | 22 | using public key encryption. Data can then be encrypted using this |
23 | key. | 23 | key. |
24 | 24 | ||
25 | EVP_SealInit() initialises a cipher context B<ctx> for encryption | 25 | EVP_SealInit() initializes a cipher context B<ctx> for encryption |
26 | with cipher B<type> using a random secret key and IV supplied in | 26 | with cipher B<type> using a random secret key and IV supplied in |
27 | the B<iv> parameter. B<type> is normally supplied by a function such | 27 | the B<iv> parameter. B<type> is normally supplied by a function such |
28 | as EVP_des_cbc(). The secret key is encrypted using one or more public | 28 | as EVP_des_cbc(). The secret key is encrypted using one or more public |
@@ -41,9 +41,10 @@ page. | |||
41 | 41 | ||
42 | =head1 RETURN VALUES | 42 | =head1 RETURN VALUES |
43 | 43 | ||
44 | EVP_SealInit() returns -1 on error or B<npubk> if successful. | 44 | EVP_SealInit() returns 0 on error or B<npubk> if successful. |
45 | 45 | ||
46 | EVP_SealUpdate() and EVP_SealFinal() do not return values. | 46 | EVP_SealUpdate() and EVP_SealFinal() return 1 for success and 0 for |
47 | failure. | ||
47 | 48 | ||
48 | =head1 NOTES | 49 | =head1 NOTES |
49 | 50 | ||
@@ -59,9 +60,14 @@ but symmetric encryption is fast. So symmetric encryption is used for | |||
59 | bulk encryption and the small random symmetric key used is transferred | 60 | bulk encryption and the small random symmetric key used is transferred |
60 | using public key encryption. | 61 | using public key encryption. |
61 | 62 | ||
63 | It is possible to call EVP_SealInit() twice in the same way as | ||
64 | EVP_EncryptInit(). The first call should have B<npubk> set to 0 | ||
65 | and (after setting any cipher parameters) it should be called again | ||
66 | with B<type> set to NULL. | ||
67 | |||
62 | =head1 SEE ALSO | 68 | =head1 SEE ALSO |
63 | 69 | ||
64 | L<evp(3)|evp(3)>, | 70 | L<evp(3)|evp(3)>, L<rand(3)|rand(3)>, |
65 | L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>, | 71 | L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>, |
66 | L<EVP_OpenInit(3)|EVP_OpenInit(3)> | 72 | L<EVP_OpenInit(3)|EVP_OpenInit(3)> |
67 | 73 | ||
diff --git a/src/lib/libcrypto/doc/EVP_SignInit.pod b/src/lib/libcrypto/doc/EVP_SignInit.pod index 1167cefb45..d5ce245ecd 100644 --- a/src/lib/libcrypto/doc/EVP_SignInit.pod +++ b/src/lib/libcrypto/doc/EVP_SignInit.pod | |||
@@ -19,12 +19,12 @@ EVP_SignInit, EVP_SignUpdate, EVP_SignFinal - EVP signing functions | |||
19 | The EVP signature routines are a high level interface to digital | 19 | The EVP signature routines are a high level interface to digital |
20 | signatures. | 20 | signatures. |
21 | 21 | ||
22 | EVP_SignInit() initialises a signing context B<ctx> to using digest | 22 | EVP_SignInit() initializes a signing context B<ctx> to using digest |
23 | B<type>: this will typically be supplied by a function such as | 23 | B<type>: this will typically be supplied by a function such as |
24 | EVP_sha1(). | 24 | EVP_sha1(). |
25 | 25 | ||
26 | EVP_SignUpdate() hashes B<cnt> bytes of data at B<d> into the | 26 | EVP_SignUpdate() hashes B<cnt> bytes of data at B<d> into the |
27 | signature context B<ctx>. This funtion can be called several times on the | 27 | signature context B<ctx>. This function can be called several times on the |
28 | same B<ctx> to include additional data. | 28 | same B<ctx> to include additional data. |
29 | 29 | ||
30 | EVP_SignFinal() signs the data in B<ctx> using the private key B<pkey> | 30 | EVP_SignFinal() signs the data in B<ctx> using the private key B<pkey> |
@@ -32,7 +32,7 @@ and places the signature in B<sig>. If the B<s> parameter is not NULL | |||
32 | then the number of bytes of data written (i.e. the length of the signature) | 32 | then the number of bytes of data written (i.e. the length of the signature) |
33 | will be written to the integer at B<s>, at most EVP_PKEY_size(pkey) bytes | 33 | will be written to the integer at B<s>, at most EVP_PKEY_size(pkey) bytes |
34 | will be written. After calling EVP_SignFinal() no additional calls to | 34 | will be written. After calling EVP_SignFinal() no additional calls to |
35 | EVP_SignUpdate() can be made, but EVP_SignInit() can be called to initialiase | 35 | EVP_SignUpdate() can be made, but EVP_SignInit() can be called to initialize |
36 | a new signature operation. | 36 | a new signature operation. |
37 | 37 | ||
38 | EVP_PKEY_size() returns the maximum size of a signature in bytes. The actual | 38 | EVP_PKEY_size() returns the maximum size of a signature in bytes. The actual |
diff --git a/src/lib/libcrypto/doc/EVP_VerifyInit.pod b/src/lib/libcrypto/doc/EVP_VerifyInit.pod index 5e74c5dcf9..736a0f4a82 100644 --- a/src/lib/libcrypto/doc/EVP_VerifyInit.pod +++ b/src/lib/libcrypto/doc/EVP_VerifyInit.pod | |||
@@ -17,17 +17,17 @@ EVP_VerifyInit, EVP_VerifyUpdate, EVP_VerifyFinal - EVP signature verification f | |||
17 | The EVP signature verification routines are a high level interface to digital | 17 | The EVP signature verification routines are a high level interface to digital |
18 | signatures. | 18 | signatures. |
19 | 19 | ||
20 | EVP_VerifyInit() initialises a verification context B<ctx> to using digest | 20 | EVP_VerifyInit() initializes a verification context B<ctx> to using digest |
21 | B<type>: this will typically be supplied by a function such as EVP_sha1(). | 21 | B<type>: this will typically be supplied by a function such as EVP_sha1(). |
22 | 22 | ||
23 | EVP_VerifyUpdate() hashes B<cnt> bytes of data at B<d> into the | 23 | EVP_VerifyUpdate() hashes B<cnt> bytes of data at B<d> into the |
24 | verification context B<ctx>. This funtion can be called several times on the | 24 | verification context B<ctx>. This function can be called several times on the |
25 | same B<ctx> to include additional data. | 25 | same B<ctx> to include additional data. |
26 | 26 | ||
27 | EVP_VerifyFinal() verifies the data in B<ctx> using the public key B<pkey> | 27 | EVP_VerifyFinal() verifies the data in B<ctx> using the public key B<pkey> |
28 | and against the B<siglen> bytes at B<sigbuf>. After calling EVP_VerifyFinal() | 28 | and against the B<siglen> bytes at B<sigbuf>. After calling EVP_VerifyFinal() |
29 | no additional calls to EVP_VerifyUpdate() can be made, but EVP_VerifyInit() | 29 | no additional calls to EVP_VerifyUpdate() can be made, but EVP_VerifyInit() |
30 | can be called to initialiase a new verification operation. | 30 | can be called to initialize a new verification operation. |
31 | 31 | ||
32 | =head1 RETURN VALUES | 32 | =head1 RETURN VALUES |
33 | 33 | ||
@@ -57,11 +57,12 @@ might. | |||
57 | 57 | ||
58 | =head1 SEE ALSO | 58 | =head1 SEE ALSO |
59 | 59 | ||
60 | L<evp(3)|evp(3)>, | ||
60 | L<EVP_SignInit(3)|EVP_SignInit(3)>, | 61 | L<EVP_SignInit(3)|EVP_SignInit(3)>, |
61 | L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, | 62 | L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>, |
62 | L<evp(3)|evp(3)>, L<HMAC(3)|HMAC(3)>, L<MD2(3)|MD2(3)>, | 63 | L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, |
63 | L<MD5(3)|MD5(3)>, L<MDC2(3)|MDC2(3)>, L<RIPEMD(3)|RIPEMD(3)>, | 64 | L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, |
64 | L<SHA1(3)|SHA1(3)>, L<digest(1)|digest(1)> | 65 | L<sha(3)|sha(3)>, L<digest(1)|digest(1)> |
65 | 66 | ||
66 | =head1 HISTORY | 67 | =head1 HISTORY |
67 | 68 | ||
diff --git a/src/lib/libcrypto/doc/OPENSSL_VERSION_NUMBER.pod b/src/lib/libcrypto/doc/OPENSSL_VERSION_NUMBER.pod index b0b1058d19..68ea723259 100644 --- a/src/lib/libcrypto/doc/OPENSSL_VERSION_NUMBER.pod +++ b/src/lib/libcrypto/doc/OPENSSL_VERSION_NUMBER.pod | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | OPENSSL_VERSION_NUMBER, SSLeay - get OpenSSL version number | 5 | OPENSSL_VERSION_NUMBER, SSLeay SSLeay_version - get OpenSSL version number |
6 | 6 | ||
7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
8 | 8 | ||
@@ -11,11 +11,27 @@ OPENSSL_VERSION_NUMBER, SSLeay - get OpenSSL version number | |||
11 | 11 | ||
12 | #include <openssl/crypto.h> | 12 | #include <openssl/crypto.h> |
13 | long SSLeay(void); | 13 | long SSLeay(void); |
14 | char *SSLeay_version(int t); | ||
14 | 15 | ||
15 | =head1 DESCRIPTION | 16 | =head1 DESCRIPTION |
16 | 17 | ||
17 | OPENSSL_VERSION_NUMBER is a numeric release version identifier: | 18 | OPENSSL_VERSION_NUMBER is a numeric release version identifier: |
18 | 19 | ||
20 | MMNNFFPPS: major minor fix patch status | ||
21 | |||
22 | The status nibble has one of the values 0 for development, 1 to e for betas | ||
23 | 1 to 14, and f for release. | ||
24 | |||
25 | for example | ||
26 | |||
27 | 0x000906000 == 0.9.6 dev | ||
28 | 0x000906023 == 0.9.6b beta 3 | ||
29 | 0x00090605f == 0.9.6e release | ||
30 | |||
31 | Versions prior to 0.9.3 have identifiers E<lt> 0x0930. | ||
32 | Versions between 0.9.3 and 0.9.5 had a version identifier with this | ||
33 | interpretation: | ||
34 | |||
19 | MMNNFFRBB major minor fix final beta/patch | 35 | MMNNFFRBB major minor fix final beta/patch |
20 | 36 | ||
21 | for example | 37 | for example |
@@ -23,13 +39,39 @@ for example | |||
23 | 0x000904100 == 0.9.4 release | 39 | 0x000904100 == 0.9.4 release |
24 | 0x000905000 == 0.9.5 dev | 40 | 0x000905000 == 0.9.5 dev |
25 | 41 | ||
26 | Versions prior to 0.9.3 have identifiers E<lt> 0x0930. | 42 | Version 0.9.5a had an interim interpretation that is like the current one, |
43 | except the patch level got the highest bit set, to keep continuity. The | ||
44 | number was therefore 0x0090581f. | ||
45 | |||
46 | |||
27 | For backward compatibility, SSLEAY_VERSION_NUMBER is also defined. | 47 | For backward compatibility, SSLEAY_VERSION_NUMBER is also defined. |
28 | 48 | ||
29 | SSLeay() returns this number. The return value can be compared to the | 49 | SSLeay() returns this number. The return value can be compared to the |
30 | macro to make sure that the correct version of the library has been | 50 | macro to make sure that the correct version of the library has been |
31 | loaded, especially when using DLLs on Windows systems. | 51 | loaded, especially when using DLLs on Windows systems. |
32 | 52 | ||
53 | SSLeay_version() returns different strings depending on B<t>: | ||
54 | |||
55 | =over 4 | ||
56 | |||
57 | =item SSLEAY_VERSION | ||
58 | The text variant of the version number and the release date. For example, | ||
59 | "OpenSSL 0.9.5a 1 Apr 2000". | ||
60 | |||
61 | =item SSLEAY_CFLAGS | ||
62 | The flags given to the C compiler when compiling OpenSSL are returned in a | ||
63 | string. | ||
64 | |||
65 | =item SSLEAY_PLATFORM | ||
66 | The platform name used when OpenSSL was configured is returned. | ||
67 | |||
68 | =back | ||
69 | |||
70 | If the data request isn't available, a text saying that the information is | ||
71 | not available is returned. | ||
72 | |||
73 | For an unknown B<t>, the text "not available" is returned. | ||
74 | |||
33 | =head1 RETURN VALUE | 75 | =head1 RETURN VALUE |
34 | 76 | ||
35 | The version number. | 77 | The version number. |
diff --git a/src/lib/libcrypto/doc/OpenSSL_add_all_algorithms.pod b/src/lib/libcrypto/doc/OpenSSL_add_all_algorithms.pod index 015d4eaf36..e63411b5bb 100644 --- a/src/lib/libcrypto/doc/OpenSSL_add_all_algorithms.pod +++ b/src/lib/libcrypto/doc/OpenSSL_add_all_algorithms.pod | |||
@@ -2,7 +2,8 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | OpenSSL_add_all_algorithms() - add algorithms to internal table | 5 | OpenSSL_add_all_algorithms, OpenSSL_add_all_ciphers, OpenSSL_add_all_digests - |
6 | add algorithms to internal table | ||
6 | 7 | ||
7 | =head1 SYNOPSIS | 8 | =head1 SYNOPSIS |
8 | 9 | ||
@@ -43,7 +44,7 @@ by EVP_sha1(). It just needs to add them if it (or any of the functions it calls | |||
43 | needs to lookup algorithms. | 44 | needs to lookup algorithms. |
44 | 45 | ||
45 | The cipher and digest lookup functions are used in many parts of the library. If | 46 | The cipher and digest lookup functions are used in many parts of the library. If |
46 | the table is not initialised several functions will misbehave and complain they | 47 | the table is not initialized several functions will misbehave and complain they |
47 | cannot find algorithms. This includes the PEM, PKCS#12, SSL and S/MIME libraries. | 48 | cannot find algorithms. This includes the PEM, PKCS#12, SSL and S/MIME libraries. |
48 | This is a common query in the OpenSSL mailing lists. | 49 | This is a common query in the OpenSSL mailing lists. |
49 | 50 | ||
diff --git a/src/lib/libcrypto/doc/RSA_get_ex_new_index.pod b/src/lib/libcrypto/doc/RSA_get_ex_new_index.pod index 920dc76325..46cc8f5359 100644 --- a/src/lib/libcrypto/doc/RSA_get_ex_new_index.pod +++ b/src/lib/libcrypto/doc/RSA_get_ex_new_index.pod | |||
@@ -17,14 +17,12 @@ RSA_get_ex_new_index, RSA_set_ex_data, RSA_get_ex_data - add application specifi | |||
17 | 17 | ||
18 | void *RSA_get_ex_data(RSA *r, int idx); | 18 | void *RSA_get_ex_data(RSA *r, int idx); |
19 | 19 | ||
20 | int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | 20 | typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, |
21 | int idx, long argl, void *argp); | 21 | int idx, long argl, void *argp); |
22 | 22 | typedef void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | |
23 | void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | 23 | int idx, long argl, void *argp); |
24 | int idx, long argl, void *argp); | 24 | typedef int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, |
25 | 25 | int idx, long argl, void *argp); | |
26 | int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, | ||
27 | int idx, long argl, void *argp); | ||
28 | 26 | ||
29 | =head1 DESCRIPTION | 27 | =head1 DESCRIPTION |
30 | 28 | ||
diff --git a/src/lib/libcrypto/doc/RSA_print.pod b/src/lib/libcrypto/doc/RSA_print.pod index dd968a5274..67876facc5 100644 --- a/src/lib/libcrypto/doc/RSA_print.pod +++ b/src/lib/libcrypto/doc/RSA_print.pod | |||
@@ -2,8 +2,9 @@ | |||
2 | 2 | ||
3 | =head1 NAME | 3 | =head1 NAME |
4 | 4 | ||
5 | RSA_print, RSA_print_fp, DHparams_print, DHparams_print_fp - print | 5 | RSA_print, RSA_print_fp, DHparams_print, DHparams_print_fp, DSA_print, |
6 | cryptographic parameters | 6 | DSA_print_fp, DHparams_print, DHparams_print_fp - print cryptographic |
7 | parameters | ||
7 | 8 | ||
8 | =head1 SYNOPSIS | 9 | =head1 SYNOPSIS |
9 | 10 | ||
diff --git a/src/lib/libcrypto/doc/RSA_public_encrypt.pod b/src/lib/libcrypto/doc/RSA_public_encrypt.pod index 13b7df62be..23861c0004 100644 --- a/src/lib/libcrypto/doc/RSA_public_encrypt.pod +++ b/src/lib/libcrypto/doc/RSA_public_encrypt.pod | |||
@@ -47,7 +47,7 @@ Encrypting user data directly with RSA is insecure. | |||
47 | =back | 47 | =back |
48 | 48 | ||
49 | B<flen> must be less than RSA_size(B<rsa>) - 11 for the PKCS #1 v1.5 | 49 | B<flen> must be less than RSA_size(B<rsa>) - 11 for the PKCS #1 v1.5 |
50 | based padding modes, and less than RSA_size(B<rsa>) - 21 for | 50 | based padding modes, and less than RSA_size(B<rsa>) - 41 for |
51 | RSA_PKCS1_OAEP_PADDING. The random number generator must be seeded | 51 | RSA_PKCS1_OAEP_PADDING. The random number generator must be seeded |
52 | prior to calling RSA_public_encrypt(). | 52 | prior to calling RSA_public_encrypt(). |
53 | 53 | ||
diff --git a/src/lib/libcrypto/doc/RSA_set_method.pod b/src/lib/libcrypto/doc/RSA_set_method.pod index 14b0b4cf35..b672712292 100644 --- a/src/lib/libcrypto/doc/RSA_set_method.pod +++ b/src/lib/libcrypto/doc/RSA_set_method.pod | |||
@@ -4,17 +4,18 @@ | |||
4 | 4 | ||
5 | RSA_set_default_method, RSA_get_default_method, RSA_set_method, | 5 | RSA_set_default_method, RSA_get_default_method, RSA_set_method, |
6 | RSA_get_method, RSA_PKCS1_SSLeay, RSA_PKCS1_RSAref, | 6 | RSA_get_method, RSA_PKCS1_SSLeay, RSA_PKCS1_RSAref, |
7 | RSA_PKCS1_null_method, RSA_flags, RSA_new_method - select RSA method | 7 | RSA_null_method, RSA_flags, RSA_new_method - select RSA method |
8 | 8 | ||
9 | =head1 SYNOPSIS | 9 | =head1 SYNOPSIS |
10 | 10 | ||
11 | #include <openssl/rsa.h> | 11 | #include <openssl/rsa.h> |
12 | #include <openssl/engine.h> | ||
12 | 13 | ||
13 | void RSA_set_default_method(RSA_METHOD *meth); | 14 | void RSA_set_default_openssl_method(RSA_METHOD *meth); |
14 | 15 | ||
15 | RSA_METHOD *RSA_get_default_method(void); | 16 | RSA_METHOD *RSA_get_default_openssl_method(void); |
16 | 17 | ||
17 | RSA_METHOD *RSA_set_method(RSA *rsa, RSA_METHOD *meth); | 18 | RSA_METHOD *RSA_set_method(RSA *rsa, ENGINE *engine); |
18 | 19 | ||
19 | RSA_METHOD *RSA_get_method(RSA *rsa); | 20 | RSA_METHOD *RSA_get_method(RSA *rsa); |
20 | 21 | ||
@@ -26,7 +27,7 @@ RSA_PKCS1_null_method, RSA_flags, RSA_new_method - select RSA method | |||
26 | 27 | ||
27 | int RSA_flags(RSA *rsa); | 28 | int RSA_flags(RSA *rsa); |
28 | 29 | ||
29 | RSA *RSA_new_method(RSA_METHOD *method); | 30 | RSA *RSA_new_method(ENGINE *engine); |
30 | 31 | ||
31 | =head1 DESCRIPTION | 32 | =head1 DESCRIPTION |
32 | 33 | ||
@@ -46,23 +47,27 @@ the RSA transformation. It is the default if OpenSSL is compiled with | |||
46 | C<-DRSA_NULL>. These methods may be useful in the USA because of a | 47 | C<-DRSA_NULL>. These methods may be useful in the USA because of a |
47 | patent on the RSA cryptosystem. | 48 | patent on the RSA cryptosystem. |
48 | 49 | ||
49 | RSA_set_default_method() makes B<meth> the default method for all B<RSA> | 50 | RSA_set_default_openssl_method() makes B<meth> the default method for all B<RSA> |
50 | structures created later. | 51 | structures created later. B<NB:> This is true only whilst the default engine |
52 | for RSA operations remains as "openssl". ENGINEs provide an | ||
53 | encapsulation for implementations of one or more algorithms at a time, and all | ||
54 | the RSA functions mentioned here operate within the scope of the default | ||
55 | "openssl" engine. | ||
51 | 56 | ||
52 | RSA_get_default_method() returns a pointer to the current default | 57 | RSA_get_default_openssl_method() returns a pointer to the current default |
53 | method. | 58 | method for the "openssl" engine. |
54 | 59 | ||
55 | RSA_set_method() selects B<meth> for all operations using the key | 60 | RSA_set_method() selects B<engine> for all operations using the key |
56 | B<rsa>. | 61 | B<rsa>. |
57 | 62 | ||
58 | RSA_get_method() returns a pointer to the method currently selected | 63 | RSA_get_method() returns a pointer to the RSA_METHOD from the currently |
59 | for B<rsa>. | 64 | selected ENGINE for B<rsa>. |
60 | 65 | ||
61 | RSA_flags() returns the B<flags> that are set for B<rsa>'s current method. | 66 | RSA_flags() returns the B<flags> that are set for B<rsa>'s current method. |
62 | 67 | ||
63 | RSA_new_method() allocates and initializes an B<RSA> structure so that | 68 | RSA_new_method() allocates and initializes an RSA structure so that |
64 | B<method> will be used for the RSA operations. If B<method> is B<NULL>, | 69 | B<engine> will be used for the RSA operations. If B<engine> is NULL, |
65 | the default method is used. | 70 | the default engine for RSA operations is used. |
66 | 71 | ||
67 | =head1 THE RSA_METHOD STRUCTURE | 72 | =head1 THE RSA_METHOD STRUCTURE |
68 | 73 | ||
@@ -128,17 +133,21 @@ the default method is used. | |||
128 | =head1 RETURN VALUES | 133 | =head1 RETURN VALUES |
129 | 134 | ||
130 | RSA_PKCS1_SSLeay(), RSA_PKCS1_RSAref(), RSA_PKCS1_null_method(), | 135 | RSA_PKCS1_SSLeay(), RSA_PKCS1_RSAref(), RSA_PKCS1_null_method(), |
131 | RSA_get_default_method() and RSA_get_method() return pointers to the | 136 | RSA_get_default_openssl_method() and RSA_get_method() return pointers to |
132 | respective B<RSA_METHOD>s. | 137 | the respective RSA_METHODs. |
133 | 138 | ||
134 | RSA_set_default_method() returns no value. | 139 | RSA_set_default_openssl_method() returns no value. |
135 | 140 | ||
136 | RSA_set_method() returns a pointer to the B<RSA_METHOD> previously | 141 | RSA_set_method() selects B<engine> as the engine that will be responsible for |
137 | associated with B<rsa>. | 142 | all operations using the structure B<rsa>. If this function completes successfully, |
143 | then the B<rsa> structure will have its own functional reference of B<engine>, so | ||
144 | the caller should remember to free their own reference to B<engine> when they are | ||
145 | finished with it. NB: An ENGINE's RSA_METHOD can be retrieved (or set) by | ||
146 | ENGINE_get_RSA() or ENGINE_set_RSA(). | ||
138 | 147 | ||
139 | RSA_new_method() returns B<NULL> and sets an error code that can be | 148 | RSA_new_method() returns NULL and sets an error code that can be |
140 | obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation fails. Otherwise it | 149 | obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation fails. Otherwise |
141 | returns a pointer to the newly allocated structure. | 150 | it returns a pointer to the newly allocated structure. |
142 | 151 | ||
143 | =head1 SEE ALSO | 152 | =head1 SEE ALSO |
144 | 153 | ||
@@ -151,4 +160,9 @@ RSA_get_default_method(), RSA_set_method() and RSA_get_method() as | |||
151 | well as the rsa_sign and rsa_verify components of RSA_METHOD were | 160 | well as the rsa_sign and rsa_verify components of RSA_METHOD were |
152 | added in OpenSSL 0.9.4. | 161 | added in OpenSSL 0.9.4. |
153 | 162 | ||
163 | RSA_set_default_openssl_method() and RSA_get_default_openssl_method() | ||
164 | replaced RSA_set_default_method() and RSA_get_default_method() respectively, | ||
165 | and RSA_set_method() and RSA_new_method() were altered to use B<ENGINE>s | ||
166 | rather than B<DH_METHOD>s during development of OpenSSL 0.9.6. | ||
167 | |||
154 | =cut | 168 | =cut |
diff --git a/src/lib/libcrypto/doc/dh.pod b/src/lib/libcrypto/doc/dh.pod index 0a9b7c03a2..b4be4be405 100644 --- a/src/lib/libcrypto/doc/dh.pod +++ b/src/lib/libcrypto/doc/dh.pod | |||
@@ -7,6 +7,7 @@ dh - Diffie-Hellman key agreement | |||
7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
8 | 8 | ||
9 | #include <openssl/dh.h> | 9 | #include <openssl/dh.h> |
10 | #include <openssl/engine.h> | ||
10 | 11 | ||
11 | DH * DH_new(void); | 12 | DH * DH_new(void); |
12 | void DH_free(DH *dh); | 13 | void DH_free(DH *dh); |
@@ -20,10 +21,10 @@ dh - Diffie-Hellman key agreement | |||
20 | int DH_generate_key(DH *dh); | 21 | int DH_generate_key(DH *dh); |
21 | int DH_compute_key(unsigned char *key, BIGNUM *pub_key, DH *dh); | 22 | int DH_compute_key(unsigned char *key, BIGNUM *pub_key, DH *dh); |
22 | 23 | ||
23 | void DH_set_default_method(DH_METHOD *meth); | 24 | void DH_set_default_openssl_method(DH_METHOD *meth); |
24 | DH_METHOD *DH_get_default_method(void); | 25 | DH_METHOD *DH_get_default_openssl_method(void); |
25 | DH_METHOD *DH_set_method(DH *dh, DH_METHOD *meth); | 26 | int DH_set_method(DH *dh, ENGINE *engine); |
26 | DH *DH_new_method(DH_METHOD *meth); | 27 | DH *DH_new_method(ENGINE *engine); |
27 | DH_METHOD *DH_OpenSSL(void); | 28 | DH_METHOD *DH_OpenSSL(void); |
28 | 29 | ||
29 | int DH_get_ex_new_index(long argl, char *argp, int (*new_func)(), | 30 | int DH_get_ex_new_index(long argl, char *argp, int (*new_func)(), |
diff --git a/src/lib/libcrypto/doc/dsa.pod b/src/lib/libcrypto/doc/dsa.pod index 80ecf38178..573500204b 100644 --- a/src/lib/libcrypto/doc/dsa.pod +++ b/src/lib/libcrypto/doc/dsa.pod | |||
@@ -7,6 +7,7 @@ dsa - Digital Signature Algorithm | |||
7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
8 | 8 | ||
9 | #include <openssl/dsa.h> | 9 | #include <openssl/dsa.h> |
10 | #include <openssl/engine.h> | ||
10 | 11 | ||
11 | DSA * DSA_new(void); | 12 | DSA * DSA_new(void); |
12 | void DSA_free(DSA *dsa); | 13 | void DSA_free(DSA *dsa); |
@@ -28,10 +29,10 @@ dsa - Digital Signature Algorithm | |||
28 | int DSA_verify(int dummy, const unsigned char *dgst, int len, | 29 | int DSA_verify(int dummy, const unsigned char *dgst, int len, |
29 | unsigned char *sigbuf, int siglen, DSA *dsa); | 30 | unsigned char *sigbuf, int siglen, DSA *dsa); |
30 | 31 | ||
31 | void DSA_set_default_method(DSA_METHOD *meth); | 32 | void DSA_set_default_openssl_method(DSA_METHOD *meth); |
32 | DSA_METHOD *DSA_get_default_method(void); | 33 | DSA_METHOD *DSA_get_default_openssl_method(void); |
33 | DSA_METHOD *DSA_set_method(DSA *dsa, DSA_METHOD *meth); | 34 | int DSA_set_method(DSA *dsa, ENGINE *engine); |
34 | DSA *DSA_new_method(DSA_METHOD *meth); | 35 | DSA *DSA_new_method(ENGINE *engine); |
35 | DSA_METHOD *DSA_OpenSSL(void); | 36 | DSA_METHOD *DSA_OpenSSL(void); |
36 | 37 | ||
37 | int DSA_get_ex_new_index(long argl, char *argp, int (*new_func)(), | 38 | int DSA_get_ex_new_index(long argl, char *argp, int (*new_func)(), |
diff --git a/src/lib/libcrypto/doc/evp.pod b/src/lib/libcrypto/doc/evp.pod new file mode 100644 index 0000000000..f089dd49a2 --- /dev/null +++ b/src/lib/libcrypto/doc/evp.pod | |||
@@ -0,0 +1,37 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | evp - high-level cryptographic functions | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/evp.h> | ||
10 | |||
11 | =head1 DESCRIPTION | ||
12 | |||
13 | The EVP library provided a high-level interface to cryptographic | ||
14 | functions. | ||
15 | |||
16 | B<EVP_Seal>I<...> and B<EVP_Open>I<...> provide public key encryption | ||
17 | and decryption to implement digital "envelopes". | ||
18 | |||
19 | The B<EVP_Sign>I<...> and B<EVP_Verify>I<...> functions implement | ||
20 | digital signatures. | ||
21 | |||
22 | Symmetric encryption is available with the B<EVP_Encrypt>I<...> | ||
23 | functions. The B<EVP_Digest>I<...> functions provide message digests. | ||
24 | |||
25 | Algorithms are loaded with OpenSSL_add_all_algorithms(3). | ||
26 | |||
27 | =head1 SEE ALSO | ||
28 | |||
29 | L<EVP_DigestInit(3)|EVP_DigestInit(3)>, | ||
30 | L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>, | ||
31 | L<EVP_OpenInit(3)|EVP_OpenInit(3)>, | ||
32 | L<EVP_SealInit(3)|EVP_SealInit(3)>, | ||
33 | L<EVP_SignInit(3)|EVP_SignInit(3)>, | ||
34 | L<EVP_VerifyInit(3)|EVP_VerifyInit(3)>, | ||
35 | L<OpenSSL_add_all_algorithms(3)|OpenSSL_add_all_algorithms(3)> | ||
36 | |||
37 | =cut | ||
diff --git a/src/lib/libcrypto/doc/rsa.pod b/src/lib/libcrypto/doc/rsa.pod index eb8ba612c4..ef0d4df205 100644 --- a/src/lib/libcrypto/doc/rsa.pod +++ b/src/lib/libcrypto/doc/rsa.pod | |||
@@ -7,6 +7,7 @@ rsa - RSA public key cryptosystem | |||
7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
8 | 8 | ||
9 | #include <openssl/rsa.h> | 9 | #include <openssl/rsa.h> |
10 | #include <openssl/engine.h> | ||
10 | 11 | ||
11 | RSA * RSA_new(void); | 12 | RSA * RSA_new(void); |
12 | void RSA_free(RSA *rsa); | 13 | void RSA_free(RSA *rsa); |
@@ -31,15 +32,15 @@ rsa - RSA public key cryptosystem | |||
31 | int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); | 32 | int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); |
32 | void RSA_blinding_off(RSA *rsa); | 33 | void RSA_blinding_off(RSA *rsa); |
33 | 34 | ||
34 | void RSA_set_default_method(RSA_METHOD *meth); | 35 | void RSA_set_default_openssl_method(RSA_METHOD *meth); |
35 | RSA_METHOD *RSA_get_default_method(void); | 36 | RSA_METHOD *RSA_get_default_openssl_method(void); |
36 | RSA_METHOD *RSA_set_method(RSA *rsa, RSA_METHOD *meth); | 37 | int RSA_set_method(RSA *rsa, ENGINE *engine); |
37 | RSA_METHOD *RSA_get_method(RSA *rsa); | 38 | RSA_METHOD *RSA_get_method(RSA *rsa); |
38 | RSA_METHOD *RSA_PKCS1_SSLeay(void); | 39 | RSA_METHOD *RSA_PKCS1_SSLeay(void); |
39 | RSA_METHOD *RSA_PKCS1_RSAref(void); | 40 | RSA_METHOD *RSA_PKCS1_RSAref(void); |
40 | RSA_METHOD *RSA_null_method(void); | 41 | RSA_METHOD *RSA_null_method(void); |
41 | int RSA_flags(RSA *rsa); | 42 | int RSA_flags(RSA *rsa); |
42 | RSA *RSA_new_method(RSA_METHOD *method); | 43 | RSA *RSA_new_method(ENGINE *engine); |
43 | 44 | ||
44 | int RSA_print(BIO *bp, RSA *x, int offset); | 45 | int RSA_print(BIO *bp, RSA *x, int offset); |
45 | int RSA_print_fp(FILE *fp, RSA *x, int offset); | 46 | int RSA_print_fp(FILE *fp, RSA *x, int offset); |
@@ -96,7 +97,7 @@ SSL, PKCS #1 v2.0 | |||
96 | 97 | ||
97 | =head1 PATENTS | 98 | =head1 PATENTS |
98 | 99 | ||
99 | RSA is covered by a US patent which expires in September 2000. | 100 | RSA was covered by a US patent which expired in September 2000. |
100 | 101 | ||
101 | =head1 SEE ALSO | 102 | =head1 SEE ALSO |
102 | 103 | ||