X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=secnet.git;a=blobdiff_plain;f=dh.c;h=67ebd5068bbff17d5ccabd885fd0c10931492c49;hp=eb9ae21c7b75a7989bf77a13f1fe1d44ed51b199;hb=70dc107b6edee55270619b895f17acb66065f7ea;hpb=baa06aeb963965b4b6a8a8051ec15b72372080dd 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;