summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/rsa')
-rw-r--r--src/lib/libcrypto/rsa/rsa.h2
-rw-r--r--src/lib/libcrypto/rsa/rsa_ameth.c8
-rw-r--r--src/lib/libcrypto/rsa/rsa_chk.c6
-rw-r--r--src/lib/libcrypto/rsa/rsa_eay.c6
-rw-r--r--src/lib/libcrypto/rsa/rsa_oaep.c2
-rw-r--r--src/lib/libcrypto/rsa/rsa_pmeth.c2
6 files changed, 17 insertions, 9 deletions
diff --git a/src/lib/libcrypto/rsa/rsa.h b/src/lib/libcrypto/rsa/rsa.h
index 4814a2fc15..5f269e577a 100644
--- a/src/lib/libcrypto/rsa/rsa.h
+++ b/src/lib/libcrypto/rsa/rsa.h
@@ -280,7 +280,7 @@ struct rsa_st
280 280
281RSA * RSA_new(void); 281RSA * RSA_new(void);
282RSA * RSA_new_method(ENGINE *engine); 282RSA * RSA_new_method(ENGINE *engine);
283int RSA_size(const RSA *); 283int RSA_size(const RSA *rsa);
284 284
285/* Deprecated version */ 285/* Deprecated version */
286#ifndef OPENSSL_NO_DEPRECATED 286#ifndef OPENSSL_NO_DEPRECATED
diff --git a/src/lib/libcrypto/rsa/rsa_ameth.c b/src/lib/libcrypto/rsa/rsa_ameth.c
index 2460910ab2..5a2062f903 100644
--- a/src/lib/libcrypto/rsa/rsa_ameth.c
+++ b/src/lib/libcrypto/rsa/rsa_ameth.c
@@ -351,27 +351,27 @@ static int rsa_pss_param_print(BIO *bp, RSA_PSS_PARAMS *pss,
351 351
352 if (!BIO_indent(bp, indent, 128)) 352 if (!BIO_indent(bp, indent, 128))
353 goto err; 353 goto err;
354 if (BIO_puts(bp, "Salt Length: ") <= 0) 354 if (BIO_puts(bp, "Salt Length: 0x") <= 0)
355 goto err; 355 goto err;
356 if (pss->saltLength) 356 if (pss->saltLength)
357 { 357 {
358 if (i2a_ASN1_INTEGER(bp, pss->saltLength) <= 0) 358 if (i2a_ASN1_INTEGER(bp, pss->saltLength) <= 0)
359 goto err; 359 goto err;
360 } 360 }
361 else if (BIO_puts(bp, "20 (default)") <= 0) 361 else if (BIO_puts(bp, "0x14 (default)") <= 0)
362 goto err; 362 goto err;
363 BIO_puts(bp, "\n"); 363 BIO_puts(bp, "\n");
364 364
365 if (!BIO_indent(bp, indent, 128)) 365 if (!BIO_indent(bp, indent, 128))
366 goto err; 366 goto err;
367 if (BIO_puts(bp, "Trailer Field: ") <= 0) 367 if (BIO_puts(bp, "Trailer Field: 0x") <= 0)
368 goto err; 368 goto err;
369 if (pss->trailerField) 369 if (pss->trailerField)
370 { 370 {
371 if (i2a_ASN1_INTEGER(bp, pss->trailerField) <= 0) 371 if (i2a_ASN1_INTEGER(bp, pss->trailerField) <= 0)
372 goto err; 372 goto err;
373 } 373 }
374 else if (BIO_puts(bp, "0xbc (default)") <= 0) 374 else if (BIO_puts(bp, "BC (default)") <= 0)
375 goto err; 375 goto err;
376 BIO_puts(bp, "\n"); 376 BIO_puts(bp, "\n");
377 377
diff --git a/src/lib/libcrypto/rsa/rsa_chk.c b/src/lib/libcrypto/rsa/rsa_chk.c
index 9d848db8c6..cc30e77132 100644
--- a/src/lib/libcrypto/rsa/rsa_chk.c
+++ b/src/lib/libcrypto/rsa/rsa_chk.c
@@ -59,6 +59,12 @@ int RSA_check_key(const RSA *key)
59 BN_CTX *ctx; 59 BN_CTX *ctx;
60 int r; 60 int r;
61 int ret=1; 61 int ret=1;
62
63 if (!key->p || !key->q || !key->n || !key->e || !key->d)
64 {
65 RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_VALUE_MISSING);
66 return 0;
67 }
62 68
63 i = BN_new(); 69 i = BN_new();
64 j = BN_new(); 70 j = BN_new();
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c
index 2e1ddd48d3..88ee2cb557 100644
--- a/src/lib/libcrypto/rsa/rsa_eay.c
+++ b/src/lib/libcrypto/rsa/rsa_eay.c
@@ -847,12 +847,12 @@ static int RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
847 if (!BN_mod(r0,pr1,rsa->p,ctx)) goto err; 847 if (!BN_mod(r0,pr1,rsa->p,ctx)) goto err;
848 848
849 /* If p < q it is occasionally possible for the correction of 849 /* If p < q it is occasionally possible for the correction of
850 * adding 'p' if r0 is negative above to leave the result still 850 * adding 'p' if r0 is negative above to leave the result still
851 * negative. This can break the private key operations: the following 851 * negative. This can break the private key operations: the following
852 * second correction should *always* correct this rare occurrence. 852 * second correction should *always* correct this rare occurrence.
853 * This will *never* happen with OpenSSL generated keys because 853 * This will *never* happen with OpenSSL generated keys because
854 * they ensure p > q [steve] 854 * they ensure p > q [steve]
855 */ 855 */
856 if (BN_is_negative(r0)) 856 if (BN_is_negative(r0))
857 if (!BN_add(r0,r0,rsa->p)) goto err; 857 if (!BN_add(r0,r0,rsa->p)) goto err;
858 if (!BN_mul(r1,r0,rsa->q,ctx)) goto err; 858 if (!BN_mul(r1,r0,rsa->q,ctx)) goto err;
diff --git a/src/lib/libcrypto/rsa/rsa_oaep.c b/src/lib/libcrypto/rsa/rsa_oaep.c
index 553d212ebe..af4d24a56e 100644
--- a/src/lib/libcrypto/rsa/rsa_oaep.c
+++ b/src/lib/libcrypto/rsa/rsa_oaep.c
@@ -149,7 +149,7 @@ int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen,
149 if (!EVP_Digest((void *)param, plen, phash, NULL, EVP_sha1(), NULL)) 149 if (!EVP_Digest((void *)param, plen, phash, NULL, EVP_sha1(), NULL))
150 return -1; 150 return -1;
151 151
152 if (memcmp(db, phash, SHA_DIGEST_LENGTH) != 0 || bad) 152 if (CRYPTO_memcmp(db, phash, SHA_DIGEST_LENGTH) != 0 || bad)
153 goto decoding_err; 153 goto decoding_err;
154 else 154 else
155 { 155 {
diff --git a/src/lib/libcrypto/rsa/rsa_pmeth.c b/src/lib/libcrypto/rsa/rsa_pmeth.c
index 5b2ecf56ad..157aa5c41d 100644
--- a/src/lib/libcrypto/rsa/rsa_pmeth.c
+++ b/src/lib/libcrypto/rsa/rsa_pmeth.c
@@ -611,6 +611,8 @@ static int pkey_rsa_ctrl_str(EVP_PKEY_CTX *ctx,
611 pm = RSA_NO_PADDING; 611 pm = RSA_NO_PADDING;
612 else if (!strcmp(value, "oeap")) 612 else if (!strcmp(value, "oeap"))
613 pm = RSA_PKCS1_OAEP_PADDING; 613 pm = RSA_PKCS1_OAEP_PADDING;
614 else if (!strcmp(value, "oaep"))
615 pm = RSA_PKCS1_OAEP_PADDING;
614 else if (!strcmp(value, "x931")) 616 else if (!strcmp(value, "x931"))
615 pm = RSA_X931_PADDING; 617 pm = RSA_X931_PADDING;
616 else if (!strcmp(value, "pss")) 618 else if (!strcmp(value, "pss"))