summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/doc/RSA_set_method.pod
diff options
context:
space:
mode:
authormarkus <>2002-09-14 11:18:04 +0000
committermarkus <>2002-09-14 11:18:04 +0000
commit3a3a489a756f2852d798376f20cc0d4ab609c866 (patch)
tree2a4277fc9b7635e82c33faa3bae9f9380bc639e8 /src/lib/libcrypto/doc/RSA_set_method.pod
parent82d2611e1bb67683df1bb201dcc2afbff4c76980 (diff)
downloadopenbsd-3a3a489a756f2852d798376f20cc0d4ab609c866.tar.gz
openbsd-3a3a489a756f2852d798376f20cc0d4ab609c866.tar.bz2
openbsd-3a3a489a756f2852d798376f20cc0d4ab609c866.zip
merge with openssl-0.9.7-stable-SNAP-20020911,
new minor for libcrypto (_X509_REQ_print_ex) tested by miod@, pb@
Diffstat (limited to 'src/lib/libcrypto/doc/RSA_set_method.pod')
-rw-r--r--src/lib/libcrypto/doc/RSA_set_method.pod127
1 files changed, 84 insertions, 43 deletions
diff --git a/src/lib/libcrypto/doc/RSA_set_method.pod b/src/lib/libcrypto/doc/RSA_set_method.pod
index 14917dd35f..0687c2242a 100644
--- a/src/lib/libcrypto/doc/RSA_set_method.pod
+++ b/src/lib/libcrypto/doc/RSA_set_method.pod
@@ -11,52 +11,64 @@ RSA_null_method, RSA_flags, RSA_new_method - select RSA method
11 #include <openssl/rsa.h> 11 #include <openssl/rsa.h>
12 #include <openssl/engine.h> 12 #include <openssl/engine.h>
13 13
14 void RSA_set_default_openssl_method(RSA_METHOD *meth); 14 void RSA_set_default_method(const RSA_METHOD *meth);
15 15
16 RSA_METHOD *RSA_get_default_openssl_method(void); 16 RSA_METHOD *RSA_get_default_method(void);
17 17
18 int RSA_set_method(RSA *rsa, ENGINE *engine); 18 int RSA_set_method(RSA *rsa, const RSA_METHOD *meth);
19 19
20 RSA_METHOD *RSA_get_method(RSA *rsa); 20 RSA_METHOD *RSA_get_method(const RSA *rsa);
21 21
22 RSA_METHOD *RSA_PKCS1_SSLeay(void); 22 RSA_METHOD *RSA_PKCS1_SSLeay(void);
23 23
24 RSA_METHOD *RSA_null_method(void); 24 RSA_METHOD *RSA_null_method(void);
25 25
26 int RSA_flags(RSA *rsa); 26 int RSA_flags(const RSA *rsa);
27 27
28 RSA *RSA_new_method(ENGINE *engine); 28 RSA *RSA_new_method(ENGINE *engine);
29 29
30=head1 DESCRIPTION 30=head1 DESCRIPTION
31 31
32An B<RSA_METHOD> specifies the functions that OpenSSL uses for RSA 32An B<RSA_METHOD> specifies the functions that OpenSSL uses for RSA
33operations. By modifying the method, alternative implementations 33operations. By modifying the method, alternative implementations such as
34such as hardware accelerators may be used. 34hardware accelerators may be used. IMPORTANT: See the NOTES section for
35 35important information about how these RSA API functions are affected by the
36Initially, the default is to use the OpenSSL internal implementation. 36use of B<ENGINE> API calls.
37RSA_PKCS1_SSLeay() returns a pointer to that method. 37
38 38Initially, the default RSA_METHOD is the OpenSSL internal implementation,
39RSA_set_default_openssl_method() makes B<meth> the default method for all B<RSA> 39as returned by RSA_PKCS1_SSLeay().
40structures created later. B<NB:> This is true only whilst the default engine 40
41for RSA operations remains as "openssl". ENGINEs provide an 41RSA_set_default_method() makes B<meth> the default method for all RSA
42encapsulation for implementations of one or more algorithms at a time, and all 42structures created later. B<NB>: This is true only whilst no ENGINE has
43the RSA functions mentioned here operate within the scope of the default 43been set as a default for RSA, so this function is no longer recommended.
44"openssl" engine. 44
45 45RSA_get_default_method() returns a pointer to the current default
46RSA_get_default_openssl_method() returns a pointer to the current default 46RSA_METHOD. However, the meaningfulness of this result is dependant on
47method for the "openssl" engine. 47whether the ENGINE API is being used, so this function is no longer
48 48recommended.
49RSA_set_method() selects B<engine> for all operations using the key 49
50B<rsa>. 50RSA_set_method() selects B<meth> to perform all operations using the key
51 51B<rsa>. This will replace the RSA_METHOD used by the RSA key and if the
52RSA_get_method() returns a pointer to the RSA_METHOD from the currently 52previous method was supplied by an ENGINE, the handle to that ENGINE will
53selected ENGINE for B<rsa>. 53be released during the change. It is possible to have RSA keys that only
54 54work with certain RSA_METHOD implementations (eg. from an ENGINE module
55RSA_flags() returns the B<flags> that are set for B<rsa>'s current method. 55that supports embedded hardware-protected keys), and in such cases
56attempting to change the RSA_METHOD for the key can have unexpected
57results.
58
59RSA_get_method() returns a pointer to the RSA_METHOD being used by B<rsa>.
60This method may or may not be supplied by an ENGINE implementation, but if
61it is, the return value can only be guaranteed to be valid as long as the
62RSA key itself is valid and does not have its implementation changed by
63RSA_set_method().
64
65RSA_flags() returns the B<flags> that are set for B<rsa>'s current
66RSA_METHOD. See the BUGS section.
56 67
57RSA_new_method() allocates and initializes an RSA structure so that 68RSA_new_method() allocates and initializes an RSA structure so that
58B<engine> will be used for the RSA operations. If B<engine> is NULL, 69B<engine> will be used for the RSA operations. If B<engine> is NULL, the
59the default engine for RSA operations is used. 70default ENGINE for RSA operations is used, and if no default ENGINE is set,
71the RSA_METHOD controlled by RSA_set_default_method() is used.
60 72
61=head1 THE RSA_METHOD STRUCTURE 73=head1 THE RSA_METHOD STRUCTURE
62 74
@@ -121,22 +133,45 @@ the default engine for RSA operations is used.
121 133
122=head1 RETURN VALUES 134=head1 RETURN VALUES
123 135
124RSA_PKCS1_SSLeay(), RSA_PKCS1_null_method(), RSA_get_default_openssl_method() 136RSA_PKCS1_SSLeay(), RSA_PKCS1_null_method(), RSA_get_default_method()
125and RSA_get_method() return pointers to the respective RSA_METHODs. 137and RSA_get_method() return pointers to the respective RSA_METHODs.
126 138
127RSA_set_default_openssl_method() returns no value. 139RSA_set_default_method() returns no value.
128 140
129RSA_set_method() selects B<engine> as the engine that will be responsible for 141RSA_set_method() returns a pointer to the old RSA_METHOD implementation
130all operations using the structure B<rsa>. If this function completes successfully, 142that was replaced. However, this return value should probably be ignored
131then the B<rsa> structure will have its own functional reference of B<engine>, so 143because if it was supplied by an ENGINE, the pointer could be invalidated
132the caller should remember to free their own reference to B<engine> when they are 144at any time if the ENGINE is unloaded (in fact it could be unloaded as a
133finished with it. NB: An ENGINE's RSA_METHOD can be retrieved (or set) by 145result of the RSA_set_method() function releasing its handle to the
134ENGINE_get_RSA() or ENGINE_set_RSA(). 146ENGINE). For this reason, the return type may be replaced with a B<void>
147declaration in a future release.
135 148
136RSA_new_method() returns NULL and sets an error code that can be 149RSA_new_method() returns NULL and sets an error code that can be obtained
137obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation fails. Otherwise 150by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation fails. Otherwise
138it returns a pointer to the newly allocated structure. 151it returns a pointer to the newly allocated structure.
139 152
153=head1 NOTES
154
155As of version 0.9.7, RSA_METHOD implementations are grouped together with
156other algorithmic APIs (eg. DSA_METHOD, EVP_CIPHER, etc) into B<ENGINE>
157modules. If a default ENGINE is specified for RSA functionality using an
158ENGINE API function, that will override any RSA defaults set using the RSA
159API (ie. RSA_set_default_method()). For this reason, the ENGINE API is the
160recommended way to control default implementations for use in RSA and other
161cryptographic algorithms.
162
163=head1 BUGS
164
165The behaviour of RSA_flags() is a mis-feature that is left as-is for now
166to avoid creating compatibility problems. RSA functionality, such as the
167encryption functions, are controlled by the B<flags> value in the RSA key
168itself, not by the B<flags> value in the RSA_METHOD attached to the RSA key
169(which is what this function returns). If the flags element of an RSA key
170is changed, the changes will be honoured by RSA functionality but will not
171be reflected in the return value of the RSA_flags() function - in effect
172RSA_flags() behaves more like an RSA_default_flags() function (which does
173not currently exist).
174
140=head1 SEE ALSO 175=head1 SEE ALSO
141 176
142L<rsa(3)|rsa(3)>, L<RSA_new(3)|RSA_new(3)> 177L<rsa(3)|rsa(3)>, L<RSA_new(3)|RSA_new(3)>
@@ -149,8 +184,14 @@ well as the rsa_sign and rsa_verify components of RSA_METHOD were
149added in OpenSSL 0.9.4. 184added in OpenSSL 0.9.4.
150 185
151RSA_set_default_openssl_method() and RSA_get_default_openssl_method() 186RSA_set_default_openssl_method() and RSA_get_default_openssl_method()
152replaced RSA_set_default_method() and RSA_get_default_method() respectively, 187replaced RSA_set_default_method() and RSA_get_default_method()
153and RSA_set_method() and RSA_new_method() were altered to use B<ENGINE>s 188respectively, and RSA_set_method() and RSA_new_method() were altered to use
154rather than B<RSA_METHOD>s during development of OpenSSL 0.9.6. 189B<ENGINE>s rather than B<RSA_METHOD>s during development of the engine
190version of OpenSSL 0.9.6. For 0.9.7, the handling of defaults in the ENGINE
191API was restructured so that this change was reversed, and behaviour of the
192other functions resembled more closely the previous behaviour. The
193behaviour of defaults in the ENGINE API now transparently overrides the
194behaviour of defaults in the RSA API without requiring changing these
195function prototypes.
155 196
156=cut 197=cut