summaryrefslogtreecommitdiff
path: root/crypto/dsa/dsa_gen.c
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2018-11-20 19:01:17 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2018-11-20 19:01:17 +0000
commitf12dd99bc33eefb702280bdaed6156a57d867be1 (patch)
tree3ced903ff59efa46be0b01f4cae665cd9c974b15 /crypto/dsa/dsa_gen.c
parent43a67e02da9068b94df1c07fc6f0d70bafd9263b (diff)
Notes
Diffstat (limited to 'crypto/dsa/dsa_gen.c')
-rw-r--r--crypto/dsa/dsa_gen.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/crypto/dsa/dsa_gen.c b/crypto/dsa/dsa_gen.c
index db52a38a1882..e55d585890d9 100644
--- a/crypto/dsa/dsa_gen.c
+++ b/crypto/dsa/dsa_gen.c
@@ -435,6 +435,12 @@ int dsa_builtin_paramgen2(DSA *ret, size_t L, size_t N,
EVP_MD_CTX_init(&mctx);
+ /* make sure L > N, otherwise we'll get trapped in an infinite loop */
+ if (L <= N) {
+ DSAerr(DSA_F_DSA_BUILTIN_PARAMGEN2, DSA_R_INVALID_PARAMETERS);
+ goto err;
+ }
+
if (evpmd == NULL) {
if (N == 160)
evpmd = EVP_sha1();