summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/doc/RSA_set_method.pod
diff options
context:
space:
mode:
authorschwarze <>2016-11-04 10:17:17 +0000
committerschwarze <>2016-11-04 10:17:17 +0000
commit195fe5e91c60bd205043b4bea113abdff1c67bcc (patch)
tree1d15fe02d83a7ffb422ebe78c34ee1117da63e59 /src/lib/libcrypto/doc/RSA_set_method.pod
parent00872265b9546fcf2d5795aa3a120c35142d268b (diff)
downloadopenbsd-195fe5e91c60bd205043b4bea113abdff1c67bcc.tar.gz
openbsd-195fe5e91c60bd205043b4bea113abdff1c67bcc.tar.bz2
openbsd-195fe5e91c60bd205043b4bea113abdff1c67bcc.zip
convert RSA manuals from pod to mdoc
Diffstat (limited to 'src/lib/libcrypto/doc/RSA_set_method.pod')
-rw-r--r--src/lib/libcrypto/doc/RSA_set_method.pod201
1 files changed, 0 insertions, 201 deletions
diff --git a/src/lib/libcrypto/doc/RSA_set_method.pod b/src/lib/libcrypto/doc/RSA_set_method.pod
deleted file mode 100644
index 3f50a89e5c..0000000000
--- a/src/lib/libcrypto/doc/RSA_set_method.pod
+++ /dev/null
@@ -1,201 +0,0 @@
1=pod
2
3=head1 NAME
4
5RSA_set_default_method, RSA_get_default_method, RSA_set_method,
6RSA_get_method, RSA_PKCS1_SSLeay, RSA_null_method, RSA_flags,
7RSA_new_method, RSA_get_default_openssl_method,
8RSA_set_default_openssl_method - select RSA method
9
10=head1 SYNOPSIS
11
12 #include <openssl/rsa.h>
13
14 void RSA_set_default_method(const RSA_METHOD *meth);
15
16 RSA_METHOD *RSA_get_default_method(void);
17
18 int RSA_set_method(RSA *rsa, const RSA_METHOD *meth);
19
20 RSA_METHOD *RSA_get_method(const RSA *rsa);
21
22 RSA_METHOD *RSA_PKCS1_SSLeay(void);
23
24 RSA_METHOD *RSA_null_method(void);
25
26 int RSA_flags(const RSA *rsa);
27
28 RSA *RSA_new_method(RSA_METHOD *method);
29
30=head1 DESCRIPTION
31
32An B<RSA_METHOD> specifies the functions that OpenSSL uses for RSA
33operations. By modifying the method, alternative implementations such as
34hardware accelerators may be used. IMPORTANT: See the NOTES section for
35important information about how these RSA API functions are affected by the
36use of B<ENGINE> API calls.
37
38Initially, the default RSA_METHOD is the OpenSSL internal implementation,
39as returned by RSA_PKCS1_SSLeay().
40
41RSA_set_default_method() makes B<meth> the default method for all RSA
42structures created later. B<NB>: This is true only whilst no ENGINE has
43been set as a default for RSA, so this function is no longer recommended.
44
45RSA_get_default_method() returns a pointer to the current default
46RSA_METHOD. However, the meaningfulness of this result is dependent on
47whether the ENGINE API is being used, so this function is no longer
48recommended.
49
50RSA_set_method() selects B<meth> to perform all operations using the key
51B<rsa>. This will replace the RSA_METHOD used by the RSA key and if the
52previous method was supplied by an ENGINE, the handle to that ENGINE will
53be released during the change. It is possible to have RSA keys that only
54work with certain RSA_METHOD implementations (eg. from an ENGINE module
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.
67
68RSA_new_method() allocates and initializes an RSA structure so that
69B<engine> will be used for the RSA operations. If B<engine> is NULL, the
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.
72
73RSA_flags() returns the B<flags> that are set for B<rsa>'s current method.
74
75RSA_new_method() allocates and initializes an B<RSA> structure so that
76B<method> will be used for the RSA operations. If B<method> is B<NULL>,
77the default method is used.
78
79=head1 THE RSA_METHOD STRUCTURE
80
81 typedef struct rsa_meth_st
82 {
83 /* name of the implementation */
84 const char *name;
85
86 /* encrypt */
87 int (*rsa_pub_enc)(int flen, unsigned char *from,
88 unsigned char *to, RSA *rsa, int padding);
89
90 /* verify arbitrary data */
91 int (*rsa_pub_dec)(int flen, unsigned char *from,
92 unsigned char *to, RSA *rsa, int padding);
93
94 /* sign arbitrary data */
95 int (*rsa_priv_enc)(int flen, unsigned char *from,
96 unsigned char *to, RSA *rsa, int padding);
97
98 /* decrypt */
99 int (*rsa_priv_dec)(int flen, unsigned char *from,
100 unsigned char *to, RSA *rsa, int padding);
101
102 /* compute r0 = r0 ^ I mod rsa->n (May be NULL for some
103 implementations) */
104 int (*rsa_mod_exp)(BIGNUM *r0, BIGNUM *I, RSA *rsa);
105
106 /* compute r = a ^ p mod m (May be NULL for some implementations) */
107 int (*bn_mod_exp)(BIGNUM *r, BIGNUM *a, const BIGNUM *p,
108 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
109
110 /* called at RSA_new */
111 int (*init)(RSA *rsa);
112
113 /* called at RSA_free */
114 int (*finish)(RSA *rsa);
115
116 /* RSA_FLAG_EXT_PKEY - rsa_mod_exp is called for private key
117 * operations, even if p,q,dmp1,dmq1,iqmp
118 * are NULL
119 * RSA_FLAG_SIGN_VER - enable rsa_sign and rsa_verify
120 * RSA_METHOD_FLAG_NO_CHECK - don't check pub/private match
121 */
122 int flags;
123
124 char *app_data; /* ?? */
125
126 /* sign. For backward compatibility, this is used only
127 * if (flags & RSA_FLAG_SIGN_VER)
128 */
129 int (*rsa_sign)(int type, unsigned char *m, unsigned int m_len,
130 unsigned char *sigret, unsigned int *siglen, RSA *rsa);
131
132 /* verify. For backward compatibility, this is used only
133 * if (flags & RSA_FLAG_SIGN_VER)
134 */
135 int (*rsa_verify)(int type, unsigned char *m, unsigned int m_len,
136 unsigned char *sigbuf, unsigned int siglen, RSA *rsa);
137
138 } RSA_METHOD;
139
140=head1 RETURN VALUES
141
142RSA_PKCS1_SSLeay(), RSA_PKCS1_null_method(), RSA_get_default_method()
143and RSA_get_method() return pointers to the respective RSA_METHODs.
144
145RSA_set_method() returns a pointer to the old RSA_METHOD implementation
146that was replaced. However, this return value should probably be ignored
147because if it was supplied by an ENGINE, the pointer could be invalidated
148at any time if the ENGINE is unloaded (in fact it could be unloaded as a
149result of the RSA_set_method() function releasing its handle to the
150ENGINE). For this reason, the return type may be replaced with a B<void>
151declaration in a future release.
152
153RSA_new_method() returns NULL and sets an error code that can be obtained
154by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation fails. Otherwise
155it returns a pointer to the newly allocated structure.
156
157=head1 NOTES
158
159As of version 0.9.7, RSA_METHOD implementations are grouped together with
160other algorithmic APIs (eg. DSA_METHOD, EVP_CIPHER, etc) into B<ENGINE>
161modules. If a default ENGINE is specified for RSA functionality using an
162ENGINE API function, that will override any RSA defaults set using the RSA
163API (ie. RSA_set_default_method()). For this reason, the ENGINE API is the
164recommended way to control default implementations for use in RSA and other
165cryptographic algorithms.
166
167=head1 BUGS
168
169The behaviour of RSA_flags() is a mis-feature that is left as-is for now
170to avoid creating compatibility problems. RSA functionality, such as the
171encryption functions, are controlled by the B<flags> value in the RSA key
172itself, not by the B<flags> value in the RSA_METHOD attached to the RSA key
173(which is what this function returns). If the flags element of an RSA key
174is changed, the changes will be honoured by RSA functionality but will not
175be reflected in the return value of the RSA_flags() function - in effect
176RSA_flags() behaves more like an RSA_default_flags() function (which does
177not currently exist).
178
179=head1 SEE ALSO
180
181L<rsa(3)|rsa(3)>, L<RSA_new(3)|RSA_new(3)>
182
183=head1 HISTORY
184
185RSA_new_method() and RSA_set_default_method() appeared in SSLeay 0.8.
186RSA_get_default_method(), RSA_set_method() and RSA_get_method() as
187well as the rsa_sign and rsa_verify components of RSA_METHOD were
188added in OpenSSL 0.9.4.
189
190RSA_set_default_openssl_method() and RSA_get_default_openssl_method()
191replaced RSA_set_default_method() and RSA_get_default_method()
192respectively, and RSA_set_method() and RSA_new_method() were altered to use
193B<ENGINE>s rather than B<RSA_METHOD>s during development of the engine
194version of OpenSSL 0.9.6. For 0.9.7, the handling of defaults in the ENGINE
195API was restructured so that this change was reversed, and behaviour of the
196other functions resembled more closely the previous behaviour. The
197behaviour of defaults in the ENGINE API now transparently overrides the
198behaviour of defaults in the RSA API without requiring changing these
199function prototypes.
200
201=cut