aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/misc/srp6
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-02-19 11:45:35 -0500
committerJack Lloyd <[email protected]>2018-02-19 11:48:04 -0500
commit4dcff1874ad430269bb7d75818b906b34331d919 (patch)
treed810d87b0a9aeba197f8dc376113cb36720f90c0 /src/lib/misc/srp6
parent6d4affbbc27f021c6e87f74c5db420b75ca96581 (diff)
Use new DL_Group functions
Diffstat (limited to 'src/lib/misc/srp6')
-rw-r--r--src/lib/misc/srp6/srp6.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/misc/srp6/srp6.cpp b/src/lib/misc/srp6/srp6.cpp
index e41c67c81..94a6fe4a4 100644
--- a/src/lib/misc/srp6/srp6.cpp
+++ b/src/lib/misc/srp6/srp6.cpp
@@ -86,24 +86,24 @@ srp6_client_agree(const std::string& identifier,
const BigInt& g = group.get_g();
const BigInt& p = group.get_p();
- const size_t p_bytes = group.get_p().bytes();
+ const size_t p_bytes = group.p_bytes();
if(B <= 0 || B >= p)
throw Exception("Invalid SRP parameter from server");
- BigInt k = hash_seq(hash_id, p_bytes, p, g);
+ const BigInt k = hash_seq(hash_id, p_bytes, p, g);
- BigInt a(rng, 256);
+ const BigInt a(rng, 256);
- BigInt A = power_mod(g, a, p);
+ const BigInt A = group.power_g_p(a);
- BigInt u = hash_seq(hash_id, p_bytes, A, B);
+ const BigInt u = hash_seq(hash_id, p_bytes, A, B);
const BigInt x = compute_x(hash_id, identifier, password, salt);
- BigInt S = power_mod((B - (k * power_mod(g, x, p))) % p, (a + (u * x)), p);
+ const BigInt S = power_mod((B - (k * power_mod(g, x, p))) % p, (a + (u * x)), p);
- SymmetricKey Sk(BigInt::encode_1363(S, p_bytes));
+ const SymmetricKey Sk(BigInt::encode_1363(S, p_bytes));
return std::make_pair(A, Sk);
}
@@ -137,7 +137,7 @@ BigInt SRP6_Server_Session::step1(const BigInt& v,
const BigInt k = hash_seq(hash_id, m_p_bytes, p, g);
- m_B = (v*k + power_mod(g, m_b, p)) % p;
+ m_B = group.mod_p(v*k + group.power_g_p(m_b));;
return m_B;
}