diff options
author | jsing <> | 2014-07-09 19:51:38 +0000 |
---|---|---|
committer | jsing <> | 2014-07-09 19:51:38 +0000 |
commit | 912aa7ccdb6d6bc2bd2f8d06dccbb387e2e136cd (patch) | |
tree | b95d623ff1b12a60bca71b907401534e927f713b | |
parent | 5155b53399b3cd5c9947109652d415d6dcc6ce1d (diff) | |
download | openbsd-912aa7ccdb6d6bc2bd2f8d06dccbb387e2e136cd.tar.gz openbsd-912aa7ccdb6d6bc2bd2f8d06dccbb387e2e136cd.tar.bz2 openbsd-912aa7ccdb6d6bc2bd2f8d06dccbb387e2e136cd.zip |
More KNF.
38 files changed, 662 insertions, 644 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_ameth.c b/src/lib/libcrypto/rsa/rsa_ameth.c index 8e15e3f535..813c634f31 100644 --- a/src/lib/libcrypto/rsa/rsa_ameth.c +++ b/src/lib/libcrypto/rsa/rsa_ameth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_ameth.c,v 1.7 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_ameth.c,v 1.8 2014/07/09 19:51:38 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -104,8 +104,8 @@ rsa_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey) | |||
104 | static int | 104 | static int |
105 | rsa_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b) | 105 | rsa_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b) |
106 | { | 106 | { |
107 | if (BN_cmp(b->pkey.rsa->n,a->pkey.rsa->n) != 0 || | 107 | if (BN_cmp(b->pkey.rsa->n, a->pkey.rsa->n) != 0 || |
108 | BN_cmp(b->pkey.rsa->e,a->pkey.rsa->e) != 0) | 108 | BN_cmp(b->pkey.rsa->e, a->pkey.rsa->e) != 0) |
109 | return 0; | 109 | return 0; |
110 | return 1; | 110 | return 1; |
111 | } | 111 | } |
@@ -256,7 +256,7 @@ do_rsa_print(BIO *bp, const RSA *x, int off, int priv) | |||
256 | ret = 1; | 256 | ret = 1; |
257 | err: | 257 | err: |
258 | free(m); | 258 | free(m); |
259 | return(ret); | 259 | return (ret); |
260 | } | 260 | } |
261 | 261 | ||
262 | static int | 262 | static int |
@@ -282,13 +282,14 @@ rsa_pss_decode(const X509_ALGOR *alg, X509_ALGOR **pmaskHash) | |||
282 | 282 | ||
283 | if (!alg->parameter || alg->parameter->type != V_ASN1_SEQUENCE) | 283 | if (!alg->parameter || alg->parameter->type != V_ASN1_SEQUENCE) |
284 | return NULL; | 284 | return NULL; |
285 | |||
285 | p = alg->parameter->value.sequence->data; | 286 | p = alg->parameter->value.sequence->data; |
286 | plen = alg->parameter->value.sequence->length; | 287 | plen = alg->parameter->value.sequence->length; |
287 | pss = d2i_RSA_PSS_PARAMS(NULL, &p, plen); | 288 | pss = d2i_RSA_PSS_PARAMS(NULL, &p, plen); |
288 | 289 | ||
289 | if (!pss) | 290 | if (!pss) |
290 | return NULL; | 291 | return NULL; |
291 | 292 | ||
292 | if (pss->maskGenAlgorithm) { | 293 | if (pss->maskGenAlgorithm) { |
293 | ASN1_TYPE *param = pss->maskGenAlgorithm->parameter; | 294 | ASN1_TYPE *param = pss->maskGenAlgorithm->parameter; |
294 | if (OBJ_obj2nid(pss->maskGenAlgorithm->algorithm) == NID_mgf1 && | 295 | if (OBJ_obj2nid(pss->maskGenAlgorithm->algorithm) == NID_mgf1 && |
@@ -351,7 +352,7 @@ rsa_pss_param_print(BIO *bp, RSA_PSS_PARAMS *pss, X509_ALGOR *maskHash, | |||
351 | if (!BIO_indent(bp, indent, 128)) | 352 | if (!BIO_indent(bp, indent, 128)) |
352 | goto err; | 353 | goto err; |
353 | if (BIO_puts(bp, "Salt Length: 0x") <= 0) | 354 | if (BIO_puts(bp, "Salt Length: 0x") <= 0) |
354 | goto err; | 355 | goto err; |
355 | if (pss->saltLength) { | 356 | if (pss->saltLength) { |
356 | if (i2a_ASN1_INTEGER(bp, pss->saltLength) <= 0) | 357 | if (i2a_ASN1_INTEGER(bp, pss->saltLength) <= 0) |
357 | goto err; | 358 | goto err; |
@@ -369,7 +370,7 @@ rsa_pss_param_print(BIO *bp, RSA_PSS_PARAMS *pss, X509_ALGOR *maskHash, | |||
369 | } else if (BIO_puts(bp, "BC (default)") <= 0) | 370 | } else if (BIO_puts(bp, "BC (default)") <= 0) |
370 | goto err; | 371 | goto err; |
371 | BIO_puts(bp, "\n"); | 372 | BIO_puts(bp, "\n"); |
372 | 373 | ||
373 | rv = 1; | 374 | rv = 1; |
374 | 375 | ||
375 | err: | 376 | err: |
@@ -403,6 +404,7 @@ static int | |||
403 | rsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) | 404 | rsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) |
404 | { | 405 | { |
405 | X509_ALGOR *alg = NULL; | 406 | X509_ALGOR *alg = NULL; |
407 | |||
406 | switch (op) { | 408 | switch (op) { |
407 | case ASN1_PKEY_CTRL_PKCS7_SIGN: | 409 | case ASN1_PKEY_CTRL_PKCS7_SIGN: |
408 | if (arg1 == 0) | 410 | if (arg1 == 0) |
@@ -422,7 +424,7 @@ rsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) | |||
422 | case ASN1_PKEY_CTRL_CMS_ENVELOPE: | 424 | case ASN1_PKEY_CTRL_CMS_ENVELOPE: |
423 | if (arg1 == 0) | 425 | if (arg1 == 0) |
424 | CMS_RecipientInfo_ktri_get0_algs(arg2, NULL, NULL, &alg); | 426 | CMS_RecipientInfo_ktri_get0_algs(arg2, NULL, NULL, &alg); |
425 | break; | 427 | break; |
426 | #endif | 428 | #endif |
427 | 429 | ||
428 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: | 430 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: |
@@ -440,8 +442,8 @@ rsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) | |||
440 | return 1; | 442 | return 1; |
441 | } | 443 | } |
442 | 444 | ||
443 | /* Customised RSA item verification routine. This is called | 445 | /* Customised RSA item verification routine. This is called |
444 | * when a signature is encountered requiring special handling. We | 446 | * when a signature is encountered requiring special handling. We |
445 | * currently only handle PSS. | 447 | * currently only handle PSS. |
446 | */ | 448 | */ |
447 | static int | 449 | static int |
@@ -460,6 +462,7 @@ rsa_item_verify(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, | |||
460 | RSAerr(RSA_F_RSA_ITEM_VERIFY, RSA_R_UNSUPPORTED_SIGNATURE_TYPE); | 462 | RSAerr(RSA_F_RSA_ITEM_VERIFY, RSA_R_UNSUPPORTED_SIGNATURE_TYPE); |
461 | return -1; | 463 | return -1; |
462 | } | 464 | } |
465 | |||
463 | /* Decode PSS parameters */ | 466 | /* Decode PSS parameters */ |
464 | pss = rsa_pss_decode(sigalg, &maskHash); | 467 | pss = rsa_pss_decode(sigalg, &maskHash); |
465 | 468 | ||
@@ -544,7 +547,7 @@ err: | |||
544 | 547 | ||
545 | static int | 548 | static int |
546 | rsa_item_sign(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, | 549 | rsa_item_sign(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, |
547 | X509_ALGOR *alg1, X509_ALGOR *alg2, ASN1_BIT_STRING *sig) | 550 | X509_ALGOR *alg1, X509_ALGOR *alg2, ASN1_BIT_STRING *sig) |
548 | { | 551 | { |
549 | int pad_mode; | 552 | int pad_mode; |
550 | EVP_PKEY_CTX *pkctx = ctx->pctx; | 553 | EVP_PKEY_CTX *pkctx = ctx->pctx; |
diff --git a/src/lib/libcrypto/rsa/rsa_asn1.c b/src/lib/libcrypto/rsa/rsa_asn1.c index e876dbdf49..9bc5f17b06 100644 --- a/src/lib/libcrypto/rsa/rsa_asn1.c +++ b/src/lib/libcrypto/rsa/rsa_asn1.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_asn1.c,v 1.7 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_asn1.c,v 1.8 2014/07/09 19:51:38 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -99,10 +99,10 @@ ASN1_SEQUENCE_cb(RSAPublicKey, rsa_cb) = { | |||
99 | } ASN1_SEQUENCE_END_cb(RSA, RSAPublicKey) | 99 | } ASN1_SEQUENCE_END_cb(RSA, RSAPublicKey) |
100 | 100 | ||
101 | ASN1_SEQUENCE(RSA_PSS_PARAMS) = { | 101 | ASN1_SEQUENCE(RSA_PSS_PARAMS) = { |
102 | ASN1_EXP_OPT(RSA_PSS_PARAMS, hashAlgorithm, X509_ALGOR,0), | 102 | ASN1_EXP_OPT(RSA_PSS_PARAMS, hashAlgorithm, X509_ALGOR, 0), |
103 | ASN1_EXP_OPT(RSA_PSS_PARAMS, maskGenAlgorithm, X509_ALGOR,1), | 103 | ASN1_EXP_OPT(RSA_PSS_PARAMS, maskGenAlgorithm, X509_ALGOR, 1), |
104 | ASN1_EXP_OPT(RSA_PSS_PARAMS, saltLength, ASN1_INTEGER,2), | 104 | ASN1_EXP_OPT(RSA_PSS_PARAMS, saltLength, ASN1_INTEGER, 2), |
105 | ASN1_EXP_OPT(RSA_PSS_PARAMS, trailerField, ASN1_INTEGER,3) | 105 | ASN1_EXP_OPT(RSA_PSS_PARAMS, trailerField, ASN1_INTEGER, 3) |
106 | } ASN1_SEQUENCE_END(RSA_PSS_PARAMS) | 106 | } ASN1_SEQUENCE_END(RSA_PSS_PARAMS) |
107 | 107 | ||
108 | IMPLEMENT_ASN1_FUNCTIONS(RSA_PSS_PARAMS) | 108 | IMPLEMENT_ASN1_FUNCTIONS(RSA_PSS_PARAMS) |
diff --git a/src/lib/libcrypto/rsa/rsa_chk.c b/src/lib/libcrypto/rsa/rsa_chk.c index 54113f89f6..0f9e0944db 100644 --- a/src/lib/libcrypto/rsa/rsa_chk.c +++ b/src/lib/libcrypto/rsa/rsa_chk.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_chk.c,v 1.7 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_chk.c,v 1.8 2014/07/09 19:51:38 jsing Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -7,7 +7,7 @@ | |||
7 | * are met: | 7 | * are met: |
8 | * | 8 | * |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * | 11 | * |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in | 13 | * notice, this list of conditions and the following disclaimer in |
@@ -65,7 +65,7 @@ RSA_check_key(const RSA *key) | |||
65 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_VALUE_MISSING); | 65 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_VALUE_MISSING); |
66 | return 0; | 66 | return 0; |
67 | } | 67 | } |
68 | 68 | ||
69 | i = BN_new(); | 69 | i = BN_new(); |
70 | j = BN_new(); | 70 | j = BN_new(); |
71 | k = BN_new(); | 71 | k = BN_new(); |
@@ -78,7 +78,7 @@ RSA_check_key(const RSA *key) | |||
78 | RSAerr(RSA_F_RSA_CHECK_KEY, ERR_R_MALLOC_FAILURE); | 78 | RSAerr(RSA_F_RSA_CHECK_KEY, ERR_R_MALLOC_FAILURE); |
79 | goto err; | 79 | goto err; |
80 | } | 80 | } |
81 | 81 | ||
82 | /* p prime? */ | 82 | /* p prime? */ |
83 | r = BN_is_prime_ex(key->p, BN_prime_checks, NULL, NULL); | 83 | r = BN_is_prime_ex(key->p, BN_prime_checks, NULL, NULL); |
84 | if (r != 1) { | 84 | if (r != 1) { |
@@ -87,7 +87,7 @@ RSA_check_key(const RSA *key) | |||
87 | goto err; | 87 | goto err; |
88 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_P_NOT_PRIME); | 88 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_P_NOT_PRIME); |
89 | } | 89 | } |
90 | 90 | ||
91 | /* q prime? */ | 91 | /* q prime? */ |
92 | r = BN_is_prime_ex(key->q, BN_prime_checks, NULL, NULL); | 92 | r = BN_is_prime_ex(key->q, BN_prime_checks, NULL, NULL); |
93 | if (r != 1) { | 93 | if (r != 1) { |
@@ -96,19 +96,19 @@ RSA_check_key(const RSA *key) | |||
96 | goto err; | 96 | goto err; |
97 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_Q_NOT_PRIME); | 97 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_Q_NOT_PRIME); |
98 | } | 98 | } |
99 | 99 | ||
100 | /* n = p*q? */ | 100 | /* n = p*q? */ |
101 | r = BN_mul(i, key->p, key->q, ctx); | 101 | r = BN_mul(i, key->p, key->q, ctx); |
102 | if (!r) { | 102 | if (!r) { |
103 | ret = -1; | 103 | ret = -1; |
104 | goto err; | 104 | goto err; |
105 | } | 105 | } |
106 | 106 | ||
107 | if (BN_cmp(i, key->n) != 0) { | 107 | if (BN_cmp(i, key->n) != 0) { |
108 | ret = 0; | 108 | ret = 0; |
109 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_N_DOES_NOT_EQUAL_P_Q); | 109 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_N_DOES_NOT_EQUAL_P_Q); |
110 | } | 110 | } |
111 | 111 | ||
112 | /* d*e = 1 mod lcm(p-1,q-1)? */ | 112 | /* d*e = 1 mod lcm(p-1,q-1)? */ |
113 | 113 | ||
114 | r = BN_sub(i, key->p, BN_value_one()); | 114 | r = BN_sub(i, key->p, BN_value_one()); |
@@ -149,7 +149,7 @@ RSA_check_key(const RSA *key) | |||
149 | ret = 0; | 149 | ret = 0; |
150 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_D_E_NOT_CONGRUENT_TO_1); | 150 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_D_E_NOT_CONGRUENT_TO_1); |
151 | } | 151 | } |
152 | 152 | ||
153 | if (key->dmp1 != NULL && key->dmq1 != NULL && key->iqmp != NULL) { | 153 | if (key->dmp1 != NULL && key->dmq1 != NULL && key->iqmp != NULL) { |
154 | /* dmp1 = d mod (p-1)? */ | 154 | /* dmp1 = d mod (p-1)? */ |
155 | r = BN_sub(i, key->p, BN_value_one()); | 155 | r = BN_sub(i, key->p, BN_value_one()); |
@@ -169,14 +169,14 @@ RSA_check_key(const RSA *key) | |||
169 | RSAerr(RSA_F_RSA_CHECK_KEY, | 169 | RSAerr(RSA_F_RSA_CHECK_KEY, |
170 | RSA_R_DMP1_NOT_CONGRUENT_TO_D); | 170 | RSA_R_DMP1_NOT_CONGRUENT_TO_D); |
171 | } | 171 | } |
172 | 172 | ||
173 | /* dmq1 = d mod (q-1)? */ | 173 | /* dmq1 = d mod (q-1)? */ |
174 | r = BN_sub(i, key->q, BN_value_one()); | 174 | r = BN_sub(i, key->q, BN_value_one()); |
175 | if (!r) { | 175 | if (!r) { |
176 | ret = -1; | 176 | ret = -1; |
177 | goto err; | 177 | goto err; |
178 | } | 178 | } |
179 | 179 | ||
180 | r = BN_mod(j, key->d, i, ctx); | 180 | r = BN_mod(j, key->d, i, ctx); |
181 | if (!r) { | 181 | if (!r) { |
182 | ret = -1; | 182 | ret = -1; |
@@ -188,7 +188,7 @@ RSA_check_key(const RSA *key) | |||
188 | RSAerr(RSA_F_RSA_CHECK_KEY, | 188 | RSAerr(RSA_F_RSA_CHECK_KEY, |
189 | RSA_R_DMQ1_NOT_CONGRUENT_TO_D); | 189 | RSA_R_DMQ1_NOT_CONGRUENT_TO_D); |
190 | } | 190 | } |
191 | 191 | ||
192 | /* iqmp = q^-1 mod p? */ | 192 | /* iqmp = q^-1 mod p? */ |
193 | if (!BN_mod_inverse(i, key->q, key->p, ctx)) { | 193 | if (!BN_mod_inverse(i, key->q, key->p, ctx)) { |
194 | ret = -1; | 194 | ret = -1; |
@@ -202,7 +202,7 @@ RSA_check_key(const RSA *key) | |||
202 | } | 202 | } |
203 | } | 203 | } |
204 | 204 | ||
205 | err: | 205 | err: |
206 | if (i != NULL) | 206 | if (i != NULL) |
207 | BN_free(i); | 207 | BN_free(i); |
208 | if (j != NULL) | 208 | if (j != NULL) |
diff --git a/src/lib/libcrypto/rsa/rsa_crpt.c b/src/lib/libcrypto/rsa/rsa_crpt.c index 16679cfd14..fb09d235e1 100644 --- a/src/lib/libcrypto/rsa/rsa_crpt.c +++ b/src/lib/libcrypto/rsa/rsa_crpt.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: rsa_crpt.c,v 1.5 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_crpt.c,v 1.6 2014/07/09 19:51:38 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 |
@@ -134,7 +134,7 @@ RSA_blinding_on(RSA *rsa, BN_CTX *ctx) | |||
134 | rsa->flags &= ~RSA_FLAG_NO_BLINDING; | 134 | rsa->flags &= ~RSA_FLAG_NO_BLINDING; |
135 | ret = 1; | 135 | ret = 1; |
136 | err: | 136 | err: |
137 | return(ret); | 137 | return (ret); |
138 | } | 138 | } |
139 | 139 | ||
140 | static BIGNUM * | 140 | static BIGNUM * |
@@ -181,7 +181,7 @@ RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx) | |||
181 | ctx = in_ctx; | 181 | ctx = in_ctx; |
182 | 182 | ||
183 | BN_CTX_start(ctx); | 183 | BN_CTX_start(ctx); |
184 | e = BN_CTX_get(ctx); | 184 | e = BN_CTX_get(ctx); |
185 | if (e == NULL) { | 185 | if (e == NULL) { |
186 | RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_MALLOC_FAILURE); | 186 | RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_MALLOC_FAILURE); |
187 | goto err; | 187 | goto err; |
diff --git a/src/lib/libcrypto/rsa/rsa_depr.c b/src/lib/libcrypto/rsa/rsa_depr.c index 6808b5aecb..7a3ecca666 100644 --- a/src/lib/libcrypto/rsa/rsa_depr.c +++ b/src/lib/libcrypto/rsa/rsa_depr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_depr.c,v 1.4 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_depr.c,v 1.5 2014/07/09 19:51:38 jsing Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -7,7 +7,7 @@ | |||
7 | * are met: | 7 | * are met: |
8 | * | 8 | * |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * | 11 | * |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in | 13 | * notice, this list of conditions and the following disclaimer in |
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c index 06bd8ded96..ede772cb83 100644 --- a/src/lib/libcrypto/rsa/rsa_eay.c +++ b/src/lib/libcrypto/rsa/rsa_eay.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: rsa_eay.c,v 1.30 2014/07/09 08:44:53 miod Exp $ */ | 1 | /* $OpenBSD: rsa_eay.c,v 1.31 2014/07/09 19:51:38 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 |
@@ -63,7 +63,7 @@ | |||
63 | * are met: | 63 | * are met: |
64 | * | 64 | * |
65 | * 1. Redistributions of source code must retain the above copyright | 65 | * 1. Redistributions of source code must retain the above copyright |
66 | * notice, this list of conditions and the following disclaimer. | 66 | * notice, this list of conditions and the following disclaimer. |
67 | * | 67 | * |
68 | * 2. Redistributions in binary form must reproduce the above copyright | 68 | * 2. Redistributions in binary form must reproduce the above copyright |
69 | * notice, this list of conditions and the following disclaimer in | 69 | * notice, this list of conditions and the following disclaimer in |
@@ -116,16 +116,17 @@ | |||
116 | #include <openssl/rand.h> | 116 | #include <openssl/rand.h> |
117 | 117 | ||
118 | static int RSA_eay_public_encrypt(int flen, const unsigned char *from, | 118 | static int RSA_eay_public_encrypt(int flen, const unsigned char *from, |
119 | unsigned char *to, RSA *rsa,int padding); | 119 | unsigned char *to, RSA *rsa, int padding); |
120 | static int RSA_eay_private_encrypt(int flen, const unsigned char *from, | 120 | static int RSA_eay_private_encrypt(int flen, const unsigned char *from, |
121 | unsigned char *to, RSA *rsa,int padding); | 121 | unsigned char *to, RSA *rsa, int padding); |
122 | static int RSA_eay_public_decrypt(int flen, const unsigned char *from, | 122 | static int RSA_eay_public_decrypt(int flen, const unsigned char *from, |
123 | unsigned char *to, RSA *rsa,int padding); | 123 | unsigned char *to, RSA *rsa, int padding); |
124 | static int RSA_eay_private_decrypt(int flen, const unsigned char *from, | 124 | static int RSA_eay_private_decrypt(int flen, const unsigned char *from, |
125 | unsigned char *to, RSA *rsa,int padding); | 125 | unsigned char *to, RSA *rsa, int padding); |
126 | static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *i, RSA *rsa, BN_CTX *ctx); | 126 | static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *i, RSA *rsa, BN_CTX *ctx); |
127 | static int RSA_eay_init(RSA *rsa); | 127 | static int RSA_eay_init(RSA *rsa); |
128 | static int RSA_eay_finish(RSA *rsa); | 128 | static int RSA_eay_finish(RSA *rsa); |
129 | |||
129 | static RSA_METHOD rsa_pkcs1_eay_meth = { | 130 | static RSA_METHOD rsa_pkcs1_eay_meth = { |
130 | .name = "Eric Young's PKCS#1 RSA", | 131 | .name = "Eric Young's PKCS#1 RSA", |
131 | .rsa_pub_enc = RSA_eay_public_encrypt, | 132 | .rsa_pub_enc = RSA_eay_public_encrypt, |
@@ -170,8 +171,8 @@ RSA_eay_public_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
170 | return -1; | 171 | return -1; |
171 | } | 172 | } |
172 | } | 173 | } |
173 | 174 | ||
174 | if ((ctx=BN_CTX_new()) == NULL) | 175 | if ((ctx = BN_CTX_new()) == NULL) |
175 | goto err; | 176 | goto err; |
176 | BN_CTX_start(ctx); | 177 | BN_CTX_start(ctx); |
177 | f = BN_CTX_get(ctx); | 178 | f = BN_CTX_get(ctx); |
@@ -179,7 +180,7 @@ RSA_eay_public_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
179 | num = BN_num_bytes(rsa->n); | 180 | num = BN_num_bytes(rsa->n); |
180 | buf = malloc(num); | 181 | buf = malloc(num); |
181 | if (!f || !ret || !buf) { | 182 | if (!f || !ret || !buf) { |
182 | RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT,ERR_R_MALLOC_FAILURE); | 183 | RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, ERR_R_MALLOC_FAILURE); |
183 | goto err; | 184 | goto err; |
184 | } | 185 | } |
185 | 186 | ||
@@ -189,7 +190,7 @@ RSA_eay_public_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
189 | break; | 190 | break; |
190 | #ifndef OPENSSL_NO_SHA | 191 | #ifndef OPENSSL_NO_SHA |
191 | case RSA_PKCS1_OAEP_PADDING: | 192 | case RSA_PKCS1_OAEP_PADDING: |
192 | i = RSA_padding_add_PKCS1_OAEP(buf, num, from, flen, NULL, 0); | 193 | i = RSA_padding_add_PKCS1_OAEP(buf, num, from, flen, NULL, 0); |
193 | break; | 194 | break; |
194 | #endif | 195 | #endif |
195 | case RSA_SSLV23_PADDING: | 196 | case RSA_SSLV23_PADDING: |
@@ -208,7 +209,7 @@ RSA_eay_public_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
208 | 209 | ||
209 | if (BN_bin2bn(buf, num, f) == NULL) | 210 | if (BN_bin2bn(buf, num, f) == NULL) |
210 | goto err; | 211 | goto err; |
211 | 212 | ||
212 | if (BN_ucmp(f, rsa->n) >= 0) { | 213 | if (BN_ucmp(f, rsa->n) >= 0) { |
213 | /* usually the padding functions would catch this */ | 214 | /* usually the padding functions would catch this */ |
214 | RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, | 215 | RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, |
@@ -221,7 +222,8 @@ RSA_eay_public_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
221 | CRYPTO_LOCK_RSA, rsa->n, ctx)) | 222 | CRYPTO_LOCK_RSA, rsa->n, ctx)) |
222 | goto err; | 223 | goto err; |
223 | 224 | ||
224 | if (!rsa->meth->bn_mod_exp(ret,f,rsa->e,rsa->n,ctx, rsa->_method_mod_n)) | 225 | if (!rsa->meth->bn_mod_exp(ret, f,rsa->e, rsa->n, ctx, |
226 | rsa->_method_mod_n)) | ||
225 | goto err; | 227 | goto err; |
226 | 228 | ||
227 | /* put in leading 0 bytes if the number is less than the | 229 | /* put in leading 0 bytes if the number is less than the |
@@ -286,7 +288,7 @@ rsa_get_blinding(RSA *rsa, int *local, BN_CTX *ctx) | |||
286 | CRYPTO_w_lock(CRYPTO_LOCK_RSA); | 288 | CRYPTO_w_lock(CRYPTO_LOCK_RSA); |
287 | got_write_lock = 1; | 289 | got_write_lock = 1; |
288 | } | 290 | } |
289 | 291 | ||
290 | if (rsa->mt_blinding == NULL) | 292 | if (rsa->mt_blinding == NULL) |
291 | rsa->mt_blinding = RSA_setup_blinding(rsa, ctx); | 293 | rsa->mt_blinding = RSA_setup_blinding(rsa, ctx); |
292 | } | 294 | } |
@@ -355,7 +357,7 @@ RSA_eay_private_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
355 | BIGNUM *unblind = NULL; | 357 | BIGNUM *unblind = NULL; |
356 | BN_BLINDING *blinding = NULL; | 358 | BN_BLINDING *blinding = NULL; |
357 | 359 | ||
358 | if ((ctx=BN_CTX_new()) == NULL) | 360 | if ((ctx = BN_CTX_new()) == NULL) |
359 | goto err; | 361 | goto err; |
360 | BN_CTX_start(ctx); | 362 | BN_CTX_start(ctx); |
361 | f = BN_CTX_get(ctx); | 363 | f = BN_CTX_get(ctx); |
@@ -386,10 +388,10 @@ RSA_eay_private_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
386 | if (i <= 0) | 388 | if (i <= 0) |
387 | goto err; | 389 | goto err; |
388 | 390 | ||
389 | if (BN_bin2bn(buf,num,f) == NULL) | 391 | if (BN_bin2bn(buf, num, f) == NULL) |
390 | goto err; | 392 | goto err; |
391 | 393 | ||
392 | if (BN_ucmp(f, rsa->n) >= 0) { | 394 | if (BN_ucmp(f, rsa->n) >= 0) { |
393 | /* usually the padding functions would catch this */ | 395 | /* usually the padding functions would catch this */ |
394 | RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT, | 396 | RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT, |
395 | RSA_R_DATA_TOO_LARGE_FOR_MODULUS); | 397 | RSA_R_DATA_TOO_LARGE_FOR_MODULUS); |
@@ -404,7 +406,7 @@ RSA_eay_private_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
404 | goto err; | 406 | goto err; |
405 | } | 407 | } |
406 | } | 408 | } |
407 | 409 | ||
408 | if (blinding != NULL) { | 410 | if (blinding != NULL) { |
409 | if (!local_blinding && ((unblind = BN_CTX_get(ctx)) == NULL)) { | 411 | if (!local_blinding && ((unblind = BN_CTX_get(ctx)) == NULL)) { |
410 | RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT, | 412 | RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT, |
@@ -417,13 +419,13 @@ RSA_eay_private_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
417 | 419 | ||
418 | if ((rsa->flags & RSA_FLAG_EXT_PKEY) || | 420 | if ((rsa->flags & RSA_FLAG_EXT_PKEY) || |
419 | (rsa->p != NULL && rsa->q != NULL && rsa->dmp1 != NULL && | 421 | (rsa->p != NULL && rsa->q != NULL && rsa->dmp1 != NULL && |
420 | rsa->dmq1 != NULL && rsa->iqmp != NULL)) { | 422 | rsa->dmq1 != NULL && rsa->iqmp != NULL)) { |
421 | if (!rsa->meth->rsa_mod_exp(ret, f, rsa, ctx)) | 423 | if (!rsa->meth->rsa_mod_exp(ret, f, rsa, ctx)) |
422 | goto err; | 424 | goto err; |
423 | } else { | 425 | } else { |
424 | BIGNUM local_d; | 426 | BIGNUM local_d; |
425 | BIGNUM *d = NULL; | 427 | BIGNUM *d = NULL; |
426 | 428 | ||
427 | if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) { | 429 | if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) { |
428 | BN_init(&local_d); | 430 | BN_init(&local_d); |
429 | d = &local_d; | 431 | d = &local_d; |
@@ -436,7 +438,7 @@ RSA_eay_private_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
436 | CRYPTO_LOCK_RSA, rsa->n, ctx)) | 438 | CRYPTO_LOCK_RSA, rsa->n, ctx)) |
437 | goto err; | 439 | goto err; |
438 | 440 | ||
439 | if (!rsa->meth->bn_mod_exp(ret, f, d, rsa->n,ctx, | 441 | if (!rsa->meth->bn_mod_exp(ret, f, d, rsa->n, ctx, |
440 | rsa->_method_mod_n)) | 442 | rsa->_method_mod_n)) |
441 | goto err; | 443 | goto err; |
442 | } | 444 | } |
@@ -530,7 +532,7 @@ RSA_eay_private_decrypt(int flen, const unsigned char *from, unsigned char *to, | |||
530 | goto err; | 532 | goto err; |
531 | } | 533 | } |
532 | } | 534 | } |
533 | 535 | ||
534 | if (blinding != NULL) { | 536 | if (blinding != NULL) { |
535 | if (!local_blinding && ((unblind = BN_CTX_get(ctx)) == NULL)) { | 537 | if (!local_blinding && ((unblind = BN_CTX_get(ctx)) == NULL)) { |
536 | RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT, | 538 | RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT, |
@@ -544,13 +546,13 @@ RSA_eay_private_decrypt(int flen, const unsigned char *from, unsigned char *to, | |||
544 | /* do the decrypt */ | 546 | /* do the decrypt */ |
545 | if ((rsa->flags & RSA_FLAG_EXT_PKEY) || | 547 | if ((rsa->flags & RSA_FLAG_EXT_PKEY) || |
546 | (rsa->p != NULL && rsa->q != NULL && rsa->dmp1 != NULL && | 548 | (rsa->p != NULL && rsa->q != NULL && rsa->dmp1 != NULL && |
547 | rsa->dmq1 != NULL && rsa->iqmp != NULL)) { | 549 | rsa->dmq1 != NULL && rsa->iqmp != NULL)) { |
548 | if (!rsa->meth->rsa_mod_exp(ret, f, rsa, ctx)) | 550 | if (!rsa->meth->rsa_mod_exp(ret, f, rsa, ctx)) |
549 | goto err; | 551 | goto err; |
550 | } else { | 552 | } else { |
551 | BIGNUM local_d; | 553 | BIGNUM local_d; |
552 | BIGNUM *d = NULL; | 554 | BIGNUM *d = NULL; |
553 | 555 | ||
554 | if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) { | 556 | if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) { |
555 | d = &local_d; | 557 | d = &local_d; |
556 | BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME); | 558 | BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME); |
@@ -578,11 +580,11 @@ RSA_eay_private_decrypt(int flen, const unsigned char *from, unsigned char *to, | |||
578 | r = RSA_padding_check_PKCS1_type_2(to, num, buf, j, num); | 580 | r = RSA_padding_check_PKCS1_type_2(to, num, buf, j, num); |
579 | break; | 581 | break; |
580 | #ifndef OPENSSL_NO_SHA | 582 | #ifndef OPENSSL_NO_SHA |
581 | case RSA_PKCS1_OAEP_PADDING: | 583 | case RSA_PKCS1_OAEP_PADDING: |
582 | r = RSA_padding_check_PKCS1_OAEP(to, num, buf, j, num, NULL, 0); | 584 | r = RSA_padding_check_PKCS1_OAEP(to, num, buf, j, num, NULL, 0); |
583 | break; | 585 | break; |
584 | #endif | 586 | #endif |
585 | case RSA_SSLV23_PADDING: | 587 | case RSA_SSLV23_PADDING: |
586 | r = RSA_padding_check_SSLv23(to, num, buf, j, num); | 588 | r = RSA_padding_check_SSLv23(to, num, buf, j, num); |
587 | break; | 589 | break; |
588 | case RSA_NO_PADDING: | 590 | case RSA_NO_PADDING: |
@@ -603,7 +605,7 @@ err: | |||
603 | BN_CTX_free(ctx); | 605 | BN_CTX_free(ctx); |
604 | } | 606 | } |
605 | if (buf != NULL) { | 607 | if (buf != NULL) { |
606 | OPENSSL_cleanse(buf,num); | 608 | OPENSSL_cleanse(buf, num); |
607 | free(buf); | 609 | free(buf); |
608 | } | 610 | } |
609 | return r; | 611 | return r; |
@@ -615,7 +617,7 @@ RSA_eay_public_decrypt(int flen, const unsigned char *from, unsigned char *to, | |||
615 | RSA *rsa, int padding) | 617 | RSA *rsa, int padding) |
616 | { | 618 | { |
617 | BIGNUM *f, *ret; | 619 | BIGNUM *f, *ret; |
618 | int i, num = 0,r = -1; | 620 | int i, num = 0, r = -1; |
619 | unsigned char *p; | 621 | unsigned char *p; |
620 | unsigned char *buf = NULL; | 622 | unsigned char *buf = NULL; |
621 | BN_CTX *ctx = NULL; | 623 | BN_CTX *ctx = NULL; |
@@ -637,7 +639,7 @@ RSA_eay_public_decrypt(int flen, const unsigned char *from, unsigned char *to, | |||
637 | return -1; | 639 | return -1; |
638 | } | 640 | } |
639 | } | 641 | } |
640 | 642 | ||
641 | if ((ctx = BN_CTX_new()) == NULL) | 643 | if ((ctx = BN_CTX_new()) == NULL) |
642 | goto err; | 644 | goto err; |
643 | BN_CTX_start(ctx); | 645 | BN_CTX_start(ctx); |
@@ -658,7 +660,7 @@ RSA_eay_public_decrypt(int flen, const unsigned char *from, unsigned char *to, | |||
658 | goto err; | 660 | goto err; |
659 | } | 661 | } |
660 | 662 | ||
661 | if (BN_bin2bn(from,flen,f) == NULL) | 663 | if (BN_bin2bn(from, flen, f) == NULL) |
662 | goto err; | 664 | goto err; |
663 | 665 | ||
664 | if (BN_ucmp(f, rsa->n) >= 0) { | 666 | if (BN_ucmp(f, rsa->n) >= 0) { |
@@ -801,7 +803,7 @@ RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) | |||
801 | BN_with_flags(dmp1, rsa->dmp1, BN_FLG_CONSTTIME); | 803 | BN_with_flags(dmp1, rsa->dmp1, BN_FLG_CONSTTIME); |
802 | } else | 804 | } else |
803 | dmp1 = rsa->dmp1; | 805 | dmp1 = rsa->dmp1; |
804 | if (!rsa->meth->bn_mod_exp(r0, r1, dmp1, rsa->p,ctx, | 806 | if (!rsa->meth->bn_mod_exp(r0, r1, dmp1, rsa->p, ctx, |
805 | rsa->_method_mod_p)) | 807 | rsa->_method_mod_p)) |
806 | goto err; | 808 | goto err; |
807 | 809 | ||
@@ -824,7 +826,7 @@ RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) | |||
824 | BN_with_flags(pr1, r1, BN_FLG_CONSTTIME); | 826 | BN_with_flags(pr1, r1, BN_FLG_CONSTTIME); |
825 | } else | 827 | } else |
826 | pr1 = r1; | 828 | pr1 = r1; |
827 | if (!BN_mod(r0, pr1, rsa->p,ctx)) | 829 | if (!BN_mod(r0, pr1, rsa->p, ctx)) |
828 | goto err; | 830 | goto err; |
829 | 831 | ||
830 | /* | 832 | /* |
@@ -869,7 +871,7 @@ RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) | |||
869 | 871 | ||
870 | BIGNUM local_d; | 872 | BIGNUM local_d; |
871 | BIGNUM *d = NULL; | 873 | BIGNUM *d = NULL; |
872 | 874 | ||
873 | if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) { | 875 | if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) { |
874 | d = &local_d; | 876 | d = &local_d; |
875 | BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME); | 877 | BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME); |
@@ -890,7 +892,7 @@ static int | |||
890 | RSA_eay_init(RSA *rsa) | 892 | RSA_eay_init(RSA *rsa) |
891 | { | 893 | { |
892 | rsa->flags |= RSA_FLAG_CACHE_PUBLIC | RSA_FLAG_CACHE_PRIVATE; | 894 | rsa->flags |= RSA_FLAG_CACHE_PUBLIC | RSA_FLAG_CACHE_PRIVATE; |
893 | return 1 ; | 895 | return 1; |
894 | } | 896 | } |
895 | 897 | ||
896 | static int | 898 | static int |
@@ -902,5 +904,6 @@ RSA_eay_finish(RSA *rsa) | |||
902 | BN_MONT_CTX_free(rsa->_method_mod_p); | 904 | BN_MONT_CTX_free(rsa->_method_mod_p); |
903 | if (rsa->_method_mod_q != NULL) | 905 | if (rsa->_method_mod_q != NULL) |
904 | BN_MONT_CTX_free(rsa->_method_mod_q); | 906 | BN_MONT_CTX_free(rsa->_method_mod_q); |
907 | |||
905 | return 1; | 908 | return 1; |
906 | } | 909 | } |
diff --git a/src/lib/libcrypto/rsa/rsa_err.c b/src/lib/libcrypto/rsa/rsa_err.c index c7d6881100..893069a892 100644 --- a/src/lib/libcrypto/rsa/rsa_err.c +++ b/src/lib/libcrypto/rsa/rsa_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_err.c,v 1.13 2014/07/09 08:44:53 miod Exp $ */ | 1 | /* $OpenBSD: rsa_err.c,v 1.14 2014/07/09 19:51:38 jsing Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -7,7 +7,7 @@ | |||
7 | * are met: | 7 | * are met: |
8 | * | 8 | * |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * | 11 | * |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in | 13 | * notice, this list of conditions and the following disclaimer in |
@@ -68,136 +68,133 @@ | |||
68 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_RSA,func,0) | 68 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_RSA,func,0) |
69 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_RSA,0,reason) | 69 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_RSA,0,reason) |
70 | 70 | ||
71 | static ERR_STRING_DATA RSA_str_functs[]= | 71 | static ERR_STRING_DATA RSA_str_functs[] = { |
72 | { | 72 | {ERR_FUNC(RSA_F_CHECK_PADDING_MD), "CHECK_PADDING_MD"}, |
73 | {ERR_FUNC(RSA_F_CHECK_PADDING_MD), "CHECK_PADDING_MD"}, | 73 | {ERR_FUNC(RSA_F_DO_RSA_PRINT), "DO_RSA_PRINT"}, |
74 | {ERR_FUNC(RSA_F_DO_RSA_PRINT), "DO_RSA_PRINT"}, | 74 | {ERR_FUNC(RSA_F_INT_RSA_VERIFY), "INT_RSA_VERIFY"}, |
75 | {ERR_FUNC(RSA_F_INT_RSA_VERIFY), "INT_RSA_VERIFY"}, | 75 | {ERR_FUNC(RSA_F_MEMORY_LOCK), "MEMORY_LOCK"}, |
76 | {ERR_FUNC(RSA_F_MEMORY_LOCK), "MEMORY_LOCK"}, | 76 | {ERR_FUNC(RSA_F_OLD_RSA_PRIV_DECODE), "OLD_RSA_PRIV_DECODE"}, |
77 | {ERR_FUNC(RSA_F_OLD_RSA_PRIV_DECODE), "OLD_RSA_PRIV_DECODE"}, | 77 | {ERR_FUNC(RSA_F_PKEY_RSA_CTRL), "PKEY_RSA_CTRL"}, |
78 | {ERR_FUNC(RSA_F_PKEY_RSA_CTRL), "PKEY_RSA_CTRL"}, | 78 | {ERR_FUNC(RSA_F_PKEY_RSA_CTRL_STR), "PKEY_RSA_CTRL_STR"}, |
79 | {ERR_FUNC(RSA_F_PKEY_RSA_CTRL_STR), "PKEY_RSA_CTRL_STR"}, | 79 | {ERR_FUNC(RSA_F_PKEY_RSA_SIGN), "PKEY_RSA_SIGN"}, |
80 | {ERR_FUNC(RSA_F_PKEY_RSA_SIGN), "PKEY_RSA_SIGN"}, | 80 | {ERR_FUNC(RSA_F_PKEY_RSA_VERIFY), "PKEY_RSA_VERIFY"}, |
81 | {ERR_FUNC(RSA_F_PKEY_RSA_VERIFY), "PKEY_RSA_VERIFY"}, | 81 | {ERR_FUNC(RSA_F_PKEY_RSA_VERIFYRECOVER), "PKEY_RSA_VERIFYRECOVER"}, |
82 | {ERR_FUNC(RSA_F_PKEY_RSA_VERIFYRECOVER), "PKEY_RSA_VERIFYRECOVER"}, | 82 | {ERR_FUNC(RSA_F_RSA_BUILTIN_KEYGEN), "RSA_BUILTIN_KEYGEN"}, |
83 | {ERR_FUNC(RSA_F_RSA_BUILTIN_KEYGEN), "RSA_BUILTIN_KEYGEN"}, | 83 | {ERR_FUNC(RSA_F_RSA_CHECK_KEY), "RSA_check_key"}, |
84 | {ERR_FUNC(RSA_F_RSA_CHECK_KEY), "RSA_check_key"}, | 84 | {ERR_FUNC(RSA_F_RSA_EAY_PRIVATE_DECRYPT), "RSA_EAY_PRIVATE_DECRYPT"}, |
85 | {ERR_FUNC(RSA_F_RSA_EAY_PRIVATE_DECRYPT), "RSA_EAY_PRIVATE_DECRYPT"}, | 85 | {ERR_FUNC(RSA_F_RSA_EAY_PRIVATE_ENCRYPT), "RSA_EAY_PRIVATE_ENCRYPT"}, |
86 | {ERR_FUNC(RSA_F_RSA_EAY_PRIVATE_ENCRYPT), "RSA_EAY_PRIVATE_ENCRYPT"}, | 86 | {ERR_FUNC(RSA_F_RSA_EAY_PUBLIC_DECRYPT), "RSA_EAY_PUBLIC_DECRYPT"}, |
87 | {ERR_FUNC(RSA_F_RSA_EAY_PUBLIC_DECRYPT), "RSA_EAY_PUBLIC_DECRYPT"}, | 87 | {ERR_FUNC(RSA_F_RSA_EAY_PUBLIC_ENCRYPT), "RSA_EAY_PUBLIC_ENCRYPT"}, |
88 | {ERR_FUNC(RSA_F_RSA_EAY_PUBLIC_ENCRYPT), "RSA_EAY_PUBLIC_ENCRYPT"}, | 88 | {ERR_FUNC(RSA_F_RSA_GENERATE_KEY), "RSA_generate_key"}, |
89 | {ERR_FUNC(RSA_F_RSA_GENERATE_KEY), "RSA_generate_key"}, | 89 | {ERR_FUNC(RSA_F_RSA_GENERATE_KEY_EX), "RSA_generate_key_ex"}, |
90 | {ERR_FUNC(RSA_F_RSA_GENERATE_KEY_EX), "RSA_generate_key_ex"}, | 90 | {ERR_FUNC(RSA_F_RSA_ITEM_VERIFY), "RSA_ITEM_VERIFY"}, |
91 | {ERR_FUNC(RSA_F_RSA_ITEM_VERIFY), "RSA_ITEM_VERIFY"}, | 91 | {ERR_FUNC(RSA_F_RSA_MEMORY_LOCK), "RSA_memory_lock"}, |
92 | {ERR_FUNC(RSA_F_RSA_MEMORY_LOCK), "RSA_memory_lock"}, | 92 | {ERR_FUNC(RSA_F_RSA_NEW_METHOD), "RSA_new_method"}, |
93 | {ERR_FUNC(RSA_F_RSA_NEW_METHOD), "RSA_new_method"}, | 93 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_NONE), "RSA_padding_add_none"}, |
94 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_NONE), "RSA_padding_add_none"}, | 94 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP), "RSA_padding_add_PKCS1_OAEP"}, |
95 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP), "RSA_padding_add_PKCS1_OAEP"}, | 95 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_PSS), "RSA_padding_add_PKCS1_PSS"}, |
96 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_PSS), "RSA_padding_add_PKCS1_PSS"}, | 96 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1), "RSA_padding_add_PKCS1_PSS_mgf1"}, |
97 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1), "RSA_padding_add_PKCS1_PSS_mgf1"}, | 97 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1), "RSA_padding_add_PKCS1_type_1"}, |
98 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1), "RSA_padding_add_PKCS1_type_1"}, | 98 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2), "RSA_padding_add_PKCS1_type_2"}, |
99 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2), "RSA_padding_add_PKCS1_type_2"}, | 99 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_SSLV23), "RSA_padding_add_SSLv23"}, |
100 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_SSLV23), "RSA_padding_add_SSLv23"}, | 100 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_X931), "RSA_padding_add_X931"}, |
101 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_X931), "RSA_padding_add_X931"}, | 101 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_NONE), "RSA_padding_check_none"}, |
102 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_NONE), "RSA_padding_check_none"}, | 102 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP), "RSA_padding_check_PKCS1_OAEP"}, |
103 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP), "RSA_padding_check_PKCS1_OAEP"}, | 103 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1), "RSA_padding_check_PKCS1_type_1"}, |
104 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1), "RSA_padding_check_PKCS1_type_1"}, | 104 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2), "RSA_padding_check_PKCS1_type_2"}, |
105 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2), "RSA_padding_check_PKCS1_type_2"}, | 105 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_SSLV23), "RSA_padding_check_SSLv23"}, |
106 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_SSLV23), "RSA_padding_check_SSLv23"}, | 106 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_X931), "RSA_padding_check_X931"}, |
107 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_X931), "RSA_padding_check_X931"}, | 107 | {ERR_FUNC(RSA_F_RSA_PRINT), "RSA_print"}, |
108 | {ERR_FUNC(RSA_F_RSA_PRINT), "RSA_print"}, | 108 | {ERR_FUNC(RSA_F_RSA_PRINT_FP), "RSA_print_fp"}, |
109 | {ERR_FUNC(RSA_F_RSA_PRINT_FP), "RSA_print_fp"}, | 109 | {ERR_FUNC(RSA_F_RSA_PRIVATE_DECRYPT), "RSA_private_decrypt"}, |
110 | {ERR_FUNC(RSA_F_RSA_PRIVATE_DECRYPT), "RSA_private_decrypt"}, | 110 | {ERR_FUNC(RSA_F_RSA_PRIVATE_ENCRYPT), "RSA_private_encrypt"}, |
111 | {ERR_FUNC(RSA_F_RSA_PRIVATE_ENCRYPT), "RSA_private_encrypt"}, | 111 | {ERR_FUNC(RSA_F_RSA_PRIV_DECODE), "RSA_PRIV_DECODE"}, |
112 | {ERR_FUNC(RSA_F_RSA_PRIV_DECODE), "RSA_PRIV_DECODE"}, | 112 | {ERR_FUNC(RSA_F_RSA_PRIV_ENCODE), "RSA_PRIV_ENCODE"}, |
113 | {ERR_FUNC(RSA_F_RSA_PRIV_ENCODE), "RSA_PRIV_ENCODE"}, | 113 | {ERR_FUNC(RSA_F_RSA_PUBLIC_DECRYPT), "RSA_public_decrypt"}, |
114 | {ERR_FUNC(RSA_F_RSA_PUBLIC_DECRYPT), "RSA_public_decrypt"}, | 114 | {ERR_FUNC(RSA_F_RSA_PUBLIC_ENCRYPT), "RSA_public_encrypt"}, |
115 | {ERR_FUNC(RSA_F_RSA_PUBLIC_ENCRYPT), "RSA_public_encrypt"}, | 115 | {ERR_FUNC(RSA_F_RSA_PUB_DECODE), "RSA_PUB_DECODE"}, |
116 | {ERR_FUNC(RSA_F_RSA_PUB_DECODE), "RSA_PUB_DECODE"}, | 116 | {ERR_FUNC(RSA_F_RSA_SETUP_BLINDING), "RSA_setup_blinding"}, |
117 | {ERR_FUNC(RSA_F_RSA_SETUP_BLINDING), "RSA_setup_blinding"}, | 117 | {ERR_FUNC(RSA_F_RSA_SIGN), "RSA_sign"}, |
118 | {ERR_FUNC(RSA_F_RSA_SIGN), "RSA_sign"}, | 118 | {ERR_FUNC(RSA_F_RSA_SIGN_ASN1_OCTET_STRING), "RSA_sign_ASN1_OCTET_STRING"}, |
119 | {ERR_FUNC(RSA_F_RSA_SIGN_ASN1_OCTET_STRING), "RSA_sign_ASN1_OCTET_STRING"}, | 119 | {ERR_FUNC(RSA_F_RSA_VERIFY), "RSA_verify"}, |
120 | {ERR_FUNC(RSA_F_RSA_VERIFY), "RSA_verify"}, | 120 | {ERR_FUNC(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING), "RSA_verify_ASN1_OCTET_STRING"}, |
121 | {ERR_FUNC(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING), "RSA_verify_ASN1_OCTET_STRING"}, | 121 | {ERR_FUNC(RSA_F_RSA_VERIFY_PKCS1_PSS), "RSA_verify_PKCS1_PSS"}, |
122 | {ERR_FUNC(RSA_F_RSA_VERIFY_PKCS1_PSS), "RSA_verify_PKCS1_PSS"}, | 122 | {ERR_FUNC(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1), "RSA_verify_PKCS1_PSS_mgf1"}, |
123 | {ERR_FUNC(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1), "RSA_verify_PKCS1_PSS_mgf1"}, | 123 | {0, NULL} |
124 | {0,NULL} | 124 | }; |
125 | }; | ||
126 | 125 | ||
127 | static ERR_STRING_DATA RSA_str_reasons[]= | 126 | static ERR_STRING_DATA RSA_str_reasons[] = { |
128 | { | 127 | {ERR_REASON(RSA_R_ALGORITHM_MISMATCH) , "algorithm mismatch"}, |
129 | {ERR_REASON(RSA_R_ALGORITHM_MISMATCH) ,"algorithm mismatch"}, | 128 | {ERR_REASON(RSA_R_BAD_E_VALUE) , "bad e value"}, |
130 | {ERR_REASON(RSA_R_BAD_E_VALUE) ,"bad e value"}, | 129 | {ERR_REASON(RSA_R_BAD_FIXED_HEADER_DECRYPT), "bad fixed header decrypt"}, |
131 | {ERR_REASON(RSA_R_BAD_FIXED_HEADER_DECRYPT),"bad fixed header decrypt"}, | 130 | {ERR_REASON(RSA_R_BAD_PAD_BYTE_COUNT) , "bad pad byte count"}, |
132 | {ERR_REASON(RSA_R_BAD_PAD_BYTE_COUNT) ,"bad pad byte count"}, | 131 | {ERR_REASON(RSA_R_BAD_SIGNATURE) , "bad signature"}, |
133 | {ERR_REASON(RSA_R_BAD_SIGNATURE) ,"bad signature"}, | 132 | {ERR_REASON(RSA_R_BLOCK_TYPE_IS_NOT_01) , "block type is not 01"}, |
134 | {ERR_REASON(RSA_R_BLOCK_TYPE_IS_NOT_01) ,"block type is not 01"}, | 133 | {ERR_REASON(RSA_R_BLOCK_TYPE_IS_NOT_02) , "block type is not 02"}, |
135 | {ERR_REASON(RSA_R_BLOCK_TYPE_IS_NOT_02) ,"block type is not 02"}, | 134 | {ERR_REASON(RSA_R_DATA_GREATER_THAN_MOD_LEN), "data greater than mod len"}, |
136 | {ERR_REASON(RSA_R_DATA_GREATER_THAN_MOD_LEN),"data greater than mod len"}, | 135 | {ERR_REASON(RSA_R_DATA_TOO_LARGE) , "data too large"}, |
137 | {ERR_REASON(RSA_R_DATA_TOO_LARGE) ,"data too large"}, | 136 | {ERR_REASON(RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE), "data too large for key size"}, |
138 | {ERR_REASON(RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE),"data too large for key size"}, | 137 | {ERR_REASON(RSA_R_DATA_TOO_LARGE_FOR_MODULUS), "data too large for modulus"}, |
139 | {ERR_REASON(RSA_R_DATA_TOO_LARGE_FOR_MODULUS),"data too large for modulus"}, | 138 | {ERR_REASON(RSA_R_DATA_TOO_SMALL) , "data too small"}, |
140 | {ERR_REASON(RSA_R_DATA_TOO_SMALL) ,"data too small"}, | 139 | {ERR_REASON(RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE), "data too small for key size"}, |
141 | {ERR_REASON(RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE),"data too small for key size"}, | 140 | {ERR_REASON(RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY), "digest too big for rsa key"}, |
142 | {ERR_REASON(RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY),"digest too big for rsa key"}, | 141 | {ERR_REASON(RSA_R_DMP1_NOT_CONGRUENT_TO_D), "dmp1 not congruent to d"}, |
143 | {ERR_REASON(RSA_R_DMP1_NOT_CONGRUENT_TO_D),"dmp1 not congruent to d"}, | 142 | {ERR_REASON(RSA_R_DMQ1_NOT_CONGRUENT_TO_D), "dmq1 not congruent to d"}, |
144 | {ERR_REASON(RSA_R_DMQ1_NOT_CONGRUENT_TO_D),"dmq1 not congruent to d"}, | 143 | {ERR_REASON(RSA_R_D_E_NOT_CONGRUENT_TO_1), "d e not congruent to 1"}, |
145 | {ERR_REASON(RSA_R_D_E_NOT_CONGRUENT_TO_1),"d e not congruent to 1"}, | 144 | {ERR_REASON(RSA_R_FIRST_OCTET_INVALID) , "first octet invalid"}, |
146 | {ERR_REASON(RSA_R_FIRST_OCTET_INVALID) ,"first octet invalid"}, | 145 | {ERR_REASON(RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE), "illegal or unsupported padding mode"}, |
147 | {ERR_REASON(RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE),"illegal or unsupported padding mode"}, | 146 | {ERR_REASON(RSA_R_INVALID_DIGEST_LENGTH) , "invalid digest length"}, |
148 | {ERR_REASON(RSA_R_INVALID_DIGEST_LENGTH) ,"invalid digest length"}, | 147 | {ERR_REASON(RSA_R_INVALID_HEADER) , "invalid header"}, |
149 | {ERR_REASON(RSA_R_INVALID_HEADER) ,"invalid header"}, | 148 | {ERR_REASON(RSA_R_INVALID_KEYBITS) , "invalid keybits"}, |
150 | {ERR_REASON(RSA_R_INVALID_KEYBITS) ,"invalid keybits"}, | 149 | {ERR_REASON(RSA_R_INVALID_MESSAGE_LENGTH), "invalid message length"}, |
151 | {ERR_REASON(RSA_R_INVALID_MESSAGE_LENGTH),"invalid message length"}, | 150 | {ERR_REASON(RSA_R_INVALID_MGF1_MD) , "invalid mgf1 md"}, |
152 | {ERR_REASON(RSA_R_INVALID_MGF1_MD) ,"invalid mgf1 md"}, | 151 | {ERR_REASON(RSA_R_INVALID_PADDING) , "invalid padding"}, |
153 | {ERR_REASON(RSA_R_INVALID_PADDING) ,"invalid padding"}, | 152 | {ERR_REASON(RSA_R_INVALID_PADDING_MODE) , "invalid padding mode"}, |
154 | {ERR_REASON(RSA_R_INVALID_PADDING_MODE) ,"invalid padding mode"}, | 153 | {ERR_REASON(RSA_R_INVALID_PSS_PARAMETERS), "invalid pss parameters"}, |
155 | {ERR_REASON(RSA_R_INVALID_PSS_PARAMETERS),"invalid pss parameters"}, | 154 | {ERR_REASON(RSA_R_INVALID_PSS_SALTLEN) , "invalid pss saltlen"}, |
156 | {ERR_REASON(RSA_R_INVALID_PSS_SALTLEN) ,"invalid pss saltlen"}, | 155 | {ERR_REASON(RSA_R_INVALID_SALT_LENGTH) , "invalid salt length"}, |
157 | {ERR_REASON(RSA_R_INVALID_SALT_LENGTH) ,"invalid salt length"}, | 156 | {ERR_REASON(RSA_R_INVALID_TRAILER) , "invalid trailer"}, |
158 | {ERR_REASON(RSA_R_INVALID_TRAILER) ,"invalid trailer"}, | 157 | {ERR_REASON(RSA_R_INVALID_X931_DIGEST) , "invalid x931 digest"}, |
159 | {ERR_REASON(RSA_R_INVALID_X931_DIGEST) ,"invalid x931 digest"}, | 158 | {ERR_REASON(RSA_R_IQMP_NOT_INVERSE_OF_Q) , "iqmp not inverse of q"}, |
160 | {ERR_REASON(RSA_R_IQMP_NOT_INVERSE_OF_Q) ,"iqmp not inverse of q"}, | 159 | {ERR_REASON(RSA_R_KEY_SIZE_TOO_SMALL) , "key size too small"}, |
161 | {ERR_REASON(RSA_R_KEY_SIZE_TOO_SMALL) ,"key size too small"}, | 160 | {ERR_REASON(RSA_R_LAST_OCTET_INVALID) , "last octet invalid"}, |
162 | {ERR_REASON(RSA_R_LAST_OCTET_INVALID) ,"last octet invalid"}, | 161 | {ERR_REASON(RSA_R_MODULUS_TOO_LARGE) , "modulus too large"}, |
163 | {ERR_REASON(RSA_R_MODULUS_TOO_LARGE) ,"modulus too large"}, | 162 | {ERR_REASON(RSA_R_NON_FIPS_RSA_METHOD) , "non fips rsa method"}, |
164 | {ERR_REASON(RSA_R_NON_FIPS_RSA_METHOD) ,"non fips rsa method"}, | 163 | {ERR_REASON(RSA_R_NO_PUBLIC_EXPONENT) , "no public exponent"}, |
165 | {ERR_REASON(RSA_R_NO_PUBLIC_EXPONENT) ,"no public exponent"}, | 164 | {ERR_REASON(RSA_R_NULL_BEFORE_BLOCK_MISSING), "null before block missing"}, |
166 | {ERR_REASON(RSA_R_NULL_BEFORE_BLOCK_MISSING),"null before block missing"}, | 165 | {ERR_REASON(RSA_R_N_DOES_NOT_EQUAL_P_Q) , "n does not equal p q"}, |
167 | {ERR_REASON(RSA_R_N_DOES_NOT_EQUAL_P_Q) ,"n does not equal p q"}, | 166 | {ERR_REASON(RSA_R_OAEP_DECODING_ERROR) , "oaep decoding error"}, |
168 | {ERR_REASON(RSA_R_OAEP_DECODING_ERROR) ,"oaep decoding error"}, | 167 | {ERR_REASON(RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE), "operation not allowed in fips mode"}, |
169 | {ERR_REASON(RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE),"operation not allowed in fips mode"}, | 168 | {ERR_REASON(RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE), "operation not supported for this keytype"}, |
170 | {ERR_REASON(RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE),"operation not supported for this keytype"}, | 169 | {ERR_REASON(RSA_R_PADDING_CHECK_FAILED) , "padding check failed"}, |
171 | {ERR_REASON(RSA_R_PADDING_CHECK_FAILED) ,"padding check failed"}, | 170 | {ERR_REASON(RSA_R_P_NOT_PRIME) , "p not prime"}, |
172 | {ERR_REASON(RSA_R_P_NOT_PRIME) ,"p not prime"}, | 171 | {ERR_REASON(RSA_R_Q_NOT_PRIME) , "q not prime"}, |
173 | {ERR_REASON(RSA_R_Q_NOT_PRIME) ,"q not prime"}, | 172 | {ERR_REASON(RSA_R_RSA_OPERATIONS_NOT_SUPPORTED), "rsa operations not supported"}, |
174 | {ERR_REASON(RSA_R_RSA_OPERATIONS_NOT_SUPPORTED),"rsa operations not supported"}, | 173 | {ERR_REASON(RSA_R_SLEN_CHECK_FAILED) , "salt length check failed"}, |
175 | {ERR_REASON(RSA_R_SLEN_CHECK_FAILED) ,"salt length check failed"}, | 174 | {ERR_REASON(RSA_R_SLEN_RECOVERY_FAILED) , "salt length recovery failed"}, |
176 | {ERR_REASON(RSA_R_SLEN_RECOVERY_FAILED) ,"salt length recovery failed"}, | 175 | {ERR_REASON(RSA_R_SSLV3_ROLLBACK_ATTACK) , "sslv3 rollback attack"}, |
177 | {ERR_REASON(RSA_R_SSLV3_ROLLBACK_ATTACK) ,"sslv3 rollback attack"}, | 176 | {ERR_REASON(RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD), "the asn1 object identifier is not known for this md"}, |
178 | {ERR_REASON(RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD),"the asn1 object identifier is not known for this md"}, | 177 | {ERR_REASON(RSA_R_UNKNOWN_ALGORITHM_TYPE), "unknown algorithm type"}, |
179 | {ERR_REASON(RSA_R_UNKNOWN_ALGORITHM_TYPE),"unknown algorithm type"}, | 178 | {ERR_REASON(RSA_R_UNKNOWN_MASK_DIGEST) , "unknown mask digest"}, |
180 | {ERR_REASON(RSA_R_UNKNOWN_MASK_DIGEST) ,"unknown mask digest"}, | 179 | {ERR_REASON(RSA_R_UNKNOWN_PADDING_TYPE) , "unknown padding type"}, |
181 | {ERR_REASON(RSA_R_UNKNOWN_PADDING_TYPE) ,"unknown padding type"}, | 180 | {ERR_REASON(RSA_R_UNKNOWN_PSS_DIGEST) , "unknown pss digest"}, |
182 | {ERR_REASON(RSA_R_UNKNOWN_PSS_DIGEST) ,"unknown pss digest"}, | 181 | {ERR_REASON(RSA_R_UNSUPPORTED_MASK_ALGORITHM), "unsupported mask algorithm"}, |
183 | {ERR_REASON(RSA_R_UNSUPPORTED_MASK_ALGORITHM),"unsupported mask algorithm"}, | 182 | {ERR_REASON(RSA_R_UNSUPPORTED_MASK_PARAMETER), "unsupported mask parameter"}, |
184 | {ERR_REASON(RSA_R_UNSUPPORTED_MASK_PARAMETER),"unsupported mask parameter"}, | 183 | {ERR_REASON(RSA_R_UNSUPPORTED_SIGNATURE_TYPE), "unsupported signature type"}, |
185 | {ERR_REASON(RSA_R_UNSUPPORTED_SIGNATURE_TYPE),"unsupported signature type"}, | 184 | {ERR_REASON(RSA_R_VALUE_MISSING) , "value missing"}, |
186 | {ERR_REASON(RSA_R_VALUE_MISSING) ,"value missing"}, | 185 | {ERR_REASON(RSA_R_WRONG_SIGNATURE_LENGTH), "wrong signature length"}, |
187 | {ERR_REASON(RSA_R_WRONG_SIGNATURE_LENGTH),"wrong signature length"}, | 186 | {0, NULL} |
188 | {0,NULL} | 187 | }; |
189 | }; | ||
190 | 188 | ||
191 | #endif | 189 | #endif |
192 | 190 | ||
193 | void ERR_load_RSA_strings(void) | 191 | void |
194 | { | 192 | ERR_load_RSA_strings(void) |
193 | { | ||
195 | #ifndef OPENSSL_NO_ERR | 194 | #ifndef OPENSSL_NO_ERR |
196 | 195 | if (ERR_func_error_string(RSA_str_functs[0].error) == NULL) { | |
197 | if (ERR_func_error_string(RSA_str_functs[0].error) == NULL) | 196 | ERR_load_strings(0, RSA_str_functs); |
198 | { | 197 | ERR_load_strings(0, RSA_str_reasons); |
199 | ERR_load_strings(0,RSA_str_functs); | ||
200 | ERR_load_strings(0,RSA_str_reasons); | ||
201 | } | ||
202 | #endif | ||
203 | } | 198 | } |
199 | #endif | ||
200 | } | ||
diff --git a/src/lib/libcrypto/rsa/rsa_gen.c b/src/lib/libcrypto/rsa/rsa_gen.c index 3a6aa1ca7a..f000b41940 100644 --- a/src/lib/libcrypto/rsa/rsa_gen.c +++ b/src/lib/libcrypto/rsa/rsa_gen.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: rsa_gen.c,v 1.14 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_gen.c,v 1.15 2014/07/09 19:51:38 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 |
@@ -154,8 +154,8 @@ rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb) | |||
154 | if (!BN_generate_prime_ex(rsa->q, bitsq, 0, NULL, NULL, | 154 | if (!BN_generate_prime_ex(rsa->q, bitsq, 0, NULL, NULL, |
155 | cb)) | 155 | cb)) |
156 | goto err; | 156 | goto err; |
157 | } while (BN_cmp(rsa->p, rsa->q) == 0 && | 157 | } while (BN_cmp(rsa->p, rsa->q) == 0 && |
158 | ++degenerate < 3); | 158 | ++degenerate < 3); |
159 | if (degenerate == 3) { | 159 | if (degenerate == 3) { |
160 | ok = 0; /* we set our own err */ | 160 | ok = 0; /* we set our own err */ |
161 | RSAerr(RSA_F_RSA_BUILTIN_KEYGEN, | 161 | RSAerr(RSA_F_RSA_BUILTIN_KEYGEN, |
@@ -173,7 +173,7 @@ rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb) | |||
173 | } | 173 | } |
174 | if (!BN_GENCB_call(cb, 3, 1)) | 174 | if (!BN_GENCB_call(cb, 3, 1)) |
175 | goto err; | 175 | goto err; |
176 | if (BN_cmp(rsa->p,rsa->q) < 0) { | 176 | if (BN_cmp(rsa->p, rsa->q) < 0) { |
177 | tmp = rsa->p; | 177 | tmp = rsa->p; |
178 | rsa->p = rsa->q; | 178 | rsa->p = rsa->q; |
179 | rsa->q = tmp; | 179 | rsa->q = tmp; |
@@ -191,8 +191,8 @@ rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb) | |||
191 | if (!BN_mul(r0, r1, r2, ctx)) /* (p-1)(q-1) */ | 191 | if (!BN_mul(r0, r1, r2, ctx)) /* (p-1)(q-1) */ |
192 | goto err; | 192 | goto err; |
193 | if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) { | 193 | if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) { |
194 | pr0 = &local_r0; | 194 | pr0 = &local_r0; |
195 | BN_with_flags(pr0, r0, BN_FLG_CONSTTIME); | 195 | BN_with_flags(pr0, r0, BN_FLG_CONSTTIME); |
196 | } else | 196 | } else |
197 | pr0 = r0; | 197 | pr0 = r0; |
198 | if (!BN_mod_inverse(rsa->d, rsa->e, pr0, ctx)) /* d */ | 198 | if (!BN_mod_inverse(rsa->d, rsa->e, pr0, ctx)) /* d */ |
diff --git a/src/lib/libcrypto/rsa/rsa_lib.c b/src/lib/libcrypto/rsa/rsa_lib.c index 44a86700c2..5afed37825 100644 --- a/src/lib/libcrypto/rsa/rsa_lib.c +++ b/src/lib/libcrypto/rsa/rsa_lib.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: rsa_lib.c,v 1.24 2014/07/09 11:10:51 bcook Exp $ */ | 1 | /* $OpenBSD: rsa_lib.c,v 1.25 2014/07/09 19:51:38 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 |
@@ -144,7 +144,7 @@ RSA_new_method(ENGINE *engine) | |||
144 | ret->engine = engine; | 144 | ret->engine = engine; |
145 | } else | 145 | } else |
146 | ret->engine = ENGINE_get_default_RSA(); | 146 | ret->engine = ENGINE_get_default_RSA(); |
147 | if(ret->engine) { | 147 | if (ret->engine) { |
148 | ret->meth = ENGINE_get_RSA(ret->engine); | 148 | ret->meth = ENGINE_get_RSA(ret->engine); |
149 | if (!ret->meth) { | 149 | if (!ret->meth) { |
150 | RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_ENGINE_LIB); | 150 | RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_ENGINE_LIB); |
diff --git a/src/lib/libcrypto/rsa/rsa_none.c b/src/lib/libcrypto/rsa/rsa_none.c index fde5eb6ef6..818fd26fa4 100644 --- a/src/lib/libcrypto/rsa/rsa_none.c +++ b/src/lib/libcrypto/rsa/rsa_none.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: rsa_none.c,v 1.5 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_none.c,v 1.6 2014/07/09 19:51:38 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 |
@@ -77,7 +77,7 @@ RSA_padding_add_none(unsigned char *to, int tlen, const unsigned char *from, | |||
77 | RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE); | 77 | RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE); |
78 | return 0; | 78 | return 0; |
79 | } | 79 | } |
80 | 80 | ||
81 | memcpy(to, from, (unsigned int)flen); | 81 | memcpy(to, from, (unsigned int)flen); |
82 | return 1; | 82 | return 1; |
83 | } | 83 | } |
diff --git a/src/lib/libcrypto/rsa/rsa_oaep.c b/src/lib/libcrypto/rsa/rsa_oaep.c index df288fa615..1e862a99e0 100644 --- a/src/lib/libcrypto/rsa/rsa_oaep.c +++ b/src/lib/libcrypto/rsa/rsa_oaep.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_oaep.c,v 1.18 2014/07/09 17:08:40 miod Exp $ */ | 1 | /* $OpenBSD: rsa_oaep.c,v 1.19 2014/07/09 19:51:38 jsing Exp $ */ |
2 | /* Written by Ulf Moeller. This software is distributed on an "AS IS" | 2 | /* Written by Ulf Moeller. This software is distributed on an "AS IS" |
3 | basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. */ | 3 | basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. */ |
4 | 4 | ||
@@ -8,7 +8,7 @@ | |||
8 | * <URL: http://www.shoup.net/papers/oaep.ps.Z> | 8 | * <URL: http://www.shoup.net/papers/oaep.ps.Z> |
9 | * for problems with the security proof for the | 9 | * for problems with the security proof for the |
10 | * original OAEP scheme, which EME-OAEP is based on. | 10 | * original OAEP scheme, which EME-OAEP is based on. |
11 | * | 11 | * |
12 | * A new proof can be found in E. Fujisaki, T. Okamoto, | 12 | * A new proof can be found in E. Fujisaki, T. Okamoto, |
13 | * D. Pointcheval, J. Stern, "RSA-OEAP is Still Alive!", | 13 | * D. Pointcheval, J. Stern, "RSA-OEAP is Still Alive!", |
14 | * Dec. 2000, <URL: http://eprint.iacr.org/2000/061/>. | 14 | * Dec. 2000, <URL: http://eprint.iacr.org/2000/061/>. |
@@ -29,7 +29,7 @@ | |||
29 | #include <openssl/sha.h> | 29 | #include <openssl/sha.h> |
30 | 30 | ||
31 | static int MGF1(unsigned char *mask, long len, const unsigned char *seed, | 31 | static int MGF1(unsigned char *mask, long len, const unsigned char *seed, |
32 | long seedlen); | 32 | long seedlen); |
33 | 33 | ||
34 | int | 34 | int |
35 | RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, | 35 | RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, |
@@ -142,7 +142,7 @@ RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, | |||
142 | return -1; | 142 | return -1; |
143 | for (i = 0; i < SHA_DIGEST_LENGTH; i++) | 143 | for (i = 0; i < SHA_DIGEST_LENGTH; i++) |
144 | seed[i] ^= padded_from[i]; | 144 | seed[i] ^= padded_from[i]; |
145 | 145 | ||
146 | if (MGF1(db, dblen, seed, SHA_DIGEST_LENGTH)) | 146 | if (MGF1(db, dblen, seed, SHA_DIGEST_LENGTH)) |
147 | return -1; | 147 | return -1; |
148 | for (i = 0; i < dblen; i++) | 148 | for (i = 0; i < dblen; i++) |
@@ -204,7 +204,7 @@ PKCS1_MGF1(unsigned char *mask, long len, const unsigned char *seed, | |||
204 | cnt[1] = (unsigned char)((i >> 16) & 255); | 204 | cnt[1] = (unsigned char)((i >> 16) & 255); |
205 | cnt[2] = (unsigned char)((i >> 8)) & 255; | 205 | cnt[2] = (unsigned char)((i >> 8)) & 255; |
206 | cnt[3] = (unsigned char)(i & 255); | 206 | cnt[3] = (unsigned char)(i & 255); |
207 | if (!EVP_DigestInit_ex(&c,dgst, NULL) || | 207 | if (!EVP_DigestInit_ex(&c, dgst, NULL) || |
208 | !EVP_DigestUpdate(&c, seed, seedlen) || | 208 | !EVP_DigestUpdate(&c, seed, seedlen) || |
209 | !EVP_DigestUpdate(&c, cnt, 4)) | 209 | !EVP_DigestUpdate(&c, cnt, 4)) |
210 | goto err; | 210 | goto err; |
diff --git a/src/lib/libcrypto/rsa/rsa_pk1.c b/src/lib/libcrypto/rsa/rsa_pk1.c index f5492315cc..d394b300c6 100644 --- a/src/lib/libcrypto/rsa/rsa_pk1.c +++ b/src/lib/libcrypto/rsa/rsa_pk1.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: rsa_pk1.c,v 1.8 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_pk1.c,v 1.9 2014/07/09 19:51:38 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 |
@@ -69,12 +69,12 @@ RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, | |||
69 | int j; | 69 | int j; |
70 | unsigned char *p; | 70 | unsigned char *p; |
71 | 71 | ||
72 | if (flen > (tlen-RSA_PKCS1_PADDING_SIZE)) { | 72 | if (flen > (tlen - RSA_PKCS1_PADDING_SIZE)) { |
73 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1, | 73 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1, |
74 | RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); | 74 | RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); |
75 | return 0; | 75 | return 0; |
76 | } | 76 | } |
77 | 77 | ||
78 | p = (unsigned char *)to; | 78 | p = (unsigned char *)to; |
79 | 79 | ||
80 | *(p++) = 0; | 80 | *(p++) = 0; |
@@ -86,6 +86,7 @@ RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, | |||
86 | p += j; | 86 | p += j; |
87 | *(p++) = '\0'; | 87 | *(p++) = '\0'; |
88 | memcpy(p, from, (unsigned int)flen); | 88 | memcpy(p, from, (unsigned int)flen); |
89 | |||
89 | return 1; | 90 | return 1; |
90 | } | 91 | } |
91 | 92 | ||
@@ -106,7 +107,8 @@ RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen, | |||
106 | /* scan over padding data */ | 107 | /* scan over padding data */ |
107 | j = flen - 1; /* one for type. */ | 108 | j = flen - 1; /* one for type. */ |
108 | for (i = 0; i < j; i++) { | 109 | for (i = 0; i < j; i++) { |
109 | if (*p != 0xff) { /* should decrypt to 0xff */ | 110 | if (*p != 0xff) { |
111 | /* should decrypt to 0xff */ | ||
110 | if (*p == 0) { | 112 | if (*p == 0) { |
111 | p++; | 113 | p++; |
112 | break; | 114 | break; |
@@ -146,15 +148,15 @@ int | |||
146 | RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, | 148 | RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, |
147 | const unsigned char *from, int flen) | 149 | const unsigned char *from, int flen) |
148 | { | 150 | { |
149 | int i,j; | 151 | int i, j; |
150 | unsigned char *p; | 152 | unsigned char *p; |
151 | 153 | ||
152 | if (flen > tlen - 11) { | 154 | if (flen > tlen - 11) { |
153 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2, | 155 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2, |
154 | RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); | 156 | RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); |
155 | return 0; | 157 | return 0; |
156 | } | 158 | } |
157 | 159 | ||
158 | p = (unsigned char *)to; | 160 | p = (unsigned char *)to; |
159 | 161 | ||
160 | *(p++) = 0; | 162 | *(p++) = 0; |
diff --git a/src/lib/libcrypto/rsa/rsa_pmeth.c b/src/lib/libcrypto/rsa/rsa_pmeth.c index 4a662c2894..f35b5800ab 100644 --- a/src/lib/libcrypto/rsa/rsa_pmeth.c +++ b/src/lib/libcrypto/rsa/rsa_pmeth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_pmeth.c,v 1.9 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_pmeth.c,v 1.10 2014/07/09 19:51:38 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -110,7 +110,7 @@ pkey_rsa_init(EVP_PKEY_CTX *ctx) | |||
110 | ctx->data = rctx; | 110 | ctx->data = rctx; |
111 | ctx->keygen_info = rctx->gentmp; | 111 | ctx->keygen_info = rctx->gentmp; |
112 | ctx->keygen_info_count = 2; | 112 | ctx->keygen_info_count = 2; |
113 | 113 | ||
114 | return 1; | 114 | return 1; |
115 | } | 115 | } |
116 | 116 | ||
@@ -121,7 +121,7 @@ pkey_rsa_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src) | |||
121 | 121 | ||
122 | if (!pkey_rsa_init(dst)) | 122 | if (!pkey_rsa_init(dst)) |
123 | return 0; | 123 | return 0; |
124 | sctx = src->data; | 124 | sctx = src->data; |
125 | dctx = dst->data; | 125 | dctx = dst->data; |
126 | dctx->nbits = sctx->nbits; | 126 | dctx->nbits = sctx->nbits; |
127 | if (sctx->pub_exp) { | 127 | if (sctx->pub_exp) { |
@@ -236,7 +236,7 @@ pkey_rsa_verifyrecover(EVP_PKEY_CTX *ctx, unsigned char *rout, size_t *routlen, | |||
236 | return 0; | 236 | return 0; |
237 | ret--; | 237 | ret--; |
238 | if (rctx->tbuf[ret] != | 238 | if (rctx->tbuf[ret] != |
239 | RSA_X931_hash_id(EVP_MD_type(rctx->md))) { | 239 | RSA_X931_hash_id(EVP_MD_type(rctx->md))) { |
240 | RSAerr(RSA_F_PKEY_RSA_VERIFYRECOVER, | 240 | RSAerr(RSA_F_PKEY_RSA_VERIFYRECOVER, |
241 | RSA_R_ALGORITHM_MISMATCH); | 241 | RSA_R_ALGORITHM_MISMATCH); |
242 | return 0; | 242 | return 0; |
@@ -371,6 +371,7 @@ static int | |||
371 | pkey_rsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) | 371 | pkey_rsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) |
372 | { | 372 | { |
373 | RSA_PKEY_CTX *rctx = ctx->data; | 373 | RSA_PKEY_CTX *rctx = ctx->data; |
374 | |||
374 | switch (type) { | 375 | switch (type) { |
375 | case EVP_PKEY_CTRL_RSA_PADDING: | 376 | case EVP_PKEY_CTRL_RSA_PADDING: |
376 | if (p1 >= RSA_PKCS1_PADDING && p1 <= RSA_PKCS1_PSS_PADDING) { | 377 | if (p1 >= RSA_PKCS1_PADDING && p1 <= RSA_PKCS1_PSS_PADDING) { |
@@ -458,17 +459,18 @@ bad_pad: | |||
458 | return 1; | 459 | return 1; |
459 | #ifndef OPENSSL_NO_CMS | 460 | #ifndef OPENSSL_NO_CMS |
460 | case EVP_PKEY_CTRL_CMS_DECRYPT: | 461 | case EVP_PKEY_CTRL_CMS_DECRYPT: |
461 | { | 462 | { |
462 | X509_ALGOR *alg = NULL; | 463 | X509_ALGOR *alg = NULL; |
463 | ASN1_OBJECT *encalg = NULL; | 464 | ASN1_OBJECT *encalg = NULL; |
464 | 465 | ||
465 | if (p2) | 466 | if (p2) |
466 | CMS_RecipientInfo_ktri_get0_algs(p2, NULL, NULL, &alg); | 467 | CMS_RecipientInfo_ktri_get0_algs(p2, NULL, |
467 | if (alg) | 468 | NULL, &alg); |
468 | X509_ALGOR_get0(&encalg, NULL, NULL, alg); | 469 | if (alg) |
469 | if (encalg && OBJ_obj2nid(encalg) == NID_rsaesOaep) | 470 | X509_ALGOR_get0(&encalg, NULL, NULL, alg); |
470 | rctx->pad_mode = RSA_PKCS1_OAEP_PADDING; | 471 | if (encalg && OBJ_obj2nid(encalg) == NID_rsaesOaep) |
471 | } | 472 | rctx->pad_mode = RSA_PKCS1_OAEP_PADDING; |
473 | } | ||
472 | /* FALLTHROUGH */ | 474 | /* FALLTHROUGH */ |
473 | 475 | ||
474 | case EVP_PKEY_CTRL_CMS_ENCRYPT: | 476 | case EVP_PKEY_CTRL_CMS_ENCRYPT: |
@@ -477,18 +479,18 @@ bad_pad: | |||
477 | #endif | 479 | #endif |
478 | case EVP_PKEY_CTRL_PEER_KEY: | 480 | case EVP_PKEY_CTRL_PEER_KEY: |
479 | RSAerr(RSA_F_PKEY_RSA_CTRL, | 481 | RSAerr(RSA_F_PKEY_RSA_CTRL, |
480 | RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE); | 482 | RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE); |
481 | return -2; | 483 | return -2; |
482 | 484 | ||
483 | default: | 485 | default: |
484 | return -2; | 486 | return -2; |
485 | } | 487 | } |
486 | } | 488 | } |
487 | 489 | ||
488 | static int | 490 | static int |
489 | pkey_rsa_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, const char *value) | 491 | pkey_rsa_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, const char *value) |
490 | { | 492 | { |
491 | long lval; | 493 | long lval; |
492 | char *ep; | 494 | char *ep; |
493 | 495 | ||
494 | if (!value) { | 496 | if (!value) { |
diff --git a/src/lib/libcrypto/rsa/rsa_prn.c b/src/lib/libcrypto/rsa/rsa_prn.c index 89cf2b45b0..5d5b0e29d8 100644 --- a/src/lib/libcrypto/rsa/rsa_prn.c +++ b/src/lib/libcrypto/rsa/rsa_prn.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_prn.c,v 1.4 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_prn.c,v 1.5 2014/07/09 19:51:38 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
diff --git a/src/lib/libcrypto/rsa/rsa_pss.c b/src/lib/libcrypto/rsa/rsa_pss.c index 4c6a90c1c7..09bf32439b 100644 --- a/src/lib/libcrypto/rsa/rsa_pss.c +++ b/src/lib/libcrypto/rsa/rsa_pss.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_pss.c,v 1.6 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_pss.c,v 1.7 2014/07/09 19:51:38 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2005. | 3 | * project 2005. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -121,7 +121,8 @@ RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, | |||
121 | EM++; | 121 | EM++; |
122 | emLen--; | 122 | emLen--; |
123 | } | 123 | } |
124 | if (emLen < (hLen + sLen + 2)) { /* sLen can be small negative */ | 124 | if (emLen < (hLen + sLen + 2)) { |
125 | /* sLen can be small negative */ | ||
125 | RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_DATA_TOO_LARGE); | 126 | RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_DATA_TOO_LARGE); |
126 | goto err; | 127 | goto err; |
127 | } | 128 | } |
@@ -143,7 +144,7 @@ RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, | |||
143 | DB[i] ^= EM[i]; | 144 | DB[i] ^= EM[i]; |
144 | if (MSBits) | 145 | if (MSBits) |
145 | DB[0] &= 0xFF >> (8 - MSBits); | 146 | DB[0] &= 0xFF >> (8 - MSBits); |
146 | for (i = 0; DB[i] == 0 && i < (maskedDBLen-1); i++) | 147 | for (i = 0; DB[i] == 0 && i < (maskedDBLen - 1); i++) |
147 | ; | 148 | ; |
148 | if (DB[i++] != 0x1) { | 149 | if (DB[i++] != 0x1) { |
149 | RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, | 150 | RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, |
@@ -168,7 +169,7 @@ RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, | |||
168 | if (memcmp(H_, H, hLen)) { | 169 | if (memcmp(H_, H, hLen)) { |
169 | RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_BAD_SIGNATURE); | 170 | RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_BAD_SIGNATURE); |
170 | ret = 0; | 171 | ret = 0; |
171 | } else | 172 | } else |
172 | ret = 1; | 173 | ret = 1; |
173 | 174 | ||
174 | err: | 175 | err: |
diff --git a/src/lib/libcrypto/rsa/rsa_saos.c b/src/lib/libcrypto/rsa/rsa_saos.c index 50dfef7e71..0ff9f570f4 100644 --- a/src/lib/libcrypto/rsa/rsa_saos.c +++ b/src/lib/libcrypto/rsa/rsa_saos.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: rsa_saos.c,v 1.12 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_saos.c,v 1.13 2014/07/09 19:51:38 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 |
@@ -69,7 +69,7 @@ RSA_sign_ASN1_OCTET_STRING(int type, const unsigned char *m, unsigned int m_len, | |||
69 | { | 69 | { |
70 | ASN1_OCTET_STRING sig; | 70 | ASN1_OCTET_STRING sig; |
71 | int i, j, ret = 1; | 71 | int i, j, ret = 1; |
72 | unsigned char *p,*s; | 72 | unsigned char *p, *s; |
73 | 73 | ||
74 | sig.type = V_ASN1_OCTET_STRING; | 74 | sig.type = V_ASN1_OCTET_STRING; |
75 | sig.length = m_len; | 75 | sig.length = m_len; |
@@ -132,7 +132,7 @@ RSA_verify_ASN1_OCTET_STRING(int dtype, const unsigned char *m, | |||
132 | goto err; | 132 | goto err; |
133 | 133 | ||
134 | if ((unsigned int)sig->length != m_len || | 134 | if ((unsigned int)sig->length != m_len || |
135 | memcmp(m,sig->data, m_len) != 0) { | 135 | memcmp(m, sig->data, m_len) != 0) { |
136 | RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING, | 136 | RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING, |
137 | RSA_R_BAD_SIGNATURE); | 137 | RSA_R_BAD_SIGNATURE); |
138 | } else | 138 | } else |
diff --git a/src/lib/libcrypto/rsa/rsa_sign.c b/src/lib/libcrypto/rsa/rsa_sign.c index 9718589be7..11ee2d128d 100644 --- a/src/lib/libcrypto/rsa/rsa_sign.c +++ b/src/lib/libcrypto/rsa/rsa_sign.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: rsa_sign.c,v 1.19 2014/07/09 09:04:14 miod Exp $ */ | 1 | /* $OpenBSD: rsa_sign.c,v 1.20 2014/07/09 19:51:38 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 |
@@ -137,7 +137,7 @@ RSA_sign(int type, const unsigned char *m, unsigned int m_len, | |||
137 | OPENSSL_cleanse(tmps, (unsigned int)j + 1); | 137 | OPENSSL_cleanse(tmps, (unsigned int)j + 1); |
138 | free(tmps); | 138 | free(tmps); |
139 | } | 139 | } |
140 | return(ret); | 140 | return (ret); |
141 | } | 141 | } |
142 | 142 | ||
143 | int | 143 | int |
@@ -199,7 +199,7 @@ int_rsa_verify(int dtype, const unsigned char *m, unsigned int m_len, | |||
199 | else | 199 | else |
200 | ret = 1; | 200 | ret = 1; |
201 | } else { | 201 | } else { |
202 | const unsigned char *p=s; | 202 | const unsigned char *p = s; |
203 | 203 | ||
204 | sig = d2i_X509_SIG(NULL, &p, (long)i); | 204 | sig = d2i_X509_SIG(NULL, &p, (long)i); |
205 | 205 | ||
@@ -240,7 +240,7 @@ int_rsa_verify(int dtype, const unsigned char *m, unsigned int m_len, | |||
240 | ret = 1; | 240 | ret = 1; |
241 | } | 241 | } |
242 | } else if ((unsigned int)sig->digest->length != m_len || | 242 | } else if ((unsigned int)sig->digest->length != m_len || |
243 | memcmp(m,sig->digest->data,m_len) != 0) { | 243 | memcmp(m, sig->digest->data, m_len) != 0) { |
244 | RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_BAD_SIGNATURE); | 244 | RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_BAD_SIGNATURE); |
245 | } else | 245 | } else |
246 | ret = 1; | 246 | ret = 1; |
diff --git a/src/lib/libcrypto/rsa/rsa_ssl.c b/src/lib/libcrypto/rsa/rsa_ssl.c index c6ab71c674..09deb08985 100644 --- a/src/lib/libcrypto/rsa/rsa_ssl.c +++ b/src/lib/libcrypto/rsa/rsa_ssl.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: rsa_ssl.c,v 1.8 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_ssl.c,v 1.9 2014/07/09 19:51:38 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 |
@@ -66,15 +66,15 @@ int | |||
66 | RSA_padding_add_SSLv23(unsigned char *to, int tlen, const unsigned char *from, | 66 | RSA_padding_add_SSLv23(unsigned char *to, int tlen, const unsigned char *from, |
67 | int flen) | 67 | int flen) |
68 | { | 68 | { |
69 | int i,j; | 69 | int i, j; |
70 | unsigned char *p; | 70 | unsigned char *p; |
71 | 71 | ||
72 | if (flen > tlen - 11) { | 72 | if (flen > tlen - 11) { |
73 | RSAerr(RSA_F_RSA_PADDING_ADD_SSLV23, | 73 | RSAerr(RSA_F_RSA_PADDING_ADD_SSLV23, |
74 | RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); | 74 | RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); |
75 | return 0; | 75 | return 0; |
76 | } | 76 | } |
77 | 77 | ||
78 | p = (unsigned char *)to; | 78 | p = (unsigned char *)to; |
79 | 79 | ||
80 | *(p++) = 0; | 80 | *(p++) = 0; |
diff --git a/src/lib/libcrypto/rsa/rsa_x931.c b/src/lib/libcrypto/rsa/rsa_x931.c index c3305139f8..74c4af91a5 100644 --- a/src/lib/libcrypto/rsa/rsa_x931.c +++ b/src/lib/libcrypto/rsa/rsa_x931.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_x931.c,v 1.4 2014/07/09 09:07:00 miod Exp $ */ | 1 | /* $OpenBSD: rsa_x931.c,v 1.5 2014/07/09 19:51:38 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2005. | 3 | * project 2005. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -81,7 +81,7 @@ RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *from, | |||
81 | RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); | 81 | RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); |
82 | return -1; | 82 | return -1; |
83 | } | 83 | } |
84 | 84 | ||
85 | p = (unsigned char *)to; | 85 | p = (unsigned char *)to; |
86 | 86 | ||
87 | /* If no padding start and end nibbles are in one byte */ | 87 | /* If no padding start and end nibbles are in one byte */ |
@@ -103,7 +103,7 @@ RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *from, | |||
103 | 103 | ||
104 | int | 104 | int |
105 | RSA_padding_check_X931(unsigned char *to, int tlen, const unsigned char *from, | 105 | RSA_padding_check_X931(unsigned char *to, int tlen, const unsigned char *from, |
106 | int flen, int num) | 106 | int flen, int num) |
107 | { | 107 | { |
108 | int i = 0, j; | 108 | int i = 0, j; |
109 | const unsigned char *p = from; | 109 | const unsigned char *p = from; |
@@ -121,13 +121,14 @@ RSA_padding_check_X931(unsigned char *to, int tlen, const unsigned char *from, | |||
121 | break; | 121 | break; |
122 | if (c != 0xBB) { | 122 | if (c != 0xBB) { |
123 | RSAerr(RSA_F_RSA_PADDING_CHECK_X931, | 123 | RSAerr(RSA_F_RSA_PADDING_CHECK_X931, |
124 | RSA_R_INVALID_PADDING); | 124 | RSA_R_INVALID_PADDING); |
125 | return -1; | 125 | return -1; |
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | if (i == 0) { | 129 | if (i == 0) { |
130 | RSAerr(RSA_F_RSA_PADDING_CHECK_X931, RSA_R_INVALID_PADDING); | 130 | RSAerr(RSA_F_RSA_PADDING_CHECK_X931, |
131 | RSA_R_INVALID_PADDING); | ||
131 | return -1; | 132 | return -1; |
132 | } | 133 | } |
133 | 134 | ||
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_ameth.c b/src/lib/libssl/src/crypto/rsa/rsa_ameth.c index 8e15e3f535..813c634f31 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_ameth.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_ameth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_ameth.c,v 1.7 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_ameth.c,v 1.8 2014/07/09 19:51:38 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -104,8 +104,8 @@ rsa_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey) | |||
104 | static int | 104 | static int |
105 | rsa_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b) | 105 | rsa_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b) |
106 | { | 106 | { |
107 | if (BN_cmp(b->pkey.rsa->n,a->pkey.rsa->n) != 0 || | 107 | if (BN_cmp(b->pkey.rsa->n, a->pkey.rsa->n) != 0 || |
108 | BN_cmp(b->pkey.rsa->e,a->pkey.rsa->e) != 0) | 108 | BN_cmp(b->pkey.rsa->e, a->pkey.rsa->e) != 0) |
109 | return 0; | 109 | return 0; |
110 | return 1; | 110 | return 1; |
111 | } | 111 | } |
@@ -256,7 +256,7 @@ do_rsa_print(BIO *bp, const RSA *x, int off, int priv) | |||
256 | ret = 1; | 256 | ret = 1; |
257 | err: | 257 | err: |
258 | free(m); | 258 | free(m); |
259 | return(ret); | 259 | return (ret); |
260 | } | 260 | } |
261 | 261 | ||
262 | static int | 262 | static int |
@@ -282,13 +282,14 @@ rsa_pss_decode(const X509_ALGOR *alg, X509_ALGOR **pmaskHash) | |||
282 | 282 | ||
283 | if (!alg->parameter || alg->parameter->type != V_ASN1_SEQUENCE) | 283 | if (!alg->parameter || alg->parameter->type != V_ASN1_SEQUENCE) |
284 | return NULL; | 284 | return NULL; |
285 | |||
285 | p = alg->parameter->value.sequence->data; | 286 | p = alg->parameter->value.sequence->data; |
286 | plen = alg->parameter->value.sequence->length; | 287 | plen = alg->parameter->value.sequence->length; |
287 | pss = d2i_RSA_PSS_PARAMS(NULL, &p, plen); | 288 | pss = d2i_RSA_PSS_PARAMS(NULL, &p, plen); |
288 | 289 | ||
289 | if (!pss) | 290 | if (!pss) |
290 | return NULL; | 291 | return NULL; |
291 | 292 | ||
292 | if (pss->maskGenAlgorithm) { | 293 | if (pss->maskGenAlgorithm) { |
293 | ASN1_TYPE *param = pss->maskGenAlgorithm->parameter; | 294 | ASN1_TYPE *param = pss->maskGenAlgorithm->parameter; |
294 | if (OBJ_obj2nid(pss->maskGenAlgorithm->algorithm) == NID_mgf1 && | 295 | if (OBJ_obj2nid(pss->maskGenAlgorithm->algorithm) == NID_mgf1 && |
@@ -351,7 +352,7 @@ rsa_pss_param_print(BIO *bp, RSA_PSS_PARAMS *pss, X509_ALGOR *maskHash, | |||
351 | if (!BIO_indent(bp, indent, 128)) | 352 | if (!BIO_indent(bp, indent, 128)) |
352 | goto err; | 353 | goto err; |
353 | if (BIO_puts(bp, "Salt Length: 0x") <= 0) | 354 | if (BIO_puts(bp, "Salt Length: 0x") <= 0) |
354 | goto err; | 355 | goto err; |
355 | if (pss->saltLength) { | 356 | if (pss->saltLength) { |
356 | if (i2a_ASN1_INTEGER(bp, pss->saltLength) <= 0) | 357 | if (i2a_ASN1_INTEGER(bp, pss->saltLength) <= 0) |
357 | goto err; | 358 | goto err; |
@@ -369,7 +370,7 @@ rsa_pss_param_print(BIO *bp, RSA_PSS_PARAMS *pss, X509_ALGOR *maskHash, | |||
369 | } else if (BIO_puts(bp, "BC (default)") <= 0) | 370 | } else if (BIO_puts(bp, "BC (default)") <= 0) |
370 | goto err; | 371 | goto err; |
371 | BIO_puts(bp, "\n"); | 372 | BIO_puts(bp, "\n"); |
372 | 373 | ||
373 | rv = 1; | 374 | rv = 1; |
374 | 375 | ||
375 | err: | 376 | err: |
@@ -403,6 +404,7 @@ static int | |||
403 | rsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) | 404 | rsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) |
404 | { | 405 | { |
405 | X509_ALGOR *alg = NULL; | 406 | X509_ALGOR *alg = NULL; |
407 | |||
406 | switch (op) { | 408 | switch (op) { |
407 | case ASN1_PKEY_CTRL_PKCS7_SIGN: | 409 | case ASN1_PKEY_CTRL_PKCS7_SIGN: |
408 | if (arg1 == 0) | 410 | if (arg1 == 0) |
@@ -422,7 +424,7 @@ rsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) | |||
422 | case ASN1_PKEY_CTRL_CMS_ENVELOPE: | 424 | case ASN1_PKEY_CTRL_CMS_ENVELOPE: |
423 | if (arg1 == 0) | 425 | if (arg1 == 0) |
424 | CMS_RecipientInfo_ktri_get0_algs(arg2, NULL, NULL, &alg); | 426 | CMS_RecipientInfo_ktri_get0_algs(arg2, NULL, NULL, &alg); |
425 | break; | 427 | break; |
426 | #endif | 428 | #endif |
427 | 429 | ||
428 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: | 430 | case ASN1_PKEY_CTRL_DEFAULT_MD_NID: |
@@ -440,8 +442,8 @@ rsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) | |||
440 | return 1; | 442 | return 1; |
441 | } | 443 | } |
442 | 444 | ||
443 | /* Customised RSA item verification routine. This is called | 445 | /* Customised RSA item verification routine. This is called |
444 | * when a signature is encountered requiring special handling. We | 446 | * when a signature is encountered requiring special handling. We |
445 | * currently only handle PSS. | 447 | * currently only handle PSS. |
446 | */ | 448 | */ |
447 | static int | 449 | static int |
@@ -460,6 +462,7 @@ rsa_item_verify(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, | |||
460 | RSAerr(RSA_F_RSA_ITEM_VERIFY, RSA_R_UNSUPPORTED_SIGNATURE_TYPE); | 462 | RSAerr(RSA_F_RSA_ITEM_VERIFY, RSA_R_UNSUPPORTED_SIGNATURE_TYPE); |
461 | return -1; | 463 | return -1; |
462 | } | 464 | } |
465 | |||
463 | /* Decode PSS parameters */ | 466 | /* Decode PSS parameters */ |
464 | pss = rsa_pss_decode(sigalg, &maskHash); | 467 | pss = rsa_pss_decode(sigalg, &maskHash); |
465 | 468 | ||
@@ -544,7 +547,7 @@ err: | |||
544 | 547 | ||
545 | static int | 548 | static int |
546 | rsa_item_sign(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, | 549 | rsa_item_sign(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, |
547 | X509_ALGOR *alg1, X509_ALGOR *alg2, ASN1_BIT_STRING *sig) | 550 | X509_ALGOR *alg1, X509_ALGOR *alg2, ASN1_BIT_STRING *sig) |
548 | { | 551 | { |
549 | int pad_mode; | 552 | int pad_mode; |
550 | EVP_PKEY_CTX *pkctx = ctx->pctx; | 553 | EVP_PKEY_CTX *pkctx = ctx->pctx; |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_asn1.c b/src/lib/libssl/src/crypto/rsa/rsa_asn1.c index e876dbdf49..9bc5f17b06 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_asn1.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_asn1.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_asn1.c,v 1.7 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_asn1.c,v 1.8 2014/07/09 19:51:38 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -99,10 +99,10 @@ ASN1_SEQUENCE_cb(RSAPublicKey, rsa_cb) = { | |||
99 | } ASN1_SEQUENCE_END_cb(RSA, RSAPublicKey) | 99 | } ASN1_SEQUENCE_END_cb(RSA, RSAPublicKey) |
100 | 100 | ||
101 | ASN1_SEQUENCE(RSA_PSS_PARAMS) = { | 101 | ASN1_SEQUENCE(RSA_PSS_PARAMS) = { |
102 | ASN1_EXP_OPT(RSA_PSS_PARAMS, hashAlgorithm, X509_ALGOR,0), | 102 | ASN1_EXP_OPT(RSA_PSS_PARAMS, hashAlgorithm, X509_ALGOR, 0), |
103 | ASN1_EXP_OPT(RSA_PSS_PARAMS, maskGenAlgorithm, X509_ALGOR,1), | 103 | ASN1_EXP_OPT(RSA_PSS_PARAMS, maskGenAlgorithm, X509_ALGOR, 1), |
104 | ASN1_EXP_OPT(RSA_PSS_PARAMS, saltLength, ASN1_INTEGER,2), | 104 | ASN1_EXP_OPT(RSA_PSS_PARAMS, saltLength, ASN1_INTEGER, 2), |
105 | ASN1_EXP_OPT(RSA_PSS_PARAMS, trailerField, ASN1_INTEGER,3) | 105 | ASN1_EXP_OPT(RSA_PSS_PARAMS, trailerField, ASN1_INTEGER, 3) |
106 | } ASN1_SEQUENCE_END(RSA_PSS_PARAMS) | 106 | } ASN1_SEQUENCE_END(RSA_PSS_PARAMS) |
107 | 107 | ||
108 | IMPLEMENT_ASN1_FUNCTIONS(RSA_PSS_PARAMS) | 108 | IMPLEMENT_ASN1_FUNCTIONS(RSA_PSS_PARAMS) |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_chk.c b/src/lib/libssl/src/crypto/rsa/rsa_chk.c index 54113f89f6..0f9e0944db 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_chk.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_chk.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_chk.c,v 1.7 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_chk.c,v 1.8 2014/07/09 19:51:38 jsing Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -7,7 +7,7 @@ | |||
7 | * are met: | 7 | * are met: |
8 | * | 8 | * |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * | 11 | * |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in | 13 | * notice, this list of conditions and the following disclaimer in |
@@ -65,7 +65,7 @@ RSA_check_key(const RSA *key) | |||
65 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_VALUE_MISSING); | 65 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_VALUE_MISSING); |
66 | return 0; | 66 | return 0; |
67 | } | 67 | } |
68 | 68 | ||
69 | i = BN_new(); | 69 | i = BN_new(); |
70 | j = BN_new(); | 70 | j = BN_new(); |
71 | k = BN_new(); | 71 | k = BN_new(); |
@@ -78,7 +78,7 @@ RSA_check_key(const RSA *key) | |||
78 | RSAerr(RSA_F_RSA_CHECK_KEY, ERR_R_MALLOC_FAILURE); | 78 | RSAerr(RSA_F_RSA_CHECK_KEY, ERR_R_MALLOC_FAILURE); |
79 | goto err; | 79 | goto err; |
80 | } | 80 | } |
81 | 81 | ||
82 | /* p prime? */ | 82 | /* p prime? */ |
83 | r = BN_is_prime_ex(key->p, BN_prime_checks, NULL, NULL); | 83 | r = BN_is_prime_ex(key->p, BN_prime_checks, NULL, NULL); |
84 | if (r != 1) { | 84 | if (r != 1) { |
@@ -87,7 +87,7 @@ RSA_check_key(const RSA *key) | |||
87 | goto err; | 87 | goto err; |
88 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_P_NOT_PRIME); | 88 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_P_NOT_PRIME); |
89 | } | 89 | } |
90 | 90 | ||
91 | /* q prime? */ | 91 | /* q prime? */ |
92 | r = BN_is_prime_ex(key->q, BN_prime_checks, NULL, NULL); | 92 | r = BN_is_prime_ex(key->q, BN_prime_checks, NULL, NULL); |
93 | if (r != 1) { | 93 | if (r != 1) { |
@@ -96,19 +96,19 @@ RSA_check_key(const RSA *key) | |||
96 | goto err; | 96 | goto err; |
97 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_Q_NOT_PRIME); | 97 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_Q_NOT_PRIME); |
98 | } | 98 | } |
99 | 99 | ||
100 | /* n = p*q? */ | 100 | /* n = p*q? */ |
101 | r = BN_mul(i, key->p, key->q, ctx); | 101 | r = BN_mul(i, key->p, key->q, ctx); |
102 | if (!r) { | 102 | if (!r) { |
103 | ret = -1; | 103 | ret = -1; |
104 | goto err; | 104 | goto err; |
105 | } | 105 | } |
106 | 106 | ||
107 | if (BN_cmp(i, key->n) != 0) { | 107 | if (BN_cmp(i, key->n) != 0) { |
108 | ret = 0; | 108 | ret = 0; |
109 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_N_DOES_NOT_EQUAL_P_Q); | 109 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_N_DOES_NOT_EQUAL_P_Q); |
110 | } | 110 | } |
111 | 111 | ||
112 | /* d*e = 1 mod lcm(p-1,q-1)? */ | 112 | /* d*e = 1 mod lcm(p-1,q-1)? */ |
113 | 113 | ||
114 | r = BN_sub(i, key->p, BN_value_one()); | 114 | r = BN_sub(i, key->p, BN_value_one()); |
@@ -149,7 +149,7 @@ RSA_check_key(const RSA *key) | |||
149 | ret = 0; | 149 | ret = 0; |
150 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_D_E_NOT_CONGRUENT_TO_1); | 150 | RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_D_E_NOT_CONGRUENT_TO_1); |
151 | } | 151 | } |
152 | 152 | ||
153 | if (key->dmp1 != NULL && key->dmq1 != NULL && key->iqmp != NULL) { | 153 | if (key->dmp1 != NULL && key->dmq1 != NULL && key->iqmp != NULL) { |
154 | /* dmp1 = d mod (p-1)? */ | 154 | /* dmp1 = d mod (p-1)? */ |
155 | r = BN_sub(i, key->p, BN_value_one()); | 155 | r = BN_sub(i, key->p, BN_value_one()); |
@@ -169,14 +169,14 @@ RSA_check_key(const RSA *key) | |||
169 | RSAerr(RSA_F_RSA_CHECK_KEY, | 169 | RSAerr(RSA_F_RSA_CHECK_KEY, |
170 | RSA_R_DMP1_NOT_CONGRUENT_TO_D); | 170 | RSA_R_DMP1_NOT_CONGRUENT_TO_D); |
171 | } | 171 | } |
172 | 172 | ||
173 | /* dmq1 = d mod (q-1)? */ | 173 | /* dmq1 = d mod (q-1)? */ |
174 | r = BN_sub(i, key->q, BN_value_one()); | 174 | r = BN_sub(i, key->q, BN_value_one()); |
175 | if (!r) { | 175 | if (!r) { |
176 | ret = -1; | 176 | ret = -1; |
177 | goto err; | 177 | goto err; |
178 | } | 178 | } |
179 | 179 | ||
180 | r = BN_mod(j, key->d, i, ctx); | 180 | r = BN_mod(j, key->d, i, ctx); |
181 | if (!r) { | 181 | if (!r) { |
182 | ret = -1; | 182 | ret = -1; |
@@ -188,7 +188,7 @@ RSA_check_key(const RSA *key) | |||
188 | RSAerr(RSA_F_RSA_CHECK_KEY, | 188 | RSAerr(RSA_F_RSA_CHECK_KEY, |
189 | RSA_R_DMQ1_NOT_CONGRUENT_TO_D); | 189 | RSA_R_DMQ1_NOT_CONGRUENT_TO_D); |
190 | } | 190 | } |
191 | 191 | ||
192 | /* iqmp = q^-1 mod p? */ | 192 | /* iqmp = q^-1 mod p? */ |
193 | if (!BN_mod_inverse(i, key->q, key->p, ctx)) { | 193 | if (!BN_mod_inverse(i, key->q, key->p, ctx)) { |
194 | ret = -1; | 194 | ret = -1; |
@@ -202,7 +202,7 @@ RSA_check_key(const RSA *key) | |||
202 | } | 202 | } |
203 | } | 203 | } |
204 | 204 | ||
205 | err: | 205 | err: |
206 | if (i != NULL) | 206 | if (i != NULL) |
207 | BN_free(i); | 207 | BN_free(i); |
208 | if (j != NULL) | 208 | if (j != NULL) |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_crpt.c b/src/lib/libssl/src/crypto/rsa/rsa_crpt.c index 16679cfd14..fb09d235e1 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_crpt.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_crpt.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: rsa_crpt.c,v 1.5 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_crpt.c,v 1.6 2014/07/09 19:51:38 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 |
@@ -134,7 +134,7 @@ RSA_blinding_on(RSA *rsa, BN_CTX *ctx) | |||
134 | rsa->flags &= ~RSA_FLAG_NO_BLINDING; | 134 | rsa->flags &= ~RSA_FLAG_NO_BLINDING; |
135 | ret = 1; | 135 | ret = 1; |
136 | err: | 136 | err: |
137 | return(ret); | 137 | return (ret); |
138 | } | 138 | } |
139 | 139 | ||
140 | static BIGNUM * | 140 | static BIGNUM * |
@@ -181,7 +181,7 @@ RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx) | |||
181 | ctx = in_ctx; | 181 | ctx = in_ctx; |
182 | 182 | ||
183 | BN_CTX_start(ctx); | 183 | BN_CTX_start(ctx); |
184 | e = BN_CTX_get(ctx); | 184 | e = BN_CTX_get(ctx); |
185 | if (e == NULL) { | 185 | if (e == NULL) { |
186 | RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_MALLOC_FAILURE); | 186 | RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_MALLOC_FAILURE); |
187 | goto err; | 187 | goto err; |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_depr.c b/src/lib/libssl/src/crypto/rsa/rsa_depr.c index 6808b5aecb..7a3ecca666 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_depr.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_depr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_depr.c,v 1.4 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_depr.c,v 1.5 2014/07/09 19:51:38 jsing Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -7,7 +7,7 @@ | |||
7 | * are met: | 7 | * are met: |
8 | * | 8 | * |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * | 11 | * |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in | 13 | * notice, this list of conditions and the following disclaimer in |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_eay.c b/src/lib/libssl/src/crypto/rsa/rsa_eay.c index 06bd8ded96..ede772cb83 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_eay.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_eay.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: rsa_eay.c,v 1.30 2014/07/09 08:44:53 miod Exp $ */ | 1 | /* $OpenBSD: rsa_eay.c,v 1.31 2014/07/09 19:51:38 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 |
@@ -63,7 +63,7 @@ | |||
63 | * are met: | 63 | * are met: |
64 | * | 64 | * |
65 | * 1. Redistributions of source code must retain the above copyright | 65 | * 1. Redistributions of source code must retain the above copyright |
66 | * notice, this list of conditions and the following disclaimer. | 66 | * notice, this list of conditions and the following disclaimer. |
67 | * | 67 | * |
68 | * 2. Redistributions in binary form must reproduce the above copyright | 68 | * 2. Redistributions in binary form must reproduce the above copyright |
69 | * notice, this list of conditions and the following disclaimer in | 69 | * notice, this list of conditions and the following disclaimer in |
@@ -116,16 +116,17 @@ | |||
116 | #include <openssl/rand.h> | 116 | #include <openssl/rand.h> |
117 | 117 | ||
118 | static int RSA_eay_public_encrypt(int flen, const unsigned char *from, | 118 | static int RSA_eay_public_encrypt(int flen, const unsigned char *from, |
119 | unsigned char *to, RSA *rsa,int padding); | 119 | unsigned char *to, RSA *rsa, int padding); |
120 | static int RSA_eay_private_encrypt(int flen, const unsigned char *from, | 120 | static int RSA_eay_private_encrypt(int flen, const unsigned char *from, |
121 | unsigned char *to, RSA *rsa,int padding); | 121 | unsigned char *to, RSA *rsa, int padding); |
122 | static int RSA_eay_public_decrypt(int flen, const unsigned char *from, | 122 | static int RSA_eay_public_decrypt(int flen, const unsigned char *from, |
123 | unsigned char *to, RSA *rsa,int padding); | 123 | unsigned char *to, RSA *rsa, int padding); |
124 | static int RSA_eay_private_decrypt(int flen, const unsigned char *from, | 124 | static int RSA_eay_private_decrypt(int flen, const unsigned char *from, |
125 | unsigned char *to, RSA *rsa,int padding); | 125 | unsigned char *to, RSA *rsa, int padding); |
126 | static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *i, RSA *rsa, BN_CTX *ctx); | 126 | static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *i, RSA *rsa, BN_CTX *ctx); |
127 | static int RSA_eay_init(RSA *rsa); | 127 | static int RSA_eay_init(RSA *rsa); |
128 | static int RSA_eay_finish(RSA *rsa); | 128 | static int RSA_eay_finish(RSA *rsa); |
129 | |||
129 | static RSA_METHOD rsa_pkcs1_eay_meth = { | 130 | static RSA_METHOD rsa_pkcs1_eay_meth = { |
130 | .name = "Eric Young's PKCS#1 RSA", | 131 | .name = "Eric Young's PKCS#1 RSA", |
131 | .rsa_pub_enc = RSA_eay_public_encrypt, | 132 | .rsa_pub_enc = RSA_eay_public_encrypt, |
@@ -170,8 +171,8 @@ RSA_eay_public_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
170 | return -1; | 171 | return -1; |
171 | } | 172 | } |
172 | } | 173 | } |
173 | 174 | ||
174 | if ((ctx=BN_CTX_new()) == NULL) | 175 | if ((ctx = BN_CTX_new()) == NULL) |
175 | goto err; | 176 | goto err; |
176 | BN_CTX_start(ctx); | 177 | BN_CTX_start(ctx); |
177 | f = BN_CTX_get(ctx); | 178 | f = BN_CTX_get(ctx); |
@@ -179,7 +180,7 @@ RSA_eay_public_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
179 | num = BN_num_bytes(rsa->n); | 180 | num = BN_num_bytes(rsa->n); |
180 | buf = malloc(num); | 181 | buf = malloc(num); |
181 | if (!f || !ret || !buf) { | 182 | if (!f || !ret || !buf) { |
182 | RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT,ERR_R_MALLOC_FAILURE); | 183 | RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, ERR_R_MALLOC_FAILURE); |
183 | goto err; | 184 | goto err; |
184 | } | 185 | } |
185 | 186 | ||
@@ -189,7 +190,7 @@ RSA_eay_public_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
189 | break; | 190 | break; |
190 | #ifndef OPENSSL_NO_SHA | 191 | #ifndef OPENSSL_NO_SHA |
191 | case RSA_PKCS1_OAEP_PADDING: | 192 | case RSA_PKCS1_OAEP_PADDING: |
192 | i = RSA_padding_add_PKCS1_OAEP(buf, num, from, flen, NULL, 0); | 193 | i = RSA_padding_add_PKCS1_OAEP(buf, num, from, flen, NULL, 0); |
193 | break; | 194 | break; |
194 | #endif | 195 | #endif |
195 | case RSA_SSLV23_PADDING: | 196 | case RSA_SSLV23_PADDING: |
@@ -208,7 +209,7 @@ RSA_eay_public_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
208 | 209 | ||
209 | if (BN_bin2bn(buf, num, f) == NULL) | 210 | if (BN_bin2bn(buf, num, f) == NULL) |
210 | goto err; | 211 | goto err; |
211 | 212 | ||
212 | if (BN_ucmp(f, rsa->n) >= 0) { | 213 | if (BN_ucmp(f, rsa->n) >= 0) { |
213 | /* usually the padding functions would catch this */ | 214 | /* usually the padding functions would catch this */ |
214 | RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, | 215 | RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, |
@@ -221,7 +222,8 @@ RSA_eay_public_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
221 | CRYPTO_LOCK_RSA, rsa->n, ctx)) | 222 | CRYPTO_LOCK_RSA, rsa->n, ctx)) |
222 | goto err; | 223 | goto err; |
223 | 224 | ||
224 | if (!rsa->meth->bn_mod_exp(ret,f,rsa->e,rsa->n,ctx, rsa->_method_mod_n)) | 225 | if (!rsa->meth->bn_mod_exp(ret, f,rsa->e, rsa->n, ctx, |
226 | rsa->_method_mod_n)) | ||
225 | goto err; | 227 | goto err; |
226 | 228 | ||
227 | /* put in leading 0 bytes if the number is less than the | 229 | /* put in leading 0 bytes if the number is less than the |
@@ -286,7 +288,7 @@ rsa_get_blinding(RSA *rsa, int *local, BN_CTX *ctx) | |||
286 | CRYPTO_w_lock(CRYPTO_LOCK_RSA); | 288 | CRYPTO_w_lock(CRYPTO_LOCK_RSA); |
287 | got_write_lock = 1; | 289 | got_write_lock = 1; |
288 | } | 290 | } |
289 | 291 | ||
290 | if (rsa->mt_blinding == NULL) | 292 | if (rsa->mt_blinding == NULL) |
291 | rsa->mt_blinding = RSA_setup_blinding(rsa, ctx); | 293 | rsa->mt_blinding = RSA_setup_blinding(rsa, ctx); |
292 | } | 294 | } |
@@ -355,7 +357,7 @@ RSA_eay_private_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
355 | BIGNUM *unblind = NULL; | 357 | BIGNUM *unblind = NULL; |
356 | BN_BLINDING *blinding = NULL; | 358 | BN_BLINDING *blinding = NULL; |
357 | 359 | ||
358 | if ((ctx=BN_CTX_new()) == NULL) | 360 | if ((ctx = BN_CTX_new()) == NULL) |
359 | goto err; | 361 | goto err; |
360 | BN_CTX_start(ctx); | 362 | BN_CTX_start(ctx); |
361 | f = BN_CTX_get(ctx); | 363 | f = BN_CTX_get(ctx); |
@@ -386,10 +388,10 @@ RSA_eay_private_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
386 | if (i <= 0) | 388 | if (i <= 0) |
387 | goto err; | 389 | goto err; |
388 | 390 | ||
389 | if (BN_bin2bn(buf,num,f) == NULL) | 391 | if (BN_bin2bn(buf, num, f) == NULL) |
390 | goto err; | 392 | goto err; |
391 | 393 | ||
392 | if (BN_ucmp(f, rsa->n) >= 0) { | 394 | if (BN_ucmp(f, rsa->n) >= 0) { |
393 | /* usually the padding functions would catch this */ | 395 | /* usually the padding functions would catch this */ |
394 | RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT, | 396 | RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT, |
395 | RSA_R_DATA_TOO_LARGE_FOR_MODULUS); | 397 | RSA_R_DATA_TOO_LARGE_FOR_MODULUS); |
@@ -404,7 +406,7 @@ RSA_eay_private_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
404 | goto err; | 406 | goto err; |
405 | } | 407 | } |
406 | } | 408 | } |
407 | 409 | ||
408 | if (blinding != NULL) { | 410 | if (blinding != NULL) { |
409 | if (!local_blinding && ((unblind = BN_CTX_get(ctx)) == NULL)) { | 411 | if (!local_blinding && ((unblind = BN_CTX_get(ctx)) == NULL)) { |
410 | RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT, | 412 | RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT, |
@@ -417,13 +419,13 @@ RSA_eay_private_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
417 | 419 | ||
418 | if ((rsa->flags & RSA_FLAG_EXT_PKEY) || | 420 | if ((rsa->flags & RSA_FLAG_EXT_PKEY) || |
419 | (rsa->p != NULL && rsa->q != NULL && rsa->dmp1 != NULL && | 421 | (rsa->p != NULL && rsa->q != NULL && rsa->dmp1 != NULL && |
420 | rsa->dmq1 != NULL && rsa->iqmp != NULL)) { | 422 | rsa->dmq1 != NULL && rsa->iqmp != NULL)) { |
421 | if (!rsa->meth->rsa_mod_exp(ret, f, rsa, ctx)) | 423 | if (!rsa->meth->rsa_mod_exp(ret, f, rsa, ctx)) |
422 | goto err; | 424 | goto err; |
423 | } else { | 425 | } else { |
424 | BIGNUM local_d; | 426 | BIGNUM local_d; |
425 | BIGNUM *d = NULL; | 427 | BIGNUM *d = NULL; |
426 | 428 | ||
427 | if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) { | 429 | if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) { |
428 | BN_init(&local_d); | 430 | BN_init(&local_d); |
429 | d = &local_d; | 431 | d = &local_d; |
@@ -436,7 +438,7 @@ RSA_eay_private_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
436 | CRYPTO_LOCK_RSA, rsa->n, ctx)) | 438 | CRYPTO_LOCK_RSA, rsa->n, ctx)) |
437 | goto err; | 439 | goto err; |
438 | 440 | ||
439 | if (!rsa->meth->bn_mod_exp(ret, f, d, rsa->n,ctx, | 441 | if (!rsa->meth->bn_mod_exp(ret, f, d, rsa->n, ctx, |
440 | rsa->_method_mod_n)) | 442 | rsa->_method_mod_n)) |
441 | goto err; | 443 | goto err; |
442 | } | 444 | } |
@@ -530,7 +532,7 @@ RSA_eay_private_decrypt(int flen, const unsigned char *from, unsigned char *to, | |||
530 | goto err; | 532 | goto err; |
531 | } | 533 | } |
532 | } | 534 | } |
533 | 535 | ||
534 | if (blinding != NULL) { | 536 | if (blinding != NULL) { |
535 | if (!local_blinding && ((unblind = BN_CTX_get(ctx)) == NULL)) { | 537 | if (!local_blinding && ((unblind = BN_CTX_get(ctx)) == NULL)) { |
536 | RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT, | 538 | RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT, |
@@ -544,13 +546,13 @@ RSA_eay_private_decrypt(int flen, const unsigned char *from, unsigned char *to, | |||
544 | /* do the decrypt */ | 546 | /* do the decrypt */ |
545 | if ((rsa->flags & RSA_FLAG_EXT_PKEY) || | 547 | if ((rsa->flags & RSA_FLAG_EXT_PKEY) || |
546 | (rsa->p != NULL && rsa->q != NULL && rsa->dmp1 != NULL && | 548 | (rsa->p != NULL && rsa->q != NULL && rsa->dmp1 != NULL && |
547 | rsa->dmq1 != NULL && rsa->iqmp != NULL)) { | 549 | rsa->dmq1 != NULL && rsa->iqmp != NULL)) { |
548 | if (!rsa->meth->rsa_mod_exp(ret, f, rsa, ctx)) | 550 | if (!rsa->meth->rsa_mod_exp(ret, f, rsa, ctx)) |
549 | goto err; | 551 | goto err; |
550 | } else { | 552 | } else { |
551 | BIGNUM local_d; | 553 | BIGNUM local_d; |
552 | BIGNUM *d = NULL; | 554 | BIGNUM *d = NULL; |
553 | 555 | ||
554 | if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) { | 556 | if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) { |
555 | d = &local_d; | 557 | d = &local_d; |
556 | BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME); | 558 | BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME); |
@@ -578,11 +580,11 @@ RSA_eay_private_decrypt(int flen, const unsigned char *from, unsigned char *to, | |||
578 | r = RSA_padding_check_PKCS1_type_2(to, num, buf, j, num); | 580 | r = RSA_padding_check_PKCS1_type_2(to, num, buf, j, num); |
579 | break; | 581 | break; |
580 | #ifndef OPENSSL_NO_SHA | 582 | #ifndef OPENSSL_NO_SHA |
581 | case RSA_PKCS1_OAEP_PADDING: | 583 | case RSA_PKCS1_OAEP_PADDING: |
582 | r = RSA_padding_check_PKCS1_OAEP(to, num, buf, j, num, NULL, 0); | 584 | r = RSA_padding_check_PKCS1_OAEP(to, num, buf, j, num, NULL, 0); |
583 | break; | 585 | break; |
584 | #endif | 586 | #endif |
585 | case RSA_SSLV23_PADDING: | 587 | case RSA_SSLV23_PADDING: |
586 | r = RSA_padding_check_SSLv23(to, num, buf, j, num); | 588 | r = RSA_padding_check_SSLv23(to, num, buf, j, num); |
587 | break; | 589 | break; |
588 | case RSA_NO_PADDING: | 590 | case RSA_NO_PADDING: |
@@ -603,7 +605,7 @@ err: | |||
603 | BN_CTX_free(ctx); | 605 | BN_CTX_free(ctx); |
604 | } | 606 | } |
605 | if (buf != NULL) { | 607 | if (buf != NULL) { |
606 | OPENSSL_cleanse(buf,num); | 608 | OPENSSL_cleanse(buf, num); |
607 | free(buf); | 609 | free(buf); |
608 | } | 610 | } |
609 | return r; | 611 | return r; |
@@ -615,7 +617,7 @@ RSA_eay_public_decrypt(int flen, const unsigned char *from, unsigned char *to, | |||
615 | RSA *rsa, int padding) | 617 | RSA *rsa, int padding) |
616 | { | 618 | { |
617 | BIGNUM *f, *ret; | 619 | BIGNUM *f, *ret; |
618 | int i, num = 0,r = -1; | 620 | int i, num = 0, r = -1; |
619 | unsigned char *p; | 621 | unsigned char *p; |
620 | unsigned char *buf = NULL; | 622 | unsigned char *buf = NULL; |
621 | BN_CTX *ctx = NULL; | 623 | BN_CTX *ctx = NULL; |
@@ -637,7 +639,7 @@ RSA_eay_public_decrypt(int flen, const unsigned char *from, unsigned char *to, | |||
637 | return -1; | 639 | return -1; |
638 | } | 640 | } |
639 | } | 641 | } |
640 | 642 | ||
641 | if ((ctx = BN_CTX_new()) == NULL) | 643 | if ((ctx = BN_CTX_new()) == NULL) |
642 | goto err; | 644 | goto err; |
643 | BN_CTX_start(ctx); | 645 | BN_CTX_start(ctx); |
@@ -658,7 +660,7 @@ RSA_eay_public_decrypt(int flen, const unsigned char *from, unsigned char *to, | |||
658 | goto err; | 660 | goto err; |
659 | } | 661 | } |
660 | 662 | ||
661 | if (BN_bin2bn(from,flen,f) == NULL) | 663 | if (BN_bin2bn(from, flen, f) == NULL) |
662 | goto err; | 664 | goto err; |
663 | 665 | ||
664 | if (BN_ucmp(f, rsa->n) >= 0) { | 666 | if (BN_ucmp(f, rsa->n) >= 0) { |
@@ -801,7 +803,7 @@ RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) | |||
801 | BN_with_flags(dmp1, rsa->dmp1, BN_FLG_CONSTTIME); | 803 | BN_with_flags(dmp1, rsa->dmp1, BN_FLG_CONSTTIME); |
802 | } else | 804 | } else |
803 | dmp1 = rsa->dmp1; | 805 | dmp1 = rsa->dmp1; |
804 | if (!rsa->meth->bn_mod_exp(r0, r1, dmp1, rsa->p,ctx, | 806 | if (!rsa->meth->bn_mod_exp(r0, r1, dmp1, rsa->p, ctx, |
805 | rsa->_method_mod_p)) | 807 | rsa->_method_mod_p)) |
806 | goto err; | 808 | goto err; |
807 | 809 | ||
@@ -824,7 +826,7 @@ RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) | |||
824 | BN_with_flags(pr1, r1, BN_FLG_CONSTTIME); | 826 | BN_with_flags(pr1, r1, BN_FLG_CONSTTIME); |
825 | } else | 827 | } else |
826 | pr1 = r1; | 828 | pr1 = r1; |
827 | if (!BN_mod(r0, pr1, rsa->p,ctx)) | 829 | if (!BN_mod(r0, pr1, rsa->p, ctx)) |
828 | goto err; | 830 | goto err; |
829 | 831 | ||
830 | /* | 832 | /* |
@@ -869,7 +871,7 @@ RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) | |||
869 | 871 | ||
870 | BIGNUM local_d; | 872 | BIGNUM local_d; |
871 | BIGNUM *d = NULL; | 873 | BIGNUM *d = NULL; |
872 | 874 | ||
873 | if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) { | 875 | if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) { |
874 | d = &local_d; | 876 | d = &local_d; |
875 | BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME); | 877 | BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME); |
@@ -890,7 +892,7 @@ static int | |||
890 | RSA_eay_init(RSA *rsa) | 892 | RSA_eay_init(RSA *rsa) |
891 | { | 893 | { |
892 | rsa->flags |= RSA_FLAG_CACHE_PUBLIC | RSA_FLAG_CACHE_PRIVATE; | 894 | rsa->flags |= RSA_FLAG_CACHE_PUBLIC | RSA_FLAG_CACHE_PRIVATE; |
893 | return 1 ; | 895 | return 1; |
894 | } | 896 | } |
895 | 897 | ||
896 | static int | 898 | static int |
@@ -902,5 +904,6 @@ RSA_eay_finish(RSA *rsa) | |||
902 | BN_MONT_CTX_free(rsa->_method_mod_p); | 904 | BN_MONT_CTX_free(rsa->_method_mod_p); |
903 | if (rsa->_method_mod_q != NULL) | 905 | if (rsa->_method_mod_q != NULL) |
904 | BN_MONT_CTX_free(rsa->_method_mod_q); | 906 | BN_MONT_CTX_free(rsa->_method_mod_q); |
907 | |||
905 | return 1; | 908 | return 1; |
906 | } | 909 | } |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_err.c b/src/lib/libssl/src/crypto/rsa/rsa_err.c index c7d6881100..893069a892 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_err.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_err.c,v 1.13 2014/07/09 08:44:53 miod Exp $ */ | 1 | /* $OpenBSD: rsa_err.c,v 1.14 2014/07/09 19:51:38 jsing Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -7,7 +7,7 @@ | |||
7 | * are met: | 7 | * are met: |
8 | * | 8 | * |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * | 11 | * |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in | 13 | * notice, this list of conditions and the following disclaimer in |
@@ -68,136 +68,133 @@ | |||
68 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_RSA,func,0) | 68 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_RSA,func,0) |
69 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_RSA,0,reason) | 69 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_RSA,0,reason) |
70 | 70 | ||
71 | static ERR_STRING_DATA RSA_str_functs[]= | 71 | static ERR_STRING_DATA RSA_str_functs[] = { |
72 | { | 72 | {ERR_FUNC(RSA_F_CHECK_PADDING_MD), "CHECK_PADDING_MD"}, |
73 | {ERR_FUNC(RSA_F_CHECK_PADDING_MD), "CHECK_PADDING_MD"}, | 73 | {ERR_FUNC(RSA_F_DO_RSA_PRINT), "DO_RSA_PRINT"}, |
74 | {ERR_FUNC(RSA_F_DO_RSA_PRINT), "DO_RSA_PRINT"}, | 74 | {ERR_FUNC(RSA_F_INT_RSA_VERIFY), "INT_RSA_VERIFY"}, |
75 | {ERR_FUNC(RSA_F_INT_RSA_VERIFY), "INT_RSA_VERIFY"}, | 75 | {ERR_FUNC(RSA_F_MEMORY_LOCK), "MEMORY_LOCK"}, |
76 | {ERR_FUNC(RSA_F_MEMORY_LOCK), "MEMORY_LOCK"}, | 76 | {ERR_FUNC(RSA_F_OLD_RSA_PRIV_DECODE), "OLD_RSA_PRIV_DECODE"}, |
77 | {ERR_FUNC(RSA_F_OLD_RSA_PRIV_DECODE), "OLD_RSA_PRIV_DECODE"}, | 77 | {ERR_FUNC(RSA_F_PKEY_RSA_CTRL), "PKEY_RSA_CTRL"}, |
78 | {ERR_FUNC(RSA_F_PKEY_RSA_CTRL), "PKEY_RSA_CTRL"}, | 78 | {ERR_FUNC(RSA_F_PKEY_RSA_CTRL_STR), "PKEY_RSA_CTRL_STR"}, |
79 | {ERR_FUNC(RSA_F_PKEY_RSA_CTRL_STR), "PKEY_RSA_CTRL_STR"}, | 79 | {ERR_FUNC(RSA_F_PKEY_RSA_SIGN), "PKEY_RSA_SIGN"}, |
80 | {ERR_FUNC(RSA_F_PKEY_RSA_SIGN), "PKEY_RSA_SIGN"}, | 80 | {ERR_FUNC(RSA_F_PKEY_RSA_VERIFY), "PKEY_RSA_VERIFY"}, |
81 | {ERR_FUNC(RSA_F_PKEY_RSA_VERIFY), "PKEY_RSA_VERIFY"}, | 81 | {ERR_FUNC(RSA_F_PKEY_RSA_VERIFYRECOVER), "PKEY_RSA_VERIFYRECOVER"}, |
82 | {ERR_FUNC(RSA_F_PKEY_RSA_VERIFYRECOVER), "PKEY_RSA_VERIFYRECOVER"}, | 82 | {ERR_FUNC(RSA_F_RSA_BUILTIN_KEYGEN), "RSA_BUILTIN_KEYGEN"}, |
83 | {ERR_FUNC(RSA_F_RSA_BUILTIN_KEYGEN), "RSA_BUILTIN_KEYGEN"}, | 83 | {ERR_FUNC(RSA_F_RSA_CHECK_KEY), "RSA_check_key"}, |
84 | {ERR_FUNC(RSA_F_RSA_CHECK_KEY), "RSA_check_key"}, | 84 | {ERR_FUNC(RSA_F_RSA_EAY_PRIVATE_DECRYPT), "RSA_EAY_PRIVATE_DECRYPT"}, |
85 | {ERR_FUNC(RSA_F_RSA_EAY_PRIVATE_DECRYPT), "RSA_EAY_PRIVATE_DECRYPT"}, | 85 | {ERR_FUNC(RSA_F_RSA_EAY_PRIVATE_ENCRYPT), "RSA_EAY_PRIVATE_ENCRYPT"}, |
86 | {ERR_FUNC(RSA_F_RSA_EAY_PRIVATE_ENCRYPT), "RSA_EAY_PRIVATE_ENCRYPT"}, | 86 | {ERR_FUNC(RSA_F_RSA_EAY_PUBLIC_DECRYPT), "RSA_EAY_PUBLIC_DECRYPT"}, |
87 | {ERR_FUNC(RSA_F_RSA_EAY_PUBLIC_DECRYPT), "RSA_EAY_PUBLIC_DECRYPT"}, | 87 | {ERR_FUNC(RSA_F_RSA_EAY_PUBLIC_ENCRYPT), "RSA_EAY_PUBLIC_ENCRYPT"}, |
88 | {ERR_FUNC(RSA_F_RSA_EAY_PUBLIC_ENCRYPT), "RSA_EAY_PUBLIC_ENCRYPT"}, | 88 | {ERR_FUNC(RSA_F_RSA_GENERATE_KEY), "RSA_generate_key"}, |
89 | {ERR_FUNC(RSA_F_RSA_GENERATE_KEY), "RSA_generate_key"}, | 89 | {ERR_FUNC(RSA_F_RSA_GENERATE_KEY_EX), "RSA_generate_key_ex"}, |
90 | {ERR_FUNC(RSA_F_RSA_GENERATE_KEY_EX), "RSA_generate_key_ex"}, | 90 | {ERR_FUNC(RSA_F_RSA_ITEM_VERIFY), "RSA_ITEM_VERIFY"}, |
91 | {ERR_FUNC(RSA_F_RSA_ITEM_VERIFY), "RSA_ITEM_VERIFY"}, | 91 | {ERR_FUNC(RSA_F_RSA_MEMORY_LOCK), "RSA_memory_lock"}, |
92 | {ERR_FUNC(RSA_F_RSA_MEMORY_LOCK), "RSA_memory_lock"}, | 92 | {ERR_FUNC(RSA_F_RSA_NEW_METHOD), "RSA_new_method"}, |
93 | {ERR_FUNC(RSA_F_RSA_NEW_METHOD), "RSA_new_method"}, | 93 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_NONE), "RSA_padding_add_none"}, |
94 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_NONE), "RSA_padding_add_none"}, | 94 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP), "RSA_padding_add_PKCS1_OAEP"}, |
95 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP), "RSA_padding_add_PKCS1_OAEP"}, | 95 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_PSS), "RSA_padding_add_PKCS1_PSS"}, |
96 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_PSS), "RSA_padding_add_PKCS1_PSS"}, | 96 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1), "RSA_padding_add_PKCS1_PSS_mgf1"}, |
97 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1), "RSA_padding_add_PKCS1_PSS_mgf1"}, | 97 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1), "RSA_padding_add_PKCS1_type_1"}, |
98 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1), "RSA_padding_add_PKCS1_type_1"}, | 98 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2), "RSA_padding_add_PKCS1_type_2"}, |
99 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2), "RSA_padding_add_PKCS1_type_2"}, | 99 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_SSLV23), "RSA_padding_add_SSLv23"}, |
100 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_SSLV23), "RSA_padding_add_SSLv23"}, | 100 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_X931), "RSA_padding_add_X931"}, |
101 | {ERR_FUNC(RSA_F_RSA_PADDING_ADD_X931), "RSA_padding_add_X931"}, | 101 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_NONE), "RSA_padding_check_none"}, |
102 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_NONE), "RSA_padding_check_none"}, | 102 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP), "RSA_padding_check_PKCS1_OAEP"}, |
103 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP), "RSA_padding_check_PKCS1_OAEP"}, | 103 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1), "RSA_padding_check_PKCS1_type_1"}, |
104 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1), "RSA_padding_check_PKCS1_type_1"}, | 104 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2), "RSA_padding_check_PKCS1_type_2"}, |
105 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2), "RSA_padding_check_PKCS1_type_2"}, | 105 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_SSLV23), "RSA_padding_check_SSLv23"}, |
106 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_SSLV23), "RSA_padding_check_SSLv23"}, | 106 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_X931), "RSA_padding_check_X931"}, |
107 | {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_X931), "RSA_padding_check_X931"}, | 107 | {ERR_FUNC(RSA_F_RSA_PRINT), "RSA_print"}, |
108 | {ERR_FUNC(RSA_F_RSA_PRINT), "RSA_print"}, | 108 | {ERR_FUNC(RSA_F_RSA_PRINT_FP), "RSA_print_fp"}, |
109 | {ERR_FUNC(RSA_F_RSA_PRINT_FP), "RSA_print_fp"}, | 109 | {ERR_FUNC(RSA_F_RSA_PRIVATE_DECRYPT), "RSA_private_decrypt"}, |
110 | {ERR_FUNC(RSA_F_RSA_PRIVATE_DECRYPT), "RSA_private_decrypt"}, | 110 | {ERR_FUNC(RSA_F_RSA_PRIVATE_ENCRYPT), "RSA_private_encrypt"}, |
111 | {ERR_FUNC(RSA_F_RSA_PRIVATE_ENCRYPT), "RSA_private_encrypt"}, | 111 | {ERR_FUNC(RSA_F_RSA_PRIV_DECODE), "RSA_PRIV_DECODE"}, |
112 | {ERR_FUNC(RSA_F_RSA_PRIV_DECODE), "RSA_PRIV_DECODE"}, | 112 | {ERR_FUNC(RSA_F_RSA_PRIV_ENCODE), "RSA_PRIV_ENCODE"}, |
113 | {ERR_FUNC(RSA_F_RSA_PRIV_ENCODE), "RSA_PRIV_ENCODE"}, | 113 | {ERR_FUNC(RSA_F_RSA_PUBLIC_DECRYPT), "RSA_public_decrypt"}, |
114 | {ERR_FUNC(RSA_F_RSA_PUBLIC_DECRYPT), "RSA_public_decrypt"}, | 114 | {ERR_FUNC(RSA_F_RSA_PUBLIC_ENCRYPT), "RSA_public_encrypt"}, |
115 | {ERR_FUNC(RSA_F_RSA_PUBLIC_ENCRYPT), "RSA_public_encrypt"}, | 115 | {ERR_FUNC(RSA_F_RSA_PUB_DECODE), "RSA_PUB_DECODE"}, |
116 | {ERR_FUNC(RSA_F_RSA_PUB_DECODE), "RSA_PUB_DECODE"}, | 116 | {ERR_FUNC(RSA_F_RSA_SETUP_BLINDING), "RSA_setup_blinding"}, |
117 | {ERR_FUNC(RSA_F_RSA_SETUP_BLINDING), "RSA_setup_blinding"}, | 117 | {ERR_FUNC(RSA_F_RSA_SIGN), "RSA_sign"}, |
118 | {ERR_FUNC(RSA_F_RSA_SIGN), "RSA_sign"}, | 118 | {ERR_FUNC(RSA_F_RSA_SIGN_ASN1_OCTET_STRING), "RSA_sign_ASN1_OCTET_STRING"}, |
119 | {ERR_FUNC(RSA_F_RSA_SIGN_ASN1_OCTET_STRING), "RSA_sign_ASN1_OCTET_STRING"}, | 119 | {ERR_FUNC(RSA_F_RSA_VERIFY), "RSA_verify"}, |
120 | {ERR_FUNC(RSA_F_RSA_VERIFY), "RSA_verify"}, | 120 | {ERR_FUNC(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING), "RSA_verify_ASN1_OCTET_STRING"}, |
121 | {ERR_FUNC(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING), "RSA_verify_ASN1_OCTET_STRING"}, | 121 | {ERR_FUNC(RSA_F_RSA_VERIFY_PKCS1_PSS), "RSA_verify_PKCS1_PSS"}, |
122 | {ERR_FUNC(RSA_F_RSA_VERIFY_PKCS1_PSS), "RSA_verify_PKCS1_PSS"}, | 122 | {ERR_FUNC(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1), "RSA_verify_PKCS1_PSS_mgf1"}, |
123 | {ERR_FUNC(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1), "RSA_verify_PKCS1_PSS_mgf1"}, | 123 | {0, NULL} |
124 | {0,NULL} | 124 | }; |
125 | }; | ||
126 | 125 | ||
127 | static ERR_STRING_DATA RSA_str_reasons[]= | 126 | static ERR_STRING_DATA RSA_str_reasons[] = { |
128 | { | 127 | {ERR_REASON(RSA_R_ALGORITHM_MISMATCH) , "algorithm mismatch"}, |
129 | {ERR_REASON(RSA_R_ALGORITHM_MISMATCH) ,"algorithm mismatch"}, | 128 | {ERR_REASON(RSA_R_BAD_E_VALUE) , "bad e value"}, |
130 | {ERR_REASON(RSA_R_BAD_E_VALUE) ,"bad e value"}, | 129 | {ERR_REASON(RSA_R_BAD_FIXED_HEADER_DECRYPT), "bad fixed header decrypt"}, |
131 | {ERR_REASON(RSA_R_BAD_FIXED_HEADER_DECRYPT),"bad fixed header decrypt"}, | 130 | {ERR_REASON(RSA_R_BAD_PAD_BYTE_COUNT) , "bad pad byte count"}, |
132 | {ERR_REASON(RSA_R_BAD_PAD_BYTE_COUNT) ,"bad pad byte count"}, | 131 | {ERR_REASON(RSA_R_BAD_SIGNATURE) , "bad signature"}, |
133 | {ERR_REASON(RSA_R_BAD_SIGNATURE) ,"bad signature"}, | 132 | {ERR_REASON(RSA_R_BLOCK_TYPE_IS_NOT_01) , "block type is not 01"}, |
134 | {ERR_REASON(RSA_R_BLOCK_TYPE_IS_NOT_01) ,"block type is not 01"}, | 133 | {ERR_REASON(RSA_R_BLOCK_TYPE_IS_NOT_02) , "block type is not 02"}, |
135 | {ERR_REASON(RSA_R_BLOCK_TYPE_IS_NOT_02) ,"block type is not 02"}, | 134 | {ERR_REASON(RSA_R_DATA_GREATER_THAN_MOD_LEN), "data greater than mod len"}, |
136 | {ERR_REASON(RSA_R_DATA_GREATER_THAN_MOD_LEN),"data greater than mod len"}, | 135 | {ERR_REASON(RSA_R_DATA_TOO_LARGE) , "data too large"}, |
137 | {ERR_REASON(RSA_R_DATA_TOO_LARGE) ,"data too large"}, | 136 | {ERR_REASON(RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE), "data too large for key size"}, |
138 | {ERR_REASON(RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE),"data too large for key size"}, | 137 | {ERR_REASON(RSA_R_DATA_TOO_LARGE_FOR_MODULUS), "data too large for modulus"}, |
139 | {ERR_REASON(RSA_R_DATA_TOO_LARGE_FOR_MODULUS),"data too large for modulus"}, | 138 | {ERR_REASON(RSA_R_DATA_TOO_SMALL) , "data too small"}, |
140 | {ERR_REASON(RSA_R_DATA_TOO_SMALL) ,"data too small"}, | 139 | {ERR_REASON(RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE), "data too small for key size"}, |
141 | {ERR_REASON(RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE),"data too small for key size"}, | 140 | {ERR_REASON(RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY), "digest too big for rsa key"}, |
142 | {ERR_REASON(RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY),"digest too big for rsa key"}, | 141 | {ERR_REASON(RSA_R_DMP1_NOT_CONGRUENT_TO_D), "dmp1 not congruent to d"}, |
143 | {ERR_REASON(RSA_R_DMP1_NOT_CONGRUENT_TO_D),"dmp1 not congruent to d"}, | 142 | {ERR_REASON(RSA_R_DMQ1_NOT_CONGRUENT_TO_D), "dmq1 not congruent to d"}, |
144 | {ERR_REASON(RSA_R_DMQ1_NOT_CONGRUENT_TO_D),"dmq1 not congruent to d"}, | 143 | {ERR_REASON(RSA_R_D_E_NOT_CONGRUENT_TO_1), "d e not congruent to 1"}, |
145 | {ERR_REASON(RSA_R_D_E_NOT_CONGRUENT_TO_1),"d e not congruent to 1"}, | 144 | {ERR_REASON(RSA_R_FIRST_OCTET_INVALID) , "first octet invalid"}, |
146 | {ERR_REASON(RSA_R_FIRST_OCTET_INVALID) ,"first octet invalid"}, | 145 | {ERR_REASON(RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE), "illegal or unsupported padding mode"}, |
147 | {ERR_REASON(RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE),"illegal or unsupported padding mode"}, | 146 | {ERR_REASON(RSA_R_INVALID_DIGEST_LENGTH) , "invalid digest length"}, |
148 | {ERR_REASON(RSA_R_INVALID_DIGEST_LENGTH) ,"invalid digest length"}, | 147 | {ERR_REASON(RSA_R_INVALID_HEADER) , "invalid header"}, |
149 | {ERR_REASON(RSA_R_INVALID_HEADER) ,"invalid header"}, | 148 | {ERR_REASON(RSA_R_INVALID_KEYBITS) , "invalid keybits"}, |
150 | {ERR_REASON(RSA_R_INVALID_KEYBITS) ,"invalid keybits"}, | 149 | {ERR_REASON(RSA_R_INVALID_MESSAGE_LENGTH), "invalid message length"}, |
151 | {ERR_REASON(RSA_R_INVALID_MESSAGE_LENGTH),"invalid message length"}, | 150 | {ERR_REASON(RSA_R_INVALID_MGF1_MD) , "invalid mgf1 md"}, |
152 | {ERR_REASON(RSA_R_INVALID_MGF1_MD) ,"invalid mgf1 md"}, | 151 | {ERR_REASON(RSA_R_INVALID_PADDING) , "invalid padding"}, |
153 | {ERR_REASON(RSA_R_INVALID_PADDING) ,"invalid padding"}, | 152 | {ERR_REASON(RSA_R_INVALID_PADDING_MODE) , "invalid padding mode"}, |
154 | {ERR_REASON(RSA_R_INVALID_PADDING_MODE) ,"invalid padding mode"}, | 153 | {ERR_REASON(RSA_R_INVALID_PSS_PARAMETERS), "invalid pss parameters"}, |
155 | {ERR_REASON(RSA_R_INVALID_PSS_PARAMETERS),"invalid pss parameters"}, | 154 | {ERR_REASON(RSA_R_INVALID_PSS_SALTLEN) , "invalid pss saltlen"}, |
156 | {ERR_REASON(RSA_R_INVALID_PSS_SALTLEN) ,"invalid pss saltlen"}, | 155 | {ERR_REASON(RSA_R_INVALID_SALT_LENGTH) , "invalid salt length"}, |
157 | {ERR_REASON(RSA_R_INVALID_SALT_LENGTH) ,"invalid salt length"}, | 156 | {ERR_REASON(RSA_R_INVALID_TRAILER) , "invalid trailer"}, |
158 | {ERR_REASON(RSA_R_INVALID_TRAILER) ,"invalid trailer"}, | 157 | {ERR_REASON(RSA_R_INVALID_X931_DIGEST) , "invalid x931 digest"}, |
159 | {ERR_REASON(RSA_R_INVALID_X931_DIGEST) ,"invalid x931 digest"}, | 158 | {ERR_REASON(RSA_R_IQMP_NOT_INVERSE_OF_Q) , "iqmp not inverse of q"}, |
160 | {ERR_REASON(RSA_R_IQMP_NOT_INVERSE_OF_Q) ,"iqmp not inverse of q"}, | 159 | {ERR_REASON(RSA_R_KEY_SIZE_TOO_SMALL) , "key size too small"}, |
161 | {ERR_REASON(RSA_R_KEY_SIZE_TOO_SMALL) ,"key size too small"}, | 160 | {ERR_REASON(RSA_R_LAST_OCTET_INVALID) , "last octet invalid"}, |
162 | {ERR_REASON(RSA_R_LAST_OCTET_INVALID) ,"last octet invalid"}, | 161 | {ERR_REASON(RSA_R_MODULUS_TOO_LARGE) , "modulus too large"}, |
163 | {ERR_REASON(RSA_R_MODULUS_TOO_LARGE) ,"modulus too large"}, | 162 | {ERR_REASON(RSA_R_NON_FIPS_RSA_METHOD) , "non fips rsa method"}, |
164 | {ERR_REASON(RSA_R_NON_FIPS_RSA_METHOD) ,"non fips rsa method"}, | 163 | {ERR_REASON(RSA_R_NO_PUBLIC_EXPONENT) , "no public exponent"}, |
165 | {ERR_REASON(RSA_R_NO_PUBLIC_EXPONENT) ,"no public exponent"}, | 164 | {ERR_REASON(RSA_R_NULL_BEFORE_BLOCK_MISSING), "null before block missing"}, |
166 | {ERR_REASON(RSA_R_NULL_BEFORE_BLOCK_MISSING),"null before block missing"}, | 165 | {ERR_REASON(RSA_R_N_DOES_NOT_EQUAL_P_Q) , "n does not equal p q"}, |
167 | {ERR_REASON(RSA_R_N_DOES_NOT_EQUAL_P_Q) ,"n does not equal p q"}, | 166 | {ERR_REASON(RSA_R_OAEP_DECODING_ERROR) , "oaep decoding error"}, |
168 | {ERR_REASON(RSA_R_OAEP_DECODING_ERROR) ,"oaep decoding error"}, | 167 | {ERR_REASON(RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE), "operation not allowed in fips mode"}, |
169 | {ERR_REASON(RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE),"operation not allowed in fips mode"}, | 168 | {ERR_REASON(RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE), "operation not supported for this keytype"}, |
170 | {ERR_REASON(RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE),"operation not supported for this keytype"}, | 169 | {ERR_REASON(RSA_R_PADDING_CHECK_FAILED) , "padding check failed"}, |
171 | {ERR_REASON(RSA_R_PADDING_CHECK_FAILED) ,"padding check failed"}, | 170 | {ERR_REASON(RSA_R_P_NOT_PRIME) , "p not prime"}, |
172 | {ERR_REASON(RSA_R_P_NOT_PRIME) ,"p not prime"}, | 171 | {ERR_REASON(RSA_R_Q_NOT_PRIME) , "q not prime"}, |
173 | {ERR_REASON(RSA_R_Q_NOT_PRIME) ,"q not prime"}, | 172 | {ERR_REASON(RSA_R_RSA_OPERATIONS_NOT_SUPPORTED), "rsa operations not supported"}, |
174 | {ERR_REASON(RSA_R_RSA_OPERATIONS_NOT_SUPPORTED),"rsa operations not supported"}, | 173 | {ERR_REASON(RSA_R_SLEN_CHECK_FAILED) , "salt length check failed"}, |
175 | {ERR_REASON(RSA_R_SLEN_CHECK_FAILED) ,"salt length check failed"}, | 174 | {ERR_REASON(RSA_R_SLEN_RECOVERY_FAILED) , "salt length recovery failed"}, |
176 | {ERR_REASON(RSA_R_SLEN_RECOVERY_FAILED) ,"salt length recovery failed"}, | 175 | {ERR_REASON(RSA_R_SSLV3_ROLLBACK_ATTACK) , "sslv3 rollback attack"}, |
177 | {ERR_REASON(RSA_R_SSLV3_ROLLBACK_ATTACK) ,"sslv3 rollback attack"}, | 176 | {ERR_REASON(RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD), "the asn1 object identifier is not known for this md"}, |
178 | {ERR_REASON(RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD),"the asn1 object identifier is not known for this md"}, | 177 | {ERR_REASON(RSA_R_UNKNOWN_ALGORITHM_TYPE), "unknown algorithm type"}, |
179 | {ERR_REASON(RSA_R_UNKNOWN_ALGORITHM_TYPE),"unknown algorithm type"}, | 178 | {ERR_REASON(RSA_R_UNKNOWN_MASK_DIGEST) , "unknown mask digest"}, |
180 | {ERR_REASON(RSA_R_UNKNOWN_MASK_DIGEST) ,"unknown mask digest"}, | 179 | {ERR_REASON(RSA_R_UNKNOWN_PADDING_TYPE) , "unknown padding type"}, |
181 | {ERR_REASON(RSA_R_UNKNOWN_PADDING_TYPE) ,"unknown padding type"}, | 180 | {ERR_REASON(RSA_R_UNKNOWN_PSS_DIGEST) , "unknown pss digest"}, |
182 | {ERR_REASON(RSA_R_UNKNOWN_PSS_DIGEST) ,"unknown pss digest"}, | 181 | {ERR_REASON(RSA_R_UNSUPPORTED_MASK_ALGORITHM), "unsupported mask algorithm"}, |
183 | {ERR_REASON(RSA_R_UNSUPPORTED_MASK_ALGORITHM),"unsupported mask algorithm"}, | 182 | {ERR_REASON(RSA_R_UNSUPPORTED_MASK_PARAMETER), "unsupported mask parameter"}, |
184 | {ERR_REASON(RSA_R_UNSUPPORTED_MASK_PARAMETER),"unsupported mask parameter"}, | 183 | {ERR_REASON(RSA_R_UNSUPPORTED_SIGNATURE_TYPE), "unsupported signature type"}, |
185 | {ERR_REASON(RSA_R_UNSUPPORTED_SIGNATURE_TYPE),"unsupported signature type"}, | 184 | {ERR_REASON(RSA_R_VALUE_MISSING) , "value missing"}, |
186 | {ERR_REASON(RSA_R_VALUE_MISSING) ,"value missing"}, | 185 | {ERR_REASON(RSA_R_WRONG_SIGNATURE_LENGTH), "wrong signature length"}, |
187 | {ERR_REASON(RSA_R_WRONG_SIGNATURE_LENGTH),"wrong signature length"}, | 186 | {0, NULL} |
188 | {0,NULL} | 187 | }; |
189 | }; | ||
190 | 188 | ||
191 | #endif | 189 | #endif |
192 | 190 | ||
193 | void ERR_load_RSA_strings(void) | 191 | void |
194 | { | 192 | ERR_load_RSA_strings(void) |
193 | { | ||
195 | #ifndef OPENSSL_NO_ERR | 194 | #ifndef OPENSSL_NO_ERR |
196 | 195 | if (ERR_func_error_string(RSA_str_functs[0].error) == NULL) { | |
197 | if (ERR_func_error_string(RSA_str_functs[0].error) == NULL) | 196 | ERR_load_strings(0, RSA_str_functs); |
198 | { | 197 | ERR_load_strings(0, RSA_str_reasons); |
199 | ERR_load_strings(0,RSA_str_functs); | ||
200 | ERR_load_strings(0,RSA_str_reasons); | ||
201 | } | ||
202 | #endif | ||
203 | } | 198 | } |
199 | #endif | ||
200 | } | ||
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_gen.c b/src/lib/libssl/src/crypto/rsa/rsa_gen.c index 3a6aa1ca7a..f000b41940 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_gen.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_gen.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: rsa_gen.c,v 1.14 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_gen.c,v 1.15 2014/07/09 19:51:38 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 |
@@ -154,8 +154,8 @@ rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb) | |||
154 | if (!BN_generate_prime_ex(rsa->q, bitsq, 0, NULL, NULL, | 154 | if (!BN_generate_prime_ex(rsa->q, bitsq, 0, NULL, NULL, |
155 | cb)) | 155 | cb)) |
156 | goto err; | 156 | goto err; |
157 | } while (BN_cmp(rsa->p, rsa->q) == 0 && | 157 | } while (BN_cmp(rsa->p, rsa->q) == 0 && |
158 | ++degenerate < 3); | 158 | ++degenerate < 3); |
159 | if (degenerate == 3) { | 159 | if (degenerate == 3) { |
160 | ok = 0; /* we set our own err */ | 160 | ok = 0; /* we set our own err */ |
161 | RSAerr(RSA_F_RSA_BUILTIN_KEYGEN, | 161 | RSAerr(RSA_F_RSA_BUILTIN_KEYGEN, |
@@ -173,7 +173,7 @@ rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb) | |||
173 | } | 173 | } |
174 | if (!BN_GENCB_call(cb, 3, 1)) | 174 | if (!BN_GENCB_call(cb, 3, 1)) |
175 | goto err; | 175 | goto err; |
176 | if (BN_cmp(rsa->p,rsa->q) < 0) { | 176 | if (BN_cmp(rsa->p, rsa->q) < 0) { |
177 | tmp = rsa->p; | 177 | tmp = rsa->p; |
178 | rsa->p = rsa->q; | 178 | rsa->p = rsa->q; |
179 | rsa->q = tmp; | 179 | rsa->q = tmp; |
@@ -191,8 +191,8 @@ rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb) | |||
191 | if (!BN_mul(r0, r1, r2, ctx)) /* (p-1)(q-1) */ | 191 | if (!BN_mul(r0, r1, r2, ctx)) /* (p-1)(q-1) */ |
192 | goto err; | 192 | goto err; |
193 | if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) { | 193 | if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) { |
194 | pr0 = &local_r0; | 194 | pr0 = &local_r0; |
195 | BN_with_flags(pr0, r0, BN_FLG_CONSTTIME); | 195 | BN_with_flags(pr0, r0, BN_FLG_CONSTTIME); |
196 | } else | 196 | } else |
197 | pr0 = r0; | 197 | pr0 = r0; |
198 | if (!BN_mod_inverse(rsa->d, rsa->e, pr0, ctx)) /* d */ | 198 | if (!BN_mod_inverse(rsa->d, rsa->e, pr0, ctx)) /* d */ |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_lib.c b/src/lib/libssl/src/crypto/rsa/rsa_lib.c index 44a86700c2..5afed37825 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_lib.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_lib.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: rsa_lib.c,v 1.24 2014/07/09 11:10:51 bcook Exp $ */ | 1 | /* $OpenBSD: rsa_lib.c,v 1.25 2014/07/09 19:51:38 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 |
@@ -144,7 +144,7 @@ RSA_new_method(ENGINE *engine) | |||
144 | ret->engine = engine; | 144 | ret->engine = engine; |
145 | } else | 145 | } else |
146 | ret->engine = ENGINE_get_default_RSA(); | 146 | ret->engine = ENGINE_get_default_RSA(); |
147 | if(ret->engine) { | 147 | if (ret->engine) { |
148 | ret->meth = ENGINE_get_RSA(ret->engine); | 148 | ret->meth = ENGINE_get_RSA(ret->engine); |
149 | if (!ret->meth) { | 149 | if (!ret->meth) { |
150 | RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_ENGINE_LIB); | 150 | RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_ENGINE_LIB); |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_none.c b/src/lib/libssl/src/crypto/rsa/rsa_none.c index fde5eb6ef6..818fd26fa4 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_none.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_none.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: rsa_none.c,v 1.5 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_none.c,v 1.6 2014/07/09 19:51:38 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 |
@@ -77,7 +77,7 @@ RSA_padding_add_none(unsigned char *to, int tlen, const unsigned char *from, | |||
77 | RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE); | 77 | RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE); |
78 | return 0; | 78 | return 0; |
79 | } | 79 | } |
80 | 80 | ||
81 | memcpy(to, from, (unsigned int)flen); | 81 | memcpy(to, from, (unsigned int)flen); |
82 | return 1; | 82 | return 1; |
83 | } | 83 | } |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_oaep.c b/src/lib/libssl/src/crypto/rsa/rsa_oaep.c index df288fa615..1e862a99e0 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_oaep.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_oaep.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_oaep.c,v 1.18 2014/07/09 17:08:40 miod Exp $ */ | 1 | /* $OpenBSD: rsa_oaep.c,v 1.19 2014/07/09 19:51:38 jsing Exp $ */ |
2 | /* Written by Ulf Moeller. This software is distributed on an "AS IS" | 2 | /* Written by Ulf Moeller. This software is distributed on an "AS IS" |
3 | basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. */ | 3 | basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. */ |
4 | 4 | ||
@@ -8,7 +8,7 @@ | |||
8 | * <URL: http://www.shoup.net/papers/oaep.ps.Z> | 8 | * <URL: http://www.shoup.net/papers/oaep.ps.Z> |
9 | * for problems with the security proof for the | 9 | * for problems with the security proof for the |
10 | * original OAEP scheme, which EME-OAEP is based on. | 10 | * original OAEP scheme, which EME-OAEP is based on. |
11 | * | 11 | * |
12 | * A new proof can be found in E. Fujisaki, T. Okamoto, | 12 | * A new proof can be found in E. Fujisaki, T. Okamoto, |
13 | * D. Pointcheval, J. Stern, "RSA-OEAP is Still Alive!", | 13 | * D. Pointcheval, J. Stern, "RSA-OEAP is Still Alive!", |
14 | * Dec. 2000, <URL: http://eprint.iacr.org/2000/061/>. | 14 | * Dec. 2000, <URL: http://eprint.iacr.org/2000/061/>. |
@@ -29,7 +29,7 @@ | |||
29 | #include <openssl/sha.h> | 29 | #include <openssl/sha.h> |
30 | 30 | ||
31 | static int MGF1(unsigned char *mask, long len, const unsigned char *seed, | 31 | static int MGF1(unsigned char *mask, long len, const unsigned char *seed, |
32 | long seedlen); | 32 | long seedlen); |
33 | 33 | ||
34 | int | 34 | int |
35 | RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, | 35 | RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, |
@@ -142,7 +142,7 @@ RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, | |||
142 | return -1; | 142 | return -1; |
143 | for (i = 0; i < SHA_DIGEST_LENGTH; i++) | 143 | for (i = 0; i < SHA_DIGEST_LENGTH; i++) |
144 | seed[i] ^= padded_from[i]; | 144 | seed[i] ^= padded_from[i]; |
145 | 145 | ||
146 | if (MGF1(db, dblen, seed, SHA_DIGEST_LENGTH)) | 146 | if (MGF1(db, dblen, seed, SHA_DIGEST_LENGTH)) |
147 | return -1; | 147 | return -1; |
148 | for (i = 0; i < dblen; i++) | 148 | for (i = 0; i < dblen; i++) |
@@ -204,7 +204,7 @@ PKCS1_MGF1(unsigned char *mask, long len, const unsigned char *seed, | |||
204 | cnt[1] = (unsigned char)((i >> 16) & 255); | 204 | cnt[1] = (unsigned char)((i >> 16) & 255); |
205 | cnt[2] = (unsigned char)((i >> 8)) & 255; | 205 | cnt[2] = (unsigned char)((i >> 8)) & 255; |
206 | cnt[3] = (unsigned char)(i & 255); | 206 | cnt[3] = (unsigned char)(i & 255); |
207 | if (!EVP_DigestInit_ex(&c,dgst, NULL) || | 207 | if (!EVP_DigestInit_ex(&c, dgst, NULL) || |
208 | !EVP_DigestUpdate(&c, seed, seedlen) || | 208 | !EVP_DigestUpdate(&c, seed, seedlen) || |
209 | !EVP_DigestUpdate(&c, cnt, 4)) | 209 | !EVP_DigestUpdate(&c, cnt, 4)) |
210 | goto err; | 210 | goto err; |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_pk1.c b/src/lib/libssl/src/crypto/rsa/rsa_pk1.c index f5492315cc..d394b300c6 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_pk1.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_pk1.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: rsa_pk1.c,v 1.8 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_pk1.c,v 1.9 2014/07/09 19:51:38 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 |
@@ -69,12 +69,12 @@ RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, | |||
69 | int j; | 69 | int j; |
70 | unsigned char *p; | 70 | unsigned char *p; |
71 | 71 | ||
72 | if (flen > (tlen-RSA_PKCS1_PADDING_SIZE)) { | 72 | if (flen > (tlen - RSA_PKCS1_PADDING_SIZE)) { |
73 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1, | 73 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1, |
74 | RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); | 74 | RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); |
75 | return 0; | 75 | return 0; |
76 | } | 76 | } |
77 | 77 | ||
78 | p = (unsigned char *)to; | 78 | p = (unsigned char *)to; |
79 | 79 | ||
80 | *(p++) = 0; | 80 | *(p++) = 0; |
@@ -86,6 +86,7 @@ RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen, | |||
86 | p += j; | 86 | p += j; |
87 | *(p++) = '\0'; | 87 | *(p++) = '\0'; |
88 | memcpy(p, from, (unsigned int)flen); | 88 | memcpy(p, from, (unsigned int)flen); |
89 | |||
89 | return 1; | 90 | return 1; |
90 | } | 91 | } |
91 | 92 | ||
@@ -106,7 +107,8 @@ RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen, | |||
106 | /* scan over padding data */ | 107 | /* scan over padding data */ |
107 | j = flen - 1; /* one for type. */ | 108 | j = flen - 1; /* one for type. */ |
108 | for (i = 0; i < j; i++) { | 109 | for (i = 0; i < j; i++) { |
109 | if (*p != 0xff) { /* should decrypt to 0xff */ | 110 | if (*p != 0xff) { |
111 | /* should decrypt to 0xff */ | ||
110 | if (*p == 0) { | 112 | if (*p == 0) { |
111 | p++; | 113 | p++; |
112 | break; | 114 | break; |
@@ -146,15 +148,15 @@ int | |||
146 | RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, | 148 | RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, |
147 | const unsigned char *from, int flen) | 149 | const unsigned char *from, int flen) |
148 | { | 150 | { |
149 | int i,j; | 151 | int i, j; |
150 | unsigned char *p; | 152 | unsigned char *p; |
151 | 153 | ||
152 | if (flen > tlen - 11) { | 154 | if (flen > tlen - 11) { |
153 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2, | 155 | RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2, |
154 | RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); | 156 | RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); |
155 | return 0; | 157 | return 0; |
156 | } | 158 | } |
157 | 159 | ||
158 | p = (unsigned char *)to; | 160 | p = (unsigned char *)to; |
159 | 161 | ||
160 | *(p++) = 0; | 162 | *(p++) = 0; |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_pmeth.c b/src/lib/libssl/src/crypto/rsa/rsa_pmeth.c index 4a662c2894..f35b5800ab 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_pmeth.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_pmeth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_pmeth.c,v 1.9 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_pmeth.c,v 1.10 2014/07/09 19:51:38 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -110,7 +110,7 @@ pkey_rsa_init(EVP_PKEY_CTX *ctx) | |||
110 | ctx->data = rctx; | 110 | ctx->data = rctx; |
111 | ctx->keygen_info = rctx->gentmp; | 111 | ctx->keygen_info = rctx->gentmp; |
112 | ctx->keygen_info_count = 2; | 112 | ctx->keygen_info_count = 2; |
113 | 113 | ||
114 | return 1; | 114 | return 1; |
115 | } | 115 | } |
116 | 116 | ||
@@ -121,7 +121,7 @@ pkey_rsa_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src) | |||
121 | 121 | ||
122 | if (!pkey_rsa_init(dst)) | 122 | if (!pkey_rsa_init(dst)) |
123 | return 0; | 123 | return 0; |
124 | sctx = src->data; | 124 | sctx = src->data; |
125 | dctx = dst->data; | 125 | dctx = dst->data; |
126 | dctx->nbits = sctx->nbits; | 126 | dctx->nbits = sctx->nbits; |
127 | if (sctx->pub_exp) { | 127 | if (sctx->pub_exp) { |
@@ -236,7 +236,7 @@ pkey_rsa_verifyrecover(EVP_PKEY_CTX *ctx, unsigned char *rout, size_t *routlen, | |||
236 | return 0; | 236 | return 0; |
237 | ret--; | 237 | ret--; |
238 | if (rctx->tbuf[ret] != | 238 | if (rctx->tbuf[ret] != |
239 | RSA_X931_hash_id(EVP_MD_type(rctx->md))) { | 239 | RSA_X931_hash_id(EVP_MD_type(rctx->md))) { |
240 | RSAerr(RSA_F_PKEY_RSA_VERIFYRECOVER, | 240 | RSAerr(RSA_F_PKEY_RSA_VERIFYRECOVER, |
241 | RSA_R_ALGORITHM_MISMATCH); | 241 | RSA_R_ALGORITHM_MISMATCH); |
242 | return 0; | 242 | return 0; |
@@ -371,6 +371,7 @@ static int | |||
371 | pkey_rsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) | 371 | pkey_rsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) |
372 | { | 372 | { |
373 | RSA_PKEY_CTX *rctx = ctx->data; | 373 | RSA_PKEY_CTX *rctx = ctx->data; |
374 | |||
374 | switch (type) { | 375 | switch (type) { |
375 | case EVP_PKEY_CTRL_RSA_PADDING: | 376 | case EVP_PKEY_CTRL_RSA_PADDING: |
376 | if (p1 >= RSA_PKCS1_PADDING && p1 <= RSA_PKCS1_PSS_PADDING) { | 377 | if (p1 >= RSA_PKCS1_PADDING && p1 <= RSA_PKCS1_PSS_PADDING) { |
@@ -458,17 +459,18 @@ bad_pad: | |||
458 | return 1; | 459 | return 1; |
459 | #ifndef OPENSSL_NO_CMS | 460 | #ifndef OPENSSL_NO_CMS |
460 | case EVP_PKEY_CTRL_CMS_DECRYPT: | 461 | case EVP_PKEY_CTRL_CMS_DECRYPT: |
461 | { | 462 | { |
462 | X509_ALGOR *alg = NULL; | 463 | X509_ALGOR *alg = NULL; |
463 | ASN1_OBJECT *encalg = NULL; | 464 | ASN1_OBJECT *encalg = NULL; |
464 | 465 | ||
465 | if (p2) | 466 | if (p2) |
466 | CMS_RecipientInfo_ktri_get0_algs(p2, NULL, NULL, &alg); | 467 | CMS_RecipientInfo_ktri_get0_algs(p2, NULL, |
467 | if (alg) | 468 | NULL, &alg); |
468 | X509_ALGOR_get0(&encalg, NULL, NULL, alg); | 469 | if (alg) |
469 | if (encalg && OBJ_obj2nid(encalg) == NID_rsaesOaep) | 470 | X509_ALGOR_get0(&encalg, NULL, NULL, alg); |
470 | rctx->pad_mode = RSA_PKCS1_OAEP_PADDING; | 471 | if (encalg && OBJ_obj2nid(encalg) == NID_rsaesOaep) |
471 | } | 472 | rctx->pad_mode = RSA_PKCS1_OAEP_PADDING; |
473 | } | ||
472 | /* FALLTHROUGH */ | 474 | /* FALLTHROUGH */ |
473 | 475 | ||
474 | case EVP_PKEY_CTRL_CMS_ENCRYPT: | 476 | case EVP_PKEY_CTRL_CMS_ENCRYPT: |
@@ -477,18 +479,18 @@ bad_pad: | |||
477 | #endif | 479 | #endif |
478 | case EVP_PKEY_CTRL_PEER_KEY: | 480 | case EVP_PKEY_CTRL_PEER_KEY: |
479 | RSAerr(RSA_F_PKEY_RSA_CTRL, | 481 | RSAerr(RSA_F_PKEY_RSA_CTRL, |
480 | RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE); | 482 | RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE); |
481 | return -2; | 483 | return -2; |
482 | 484 | ||
483 | default: | 485 | default: |
484 | return -2; | 486 | return -2; |
485 | } | 487 | } |
486 | } | 488 | } |
487 | 489 | ||
488 | static int | 490 | static int |
489 | pkey_rsa_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, const char *value) | 491 | pkey_rsa_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, const char *value) |
490 | { | 492 | { |
491 | long lval; | 493 | long lval; |
492 | char *ep; | 494 | char *ep; |
493 | 495 | ||
494 | if (!value) { | 496 | if (!value) { |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_prn.c b/src/lib/libssl/src/crypto/rsa/rsa_prn.c index 89cf2b45b0..5d5b0e29d8 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_prn.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_prn.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_prn.c,v 1.4 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_prn.c,v 1.5 2014/07/09 19:51:38 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_pss.c b/src/lib/libssl/src/crypto/rsa/rsa_pss.c index 4c6a90c1c7..09bf32439b 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_pss.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_pss.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_pss.c,v 1.6 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_pss.c,v 1.7 2014/07/09 19:51:38 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2005. | 3 | * project 2005. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -121,7 +121,8 @@ RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, | |||
121 | EM++; | 121 | EM++; |
122 | emLen--; | 122 | emLen--; |
123 | } | 123 | } |
124 | if (emLen < (hLen + sLen + 2)) { /* sLen can be small negative */ | 124 | if (emLen < (hLen + sLen + 2)) { |
125 | /* sLen can be small negative */ | ||
125 | RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_DATA_TOO_LARGE); | 126 | RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_DATA_TOO_LARGE); |
126 | goto err; | 127 | goto err; |
127 | } | 128 | } |
@@ -143,7 +144,7 @@ RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, | |||
143 | DB[i] ^= EM[i]; | 144 | DB[i] ^= EM[i]; |
144 | if (MSBits) | 145 | if (MSBits) |
145 | DB[0] &= 0xFF >> (8 - MSBits); | 146 | DB[0] &= 0xFF >> (8 - MSBits); |
146 | for (i = 0; DB[i] == 0 && i < (maskedDBLen-1); i++) | 147 | for (i = 0; DB[i] == 0 && i < (maskedDBLen - 1); i++) |
147 | ; | 148 | ; |
148 | if (DB[i++] != 0x1) { | 149 | if (DB[i++] != 0x1) { |
149 | RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, | 150 | RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, |
@@ -168,7 +169,7 @@ RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash, | |||
168 | if (memcmp(H_, H, hLen)) { | 169 | if (memcmp(H_, H, hLen)) { |
169 | RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_BAD_SIGNATURE); | 170 | RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_BAD_SIGNATURE); |
170 | ret = 0; | 171 | ret = 0; |
171 | } else | 172 | } else |
172 | ret = 1; | 173 | ret = 1; |
173 | 174 | ||
174 | err: | 175 | err: |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_saos.c b/src/lib/libssl/src/crypto/rsa/rsa_saos.c index 50dfef7e71..0ff9f570f4 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_saos.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_saos.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: rsa_saos.c,v 1.12 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_saos.c,v 1.13 2014/07/09 19:51:38 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 |
@@ -69,7 +69,7 @@ RSA_sign_ASN1_OCTET_STRING(int type, const unsigned char *m, unsigned int m_len, | |||
69 | { | 69 | { |
70 | ASN1_OCTET_STRING sig; | 70 | ASN1_OCTET_STRING sig; |
71 | int i, j, ret = 1; | 71 | int i, j, ret = 1; |
72 | unsigned char *p,*s; | 72 | unsigned char *p, *s; |
73 | 73 | ||
74 | sig.type = V_ASN1_OCTET_STRING; | 74 | sig.type = V_ASN1_OCTET_STRING; |
75 | sig.length = m_len; | 75 | sig.length = m_len; |
@@ -132,7 +132,7 @@ RSA_verify_ASN1_OCTET_STRING(int dtype, const unsigned char *m, | |||
132 | goto err; | 132 | goto err; |
133 | 133 | ||
134 | if ((unsigned int)sig->length != m_len || | 134 | if ((unsigned int)sig->length != m_len || |
135 | memcmp(m,sig->data, m_len) != 0) { | 135 | memcmp(m, sig->data, m_len) != 0) { |
136 | RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING, | 136 | RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING, |
137 | RSA_R_BAD_SIGNATURE); | 137 | RSA_R_BAD_SIGNATURE); |
138 | } else | 138 | } else |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_sign.c b/src/lib/libssl/src/crypto/rsa/rsa_sign.c index 9718589be7..11ee2d128d 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_sign.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_sign.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: rsa_sign.c,v 1.19 2014/07/09 09:04:14 miod Exp $ */ | 1 | /* $OpenBSD: rsa_sign.c,v 1.20 2014/07/09 19:51:38 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 |
@@ -137,7 +137,7 @@ RSA_sign(int type, const unsigned char *m, unsigned int m_len, | |||
137 | OPENSSL_cleanse(tmps, (unsigned int)j + 1); | 137 | OPENSSL_cleanse(tmps, (unsigned int)j + 1); |
138 | free(tmps); | 138 | free(tmps); |
139 | } | 139 | } |
140 | return(ret); | 140 | return (ret); |
141 | } | 141 | } |
142 | 142 | ||
143 | int | 143 | int |
@@ -199,7 +199,7 @@ int_rsa_verify(int dtype, const unsigned char *m, unsigned int m_len, | |||
199 | else | 199 | else |
200 | ret = 1; | 200 | ret = 1; |
201 | } else { | 201 | } else { |
202 | const unsigned char *p=s; | 202 | const unsigned char *p = s; |
203 | 203 | ||
204 | sig = d2i_X509_SIG(NULL, &p, (long)i); | 204 | sig = d2i_X509_SIG(NULL, &p, (long)i); |
205 | 205 | ||
@@ -240,7 +240,7 @@ int_rsa_verify(int dtype, const unsigned char *m, unsigned int m_len, | |||
240 | ret = 1; | 240 | ret = 1; |
241 | } | 241 | } |
242 | } else if ((unsigned int)sig->digest->length != m_len || | 242 | } else if ((unsigned int)sig->digest->length != m_len || |
243 | memcmp(m,sig->digest->data,m_len) != 0) { | 243 | memcmp(m, sig->digest->data, m_len) != 0) { |
244 | RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_BAD_SIGNATURE); | 244 | RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_BAD_SIGNATURE); |
245 | } else | 245 | } else |
246 | ret = 1; | 246 | ret = 1; |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_ssl.c b/src/lib/libssl/src/crypto/rsa/rsa_ssl.c index c6ab71c674..09deb08985 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_ssl.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_ssl.c | |||
@@ -1,25 +1,25 @@ | |||
1 | /* $OpenBSD: rsa_ssl.c,v 1.8 2014/07/09 08:20:08 miod Exp $ */ | 1 | /* $OpenBSD: rsa_ssl.c,v 1.9 2014/07/09 19:51:38 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 |
@@ -66,15 +66,15 @@ int | |||
66 | RSA_padding_add_SSLv23(unsigned char *to, int tlen, const unsigned char *from, | 66 | RSA_padding_add_SSLv23(unsigned char *to, int tlen, const unsigned char *from, |
67 | int flen) | 67 | int flen) |
68 | { | 68 | { |
69 | int i,j; | 69 | int i, j; |
70 | unsigned char *p; | 70 | unsigned char *p; |
71 | 71 | ||
72 | if (flen > tlen - 11) { | 72 | if (flen > tlen - 11) { |
73 | RSAerr(RSA_F_RSA_PADDING_ADD_SSLV23, | 73 | RSAerr(RSA_F_RSA_PADDING_ADD_SSLV23, |
74 | RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); | 74 | RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); |
75 | return 0; | 75 | return 0; |
76 | } | 76 | } |
77 | 77 | ||
78 | p = (unsigned char *)to; | 78 | p = (unsigned char *)to; |
79 | 79 | ||
80 | *(p++) = 0; | 80 | *(p++) = 0; |
diff --git a/src/lib/libssl/src/crypto/rsa/rsa_x931.c b/src/lib/libssl/src/crypto/rsa/rsa_x931.c index c3305139f8..74c4af91a5 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_x931.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_x931.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_x931.c,v 1.4 2014/07/09 09:07:00 miod Exp $ */ | 1 | /* $OpenBSD: rsa_x931.c,v 1.5 2014/07/09 19:51:38 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2005. | 3 | * project 2005. |
4 | */ | 4 | */ |
@@ -10,7 +10,7 @@ | |||
10 | * are met: | 10 | * are met: |
11 | * | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * | 14 | * |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
@@ -81,7 +81,7 @@ RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *from, | |||
81 | RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); | 81 | RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); |
82 | return -1; | 82 | return -1; |
83 | } | 83 | } |
84 | 84 | ||
85 | p = (unsigned char *)to; | 85 | p = (unsigned char *)to; |
86 | 86 | ||
87 | /* If no padding start and end nibbles are in one byte */ | 87 | /* If no padding start and end nibbles are in one byte */ |
@@ -103,7 +103,7 @@ RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *from, | |||
103 | 103 | ||
104 | int | 104 | int |
105 | RSA_padding_check_X931(unsigned char *to, int tlen, const unsigned char *from, | 105 | RSA_padding_check_X931(unsigned char *to, int tlen, const unsigned char *from, |
106 | int flen, int num) | 106 | int flen, int num) |
107 | { | 107 | { |
108 | int i = 0, j; | 108 | int i = 0, j; |
109 | const unsigned char *p = from; | 109 | const unsigned char *p = from; |
@@ -121,13 +121,14 @@ RSA_padding_check_X931(unsigned char *to, int tlen, const unsigned char *from, | |||
121 | break; | 121 | break; |
122 | if (c != 0xBB) { | 122 | if (c != 0xBB) { |
123 | RSAerr(RSA_F_RSA_PADDING_CHECK_X931, | 123 | RSAerr(RSA_F_RSA_PADDING_CHECK_X931, |
124 | RSA_R_INVALID_PADDING); | 124 | RSA_R_INVALID_PADDING); |
125 | return -1; | 125 | return -1; |
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | if (i == 0) { | 129 | if (i == 0) { |
130 | RSAerr(RSA_F_RSA_PADDING_CHECK_X931, RSA_R_INVALID_PADDING); | 130 | RSAerr(RSA_F_RSA_PADDING_CHECK_X931, |
131 | RSA_R_INVALID_PADDING); | ||
131 | return -1; | 132 | return -1; |
132 | } | 133 | } |
133 | 134 | ||