X-Git-Url: https://git.distorted.org.uk/~mdw/secnet/blobdiff_plain/baa06aeb963965b4b6a8a8051ec15b72372080dd..70dc107b6edee55270619b895f17acb66065f7ea:/dh.c diff --git a/dh.c b/dh.c index eb9ae21..67ebd50 100644 --- a/dh.c +++ b/dh.c @@ -135,9 +135,15 @@ static list_t *dh_apply(closure_t *self, struct cloc loc, dict_t *context, cfgfatal(loc,"diffie-hellman","you must provide a generator\n"); } - /* Test that the modulus is really prime */ - if (mpz_probab_prime_p(&st->p,5)==0) { - cfgfatal(loc,"diffie-hellman","modulus must be a prime\n"); + i=list_elem(args,2); + if (i && i->type==t_bool && i->data.bool==False) { + Message(M_INFO,"diffie-hellman (%s:%d): skipping modulus " + "primality check\n",loc.file,loc.line); + } else { + /* Test that the modulus is really prime */ + if (mpz_probab_prime_p(&st->p,5)==0) { + cfgfatal(loc,"diffie-hellman","modulus must be a prime\n"); + } } st->ops.len=mpz_sizeinbase(&st->p,2)/8;