string_t p,g;
item_t *i;
- st=safe_malloc(sizeof(*st),"dh_apply");
+ NEW(st);
st->cl.description="dh";
st->cl.type=CL_DH;
st->cl.apply=NULL;
st->ops.len=sz;
+ st->ops.ceil_len=(mpz_sizeinbase(&st->p,2)+7)/8;
+ /* According to the docs, mpz_sizeinbase(,256) is allowed to return
+ * an answer which is 1 too large. But mpz_sizeinbase(,2) isn't. */
+
return new_closure(&st->cl);
}