X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/blobdiff_plain/01f3ef938fe2a53bb09e59b7baa81c06b3401002..bd6d65e32b835551677456bf286d09ced6859882:/pub/bbs-gen.c diff --git a/pub/bbs-gen.c b/pub/bbs-gen.c index d2b4b6e5..6ec65e2d 100644 --- a/pub/bbs-gen.c +++ b/pub/bbs-gen.c @@ -98,11 +98,14 @@ int bbs_gen(bbs_priv *bp, unsigned nbits, grand *r, unsigned n, /* --- Compute @n@ --- */ bp->n = mp_mul(MP_NEW, bp->p, bp->q); + if (mp_bits(bp->n) != nbits) goto fail_n; mp_drop(x); return (PGEN_DONE); /* --- Tidy up if things went wrong --- */ +fail_n: + mp_drop(bp->n); fail_q: mp_drop(bp->p); fail_p: