aboutsummaryrefslogtreecommitdiffstats
path: root/src/math
diff options
context:
space:
mode:
Diffstat (limited to 'src/math')
-rw-r--r--src/math/bigint/bigint.cpp21
-rw-r--r--src/math/bigint/bigint.h19
-rw-r--r--src/math/gfpmath/curve_gfp.h1
-rw-r--r--src/math/gfpmath/point_gfp.cpp2
-rw-r--r--src/math/numbertheory/dsa_gen.cpp8
-rw-r--r--src/math/numbertheory/make_prm.cpp4
-rw-r--r--src/math/numbertheory/numthry.cpp2
7 files changed, 45 insertions, 12 deletions
diff --git a/src/math/bigint/bigint.cpp b/src/math/bigint/bigint.cpp
index 09ac2a75d..b92cd359e 100644
--- a/src/math/bigint/bigint.cpp
+++ b/src/math/bigint/bigint.cpp
@@ -40,7 +40,7 @@ BigInt::BigInt(Sign s, u32bit size)
}
/*
-* Construct a BigInt from a "raw" BigInt
+* Copy constructor
*/
BigInt::BigInt(const BigInt& b)
{
@@ -100,6 +100,25 @@ BigInt::BigInt(RandomNumberGenerator& rng, u32bit 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
*/
diff --git a/src/math/bigint/bigint.h b/src/math/bigint/bigint.h
index 55ccf7aae..2612850c3 100644
--- a/src/math/bigint/bigint.h
+++ b/src/math/bigint/bigint.h
@@ -425,10 +425,14 @@ class BOTAN_DLL BigInt
BigInt(u64bit n);
/**
- * Copy-Constructor: clone given BigInt
- * @param bigint the BigInt to clone
+ * Copy constructor
*/
- BigInt(const BigInt& bigint);
+ BigInt(const BigInt& other);
+
+ /**
+ * Assignment operator
+ */
+ BigInt& operator=(const BigInt&) = default;
/**
* Create BigInt from a string.
@@ -471,6 +475,15 @@ class BOTAN_DLL BigInt
*/
BigInt(NumberType type, u32bit n);
+ /**
+ * Move constructor
+ */
+ BigInt(BigInt&& other);
+
+ /**
+ * Move assignment
+ */
+ BigInt& operator=(BigInt&& other);
private:
SecureVector<word> reg;
Sign signedness;
diff --git a/src/math/gfpmath/curve_gfp.h b/src/math/gfpmath/curve_gfp.h
index 5641e80d1..d2ca437fb 100644
--- a/src/math/gfpmath/curve_gfp.h
+++ b/src/math/gfpmath/curve_gfp.h
@@ -10,6 +10,7 @@
#ifndef BOTAN_GFP_CURVE_H__
#define BOTAN_GFP_CURVE_H__
+#include <botan/bigint.h>
#include <botan/gfp_element.h>
#include <iosfwd>
diff --git a/src/math/gfpmath/point_gfp.cpp b/src/math/gfpmath/point_gfp.cpp
index 4b2de7913..00331f25b 100644
--- a/src/math/gfpmath/point_gfp.cpp
+++ b/src/math/gfpmath/point_gfp.cpp
@@ -13,7 +13,7 @@
namespace Botan {
// construct the point at infinity or a random point
-PointGFp::PointGFp(const CurveGFp& curve) :
+nPointGFp::PointGFp(const CurveGFp& curve) :
mC(curve),
mX(curve.get_p(), 0),
mY(curve.get_p(), 1),
diff --git a/src/math/numbertheory/dsa_gen.cpp b/src/math/numbertheory/dsa_gen.cpp
index 83646e50e..39a7cf5fa 100644
--- a/src/math/numbertheory/dsa_gen.cpp
+++ b/src/math/numbertheory/dsa_gen.cpp
@@ -47,15 +47,15 @@ bool generate_dsa_primes(RandomNumberGenerator& rng,
if(!fips186_3_valid_size(pbits, qbits))
throw Invalid_Argument(
"FIPS 186-3 does not allow DSA domain parameters of " +
- to_string(pbits) + "/" + to_string(qbits) + " bits long");
+ std::to_string(pbits) + "/" + std::to_string(qbits) + " bits long");
if(seed_c.size() * 8 < qbits)
throw Invalid_Argument(
- "Generating a DSA parameter set with a " + to_string(qbits) +
+ "Generating a DSA parameter set with a " + std::to_string(qbits) +
"long q requires a seed at least as many bits long");
- std::auto_ptr<HashFunction> hash(
- af.make_hash_function("SHA-" + to_string(qbits)));
+ std::unique_ptr<HashFunction> hash(
+ af.make_hash_function("SHA-" + std::to_string(qbits)));
const u32bit HASH_SIZE = hash->OUTPUT_LENGTH;
diff --git a/src/math/numbertheory/make_prm.cpp b/src/math/numbertheory/make_prm.cpp
index b136b6d25..3eb01cd42 100644
--- a/src/math/numbertheory/make_prm.cpp
+++ b/src/math/numbertheory/make_prm.cpp
@@ -20,7 +20,7 @@ BigInt random_prime(RandomNumberGenerator& rng,
{
if(bits <= 1)
throw Invalid_Argument("random_prime: Can't make a prime of " +
- to_string(bits) + " bits");
+ std::to_string(bits) + " bits");
else if(bits == 2)
return ((rng.next_byte() % 2) ? 2 : 3);
else if(bits == 3)
@@ -85,7 +85,7 @@ BigInt random_safe_prime(RandomNumberGenerator& rng, u32bit bits)
{
if(bits <= 64)
throw Invalid_Argument("random_safe_prime: Can't make a prime of " +
- to_string(bits) + " bits");
+ std::to_string(bits) + " bits");
BigInt p;
do
diff --git a/src/math/numbertheory/numthry.cpp b/src/math/numbertheory/numthry.cpp
index 0740ea21b..760250712 100644
--- a/src/math/numbertheory/numthry.cpp
+++ b/src/math/numbertheory/numthry.cpp
@@ -20,7 +20,7 @@ u32bit miller_rabin_test_iterations(u32bit bits, bool verify)
{
struct mapping { u32bit bits; u32bit verify_iter; u32bit check_iter; };
- static const mapping tests[] = {
+ const mapping tests[] = {
{ 50, 55, 25 },
{ 100, 38, 22 },
{ 160, 32, 18 },