pub/dh-kcdsa.c: Choose the cofactor size correctly.
[catacomb] / pub / dh-kcdsa.c
index 6bd3e19..e366a16 100644 (file)
@@ -71,7 +71,7 @@ int dh_kcdsagen(dh_param *dp, unsigned ql, unsigned pl,
   /* --- First trick: find %$v$% --- */
 
   pf.step = 2;
-  x = mprand(x, pl - ql, r, 1);
+  x = mprand(x, pl - ql - 1, r, 1);
   x = pgen("v", x, x, ev, ec,
           steps, pgen_filter, &pf,
           rabin_iters(pl - ql), pgen_test, &rb);