From: Ummon Date: Mon, 12 Jan 2015 14:26:59 +0000 (+0100) Subject: Cleaning. X-Git-Url: http://git.euphorik.ch/index.cgi?a=commitdiff_plain;ds=sidebyside;p=crypto_lab3.git Cleaning. --- diff --git a/src/Rand.cpp b/src/Rand.cpp index c82b83f..ee439c3 100644 --- a/src/Rand.cpp +++ b/src/Rand.cpp @@ -57,7 +57,7 @@ void Rand::readRand(char* to, int size) 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; } diff --git a/src/RsaCrt.cpp b/src/RsaCrt.cpp index 869fce5..95f5993 100644 --- a/src/RsaCrt.cpp +++ b/src/RsaCrt.cpp @@ -26,7 +26,7 @@ pair RsaCrt::generateRSAKeys(uint exponent, uint k 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); diff --git a/src/RsaCrtShamirsTrick.cpp b/src/RsaCrtShamirsTrick.cpp index dffb20f..cc58378 100644 --- a/src/RsaCrtShamirsTrick.cpp +++ b/src/RsaCrtShamirsTrick.cpp @@ -59,8 +59,8 @@ mpz_class RsaCrtShamirsTrick::sign(const mpz_class& m, const KeyPriv& kPriv, boo 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; }