aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/math
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/math')
-rw-r--r--src/lib/math/ec_gfp/point_gfp.h6
-rw-r--r--src/lib/math/numbertheory/dsa_gen.cpp2
-rw-r--r--src/lib/math/numbertheory/pow_mod.cpp13
-rw-r--r--src/lib/math/numbertheory/powm_fw.cpp7
-rw-r--r--src/lib/math/numbertheory/reducer.h2
5 files changed, 16 insertions, 14 deletions
diff --git a/src/lib/math/ec_gfp/point_gfp.h b/src/lib/math/ec_gfp/point_gfp.h
index 206e43155..c64963683 100644
--- a/src/lib/math/ec_gfp/point_gfp.h
+++ b/src/lib/math/ec_gfp/point_gfp.h
@@ -21,7 +21,7 @@ namespace Botan {
*/
struct BOTAN_DLL Illegal_Transformation : public Exception
{
- Illegal_Transformation(const std::string& err =
+ explicit Illegal_Transformation(const std::string& err =
"Requested transformation is not possible") :
Exception(err) {}
};
@@ -31,7 +31,7 @@ struct BOTAN_DLL Illegal_Transformation : public Exception
*/
struct BOTAN_DLL Illegal_Point : public Exception
{
- Illegal_Point(const std::string& err = "Malformed ECP point detected") :
+ explicit Illegal_Point(const std::string& err = "Malformed ECP point detected") :
Exception(err) {}
};
@@ -56,7 +56,7 @@ class BOTAN_DLL PointGFp
* Construct the zero point
* @param curve The base curve
*/
- PointGFp(const CurveGFp& curve);
+ explicit PointGFp(const CurveGFp& curve);
static PointGFp zero_of(const CurveGFp& curve)
{
diff --git a/src/lib/math/numbertheory/dsa_gen.cpp b/src/lib/math/numbertheory/dsa_gen.cpp
index 1f922fd49..42bfeb4c1 100644
--- a/src/lib/math/numbertheory/dsa_gen.cpp
+++ b/src/lib/math/numbertheory/dsa_gen.cpp
@@ -61,7 +61,7 @@ bool generate_dsa_primes(RandomNumberGenerator& rng,
class Seed
{
public:
- Seed(const std::vector<byte>& s) : m_seed(s) {}
+ explicit Seed(const std::vector<byte>& s) : m_seed(s) {}
operator std::vector<byte>& () { return m_seed; }
diff --git a/src/lib/math/numbertheory/pow_mod.cpp b/src/lib/math/numbertheory/pow_mod.cpp
index 49ff6cca2..5503f313c 100644
--- a/src/lib/math/numbertheory/pow_mod.cpp
+++ b/src/lib/math/numbertheory/pow_mod.cpp
@@ -34,10 +34,15 @@ Power_Mod::Power_Mod(const Power_Mod& other)
*/
Power_Mod& Power_Mod::operator=(const Power_Mod& other)
{
- delete m_core;
- m_core = nullptr;
- if(other.m_core)
- m_core = other.m_core->copy();
+ if(this != &other)
+ {
+ delete m_core;
+ m_core = nullptr;
+ if(other.m_core)
+ {
+ m_core = other.m_core->copy();
+ }
+ }
return (*this);
}
diff --git a/src/lib/math/numbertheory/powm_fw.cpp b/src/lib/math/numbertheory/powm_fw.cpp
index 02e9bbe83..7369959a9 100644
--- a/src/lib/math/numbertheory/powm_fw.cpp
+++ b/src/lib/math/numbertheory/powm_fw.cpp
@@ -60,10 +60,7 @@ BigInt Fixed_Window_Exponentiator::execute() const
*/
Fixed_Window_Exponentiator::Fixed_Window_Exponentiator(const BigInt& n,
Power_Mod::Usage_Hints hints)
- {
- m_reducer = Modular_Reducer(n);
- m_hints = hints;
- m_window_bits = 0;
- }
+ : m_reducer{Modular_Reducer(n)}, m_exp{}, m_window_bits{}, m_g{}, m_hints{hints}
+ {}
}
diff --git a/src/lib/math/numbertheory/reducer.h b/src/lib/math/numbertheory/reducer.h
index 248de3e2f..36808f00f 100644
--- a/src/lib/math/numbertheory/reducer.h
+++ b/src/lib/math/numbertheory/reducer.h
@@ -50,7 +50,7 @@ class BOTAN_DLL Modular_Reducer
bool initialized() const { return (m_mod_words != 0); }
Modular_Reducer() { m_mod_words = 0; }
- Modular_Reducer(const BigInt& mod);
+ explicit Modular_Reducer(const BigInt& mod);
private:
BigInt m_modulus, m_modulus_2, m_mu;
size_t m_mod_words;