diff options
Diffstat (limited to 'src/lib/libcrypto/man/RSA_set_method.3')
-rw-r--r-- | src/lib/libcrypto/man/RSA_set_method.3 | 67 |
1 files changed, 51 insertions, 16 deletions
diff --git a/src/lib/libcrypto/man/RSA_set_method.3 b/src/lib/libcrypto/man/RSA_set_method.3 index 524430b6f8..53d41f5516 100644 --- a/src/lib/libcrypto/man/RSA_set_method.3 +++ b/src/lib/libcrypto/man/RSA_set_method.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: RSA_set_method.3,v 1.13 2019/05/20 06:04:45 jmc Exp $ | 1 | .\" $OpenBSD: RSA_set_method.3,v 1.14 2019/06/08 09:53:15 schwarze Exp $ |
2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
3 | .\" | 3 | .\" |
4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org> |
@@ -50,7 +50,7 @@ | |||
50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
52 | .\" | 52 | .\" |
53 | .Dd $Mdocdate: May 20 2019 $ | 53 | .Dd $Mdocdate: June 8 2019 $ |
54 | .Dt RSA_SET_METHOD 3 | 54 | .Dt RSA_SET_METHOD 3 |
55 | .Os | 55 | .Os |
56 | .Sh NAME | 56 | .Sh NAME |
@@ -121,12 +121,25 @@ selects | |||
121 | .Fa meth | 121 | .Fa meth |
122 | to perform all operations using the key | 122 | to perform all operations using the key |
123 | .Fa rsa . | 123 | .Fa rsa . |
124 | This replaces the | 124 | This replaces the previous |
125 | .Vt RSA_METHOD | 125 | .Vt RSA_METHOD |
126 | used by the RSA key, and if the previous method was supplied by an | 126 | used by the RSA key, calling the |
127 | .Fa finish | ||
128 | function set up with | ||
129 | .Xr RSA_meth_set_finish 3 | ||
130 | if any, and if the previous method was supplied by an | ||
127 | .Vt ENGINE , | 131 | .Vt ENGINE , |
128 | .Xr ENGINE_finish 3 | 132 | .Xr ENGINE_finish 3 |
129 | is called on it. | 133 | is called on it. |
134 | If | ||
135 | .Fa meth | ||
136 | contains an | ||
137 | .Fa init | ||
138 | function set up with | ||
139 | .Xr RSA_meth_set_init 3 , | ||
140 | that function is called just before returning from | ||
141 | .Fn RSA_set_method . | ||
142 | .Pp | ||
130 | It is possible to have RSA keys that only work with certain | 143 | It is possible to have RSA keys that only work with certain |
131 | .Vt RSA_METHOD | 144 | .Vt RSA_METHOD |
132 | implementations (e.g. from an | 145 | implementations (e.g. from an |
@@ -148,14 +161,19 @@ to be valid as long as the RSA key itself is valid and does not | |||
148 | have its implementation changed by | 161 | have its implementation changed by |
149 | .Fn RSA_set_method . | 162 | .Fn RSA_set_method . |
150 | .Pp | 163 | .Pp |
164 | The misleadingly named function | ||
151 | .Fn RSA_flags | 165 | .Fn RSA_flags |
152 | returns the flags that are set for the current | 166 | returns the flags that are set for the current |
153 | .Vt RSA_METHOD | 167 | .Vt RSA_METHOD |
154 | of | 168 | of |
155 | .Fa rsa . | 169 | .Fa rsa . |
170 | The flags used by | ||
171 | .Fa rsa | ||
172 | itself can instead be tested with | ||
173 | .Xr RSA_test_flags 3 . | ||
156 | See the | 174 | See the |
157 | .Sx BUGS | 175 | .Sx BUGS |
158 | section. | 176 | section for more details. |
159 | .Pp | 177 | .Pp |
160 | .Fn RSA_new_method | 178 | .Fn RSA_new_method |
161 | allocates and initializes an | 179 | allocates and initializes an |
@@ -175,6 +193,18 @@ the default method controlled by | |||
175 | .Fn RSA_set_default_method | 193 | .Fn RSA_set_default_method |
176 | is used. | 194 | is used. |
177 | .Pp | 195 | .Pp |
196 | The initial | ||
197 | .Fa flags | ||
198 | are copied from the | ||
199 | .Vt RSA_METHOD | ||
200 | object used and will not be affected by later changes to that object, | ||
201 | but may be modified by the optional | ||
202 | .Fa init | ||
203 | function which may have been set up with | ||
204 | .Xr RSA_meth_set_init 3 | ||
205 | and which is called just before returning from | ||
206 | .Fn RSA_new_method . | ||
207 | .Pp | ||
178 | The | 208 | The |
179 | .Dv RSA_METHOD | 209 | .Dv RSA_METHOD |
180 | structure is defined as follows: | 210 | structure is defined as follows: |
@@ -185,27 +215,28 @@ typedef struct rsa_meth_st | |||
185 | const char *name; | 215 | const char *name; |
186 | 216 | ||
187 | /* encrypt */ | 217 | /* encrypt */ |
188 | int (*rsa_pub_enc)(int flen, unsigned char *from, | 218 | int (*rsa_pub_enc)(int flen, const unsigned char *from, |
189 | unsigned char *to, RSA *rsa, int padding); | 219 | unsigned char *to, RSA *rsa, int padding); |
190 | 220 | ||
191 | /* verify arbitrary data */ | 221 | /* verify arbitrary data */ |
192 | int (*rsa_pub_dec)(int flen, unsigned char *from, | 222 | int (*rsa_pub_dec)(int flen, const unsigned char *from, |
193 | unsigned char *to, RSA *rsa, int padding); | 223 | unsigned char *to, RSA *rsa, int padding); |
194 | 224 | ||
195 | /* sign arbitrary data */ | 225 | /* sign arbitrary data */ |
196 | int (*rsa_priv_enc)(int flen, unsigned char *from, | 226 | int (*rsa_priv_enc)(int flen, const unsigned char *from, |
197 | unsigned char *to, RSA *rsa, int padding); | 227 | unsigned char *to, RSA *rsa, int padding); |
198 | 228 | ||
199 | /* decrypt */ | 229 | /* decrypt */ |
200 | int (*rsa_priv_dec)(int flen, unsigned char *from, | 230 | int (*rsa_priv_dec)(int flen, const unsigned char *from, |
201 | unsigned char *to, RSA *rsa, int padding); | 231 | unsigned char *to, RSA *rsa, int padding); |
202 | 232 | ||
203 | /* compute r0 = r0 ^ I mod rsa->n (May be NULL for some | 233 | /* compute r0 = r0 ^ I mod rsa->n (May be NULL for some |
204 | implementations) */ | 234 | implementations) */ |
205 | int (*rsa_mod_exp)(BIGNUM *r0, BIGNUM *I, RSA *rsa); | 235 | int (*rsa_mod_exp)(BIGNUM *r0, const BIGNUM *I, RSA *rsa, |
236 | BN_CTX *ctx); | ||
206 | 237 | ||
207 | /* compute r = a ^ p mod m (May be NULL for some implementations) */ | 238 | /* compute r = a ^ p mod m (May be NULL for some implementations) */ |
208 | int (*bn_mod_exp)(BIGNUM *r, BIGNUM *a, const BIGNUM *p, | 239 | int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, |
209 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); | 240 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); |
210 | 241 | ||
211 | /* called at RSA_new */ | 242 | /* called at RSA_new */ |
@@ -218,7 +249,6 @@ typedef struct rsa_meth_st | |||
218 | * operations, even if p,q,dmp1,dmq1,iqmp | 249 | * operations, even if p,q,dmp1,dmq1,iqmp |
219 | * are NULL | 250 | * are NULL |
220 | * RSA_FLAG_SIGN_VER - enable rsa_sign and rsa_verify | 251 | * RSA_FLAG_SIGN_VER - enable rsa_sign and rsa_verify |
221 | * RSA_METHOD_FLAG_NO_CHECK - don't check pub/private match | ||
222 | */ | 252 | */ |
223 | int flags; | 253 | int flags; |
224 | 254 | ||
@@ -227,14 +257,19 @@ typedef struct rsa_meth_st | |||
227 | /* sign. For backward compatibility, this is used only | 257 | /* sign. For backward compatibility, this is used only |
228 | * if (flags & RSA_FLAG_SIGN_VER) | 258 | * if (flags & RSA_FLAG_SIGN_VER) |
229 | */ | 259 | */ |
230 | int (*rsa_sign)(int type, unsigned char *m, unsigned int m_len, | 260 | int (*rsa_sign)(int type, const unsigned char *m, |
231 | unsigned char *sigret, unsigned int *siglen, RSA *rsa); | 261 | unsigned int m_len, unsigned char *sigret, |
262 | unsigned int *siglen, const RSA *rsa); | ||
232 | 263 | ||
233 | /* verify. For backward compatibility, this is used only | 264 | /* verify. For backward compatibility, this is used only |
234 | * if (flags & RSA_FLAG_SIGN_VER) | 265 | * if (flags & RSA_FLAG_SIGN_VER) |
235 | */ | 266 | */ |
236 | int (*rsa_verify)(int type, unsigned char *m, unsigned int m_len, | 267 | int (*rsa_verify)(int type, const unsigned char *m, |
237 | unsigned char *sigbuf, unsigned int siglen, RSA *rsa); | 268 | unsigned int m_len, const unsigned char *sigbuf, |
269 | unsigned int siglen, const RSA *rsa); | ||
270 | |||
271 | /* called at RSA_generate_key_ex; may be NULL */ | ||
272 | int (*rsa_keygen)(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); | ||
238 | 273 | ||
239 | } RSA_METHOD; | 274 | } RSA_METHOD; |
240 | .Ed | 275 | .Ed |