sync code with last fixes and improvements from OpenBSD
This commit is contained in:
parent
691f97cc10
commit
371ae113c6
175 changed files with 2932 additions and 1512 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: dh_key.c,v 1.39 2023/07/08 15:29:03 beck Exp $ */
|
||||
/* $OpenBSD: dh_key.c,v 1.40 2023/08/03 18:53:55 tb Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -109,7 +109,7 @@ generate_key(DH *dh)
|
|||
unsigned l;
|
||||
BN_CTX *ctx;
|
||||
BN_MONT_CTX *mont = NULL;
|
||||
BIGNUM *pub_key = NULL, *priv_key = NULL, *two = NULL;
|
||||
BIGNUM *pub_key = NULL, *priv_key = NULL;
|
||||
|
||||
if (BN_num_bits(dh->p) > OPENSSL_DH_MAX_MODULUS_BITS) {
|
||||
DHerror(DH_R_MODULUS_TOO_LARGE);
|
||||
|
@ -139,11 +139,7 @@ generate_key(DH *dh)
|
|||
|
||||
if (dh->priv_key == NULL) {
|
||||
if (dh->q) {
|
||||
if ((two = BN_new()) == NULL)
|
||||
goto err;
|
||||
if (!BN_add(two, BN_value_one(), BN_value_one()))
|
||||
goto err;
|
||||
if (!bn_rand_interval(priv_key, two, dh->q))
|
||||
if (!bn_rand_interval(priv_key, 2, dh->q))
|
||||
goto err;
|
||||
} else {
|
||||
/* secret exponent length */
|
||||
|
@ -169,7 +165,7 @@ generate_key(DH *dh)
|
|||
if (dh->priv_key == NULL)
|
||||
BN_free(priv_key);
|
||||
BN_CTX_free(ctx);
|
||||
BN_free(two);
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue