aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/dl_group
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-04-04 15:07:53 -0400
committerJack Lloyd <[email protected]>2018-04-04 15:07:53 -0400
commit67633e52bf4837b35fe95ec0befb9df8262fe1a2 (patch)
tree8058d390a7782da3e61cdf9a271ffc42f76408b6 /src/lib/pubkey/dl_group
parent4216b96b2eb68ca9371e0452b0111e033f64f2d2 (diff)
Add DL_Group::monty_params_p to get Montgomery params
Diffstat (limited to 'src/lib/pubkey/dl_group')
-rw-r--r--src/lib/pubkey/dl_group/dl_group.cpp9
-rw-r--r--src/lib/pubkey/dl_group/dl_group.h6
2 files changed, 13 insertions, 2 deletions
diff --git a/src/lib/pubkey/dl_group/dl_group.cpp b/src/lib/pubkey/dl_group/dl_group.cpp
index 9bd9d2462..7a35c6362 100644
--- a/src/lib/pubkey/dl_group/dl_group.cpp
+++ b/src/lib/pubkey/dl_group/dl_group.cpp
@@ -45,7 +45,7 @@ class DL_Group_Data final
return m_mod_p.multiply(x, y);
}
- std::shared_ptr<const Montgomery_Params> monty_params() const
+ std::shared_ptr<const Montgomery_Params> monty_params_p() const
{ return m_monty_params; }
size_t p_bits() const { return m_p_bits; }
@@ -394,6 +394,11 @@ const BigInt& DL_Group::get_q() const
return data().q();
}
+std::shared_ptr<const Montgomery_Params> DL_Group::monty_params_p() const
+ {
+ return data().monty_params_p();
+ }
+
size_t DL_Group::p_bits() const
{
return data().p_bits();
@@ -427,7 +432,7 @@ BigInt DL_Group::multiply_mod_p(const BigInt& x, const BigInt& y) const
BigInt DL_Group::multi_exponentiate(const BigInt& x, const BigInt& y, const BigInt& z) const
{
- return monty_multi_exp(data().monty_params(), get_g(), x, y, z);
+ return monty_multi_exp(data().monty_params_p(), get_g(), x, y, z);
}
BigInt DL_Group::power_g_p(const BigInt& x) const
diff --git a/src/lib/pubkey/dl_group/dl_group.h b/src/lib/pubkey/dl_group/dl_group.h
index 14ef3c088..921b4060e 100644
--- a/src/lib/pubkey/dl_group/dl_group.h
+++ b/src/lib/pubkey/dl_group/dl_group.h
@@ -12,6 +12,7 @@
namespace Botan {
+class Montgomery_Params;
class DL_Group_Data;
/**
@@ -193,6 +194,11 @@ class BOTAN_PUBLIC_API(2,0) DL_Group final
BigInt multi_exponentiate(const BigInt& x, const BigInt& y, const BigInt& z) const;
/**
+ * Return parameters for Montgomery reduction/exponentiation mod p
+ */
+ std::shared_ptr<const Montgomery_Params> monty_params_p() const;
+
+ /**
* Return the size of p in bits
* Same as get_p().bits()
*/