diff options
author | Shigeki Ohtsu <ohtsu@ohtsu.org> | 2017-12-07 22:54:50 +0900 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2017-12-07 13:15:51 -0500 |
commit | 53e3277375edc0faa034919b829e0c59572ceb17 (patch) | |
tree | 6ceb7f030148725b71b41332c15283abe39ca708 /deps/openssl/openssl/crypto/rsa/rsa_gen.c | |
parent | 0bc10b04726959ddf78beed13a4e462837a0d402 (diff) | |
download | android-node-v8-53e3277375edc0faa034919b829e0c59572ceb17.tar.gz android-node-v8-53e3277375edc0faa034919b829e0c59572ceb17.tar.bz2 android-node-v8-53e3277375edc0faa034919b829e0c59572ceb17.zip |
deps: upgrade openssl sources to 1.0.2n
This replaces all sources of openssl-1.0.2n.tar.gz into
deps/openssl/openssl
PR-URL: https://github.com/nodejs/node/pull/17526
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Diffstat (limited to 'deps/openssl/openssl/crypto/rsa/rsa_gen.c')
-rw-r--r-- | deps/openssl/openssl/crypto/rsa/rsa_gen.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/deps/openssl/openssl/crypto/rsa/rsa_gen.c b/deps/openssl/openssl/crypto/rsa/rsa_gen.c index 082c8da2ef..a85493d609 100644 --- a/deps/openssl/openssl/crypto/rsa/rsa_gen.c +++ b/deps/openssl/openssl/crypto/rsa/rsa_gen.c @@ -110,6 +110,16 @@ static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, int bitsp, bitsq, ok = -1, n = 0; BN_CTX *ctx = NULL; + /* + * When generating ridiculously small keys, we can get stuck + * continually regenerating the same prime values. + */ + if (bits < 16) { + ok = 0; /* we set our own err */ + RSAerr(RSA_F_RSA_BUILTIN_KEYGEN, RSA_R_KEY_SIZE_TOO_SMALL); + goto err; + } + ctx = BN_CTX_new(); if (ctx == NULL) goto err; @@ -161,21 +171,10 @@ static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, if (!BN_GENCB_call(cb, 3, 0)) goto err; for (;;) { - /* - * When generating ridiculously small keys, we can get stuck - * continually regenerating the same prime values. Check for this and - * bail if it happens 3 times. - */ - unsigned int degenerate = 0; do { if (!BN_generate_prime_ex(rsa->q, bitsq, 0, NULL, NULL, cb)) goto err; - } while ((BN_cmp(rsa->p, rsa->q) == 0) && (++degenerate < 3)); - if (degenerate == 3) { - ok = 0; /* we set our own err */ - RSAerr(RSA_F_RSA_BUILTIN_KEYGEN, RSA_R_KEY_SIZE_TOO_SMALL); - goto err; - } + } while (BN_cmp(rsa->p, rsa->q) == 0); if (!BN_sub(r2, rsa->q, BN_value_one())) goto err; if (!BN_gcd(r1, r2, rsa->e, ctx)) |