X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/blobdiff_plain/3161ce63b657589bb2c48ea49b02a4d42a1d02f5..8e5386aa4a06af90bae8b5fbcd97c46bbb0a679f:/pub/bbs-gen.c diff --git a/pub/bbs-gen.c b/pub/bbs-gen.c index 4796cf5c..fcba8288 100644 --- a/pub/bbs-gen.c +++ b/pub/bbs-gen.c @@ -102,11 +102,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: