aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/math/bigint/bigint.cpp28
-rw-r--r--src/math/bigint/bigint.h24
-rw-r--r--src/math/ec_gfp/point_gfp.h31
3 files changed, 49 insertions, 34 deletions
diff --git a/src/math/bigint/bigint.cpp b/src/math/bigint/bigint.cpp
index ae536813f..e2bbe7f5a 100644
--- a/src/math/bigint/bigint.cpp
+++ b/src/math/bigint/bigint.cpp
@@ -100,34 +100,6 @@ BigInt::BigInt(RandomNumberGenerator& rng, size_t bits)
randomize(rng, bits);
}
-/**
-* Move constructor
-*/
-BigInt::BigInt(BigInt&& other)
- {
- std::swap(*this, other);
- }
-
-/**
-* Move assignment
-*/
-BigInt& BigInt::operator=(BigInt&& other)
- {
- if(this != &other)
- std::swap(*this, other);
-
- return (*this);
- }
-
-/*
-* Swap this BigInt with another
-*/
-void BigInt::swap(BigInt& other)
- {
- reg.swap(other.reg);
- std::swap(signedness, other.signedness);
- }
-
/*
* Grow the internal storage
*/
diff --git a/src/math/bigint/bigint.h b/src/math/bigint/bigint.h
index 06e3ecd2f..57aa84528 100644
--- a/src/math/bigint/bigint.h
+++ b/src/math/bigint/bigint.h
@@ -438,7 +438,11 @@ class BOTAN_DLL BigInt
* Swap this value with another
* @param other BigInt to swap values with
*/
- void swap(BigInt& other);
+ void swap(BigInt& other)
+ {
+ reg.swap(other.reg);
+ std::swap(signedness, other.signedness);
+ }
/**
* Create empty BigInt
@@ -503,12 +507,26 @@ class BOTAN_DLL BigInt
/**
* Move constructor
*/
- BigInt(BigInt&& other);
+ BigInt(BigInt&& other)
+ {
+ this->swap(other);
+ }
/**
* Move assignment
*/
- BigInt& operator=(BigInt&& other);
+ BigInt& operator=(BigInt&& other)
+ {
+ if(this != &other)
+ this->swap(other);
+
+ return (*this);
+ }
+
+ /**
+ * Copy assignment
+ */
+ BigInt& operator=(const BigInt&) = default;
private:
SecureVector<word> reg;
Sign signedness;
diff --git a/src/math/ec_gfp/point_gfp.h b/src/math/ec_gfp/point_gfp.h
index b2b6fe2f0..546a8dd6f 100644
--- a/src/math/ec_gfp/point_gfp.h
+++ b/src/math/ec_gfp/point_gfp.h
@@ -59,6 +59,34 @@ class BOTAN_DLL PointGFp
PointGFp(const CurveGFp& curve);
/**
+ * Copy constructor
+ */
+ PointGFp(const PointGFp&) = default;
+
+ /**
+ * Move Constructor
+ */
+ PointGFp(PointGFp&& other)
+ {
+ this->swap(other);
+ }
+
+ /**
+ * Standard Assignment
+ */
+ PointGFp& operator=(const PointGFp&) = default;
+
+ /**
+ * Move Assignment
+ */
+ PointGFp& operator=(PointGFp&& other)
+ {
+ if(this != &other)
+ this->swap(other);
+ return (*this);
+ }
+
+ /**
* Construct a point from its affine coordinates
* @param curve the base curve
* @param x affine x coordinate
@@ -66,9 +94,6 @@ class BOTAN_DLL PointGFp
*/
PointGFp(const CurveGFp& curve, const BigInt& x, const BigInt& y);
- //PointGFp(const PointGFp& other) = default;
- //PointGFp& operator=(const PointGFp& other) = default;
-
/**
* += Operator
* @param rhs the PointGFp to add to the local value