We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bd45a8d commit 3984ef0Copy full SHA for 3984ef0
crypto/dh/dh_key.c
@@ -130,10 +130,15 @@ static int generate_key(DH *dh)
130
int ok = 0;
131
int generate_new_key = 0;
132
unsigned l;
133
- BN_CTX *ctx;
+ BN_CTX *ctx = NULL;
134
BN_MONT_CTX *mont = NULL;
135
BIGNUM *pub_key = NULL, *priv_key = NULL;
136
137
+ if (BN_num_bits(dh->p) > OPENSSL_DH_MAX_MODULUS_BITS) {
138
+ DHerr(DH_F_GENERATE_KEY, DH_R_MODULUS_TOO_LARGE);
139
+ return 0;
140
+ }
141
+
142
ctx = BN_CTX_new();
143
if (ctx == NULL)
144
goto err;
0 commit comments