diff options
author | jsing <> | 2014-07-09 19:51:31 +0000 |
---|---|---|
committer | jsing <> | 2014-07-09 19:51:31 +0000 |
commit | 5155b53399b3cd5c9947109652d415d6dcc6ce1d (patch) | |
tree | 02ea283e18c2b893acc7bb60207533687e5b4146 /src | |
parent | 6b9a0f99def5b0e95e23f0456bdac32ba04e517d (diff) | |
download | openbsd-5155b53399b3cd5c9947109652d415d6dcc6ce1d.tar.gz openbsd-5155b53399b3cd5c9947109652d415d6dcc6ce1d.tar.bz2 openbsd-5155b53399b3cd5c9947109652d415d6dcc6ce1d.zip |
KNF.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/rsa/rsa.h | 222 | ||||
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_locl.h | 9 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/rsa/rsa.h | 222 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/rsa/rsa_locl.h | 9 |
4 files changed, 216 insertions, 246 deletions
diff --git a/src/lib/libcrypto/rsa/rsa.h b/src/lib/libcrypto/rsa/rsa.h index daea33ff60..f51a807c3c 100644 --- a/src/lib/libcrypto/rsa/rsa.h +++ b/src/lib/libcrypto/rsa/rsa.h | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: rsa.h,v 1.20 2014/07/09 08:55:32 miod Exp $ */ | 1 | /* $OpenBSD: rsa.h,v 1.21 2014/07/09 19:51:31 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
8 | * | 8 | * |
9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
11 | * apply to all code found in this distribution, be it the RC4, RSA, | 11 | * apply to all code found in this distribution, be it the RC4, RSA, |
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation |
13 | * included with this distribution is covered by the same copyright terms | 13 | * included with this distribution is covered by the same copyright terms |
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
15 | * | 15 | * |
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
18 | * If this package is used in a product, Eric Young should be given attribution | 18 | * If this package is used in a product, Eric Young should be given attribution |
19 | * as the author of the parts of the library used. | 19 | * as the author of the parts of the library used. |
20 | * This can be in the form of a textual message at program startup or | 20 | * This can be in the form of a textual message at program startup or |
21 | * in documentation (online or textual) provided with the package. | 21 | * in documentation (online or textual) provided with the package. |
22 | * | 22 | * |
23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
25 | * are met: | 25 | * are met: |
@@ -34,10 +34,10 @@ | |||
34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 37 | * 4. If you include any Windows specific code (or a derivative thereof) from |
38 | * the apps directory (application code) you must include an acknowledgement: | 38 | * the apps directory (application code) you must include an acknowledgement: |
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
40 | * | 40 | * |
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
@@ -49,7 +49,7 @@ | |||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
52 | * | 52 | * |
53 | * The licence and distribution terms for any publically available version or | 53 | * The licence and distribution terms for any publically available version or |
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
@@ -82,25 +82,20 @@ extern "C" { | |||
82 | /* typedef struct rsa_st RSA; */ | 82 | /* typedef struct rsa_st RSA; */ |
83 | /* typedef struct rsa_meth_st RSA_METHOD; */ | 83 | /* typedef struct rsa_meth_st RSA_METHOD; */ |
84 | 84 | ||
85 | struct rsa_meth_st | 85 | struct rsa_meth_st { |
86 | { | ||
87 | const char *name; | 86 | const char *name; |
88 | int (*rsa_pub_enc)(int flen,const unsigned char *from, | 87 | int (*rsa_pub_enc)(int flen, const unsigned char *from, |
89 | unsigned char *to, | 88 | unsigned char *to, RSA *rsa, int padding); |
90 | RSA *rsa,int padding); | 89 | int (*rsa_pub_dec)(int flen, const unsigned char *from, |
91 | int (*rsa_pub_dec)(int flen,const unsigned char *from, | 90 | unsigned char *to, RSA *rsa, int padding); |
92 | unsigned char *to, | 91 | int (*rsa_priv_enc)(int flen, const unsigned char *from, |
93 | RSA *rsa,int padding); | 92 | unsigned char *to, RSA *rsa, int padding); |
94 | int (*rsa_priv_enc)(int flen,const unsigned char *from, | 93 | int (*rsa_priv_dec)(int flen, const unsigned char *from, |
95 | unsigned char *to, | 94 | unsigned char *to, RSA *rsa, int padding); |
96 | RSA *rsa,int padding); | 95 | int (*rsa_mod_exp)(BIGNUM *r0, const BIGNUM *I, RSA *rsa, |
97 | int (*rsa_priv_dec)(int flen,const unsigned char *from, | 96 | BN_CTX *ctx); /* Can be null */ |
98 | unsigned char *to, | ||
99 | RSA *rsa,int padding); | ||
100 | int (*rsa_mod_exp)(BIGNUM *r0,const BIGNUM *I,RSA *rsa,BN_CTX *ctx); /* Can be null */ | ||
101 | int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | 97 | int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, |
102 | const BIGNUM *m, BN_CTX *ctx, | 98 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); /* Can be null */ |
103 | BN_MONT_CTX *m_ctx); /* Can be null */ | ||
104 | int (*init)(RSA *rsa); /* called at new */ | 99 | int (*init)(RSA *rsa); /* called at new */ |
105 | int (*finish)(RSA *rsa); /* called at free */ | 100 | int (*finish)(RSA *rsa); /* called at free */ |
106 | int flags; /* RSA_METHOD_FLAG_* things */ | 101 | int flags; /* RSA_METHOD_FLAG_* things */ |
@@ -112,22 +107,19 @@ struct rsa_meth_st | |||
112 | * compatibility this functionality is only enabled if the RSA_FLAG_SIGN_VER | 107 | * compatibility this functionality is only enabled if the RSA_FLAG_SIGN_VER |
113 | * option is set in 'flags'. | 108 | * option is set in 'flags'. |
114 | */ | 109 | */ |
115 | int (*rsa_sign)(int type, | 110 | int (*rsa_sign)(int type, const unsigned char *m, unsigned int m_length, |
116 | const unsigned char *m, unsigned int m_length, | 111 | unsigned char *sigret, unsigned int *siglen, const RSA *rsa); |
117 | unsigned char *sigret, unsigned int *siglen, const RSA *rsa); | 112 | int (*rsa_verify)(int dtype, const unsigned char *m, |
118 | int (*rsa_verify)(int dtype, | 113 | unsigned int m_length, const unsigned char *sigbuf, |
119 | const unsigned char *m, unsigned int m_length, | 114 | unsigned int siglen, const RSA *rsa); |
120 | const unsigned char *sigbuf, unsigned int siglen, | ||
121 | const RSA *rsa); | ||
122 | /* If this callback is NULL, the builtin software RSA key-gen will be used. This | 115 | /* If this callback is NULL, the builtin software RSA key-gen will be used. This |
123 | * is for behavioural compatibility whilst the code gets rewired, but one day | 116 | * is for behavioural compatibility whilst the code gets rewired, but one day |
124 | * it would be nice to assume there are no such things as "builtin software" | 117 | * it would be nice to assume there are no such things as "builtin software" |
125 | * implementations. */ | 118 | * implementations. */ |
126 | int (*rsa_keygen)(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); | 119 | int (*rsa_keygen)(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); |
127 | }; | 120 | }; |
128 | 121 | ||
129 | struct rsa_st | 122 | struct rsa_st { |
130 | { | ||
131 | /* The first parameter is used to pickup errors where | 123 | /* The first parameter is used to pickup errors where |
132 | * this is passed instead of aEVP_PKEY, it is set to 0 */ | 124 | * this is passed instead of aEVP_PKEY, it is set to 0 */ |
133 | int pad; | 125 | int pad; |
@@ -157,7 +149,7 @@ struct rsa_st | |||
157 | * NULL */ | 149 | * NULL */ |
158 | BN_BLINDING *blinding; | 150 | BN_BLINDING *blinding; |
159 | BN_BLINDING *mt_blinding; | 151 | BN_BLINDING *mt_blinding; |
160 | }; | 152 | }; |
161 | 153 | ||
162 | #ifndef OPENSSL_RSA_MAX_MODULUS_BITS | 154 | #ifndef OPENSSL_RSA_MAX_MODULUS_BITS |
163 | # define OPENSSL_RSA_MAX_MODULUS_BITS 16384 | 155 | # define OPENSSL_RSA_MAX_MODULUS_BITS 16384 |
@@ -198,13 +190,13 @@ struct rsa_st | |||
198 | #define RSA_FLAG_NO_CONSTTIME 0x0100 /* new with 0.9.8f; the built-in RSA | 190 | #define RSA_FLAG_NO_CONSTTIME 0x0100 /* new with 0.9.8f; the built-in RSA |
199 | * implementation now uses constant time | 191 | * implementation now uses constant time |
200 | * operations by default in private key operations, | 192 | * operations by default in private key operations, |
201 | * e.g., constant time modular exponentiation, | 193 | * e.g., constant time modular exponentiation, |
202 | * modular inverse without leaking branches, | 194 | * modular inverse without leaking branches, |
203 | * division without leaking branches. This | 195 | * division without leaking branches. This |
204 | * flag disables these constant time | 196 | * flag disables these constant time |
205 | * operations and results in faster RSA | 197 | * operations and results in faster RSA |
206 | * private key operations. | 198 | * private key operations. |
207 | */ | 199 | */ |
208 | #ifndef OPENSSL_NO_DEPRECATED | 200 | #ifndef OPENSSL_NO_DEPRECATED |
209 | #define RSA_FLAG_NO_EXP_CONSTTIME RSA_FLAG_NO_CONSTTIME /* deprecated name for the flag*/ | 201 | #define RSA_FLAG_NO_EXP_CONSTTIME RSA_FLAG_NO_CONSTTIME /* deprecated name for the flag*/ |
210 | /* new with 0.9.7h; the built-in RSA | 202 | /* new with 0.9.7h; the built-in RSA |
@@ -277,34 +269,34 @@ struct rsa_st | |||
277 | #define RSA_set_app_data(s,arg) RSA_set_ex_data(s,0,arg) | 269 | #define RSA_set_app_data(s,arg) RSA_set_ex_data(s,0,arg) |
278 | #define RSA_get_app_data(s) RSA_get_ex_data(s,0) | 270 | #define RSA_get_app_data(s) RSA_get_ex_data(s,0) |
279 | 271 | ||
280 | RSA * RSA_new(void); | 272 | RSA *RSA_new(void); |
281 | RSA * RSA_new_method(ENGINE *engine); | 273 | RSA *RSA_new_method(ENGINE *engine); |
282 | int RSA_size(const RSA *rsa); | 274 | int RSA_size(const RSA *rsa); |
283 | 275 | ||
284 | /* Deprecated version */ | 276 | /* Deprecated version */ |
285 | #ifndef OPENSSL_NO_DEPRECATED | 277 | #ifndef OPENSSL_NO_DEPRECATED |
286 | RSA * RSA_generate_key(int bits, unsigned long e,void | 278 | RSA *RSA_generate_key(int bits, unsigned long e, |
287 | (*callback)(int,int,void *),void *cb_arg); | 279 | void (*callback)(int, int, void *), void *cb_arg); |
288 | #endif /* !defined(OPENSSL_NO_DEPRECATED) */ | 280 | #endif /* !defined(OPENSSL_NO_DEPRECATED) */ |
289 | 281 | ||
290 | /* New version */ | 282 | /* New version */ |
291 | int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); | 283 | int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); |
292 | 284 | ||
293 | int RSA_check_key(const RSA *); | 285 | int RSA_check_key(const RSA *); |
294 | /* next 4 return -1 on error */ | 286 | /* next 4 return -1 on error */ |
295 | int RSA_public_encrypt(int flen, const unsigned char *from, | 287 | int RSA_public_encrypt(int flen, const unsigned char *from, |
296 | unsigned char *to, RSA *rsa,int padding); | 288 | unsigned char *to, RSA *rsa, int padding); |
297 | int RSA_private_encrypt(int flen, const unsigned char *from, | 289 | int RSA_private_encrypt(int flen, const unsigned char *from, |
298 | unsigned char *to, RSA *rsa,int padding); | 290 | unsigned char *to, RSA *rsa, int padding); |
299 | int RSA_public_decrypt(int flen, const unsigned char *from, | 291 | int RSA_public_decrypt(int flen, const unsigned char *from, |
300 | unsigned char *to, RSA *rsa,int padding); | 292 | unsigned char *to, RSA *rsa, int padding); |
301 | int RSA_private_decrypt(int flen, const unsigned char *from, | 293 | int RSA_private_decrypt(int flen, const unsigned char *from, |
302 | unsigned char *to, RSA *rsa,int padding); | 294 | unsigned char *to, RSA *rsa, int padding); |
303 | void RSA_free (RSA *r); | 295 | void RSA_free (RSA *r); |
304 | /* "up" the RSA object's reference count */ | 296 | /* "up" the RSA object's reference count */ |
305 | int RSA_up_ref(RSA *r); | 297 | int RSA_up_ref(RSA *r); |
306 | 298 | ||
307 | int RSA_flags(const RSA *r); | 299 | int RSA_flags(const RSA *r); |
308 | 300 | ||
309 | void RSA_set_default_method(const RSA_METHOD *meth); | 301 | void RSA_set_default_method(const RSA_METHOD *meth); |
310 | const RSA_METHOD *RSA_get_default_method(void); | 302 | const RSA_METHOD *RSA_get_default_method(void); |
@@ -319,105 +311,99 @@ const RSA_METHOD *RSA_null_method(void); | |||
319 | DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPublicKey) | 311 | DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPublicKey) |
320 | DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey) | 312 | DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey) |
321 | 313 | ||
322 | typedef struct rsa_pss_params_st | 314 | typedef struct rsa_pss_params_st { |
323 | { | ||
324 | X509_ALGOR *hashAlgorithm; | 315 | X509_ALGOR *hashAlgorithm; |
325 | X509_ALGOR *maskGenAlgorithm; | 316 | X509_ALGOR *maskGenAlgorithm; |
326 | ASN1_INTEGER *saltLength; | 317 | ASN1_INTEGER *saltLength; |
327 | ASN1_INTEGER *trailerField; | 318 | ASN1_INTEGER *trailerField; |
328 | } RSA_PSS_PARAMS; | 319 | } RSA_PSS_PARAMS; |
329 | 320 | ||
330 | DECLARE_ASN1_FUNCTIONS(RSA_PSS_PARAMS) | 321 | DECLARE_ASN1_FUNCTIONS(RSA_PSS_PARAMS) |
331 | 322 | ||
332 | int RSA_print_fp(FILE *fp, const RSA *r,int offset); | 323 | int RSA_print_fp(FILE *fp, const RSA *r, int offset); |
333 | 324 | ||
334 | #ifndef OPENSSL_NO_BIO | 325 | #ifndef OPENSSL_NO_BIO |
335 | int RSA_print(BIO *bp, const RSA *r,int offset); | 326 | int RSA_print(BIO *bp, const RSA *r, int offset); |
336 | #endif | 327 | #endif |
337 | 328 | ||
338 | #ifndef OPENSSL_NO_RC4 | 329 | #ifndef OPENSSL_NO_RC4 |
339 | int i2d_RSA_NET(const RSA *a, unsigned char **pp, | 330 | int i2d_RSA_NET(const RSA *a, unsigned char **pp, |
340 | int (*cb)(char *buf, int len, const char *prompt, int verify), | 331 | int (*cb)(char *buf, int len, const char *prompt, int verify), int sgckey); |
341 | int sgckey); | ||
342 | RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length, | 332 | RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length, |
343 | int (*cb)(char *buf, int len, const char *prompt, int verify), | 333 | int (*cb)(char *buf, int len, const char *prompt, int verify), int sgckey); |
344 | int sgckey); | ||
345 | 334 | ||
346 | int i2d_Netscape_RSA(const RSA *a, unsigned char **pp, | 335 | int i2d_Netscape_RSA(const RSA *a, unsigned char **pp, |
347 | int (*cb)(char *buf, int len, const char *prompt, | 336 | int (*cb)(char *buf, int len, const char *prompt, int verify)); |
348 | int verify)); | ||
349 | RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length, | 337 | RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length, |
350 | int (*cb)(char *buf, int len, const char *prompt, | 338 | int (*cb)(char *buf, int len, const char *prompt, int verify)); |
351 | int verify)); | ||
352 | #endif | 339 | #endif |
353 | 340 | ||
354 | /* The following 2 functions sign and verify a X509_SIG ASN1 object | 341 | /* The following 2 functions sign and verify a X509_SIG ASN1 object |
355 | * inside PKCS#1 padded RSA encryption */ | 342 | * inside PKCS#1 padded RSA encryption */ |
356 | int RSA_sign(int type, const unsigned char *m, unsigned int m_length, | 343 | int RSA_sign(int type, const unsigned char *m, unsigned int m_length, |
357 | unsigned char *sigret, unsigned int *siglen, RSA *rsa); | 344 | unsigned char *sigret, unsigned int *siglen, RSA *rsa); |
358 | int RSA_verify(int type, const unsigned char *m, unsigned int m_length, | 345 | int RSA_verify(int type, const unsigned char *m, unsigned int m_length, |
359 | const unsigned char *sigbuf, unsigned int siglen, RSA *rsa); | 346 | const unsigned char *sigbuf, unsigned int siglen, RSA *rsa); |
360 | 347 | ||
361 | /* The following 2 function sign and verify a ASN1_OCTET_STRING | 348 | /* The following 2 function sign and verify a ASN1_OCTET_STRING |
362 | * object inside PKCS#1 padded RSA encryption */ | 349 | * object inside PKCS#1 padded RSA encryption */ |
363 | int RSA_sign_ASN1_OCTET_STRING(int type, | 350 | int RSA_sign_ASN1_OCTET_STRING(int type, const unsigned char *m, |
364 | const unsigned char *m, unsigned int m_length, | 351 | unsigned int m_length, unsigned char *sigret, unsigned int *siglen, |
365 | unsigned char *sigret, unsigned int *siglen, RSA *rsa); | 352 | RSA *rsa); |
366 | int RSA_verify_ASN1_OCTET_STRING(int type, | 353 | int RSA_verify_ASN1_OCTET_STRING(int type, const unsigned char *m, |
367 | const unsigned char *m, unsigned int m_length, | 354 | unsigned int m_length, unsigned char *sigbuf, unsigned int siglen, |
368 | unsigned char *sigbuf, unsigned int siglen, RSA *rsa); | 355 | RSA *rsa); |
369 | 356 | ||
370 | int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); | 357 | int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); |
371 | void RSA_blinding_off(RSA *rsa); | 358 | void RSA_blinding_off(RSA *rsa); |
372 | BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx); | 359 | BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx); |
373 | 360 | ||
374 | int RSA_padding_add_PKCS1_type_1(unsigned char *to,int tlen, | 361 | int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, |
375 | const unsigned char *f,int fl); | 362 | const unsigned char *f, int fl); |
376 | int RSA_padding_check_PKCS1_type_1(unsigned char *to,int tlen, | 363 | int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen, |
377 | const unsigned char *f,int fl,int rsa_len); | 364 | const unsigned char *f, int fl, int rsa_len); |
378 | int RSA_padding_add_PKCS1_type_2(unsigned char *to,int tlen, | 365 | int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, |
379 | const unsigned char *f,int fl); | 366 | const unsigned char *f, int fl); |
380 | int RSA_padding_check_PKCS1_type_2(unsigned char *to,int tlen, | 367 | int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, |
381 | const unsigned char *f,int fl,int rsa_len); | 368 | const unsigned char *f, int fl, int rsa_len); |
382 | int PKCS1_MGF1(unsigned char *mask, long len, | 369 | int PKCS1_MGF1(unsigned char *mask, long len, |
383 | const unsigned char *seed, long seedlen, const EVP_MD *dgst); | 370 | const unsigned char *seed, long seedlen, const EVP_MD *dgst); |
384 | int RSA_padding_add_PKCS1_OAEP(unsigned char *to,int tlen, | 371 | int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, |
385 | const unsigned char *f,int fl, | 372 | const unsigned char *f, int fl, |
386 | const unsigned char *p,int pl); | 373 | const unsigned char *p, int pl); |
387 | int RSA_padding_check_PKCS1_OAEP(unsigned char *to,int tlen, | 374 | int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, |
388 | const unsigned char *f,int fl,int rsa_len, | 375 | const unsigned char *f, int fl, int rsa_len, |
389 | const unsigned char *p,int pl); | 376 | const unsigned char *p, int pl); |
390 | int RSA_padding_add_SSLv23(unsigned char *to,int tlen, | 377 | int RSA_padding_add_SSLv23(unsigned char *to, int tlen, |
391 | const unsigned char *f,int fl); | 378 | const unsigned char *f, int fl); |
392 | int RSA_padding_check_SSLv23(unsigned char *to,int tlen, | 379 | int RSA_padding_check_SSLv23(unsigned char *to, int tlen, |
393 | const unsigned char *f,int fl,int rsa_len); | 380 | const unsigned char *f, int fl, int rsa_len); |
394 | int RSA_padding_add_none(unsigned char *to,int tlen, | 381 | int RSA_padding_add_none(unsigned char *to, int tlen, |
395 | const unsigned char *f,int fl); | 382 | const unsigned char *f, int fl); |
396 | int RSA_padding_check_none(unsigned char *to,int tlen, | 383 | int RSA_padding_check_none(unsigned char *to, int tlen, |
397 | const unsigned char *f,int fl,int rsa_len); | 384 | const unsigned char *f, int fl, int rsa_len); |
398 | int RSA_padding_add_X931(unsigned char *to,int tlen, | 385 | int RSA_padding_add_X931(unsigned char *to, int tlen, |
399 | const unsigned char *f,int fl); | 386 | const unsigned char *f, int fl); |
400 | int RSA_padding_check_X931(unsigned char *to,int tlen, | 387 | int RSA_padding_check_X931(unsigned char *to, int tlen, |
401 | const unsigned char *f,int fl,int rsa_len); | 388 | const unsigned char *f, int fl, int rsa_len); |
402 | int RSA_X931_hash_id(int nid); | 389 | int RSA_X931_hash_id(int nid); |
403 | 390 | ||
404 | int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash, | 391 | int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash, |
405 | const EVP_MD *Hash, const unsigned char *EM, int sLen); | 392 | const EVP_MD *Hash, const unsigned char *EM, int sLen); |
406 | int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM, | 393 | int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM, |
407 | const unsigned char *mHash, | 394 | const unsigned char *mHash, const EVP_MD *Hash, int sLen); |
408 | const EVP_MD *Hash, int sLen); | ||
409 | 395 | ||
410 | int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, | 396 | int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, |
411 | const EVP_MD *Hash, const EVP_MD *mgf1Hash, | 397 | const EVP_MD *Hash, const EVP_MD *mgf1Hash, const unsigned char *EM, |
412 | const unsigned char *EM, int sLen); | 398 | int sLen); |
413 | 399 | ||
414 | int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, | 400 | int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, |
415 | const unsigned char *mHash, | 401 | const unsigned char *mHash, const EVP_MD *Hash, const EVP_MD *mgf1Hash, |
416 | const EVP_MD *Hash, const EVP_MD *mgf1Hash, int sLen); | 402 | int sLen); |
417 | 403 | ||
418 | int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | 404 | int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, |
419 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); | 405 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); |
420 | int RSA_set_ex_data(RSA *r,int idx,void *arg); | 406 | int RSA_set_ex_data(RSA *r, int idx, void *arg); |
421 | void *RSA_get_ex_data(const RSA *r, int idx); | 407 | void *RSA_get_ex_data(const RSA *r, int idx); |
422 | 408 | ||
423 | RSA *RSAPublicKey_dup(RSA *rsa); | 409 | RSA *RSAPublicKey_dup(RSA *rsa); |
diff --git a/src/lib/libcrypto/rsa/rsa_locl.h b/src/lib/libcrypto/rsa/rsa_locl.h index 3c2de4826d..24da0dc179 100644 --- a/src/lib/libcrypto/rsa/rsa_locl.h +++ b/src/lib/libcrypto/rsa/rsa_locl.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_locl.h,v 1.2 2014/06/12 15:49:30 deraadt Exp $ */ | 1 | /* $OpenBSD: rsa_locl.h,v 1.3 2014/07/09 19:51:31 jsing Exp $ */ |
2 | extern int int_rsa_verify(int dtype, const unsigned char *m, unsigned int m_len, | 2 | extern int int_rsa_verify(int dtype, const unsigned char *m, |
3 | unsigned char *rm, size_t *prm_len, | 3 | unsigned int m_len, unsigned char *rm, size_t *prm_len, |
4 | const unsigned char *sigbuf, size_t siglen, | 4 | const unsigned char *sigbuf, size_t siglen, RSA *rsa); |
5 | RSA *rsa); | ||
diff --git a/src/lib/libssl/src/crypto/rsa/rsa.h b/src/lib/libssl/src/crypto/rsa/rsa.h index daea33ff60..f51a807c3c 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa.h +++ b/src/lib/libssl/src/crypto/rsa/rsa.h | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: rsa.h,v 1.20 2014/07/09 08:55:32 miod Exp $ */ | 1 | /* $OpenBSD: rsa.h,v 1.21 2014/07/09 19:51:31 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
8 | * | 8 | * |
9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
11 | * apply to all code found in this distribution, be it the RC4, RSA, | 11 | * apply to all code found in this distribution, be it the RC4, RSA, |
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation |
13 | * included with this distribution is covered by the same copyright terms | 13 | * included with this distribution is covered by the same copyright terms |
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
15 | * | 15 | * |
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
18 | * If this package is used in a product, Eric Young should be given attribution | 18 | * If this package is used in a product, Eric Young should be given attribution |
19 | * as the author of the parts of the library used. | 19 | * as the author of the parts of the library used. |
20 | * This can be in the form of a textual message at program startup or | 20 | * This can be in the form of a textual message at program startup or |
21 | * in documentation (online or textual) provided with the package. | 21 | * in documentation (online or textual) provided with the package. |
22 | * | 22 | * |
23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
25 | * are met: | 25 | * are met: |
@@ -34,10 +34,10 @@ | |||
34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 37 | * 4. If you include any Windows specific code (or a derivative thereof) from |
38 | * the apps directory (application code) you must include an acknowledgement: | 38 | * the apps directory (application code) you must include an acknowledgement: |
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
40 | * | 40 | * |
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
@@ -49,7 +49,7 @@ | |||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
52 | * | 52 | * |
53 | * The licence and distribution terms for any publically available version or | 53 | * The licence and distribution terms for any publically available version or |
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
@@ -82,25 +82,20 @@ extern "C" { | |||
82 | /* typedef struct rsa_st RSA; */ | 82 | /* typedef struct rsa_st RSA; */ |
83 | /* typedef struct rsa_meth_st RSA_METHOD; */ | 83 | /* typedef struct rsa_meth_st RSA_METHOD; */ |
84 | 84 | ||
85 | struct rsa_meth_st | 85 | struct rsa_meth_st { |
86 | { | ||
87 | const char *name; | 86 | const char *name; |
88 | int (*rsa_pub_enc)(int flen,const unsigned char *from, | 87 | int (*rsa_pub_enc)(int flen, const unsigned char *from, |
89 | unsigned char *to, | 88 | unsigned char *to, RSA *rsa, int padding); |
90 | RSA *rsa,int padding); | 89 | int (*rsa_pub_dec)(int flen, const unsigned char *from, |
91 | int (*rsa_pub_dec)(int flen,const unsigned char *from, | 90 | unsigned char *to, RSA *rsa, int padding); |
92 | unsigned char *to, | 91 | int (*rsa_priv_enc)(int flen, const unsigned char *from, |
93 | RSA *rsa,int padding); | 92 | unsigned char *to, RSA *rsa, int padding); |
94 | int (*rsa_priv_enc)(int flen,const unsigned char *from, | 93 | int (*rsa_priv_dec)(int flen, const unsigned char *from, |
95 | unsigned char *to, | 94 | unsigned char *to, RSA *rsa, int padding); |
96 | RSA *rsa,int padding); | 95 | int (*rsa_mod_exp)(BIGNUM *r0, const BIGNUM *I, RSA *rsa, |
97 | int (*rsa_priv_dec)(int flen,const unsigned char *from, | 96 | BN_CTX *ctx); /* Can be null */ |
98 | unsigned char *to, | ||
99 | RSA *rsa,int padding); | ||
100 | int (*rsa_mod_exp)(BIGNUM *r0,const BIGNUM *I,RSA *rsa,BN_CTX *ctx); /* Can be null */ | ||
101 | int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | 97 | int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, |
102 | const BIGNUM *m, BN_CTX *ctx, | 98 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); /* Can be null */ |
103 | BN_MONT_CTX *m_ctx); /* Can be null */ | ||
104 | int (*init)(RSA *rsa); /* called at new */ | 99 | int (*init)(RSA *rsa); /* called at new */ |
105 | int (*finish)(RSA *rsa); /* called at free */ | 100 | int (*finish)(RSA *rsa); /* called at free */ |
106 | int flags; /* RSA_METHOD_FLAG_* things */ | 101 | int flags; /* RSA_METHOD_FLAG_* things */ |
@@ -112,22 +107,19 @@ struct rsa_meth_st | |||
112 | * compatibility this functionality is only enabled if the RSA_FLAG_SIGN_VER | 107 | * compatibility this functionality is only enabled if the RSA_FLAG_SIGN_VER |
113 | * option is set in 'flags'. | 108 | * option is set in 'flags'. |
114 | */ | 109 | */ |
115 | int (*rsa_sign)(int type, | 110 | int (*rsa_sign)(int type, const unsigned char *m, unsigned int m_length, |
116 | const unsigned char *m, unsigned int m_length, | 111 | unsigned char *sigret, unsigned int *siglen, const RSA *rsa); |
117 | unsigned char *sigret, unsigned int *siglen, const RSA *rsa); | 112 | int (*rsa_verify)(int dtype, const unsigned char *m, |
118 | int (*rsa_verify)(int dtype, | 113 | unsigned int m_length, const unsigned char *sigbuf, |
119 | const unsigned char *m, unsigned int m_length, | 114 | unsigned int siglen, const RSA *rsa); |
120 | const unsigned char *sigbuf, unsigned int siglen, | ||
121 | const RSA *rsa); | ||
122 | /* If this callback is NULL, the builtin software RSA key-gen will be used. This | 115 | /* If this callback is NULL, the builtin software RSA key-gen will be used. This |
123 | * is for behavioural compatibility whilst the code gets rewired, but one day | 116 | * is for behavioural compatibility whilst the code gets rewired, but one day |
124 | * it would be nice to assume there are no such things as "builtin software" | 117 | * it would be nice to assume there are no such things as "builtin software" |
125 | * implementations. */ | 118 | * implementations. */ |
126 | int (*rsa_keygen)(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); | 119 | int (*rsa_keygen)(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); |
127 | }; | 120 | }; |
128 | 121 | ||
129 | struct rsa_st | 122 | struct rsa_st { |
130 | { | ||
131 | /* The first parameter is used to pickup errors where | 123 | /* The first parameter is used to pickup errors where |
132 | * this is passed instead of aEVP_PKEY, it is set to 0 */ | 124 | * this is passed instead of aEVP_PKEY, it is set to 0 */ |
133 | int pad; | 125 | int pad; |
@@ -157,7 +149,7 @@ struct rsa_st | |||
157 | * NULL */ | 149 | * NULL */ |
158 | BN_BLINDING *blinding; | 150 | BN_BLINDING *blinding; |
159 | BN_BLINDING *mt_blinding; | 151 | BN_BLINDING *mt_blinding; |
160 | }; | 152 | }; |
161 | 153 | ||
162 | #ifndef OPENSSL_RSA_MAX_MODULUS_BITS | 154 | #ifndef OPENSSL_RSA_MAX_MODULUS_BITS |
163 | # define OPENSSL_RSA_MAX_MODULUS_BITS 16384 | 155 | # define OPENSSL_RSA_MAX_MODULUS_BITS 16384 |
@@ -198,13 +190,13 @@ struct rsa_st | |||
198 | #define RSA_FLAG_NO_CONSTTIME 0x0100 /* new with 0.9.8f; the built-in RSA | 190 | #define RSA_FLAG_NO_CONSTTIME 0x0100 /* new with 0.9.8f; the built-in RSA |
199 | * implementation now uses constant time | 191 | * implementation now uses constant time |
200 | * operations by default in private key operations, | 192 | * operations by default in private key operations, |
201 | * e.g., constant time modular exponentiation, | 193 | * e.g., constant time modular exponentiation, |
202 | * modular inverse without leaking branches, | 194 | * modular inverse without leaking branches, |
203 | * division without leaking branches. This | 195 | * division without leaking branches. This |
204 | * flag disables these constant time | 196 | * flag disables these constant time |
205 | * operations and results in faster RSA | 197 | * operations and results in faster RSA |
206 | * private key operations. | 198 | * private key operations. |
207 | */ | 199 | */ |
208 | #ifndef OPENSSL_NO_DEPRECATED | 200 | #ifndef OPENSSL_NO_DEPRECATED |
209 | #define RSA_FLAG_NO_EXP_CONSTTIME RSA_FLAG_NO_CONSTTIME /* deprecated name for the flag*/ | 201 | #define RSA_FLAG_NO_EXP_CONSTTIME RSA_FLAG_NO_CONSTTIME /* deprecated name for the flag*/ |
210 | /* new with 0.9.7h; the built-in RSA | 202 | /* new with 0.9.7h; the built-in RSA |
@@ -277,34 +269,34 @@ struct rsa_st | |||
277 | #define RSA_set_app_data(s,arg) RSA_set_ex_data(s,0,arg) | 269 | #define RSA_set_app_data(s,arg) RSA_set_ex_data(s,0,arg) |
278 | #define RSA_get_app_data(s) RSA_get_ex_data(s,0) | 270 | #define RSA_get_app_data(s) RSA_get_ex_data(s,0) |
279 | 271 | ||
280 | RSA * RSA_new(void); | 272 | RSA *RSA_new(void); |
281 | RSA * RSA_new_method(ENGINE *engine); | 273 | RSA *RSA_new_method(ENGINE *engine); |
282 | int RSA_size(const RSA *rsa); | 274 | int RSA_size(const RSA *rsa); |
283 | 275 | ||
284 | /* Deprecated version */ | 276 | /* Deprecated version */ |
285 | #ifndef OPENSSL_NO_DEPRECATED | 277 | #ifndef OPENSSL_NO_DEPRECATED |
286 | RSA * RSA_generate_key(int bits, unsigned long e,void | 278 | RSA *RSA_generate_key(int bits, unsigned long e, |
287 | (*callback)(int,int,void *),void *cb_arg); | 279 | void (*callback)(int, int, void *), void *cb_arg); |
288 | #endif /* !defined(OPENSSL_NO_DEPRECATED) */ | 280 | #endif /* !defined(OPENSSL_NO_DEPRECATED) */ |
289 | 281 | ||
290 | /* New version */ | 282 | /* New version */ |
291 | int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); | 283 | int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); |
292 | 284 | ||
293 | int RSA_check_key(const RSA *); | 285 | int RSA_check_key(const RSA *); |
294 | /* next 4 return -1 on error */ | 286 | /* next 4 return -1 on error */ |
295 | int RSA_public_encrypt(int flen, const unsigned char *from, | 287 | int RSA_public_encrypt(int flen, const unsigned char *from, |
296 | unsigned char *to, RSA *rsa,int padding); | 288 | unsigned char *to, RSA *rsa, int padding); |
297 | int RSA_private_encrypt(int flen, const unsigned char *from, | 289 | int RSA_private_encrypt(int flen, const unsigned char *from, |
298 | unsigned char *to, RSA *rsa,int padding); | 290 | unsigned char *to, RSA *rsa, int padding); |
299 | int RSA_public_decrypt(int flen, const unsigned char *from, | 291 | int RSA_public_decrypt(int flen, const unsigned char *from, |
300 | unsigned char *to, RSA *rsa,int padding); | 292 | unsigned char *to, RSA *rsa, int padding); |
301 | int RSA_private_decrypt(int flen, const unsigned char *from, | 293 | int RSA_private_decrypt(int flen, const unsigned char *from, |
302 | unsigned char *to, RSA *rsa,int padding); | 294 | unsigned char *to, RSA *rsa, int padding); |
303 | void RSA_free (RSA *r); | 295 | void RSA_free (RSA *r); |
304 | /* "up" the RSA object's reference count */ | 296 | /* "up" the RSA object's reference count */ |
305 | int RSA_up_ref(RSA *r); | 297 | int RSA_up_ref(RSA *r); |
306 | 298 | ||
307 | int RSA_flags(const RSA *r); | 299 | int RSA_flags(const RSA *r); |
308 | 300 | ||
309 | void RSA_set_default_method(const RSA_METHOD *meth); | 301 | void RSA_set_default_method(const RSA_METHOD *meth); |
310 | const RSA_METHOD *RSA_get_default_method(void); | 302 | const RSA_METHOD *RSA_get_default_method(void); |
@@ -319,105 +311,99 @@ const RSA_METHOD *RSA_null_method(void); | |||
319 | DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPublicKey) | 311 | DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPublicKey) |
320 | DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey) | 312 | DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey) |
321 | 313 | ||
322 | typedef struct rsa_pss_params_st | 314 | typedef struct rsa_pss_params_st { |
323 | { | ||
324 | X509_ALGOR *hashAlgorithm; | 315 | X509_ALGOR *hashAlgorithm; |
325 | X509_ALGOR *maskGenAlgorithm; | 316 | X509_ALGOR *maskGenAlgorithm; |
326 | ASN1_INTEGER *saltLength; | 317 | ASN1_INTEGER *saltLength; |
327 | ASN1_INTEGER *trailerField; | 318 | ASN1_INTEGER *trailerField; |
328 | } RSA_PSS_PARAMS; | 319 | } RSA_PSS_PARAMS; |
329 | 320 | ||
330 | DECLARE_ASN1_FUNCTIONS(RSA_PSS_PARAMS) | 321 | DECLARE_ASN1_FUNCTIONS(RSA_PSS_PARAMS) |
331 | 322 | ||
332 | int RSA_print_fp(FILE *fp, const RSA *r,int offset); | 323 | int RSA_print_fp(FILE *fp, const RSA *r, int offset); |
333 | 324 | ||
334 | #ifndef OPENSSL_NO_BIO | 325 | #ifndef OPENSSL_NO_BIO |
335 | int RSA_print(BIO *bp, const RSA *r,int offset); | 326 | int RSA_print(BIO *bp, const RSA *r, int offset); |
336 | #endif | 327 | #endif |
337 | 328 | ||
338 | #ifndef OPENSSL_NO_RC4 | 329 | #ifndef OPENSSL_NO_RC4 |
339 | int i2d_RSA_NET(const RSA *a, unsigned char **pp, | 330 | int i2d_RSA_NET(const RSA *a, unsigned char **pp, |
340 | int (*cb)(char *buf, int len, const char *prompt, int verify), | 331 | int (*cb)(char *buf, int len, const char *prompt, int verify), int sgckey); |
341 | int sgckey); | ||
342 | RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length, | 332 | RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length, |
343 | int (*cb)(char *buf, int len, const char *prompt, int verify), | 333 | int (*cb)(char *buf, int len, const char *prompt, int verify), int sgckey); |
344 | int sgckey); | ||
345 | 334 | ||
346 | int i2d_Netscape_RSA(const RSA *a, unsigned char **pp, | 335 | int i2d_Netscape_RSA(const RSA *a, unsigned char **pp, |
347 | int (*cb)(char *buf, int len, const char *prompt, | 336 | int (*cb)(char *buf, int len, const char *prompt, int verify)); |
348 | int verify)); | ||
349 | RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length, | 337 | RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length, |
350 | int (*cb)(char *buf, int len, const char *prompt, | 338 | int (*cb)(char *buf, int len, const char *prompt, int verify)); |
351 | int verify)); | ||
352 | #endif | 339 | #endif |
353 | 340 | ||
354 | /* The following 2 functions sign and verify a X509_SIG ASN1 object | 341 | /* The following 2 functions sign and verify a X509_SIG ASN1 object |
355 | * inside PKCS#1 padded RSA encryption */ | 342 | * inside PKCS#1 padded RSA encryption */ |
356 | int RSA_sign(int type, const unsigned char *m, unsigned int m_length, | 343 | int RSA_sign(int type, const unsigned char *m, unsigned int m_length, |
357 | unsigned char *sigret, unsigned int *siglen, RSA *rsa); | 344 | unsigned char *sigret, unsigned int *siglen, RSA *rsa); |
358 | int RSA_verify(int type, const unsigned char *m, unsigned int m_length, | 345 | int RSA_verify(int type, const unsigned char *m, unsigned int m_length, |
359 | const unsigned char *sigbuf, unsigned int siglen, RSA *rsa); | 346 | const unsigned char *sigbuf, unsigned int siglen, RSA *rsa); |
360 | 347 | ||
361 | /* The following 2 function sign and verify a ASN1_OCTET_STRING | 348 | /* The following 2 function sign and verify a ASN1_OCTET_STRING |
362 | * object inside PKCS#1 padded RSA encryption */ | 349 | * object inside PKCS#1 padded RSA encryption */ |
363 | int RSA_sign_ASN1_OCTET_STRING(int type, | 350 | int RSA_sign_ASN1_OCTET_STRING(int type, const unsigned char *m, |
364 | const unsigned char *m, unsigned int m_length, | 351 | unsigned int m_length, unsigned char *sigret, unsigned int *siglen, |
365 | unsigned char *sigret, unsigned int *siglen, RSA *rsa); | 352 | RSA *rsa); |
366 | int RSA_verify_ASN1_OCTET_STRING(int type, | 353 | int RSA_verify_ASN1_OCTET_STRING(int type, const unsigned char *m, |
367 | const unsigned char *m, unsigned int m_length, | 354 | unsigned int m_length, unsigned char *sigbuf, unsigned int siglen, |
368 | unsigned char *sigbuf, unsigned int siglen, RSA *rsa); | 355 | RSA *rsa); |
369 | 356 | ||
370 | int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); | 357 | int RSA_blinding_on(RSA *rsa, BN_CTX *ctx); |
371 | void RSA_blinding_off(RSA *rsa); | 358 | void RSA_blinding_off(RSA *rsa); |
372 | BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx); | 359 | BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx); |
373 | 360 | ||
374 | int RSA_padding_add_PKCS1_type_1(unsigned char *to,int tlen, | 361 | int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, |
375 | const unsigned char *f,int fl); | 362 | const unsigned char *f, int fl); |
376 | int RSA_padding_check_PKCS1_type_1(unsigned char *to,int tlen, | 363 | int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen, |
377 | const unsigned char *f,int fl,int rsa_len); | 364 | const unsigned char *f, int fl, int rsa_len); |
378 | int RSA_padding_add_PKCS1_type_2(unsigned char *to,int tlen, | 365 | int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, |
379 | const unsigned char *f,int fl); | 366 | const unsigned char *f, int fl); |
380 | int RSA_padding_check_PKCS1_type_2(unsigned char *to,int tlen, | 367 | int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, |
381 | const unsigned char *f,int fl,int rsa_len); | 368 | const unsigned char *f, int fl, int rsa_len); |
382 | int PKCS1_MGF1(unsigned char *mask, long len, | 369 | int PKCS1_MGF1(unsigned char *mask, long len, |
383 | const unsigned char *seed, long seedlen, const EVP_MD *dgst); | 370 | const unsigned char *seed, long seedlen, const EVP_MD *dgst); |
384 | int RSA_padding_add_PKCS1_OAEP(unsigned char *to,int tlen, | 371 | int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, |
385 | const unsigned char *f,int fl, | 372 | const unsigned char *f, int fl, |
386 | const unsigned char *p,int pl); | 373 | const unsigned char *p, int pl); |
387 | int RSA_padding_check_PKCS1_OAEP(unsigned char *to,int tlen, | 374 | int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, |
388 | const unsigned char *f,int fl,int rsa_len, | 375 | const unsigned char *f, int fl, int rsa_len, |
389 | const unsigned char *p,int pl); | 376 | const unsigned char *p, int pl); |
390 | int RSA_padding_add_SSLv23(unsigned char *to,int tlen, | 377 | int RSA_padding_add_SSLv23(unsigned char *to, int tlen, |
391 | const unsigned char *f,int fl); | 378 | const unsigned char *f, int fl); |
392 | int RSA_padding_check_SSLv23(unsigned char *to,int tlen, | 379 | int RSA_padding_check_SSLv23(unsigned char *to, int tlen, |
393 | const unsigned char *f,int fl,int rsa_len); | 380 | const unsigned char *f, int fl, int rsa_len); |
394 | int RSA_padding_add_none(unsigned char *to,int tlen, | 381 | int RSA_padding_add_none(unsigned char *to, int tlen, |
395 | const unsigned char *f,int fl); | 382 | const unsigned char *f, int fl); |
396 | int RSA_padding_check_none(unsigned char *to,int tlen, | 383 | int RSA_padding_check_none(unsigned char *to, int tlen, |
397 | const unsigned char *f,int fl,int rsa_len); | 384 | const unsigned char *f, int fl, int rsa_len); |
398 | int RSA_padding_add_X931(unsigned char *to,int tlen, | 385 | int RSA_padding_add_X931(unsigned char *to, int tlen, |
399 | const unsigned char *f,int fl); | 386 | const unsigned char *f, int fl); |
400 | int RSA_padding_check_X931(unsigned char *to,int tlen, | 387 | int RSA_padding_check_X931(unsigned char *to, int tlen, |
401 | const unsigned char *f,int fl,int rsa_len); | 388 | const unsigned char *f, int fl, int rsa_len); |
402 | int RSA_X931_hash_id(int nid); | 389 | int RSA_X931_hash_id(int nid); |
403 | 390 | ||
404 | int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash, | 391 | int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash, |
405 | const EVP_MD *Hash, const unsigned char *EM, int sLen); | 392 | const EVP_MD *Hash, const unsigned char *EM, int sLen); |
406 | int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM, | 393 | int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM, |
407 | const unsigned char *mHash, | 394 | const unsigned char *mHash, const EVP_MD *Hash, int sLen); |
408 | const EVP_MD *Hash, int sLen); | ||
409 | 395 | ||
410 | int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, | 396 | int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, |
411 | const EVP_MD *Hash, const EVP_MD *mgf1Hash, | 397 | const EVP_MD *Hash, const EVP_MD *mgf1Hash, const unsigned char *EM, |
412 | const unsigned char *EM, int sLen); | 398 | int sLen); |
413 | 399 | ||
414 | int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, | 400 | int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM, |
415 | const unsigned char *mHash, | 401 | const unsigned char *mHash, const EVP_MD *Hash, const EVP_MD *mgf1Hash, |
416 | const EVP_MD *Hash, const EVP_MD *mgf1Hash, int sLen); | 402 | int sLen); |
417 | 403 | ||
418 | int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | 404 | int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, |
419 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); | 405 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); |
420 | int RSA_set_ex_data(RSA *r,int idx,void *arg); | 406 | int RSA_set_ex_data(RSA *r, int idx, void *arg); |
421 | void *RSA_get_ex_data(const RSA *r, int idx); | 407 | void *RSA_get_ex_data(const RSA *r, int idx); |
422 | 408 | ||
423 | RSA *RSAPublicKey_dup(RSA *rsa); | 409 | RSA *RSAPublicKey_dup(RSA *rsa); |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_locl.h b/src/lib/libssl/src/crypto/rsa/rsa_locl.h index 3c2de4826d..24da0dc179 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_locl.h +++ b/src/lib/libssl/src/crypto/rsa/rsa_locl.h | |||
@@ -1,5 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_locl.h,v 1.2 2014/06/12 15:49:30 deraadt Exp $ */ | 1 | /* $OpenBSD: rsa_locl.h,v 1.3 2014/07/09 19:51:31 jsing Exp $ */ |
2 | extern int int_rsa_verify(int dtype, const unsigned char *m, unsigned int m_len, | 2 | extern int int_rsa_verify(int dtype, const unsigned char *m, |
3 | unsigned char *rm, size_t *prm_len, | 3 | unsigned int m_len, unsigned char *rm, size_t *prm_len, |
4 | const unsigned char *sigbuf, size_t siglen, | 4 | const unsigned char *sigbuf, size_t siglen, RSA *rsa); |
5 | RSA *rsa); | ||