chiark / gitweb /
pub/dh-kcdsa.c: Choose the cofactor size correctly.
authorMark Wooding <mdw@distorted.org.uk>
Wed, 23 Oct 2019 03:11:05 +0000 (04:11 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 9 May 2020 19:57:33 +0000 (20:57 +0100)
Considering that we're going to have to multiply in a factor of 2 at
some point.

pub/dh-kcdsa.c

index 6bd3e19e80e357963f5c30d88361b45019b457d3..e366a16eef3ee80be22bea21d380ccfc97e77974 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);