static fstream ifs(RANDOM_SOURCE, ios_base::in);
if (!ifs)
{
- cerr << "Unable to read the random source: " << RANDOM_SOURCE << endl;
+ cerr << "Unable to read the random source: " << RANDOM_SOURCE << endl;
throw 1;
}
kPriv.dp = d % (kPriv.p - 1);
kPriv.dq = d % (kPriv.q - 1);
- // qInv = q^-1 (mod p)
+ // qInv = q^-1 (mod p).
mpz_invert(kPriv.qInv.get_mpz_t(), kPriv.q.get_mpz_t(), kPriv.p.get_mpz_t());
return make_pair(kPub, kPriv);
if (spr % r != sqr % r)
throw UnableToSignWithShamirsTrick();
- mpz_class sp = spr % kPriv.p;
- mpz_class sq = sqr % kPriv.q;
+ const mpz_class sp = spr % kPriv.p;
+ const mpz_class sq = sqr % kPriv.q;
return sq + ((kPriv.qInv * (sp - sq)) % kPriv.p) * kPriv.q;
}