diff options
author | lloyd <[email protected]> | 2014-10-31 11:31:27 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-10-31 11:31:27 +0000 |
commit | 083f699c30d584ac59453139e4f2e03d1fde0545 (patch) | |
tree | d9cc192ace03a9a0ef1c0e1705d5468ff3eb3489 /src/lib/constructs/srp6 | |
parent | af0cc3c7308d0f5320e82394590b0ca93f43c4d4 (diff) |
Fix various warnings from VC++ 2014 and add missing include
Diffstat (limited to 'src/lib/constructs/srp6')
-rw-r--r-- | src/lib/constructs/srp6/srp6.cpp | 27 | ||||
-rw-r--r-- | src/lib/constructs/srp6/srp6.h | 6 |
2 files changed, 15 insertions, 18 deletions
diff --git a/src/lib/constructs/srp6/srp6.cpp b/src/lib/constructs/srp6/srp6.cpp index 678dc8978..fba7fa326 100644 --- a/src/lib/constructs/srp6/srp6.cpp +++ b/src/lib/constructs/srp6/srp6.cpp @@ -131,32 +131,29 @@ BigInt SRP6_Server_Session::step1(const BigInt& v, const BigInt& g = group.get_g(); const BigInt& p = group.get_p(); - p_bytes = p.bytes(); + m_p_bytes = p.bytes(); + m_v = v; + m_b = BigInt(rng, 256); + m_p = p; + m_hash_id = hash_id; - BigInt k = hash_seq(hash_id, p_bytes, p, g); - - BigInt b(rng, 256); + const BigInt k = hash_seq(hash_id, m_p_bytes, p, g); - B = (v*k + power_mod(g, b, p)) % p; + m_B = (v*k + power_mod(g, m_b, p)) % p; - this->v = v; - this->b = b; - this->p = p; - this->hash_id = hash_id; - - return B; + return m_B; } SymmetricKey SRP6_Server_Session::step2(const BigInt& A) { - if(A <= 0 || A >= p) + if(A <= 0 || A >= m_p) throw std::runtime_error("Invalid SRP parameter from client"); - BigInt u = hash_seq(hash_id, p_bytes, A, B); + const BigInt u = hash_seq(m_hash_id, m_p_bytes, A, m_B); - BigInt S = power_mod(A * power_mod(v, u, p), b, p); + const BigInt S = power_mod(A * power_mod(m_v, u, m_p), m_b, m_p); - return BigInt::encode_1363(S, p_bytes); + return BigInt::encode_1363(S, m_p_bytes); } } diff --git a/src/lib/constructs/srp6/srp6.h b/src/lib/constructs/srp6/srp6.h index 6f3960be1..b0adc5da4 100644 --- a/src/lib/constructs/srp6/srp6.h +++ b/src/lib/constructs/srp6/srp6.h @@ -87,9 +87,9 @@ class BOTAN_DLL SRP6_Server_Session SymmetricKey step2(const BigInt& A); private: - std::string hash_id; - BigInt B, b, v, S, p; - size_t p_bytes; + std::string m_hash_id; + BigInt m_B, m_b, m_v, m_S, m_p; + size_t m_p_bytes; }; } |