aboutsummaryrefslogtreecommitdiffstats
path: root/src/math/gfpmath
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/gfpmath')
-rw-r--r--src/math/gfpmath/gfp_element.h40
-rw-r--r--src/math/gfpmath/point_gfp.cpp6
-rw-r--r--src/math/gfpmath/point_gfp.h41
3 files changed, 44 insertions, 43 deletions
diff --git a/src/math/gfpmath/gfp_element.h b/src/math/gfpmath/gfp_element.h
index 0fc4e0c7f..c6cfc9d32 100644
--- a/src/math/gfpmath/gfp_element.h
+++ b/src/math/gfpmath/gfp_element.h
@@ -225,14 +225,6 @@ class BOTAN_DLL GFpElement
//friend declarations for non-member functions
- /**
- * write a GFpElement to an output stream.
- * @param output the output stream to write to
- * @param elem the object to write
- * @result the output stream
- */
- friend std::ostream& operator<<(std::ostream& output, const GFpElement& elem);
-
friend class Point_Coords_GFp;
/**
@@ -259,31 +251,37 @@ class BOTAN_DLL GFpElement
};
// relational operators
-bool operator==(const GFpElement& lhs, const GFpElement& rhs);
+bool BOTAN_DLL operator==(const GFpElement& lhs, const GFpElement& rhs);
inline bool operator!=(const GFpElement& lhs, const GFpElement& rhs )
{
return !operator==(lhs, rhs);
}
// arithmetic operators
-GFpElement operator+(const GFpElement& lhs, const GFpElement& rhs);
-GFpElement operator-(const GFpElement& lhs, const GFpElement& rhs);
-GFpElement operator-(const GFpElement& lhs);
+GFpElement BOTAN_DLL operator+(const GFpElement& lhs, const GFpElement& rhs);
+GFpElement BOTAN_DLL operator-(const GFpElement& lhs, const GFpElement& rhs);
+GFpElement BOTAN_DLL operator-(const GFpElement& lhs);
-GFpElement operator*(const GFpElement& lhs, const GFpElement& rhs);
-GFpElement operator/(const GFpElement& lhs, const GFpElement& rhs);
-GFpElement operator* (const GFpElement& lhs, u32bit rhs);
-GFpElement operator* (u32bit rhs, const GFpElement& lhs);
+GFpElement BOTAN_DLL operator*(const GFpElement& lhs, const GFpElement& rhs);
+GFpElement BOTAN_DLL operator/(const GFpElement& lhs, const GFpElement& rhs);
+GFpElement BOTAN_DLL operator* (const GFpElement& lhs, u32bit rhs);
+GFpElement BOTAN_DLL operator* (u32bit rhs, const GFpElement& lhs);
-// io operators
-std::ostream& operator<<(std::ostream& output, const GFpElement& elem);
+
+/**
+* write a GFpElement to an output stream.
+* @param output the output stream to write to
+* @param elem the object to write
+* @result the output stream
+*/
+BOTAN_DLL std::ostream& operator<<(std::ostream& output, const GFpElement& elem);
// return (*this)^(-1)
-GFpElement inverse(const GFpElement& elem);
+GFpElement BOTAN_DLL inverse(const GFpElement& elem);
// encoding and decoding
-SecureVector<byte> FE2OSP(const GFpElement& elem);
-GFpElement OS2FEP(MemoryRegion<byte> const& os, BigInt p);
+SecureVector<byte> BOTAN_DLL FE2OSP(const GFpElement& elem);
+GFpElement BOTAN_DLL OS2FEP(MemoryRegion<byte> const& os, BigInt p);
inline void swap(GFpElement& x, GFpElement& y)
{
diff --git a/src/math/gfpmath/point_gfp.cpp b/src/math/gfpmath/point_gfp.cpp
index b67631f7b..f95add9f7 100644
--- a/src/math/gfpmath/point_gfp.cpp
+++ b/src/math/gfpmath/point_gfp.cpp
@@ -839,7 +839,7 @@ void PointGFp::swap(PointGFp& other)
std::swap<bool>(mAZpow4_set, other.mAZpow4_set);
}
-PointGFp const mult2(const PointGFp& point)
+PointGFp mult2(const PointGFp& point)
{
return (PointGFp(point)).mult2_in_place();
}
@@ -1114,8 +1114,8 @@ GFpElement PointGFp::decompress(bool yMod2, const GFpElement& x,
return GFpElement(curve.get_p(),z);
}
-PointGFp const create_random_point(RandomNumberGenerator& rng,
- const CurveGFp& curve)
+PointGFp create_random_point(RandomNumberGenerator& rng,
+ const CurveGFp& curve)
{
// create a random point
diff --git a/src/math/gfpmath/point_gfp.h b/src/math/gfpmath/point_gfp.h
index 62b3bc7da..0c7bb8428 100644
--- a/src/math/gfpmath/point_gfp.h
+++ b/src/math/gfpmath/point_gfp.h
@@ -18,7 +18,7 @@
namespace Botan {
-struct Illegal_Point : public Exception
+struct BOTAN_DLL Illegal_Point : public Exception
{
Illegal_Point(const std::string& err = "") : Exception(err) {}
};
@@ -260,36 +260,39 @@ class BOTAN_DLL PointGFp
};
// relational operators
-bool operator==(const PointGFp& lhs, const PointGFp& rhs);
+bool BOTAN_DLL operator==(const PointGFp& lhs, const PointGFp& rhs);
inline bool operator!=(const PointGFp& lhs, const PointGFp& rhs )
{
return !operator==(lhs, rhs);
}
// arithmetic operators
-PointGFp operator+(const PointGFp& lhs, const PointGFp& rhs);
-PointGFp operator-(const PointGFp& lhs, const PointGFp& rhs);
-PointGFp operator-(const PointGFp& lhs);
+PointGFp BOTAN_DLL operator+(const PointGFp& lhs, const PointGFp& rhs);
+PointGFp BOTAN_DLL operator-(const PointGFp& lhs, const PointGFp& rhs);
+PointGFp BOTAN_DLL operator-(const PointGFp& lhs);
-PointGFp operator*(const BigInt& scalar, const PointGFp& point);
-PointGFp operator*(const PointGFp& point, const BigInt& scalar);
-PointGFp mult_point_secure(const PointGFp& point,
- const BigInt& scalar,
- const BigInt& point_order,
- const BigInt& max_secret);
+PointGFp BOTAN_DLL operator*(const BigInt& scalar, const PointGFp& point);
+PointGFp BOTAN_DLL operator*(const PointGFp& point, const BigInt& scalar);
+PointGFp BOTAN_DLL mult_point_secure(const PointGFp& point,
+ const BigInt& scalar,
+ const BigInt& point_order,
+ const BigInt& max_secret);
-PointGFp const mult2(const PointGFp& point);
+PointGFp BOTAN_DLL mult2(const PointGFp& point);
-PointGFp const create_random_point(RandomNumberGenerator& rng,
- const CurveGFp& curve);
+PointGFp BOTAN_DLL create_random_point(RandomNumberGenerator& rng,
+ const CurveGFp& curve);
// encoding and decoding
-SecureVector<byte> EC2OSP(const PointGFp& point, byte format);
-PointGFp OS2ECP(MemoryRegion<byte> const& os, const CurveGFp& curve);
+SecureVector<byte> BOTAN_DLL EC2OSP(const PointGFp& point, byte format);
+PointGFp BOTAN_DLL OS2ECP(MemoryRegion<byte> const& os, const CurveGFp& curve);
-SecureVector<byte> encode_uncompressed(const PointGFp& point); // maybe make private
-SecureVector<byte> encode_hybrid(const PointGFp& point); // maybe make private
-SecureVector<byte> encode_compressed(const PointGFp& point); // maybe make private
+/* Should these be private? */
+SecureVector<byte>
+BOTAN_DLL encode_uncompressed(const PointGFp& point);
+
+SecureVector<byte> BOTAN_DLL encode_hybrid(const PointGFp& point);
+SecureVector<byte> BOTAN_DLL encode_compressed(const PointGFp& point);
// swaps the states of point1 and point2, does not throw!
// cf. Meyers, Item 25