summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa
diff options
context:
space:
mode:
authormiod <>2014-04-13 15:25:35 +0000
committermiod <>2014-04-13 15:25:35 +0000
commit1fb5cf10c3e597dbb1ecc4dd423bba727fd7721a (patch)
tree74f4ff344980894c7c9ceeab9b81176ac7572566 /src/lib/libcrypto/rsa
parent92349eb53934e1b3e9b807e603d45417a6320d21 (diff)
downloadopenbsd-1fb5cf10c3e597dbb1ecc4dd423bba727fd7721a.tar.gz
openbsd-1fb5cf10c3e597dbb1ecc4dd423bba727fd7721a.tar.bz2
openbsd-1fb5cf10c3e597dbb1ecc4dd423bba727fd7721a.zip
Merge conflicts; remove MacOS, Netware, OS/2, VMS and Windows build machinery.
Diffstat (limited to 'src/lib/libcrypto/rsa')
-rw-r--r--src/lib/libcrypto/rsa/rsa.h2
-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
4 files changed, 11 insertions, 5 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_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 e08ac151ff..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 (timingsafe_bcmp(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 {