diff options
Diffstat (limited to 'src/lib/math')
-rw-r--r-- | src/lib/math/bigint/bigint.h | 24 | ||||
-rw-r--r-- | src/lib/math/bigint/divide.h | 2 | ||||
-rw-r--r-- | src/lib/math/ec_gfp/curve_gfp.h | 2 | ||||
-rw-r--r-- | src/lib/math/ec_gfp/curve_nistp.h | 20 | ||||
-rw-r--r-- | src/lib/math/ec_gfp/point_gfp.h | 16 | ||||
-rw-r--r-- | src/lib/math/mp/mp_core.h | 8 | ||||
-rw-r--r-- | src/lib/math/numbertheory/numthry.h | 42 | ||||
-rw-r--r-- | src/lib/math/numbertheory/pow_mod.h | 8 | ||||
-rw-r--r-- | src/lib/math/numbertheory/reducer.h | 2 |
9 files changed, 62 insertions, 62 deletions
diff --git a/src/lib/math/bigint/bigint.h b/src/lib/math/bigint/bigint.h index 4bb0161fc..f1d2d277a 100644 --- a/src/lib/math/bigint/bigint.h +++ b/src/lib/math/bigint/bigint.h @@ -20,7 +20,7 @@ namespace Botan { /** * Arbitrary precision integer */ -class BOTAN_DLL BigInt +class BOTAN_PUBLIC_API(2,0) BigInt { public: /** @@ -36,7 +36,7 @@ class BOTAN_DLL BigInt /** * DivideByZero Exception */ - struct BOTAN_DLL DivideByZero : public Exception + struct BOTAN_PUBLIC_API(2,0) DivideByZero : public Exception { DivideByZero() : Exception("BigInt divide by zero") {} }; /** @@ -583,14 +583,14 @@ class BOTAN_DLL BigInt /* * Arithmetic Operators */ -BigInt BOTAN_DLL operator+(const BigInt& x, const BigInt& y); -BigInt BOTAN_DLL operator-(const BigInt& x, const BigInt& y); -BigInt BOTAN_DLL operator*(const BigInt& x, const BigInt& y); -BigInt BOTAN_DLL operator/(const BigInt& x, const BigInt& d); -BigInt BOTAN_DLL operator%(const BigInt& x, const BigInt& m); -word BOTAN_DLL operator%(const BigInt& x, word m); -BigInt BOTAN_DLL operator<<(const BigInt& x, size_t n); -BigInt BOTAN_DLL operator>>(const BigInt& x, size_t n); +BigInt BOTAN_PUBLIC_API(2,0) operator+(const BigInt& x, const BigInt& y); +BigInt BOTAN_PUBLIC_API(2,0) operator-(const BigInt& x, const BigInt& y); +BigInt BOTAN_PUBLIC_API(2,0) operator*(const BigInt& x, const BigInt& y); +BigInt BOTAN_PUBLIC_API(2,0) operator/(const BigInt& x, const BigInt& d); +BigInt BOTAN_PUBLIC_API(2,0) operator%(const BigInt& x, const BigInt& m); +word BOTAN_PUBLIC_API(2,0) operator%(const BigInt& x, word m); +BigInt BOTAN_PUBLIC_API(2,0) operator<<(const BigInt& x, size_t n); +BigInt BOTAN_PUBLIC_API(2,0) operator>>(const BigInt& x, size_t n); /* * Comparison Operators @@ -611,8 +611,8 @@ inline bool operator>(const BigInt& a, const BigInt& b) /* * I/O Operators */ -BOTAN_DLL std::ostream& operator<<(std::ostream&, const BigInt&); -BOTAN_DLL std::istream& operator>>(std::istream&, BigInt&); +BOTAN_PUBLIC_API(2,0) std::ostream& operator<<(std::ostream&, const BigInt&); +BOTAN_PUBLIC_API(2,0) std::istream& operator>>(std::istream&, BigInt&); } diff --git a/src/lib/math/bigint/divide.h b/src/lib/math/bigint/divide.h index a160e64dc..9616d4859 100644 --- a/src/lib/math/bigint/divide.h +++ b/src/lib/math/bigint/divide.h @@ -19,7 +19,7 @@ namespace Botan { * @param q will be set to x / y * @param r will be set to x % y */ -void BOTAN_DLL divide(const BigInt& x, +void BOTAN_PUBLIC_API(2,0) divide(const BigInt& x, const BigInt& y, BigInt& q, BigInt& r); diff --git a/src/lib/math/ec_gfp/curve_gfp.h b/src/lib/math/ec_gfp/curve_gfp.h index f1b4b144a..12c29dec7 100644 --- a/src/lib/math/ec_gfp/curve_gfp.h +++ b/src/lib/math/ec_gfp/curve_gfp.h @@ -50,7 +50,7 @@ class CurveGFp_Repr /** * This class represents an elliptic curve over GF(p) */ -class BOTAN_DLL CurveGFp +class BOTAN_PUBLIC_API(2,0) CurveGFp { public: diff --git a/src/lib/math/ec_gfp/curve_nistp.h b/src/lib/math/ec_gfp/curve_nistp.h index e7af69964..795ca00aa 100644 --- a/src/lib/math/ec_gfp/curve_nistp.h +++ b/src/lib/math/ec_gfp/curve_nistp.h @@ -20,24 +20,24 @@ namespace Botan { * ws is a workspace function which is used as a temporary, * and will be resized as needed. */ -BOTAN_DLL const BigInt& prime_p521(); -BOTAN_DLL void redc_p521(BigInt& x, secure_vector<word>& ws); +BOTAN_PUBLIC_API(2,0) const BigInt& prime_p521(); +BOTAN_PUBLIC_API(2,0) void redc_p521(BigInt& x, secure_vector<word>& ws); #if (BOTAN_MP_WORD_BITS == 32) || (BOTAN_MP_WORD_BITS == 64) #define BOTAN_HAS_NIST_PRIME_REDUCERS_W32 -BOTAN_DLL const BigInt& prime_p384(); -BOTAN_DLL void redc_p384(BigInt& x, secure_vector<word>& ws); +BOTAN_PUBLIC_API(2,0) const BigInt& prime_p384(); +BOTAN_PUBLIC_API(2,0) void redc_p384(BigInt& x, secure_vector<word>& ws); -BOTAN_DLL const BigInt& prime_p256(); -BOTAN_DLL void redc_p256(BigInt& x, secure_vector<word>& ws); +BOTAN_PUBLIC_API(2,0) const BigInt& prime_p256(); +BOTAN_PUBLIC_API(2,0) void redc_p256(BigInt& x, secure_vector<word>& ws); -BOTAN_DLL const BigInt& prime_p224(); -BOTAN_DLL void redc_p224(BigInt& x, secure_vector<word>& ws); +BOTAN_PUBLIC_API(2,0) const BigInt& prime_p224(); +BOTAN_PUBLIC_API(2,0) void redc_p224(BigInt& x, secure_vector<word>& ws); -BOTAN_DLL const BigInt& prime_p192(); -BOTAN_DLL void redc_p192(BigInt& x, secure_vector<word>& ws); +BOTAN_PUBLIC_API(2,0) const BigInt& prime_p192(); +BOTAN_PUBLIC_API(2,0) void redc_p192(BigInt& x, secure_vector<word>& ws); #endif diff --git a/src/lib/math/ec_gfp/point_gfp.h b/src/lib/math/ec_gfp/point_gfp.h index 46ee5449a..bd66ca682 100644 --- a/src/lib/math/ec_gfp/point_gfp.h +++ b/src/lib/math/ec_gfp/point_gfp.h @@ -19,7 +19,7 @@ namespace Botan { * Exception thrown if you try to convert a zero point to an affine * coordinate */ -struct BOTAN_DLL Illegal_Transformation : public Exception +struct BOTAN_PUBLIC_API(2,0) Illegal_Transformation : public Exception { explicit Illegal_Transformation(const std::string& err = "Requested transformation is not possible") : @@ -29,7 +29,7 @@ struct BOTAN_DLL Illegal_Transformation : public Exception /** * Exception thrown if some form of illegal point is decoded */ -struct BOTAN_DLL Illegal_Point : public Exception +struct BOTAN_PUBLIC_API(2,0) Illegal_Point : public Exception { explicit Illegal_Point(const std::string& err = "Malformed ECP point detected") : Exception(err) {} @@ -38,7 +38,7 @@ struct BOTAN_DLL Illegal_Point : public Exception /** * This class represents one point on a curve of GF(p) */ -class BOTAN_DLL PointGFp +class BOTAN_PUBLIC_API(2,0) PointGFp { public: enum Compression_Type { @@ -127,7 +127,7 @@ class BOTAN_DLL PointGFp * @param point the point value * @return scalar*point on the curve */ - friend BOTAN_DLL PointGFp operator*(const BigInt& scalar, const PointGFp& point); + friend BOTAN_PUBLIC_API(2,0) PointGFp operator*(const BigInt& scalar, const PointGFp& point); /** * Multiexponentiation @@ -137,7 +137,7 @@ class BOTAN_DLL PointGFp * @param z2 a scalar * @result (p1 * z1 + p2 * z2) */ - friend BOTAN_DLL PointGFp multi_exponentiate( + friend BOTAN_PUBLIC_API(2,0) PointGFp multi_exponentiate( const PointGFp& p1, const BigInt& z1, const PointGFp& p2, const BigInt& z2); @@ -274,9 +274,9 @@ inline PointGFp operator*(const PointGFp& point, const BigInt& scalar) } // encoding and decoding -secure_vector<uint8_t> BOTAN_DLL EC2OSP(const PointGFp& point, uint8_t format); +secure_vector<uint8_t> BOTAN_PUBLIC_API(2,0) EC2OSP(const PointGFp& point, uint8_t format); -PointGFp BOTAN_DLL OS2ECP(const uint8_t data[], size_t data_len, +PointGFp BOTAN_PUBLIC_API(2,0) OS2ECP(const uint8_t data[], size_t data_len, const CurveGFp& curve); template<typename Alloc> @@ -286,7 +286,7 @@ PointGFp OS2ECP(const std::vector<uint8_t, Alloc>& data, const CurveGFp& curve) /** */ -class BOTAN_DLL Blinded_Point_Multiply +class BOTAN_PUBLIC_API(2,0) Blinded_Point_Multiply { public: Blinded_Point_Multiply(const PointGFp& base, const BigInt& order, size_t h = 0); diff --git a/src/lib/math/mp/mp_core.h b/src/lib/math/mp/mp_core.h index a22d3b6ad..f76096d23 100644 --- a/src/lib/math/mp/mp_core.h +++ b/src/lib/math/mp/mp_core.h @@ -25,21 +25,21 @@ const size_t MP_WORD_BITS = BOTAN_MP_WORD_BITS; * If cond > 0, swaps x[0:size] with y[0:size] * Runs in constant time */ -BOTAN_DLL +BOTAN_TEST_API void bigint_cnd_swap(word cnd, word x[], word y[], size_t size); /* * If cond > 0 adds x[0:size] to y[0:size] and returns carry * Runs in constant time */ -BOTAN_DLL +BOTAN_TEST_API word bigint_cnd_add(word cnd, word x[], const word y[], size_t size); /* * If cond > 0 subs x[0:size] to y[0:size] and returns borrow * Runs in constant time */ -BOTAN_DLL +BOTAN_TEST_API word bigint_cnd_sub(word cnd, word x[], const word y[], size_t size); /* @@ -47,7 +47,7 @@ word bigint_cnd_sub(word cnd, word x[], const word y[], size_t size); * If cond > 0 sets x to ~x + 1 * Runs in constant time */ -BOTAN_DLL +BOTAN_TEST_API void bigint_cnd_abs(word cnd, word x[], size_t size); /** diff --git a/src/lib/math/numbertheory/numthry.h b/src/lib/math/numbertheory/numthry.h index e788caec1..25110e309 100644 --- a/src/lib/math/numbertheory/numthry.h +++ b/src/lib/math/numbertheory/numthry.h @@ -21,7 +21,7 @@ namespace Botan { * @param c an integer * @return (a*b)+c */ -BigInt BOTAN_DLL mul_add(const BigInt& a, +BigInt BOTAN_PUBLIC_API(2,0) mul_add(const BigInt& a, const BigInt& b, const BigInt& c); @@ -32,7 +32,7 @@ BigInt BOTAN_DLL mul_add(const BigInt& a, * @param c an integer * @return (a-b)*c */ -BigInt BOTAN_DLL sub_mul(const BigInt& a, +BigInt BOTAN_PUBLIC_API(2,0) sub_mul(const BigInt& a, const BigInt& b, const BigInt& c); @@ -43,7 +43,7 @@ BigInt BOTAN_DLL sub_mul(const BigInt& a, * @param c an integer * @return (a*b)-c */ -BigInt BOTAN_DLL mul_sub(const BigInt& a, +BigInt BOTAN_PUBLIC_API(2,0) mul_sub(const BigInt& a, const BigInt& b, const BigInt& c); @@ -60,7 +60,7 @@ inline BigInt abs(const BigInt& n) { return n.abs(); } * @param y a positive integer * @return gcd(x,y) */ -BigInt BOTAN_DLL gcd(const BigInt& x, const BigInt& y); +BigInt BOTAN_PUBLIC_API(2,0) gcd(const BigInt& x, const BigInt& y); /** * Least common multiple @@ -68,13 +68,13 @@ BigInt BOTAN_DLL gcd(const BigInt& x, const BigInt& y); * @param y a positive integer * @return z, smallest integer such that z % x == 0 and z % y == 0 */ -BigInt BOTAN_DLL lcm(const BigInt& x, const BigInt& y); +BigInt BOTAN_PUBLIC_API(2,0) lcm(const BigInt& x, const BigInt& y); /** * @param x an integer * @return (x*x) */ -BigInt BOTAN_DLL square(const BigInt& x); +BigInt BOTAN_PUBLIC_API(2,0) square(const BigInt& x); /** * Modular inversion @@ -83,28 +83,28 @@ BigInt BOTAN_DLL square(const BigInt& x); * @return y st (x*y) % modulus == 1 or 0 if no such value * Not const time */ -BigInt BOTAN_DLL inverse_mod(const BigInt& x, +BigInt BOTAN_PUBLIC_API(2,0) inverse_mod(const BigInt& x, const BigInt& modulus); /** * Const time modular inversion * Requires the modulus be odd */ -BigInt BOTAN_DLL ct_inverse_mod_odd_modulus(const BigInt& n, const BigInt& mod); +BigInt BOTAN_PUBLIC_API(2,0) ct_inverse_mod_odd_modulus(const BigInt& n, const BigInt& mod); /** * Return a^-1 * 2^k mod b * Returns k, between n and 2n * Not const time */ -size_t BOTAN_DLL almost_montgomery_inverse(BigInt& result, +size_t BOTAN_PUBLIC_API(2,0) almost_montgomery_inverse(BigInt& result, const BigInt& a, const BigInt& b); /** * Call almost_montgomery_inverse and correct the result to a^-1 mod b */ -BigInt BOTAN_DLL normalized_montgomery_inverse(const BigInt& a, const BigInt& b); +BigInt BOTAN_PUBLIC_API(2,0) normalized_montgomery_inverse(const BigInt& a, const BigInt& b); /** @@ -116,7 +116,7 @@ BigInt BOTAN_DLL normalized_montgomery_inverse(const BigInt& a, const BigInt& b) * @param n is an odd integer > 1 * @return (n / m) */ -int32_t BOTAN_DLL jacobi(const BigInt& a, +int32_t BOTAN_PUBLIC_API(2,0) jacobi(const BigInt& a, const BigInt& n); /** @@ -126,7 +126,7 @@ int32_t BOTAN_DLL jacobi(const BigInt& a, * @param m a positive modulus * @return (b^x) % m */ -BigInt BOTAN_DLL power_mod(const BigInt& b, +BigInt BOTAN_PUBLIC_API(2,0) power_mod(const BigInt& b, const BigInt& x, const BigInt& m); @@ -138,14 +138,14 @@ BigInt BOTAN_DLL power_mod(const BigInt& b, * @param p the prime * @return y such that (y*y)%p == x, or -1 if no such integer */ -BigInt BOTAN_DLL ressol(const BigInt& x, const BigInt& p); +BigInt BOTAN_PUBLIC_API(2,0) ressol(const BigInt& x, const BigInt& p); /* * Compute -input^-1 mod 2^MP_WORD_BITS. Returns zero if input * is even. If input is odd, input and 2^n are relatively prime * and an inverse exists. */ -word BOTAN_DLL monty_inverse(word input); +word BOTAN_PUBLIC_API(2,0) monty_inverse(word input); /** * @param x a positive integer @@ -153,7 +153,7 @@ word BOTAN_DLL monty_inverse(word input); * value of n such that 2^n divides x evenly. Returns zero if * n is less than or equal to zero. */ -size_t BOTAN_DLL low_zero_bits(const BigInt& x); +size_t BOTAN_PUBLIC_API(2,0) low_zero_bits(const BigInt& x); /** * Check for primality @@ -163,7 +163,7 @@ size_t BOTAN_DLL low_zero_bits(const BigInt& x); * @param is_random true if n was randomly chosen by us * @return true if all primality tests passed, otherwise false */ -bool BOTAN_DLL is_prime(const BigInt& n, +bool BOTAN_PUBLIC_API(2,0) is_prime(const BigInt& n, RandomNumberGenerator& rng, size_t prob = 56, bool is_random = false); @@ -188,7 +188,7 @@ inline bool verify_prime(const BigInt& n, RandomNumberGenerator& rng) * @param equiv_mod the modulus equiv should be checked against * @return random prime with the specified criteria */ -BigInt BOTAN_DLL random_prime(RandomNumberGenerator& rng, +BigInt BOTAN_PUBLIC_API(2,0) random_prime(RandomNumberGenerator& rng, size_t bits, const BigInt& coprime = 1, size_t equiv = 1, size_t equiv_mod = 2); @@ -198,7 +198,7 @@ BigInt BOTAN_DLL random_prime(RandomNumberGenerator& rng, * @param bits is how long the resulting prime should be * @return prime randomly chosen from safe primes of length bits */ -BigInt BOTAN_DLL random_safe_prime(RandomNumberGenerator& rng, +BigInt BOTAN_PUBLIC_API(2,0) random_safe_prime(RandomNumberGenerator& rng, size_t bits); /** @@ -210,7 +210,7 @@ BigInt BOTAN_DLL random_safe_prime(RandomNumberGenerator& rng, * @param qbits how long q will be in bits * @return random seed used to generate this parameter set */ -std::vector<uint8_t> BOTAN_DLL +std::vector<uint8_t> BOTAN_PUBLIC_API(2,0) generate_dsa_primes(RandomNumberGenerator& rng, BigInt& p_out, BigInt& q_out, size_t pbits, size_t qbits); @@ -227,7 +227,7 @@ generate_dsa_primes(RandomNumberGenerator& rng, * @return true if seed generated a valid DSA parameter set, otherwise false. p_out and q_out are only valid if true was returned. */ -bool BOTAN_DLL +bool BOTAN_PUBLIC_API(2,0) generate_dsa_primes(RandomNumberGenerator& rng, BigInt& p_out, BigInt& q_out, size_t pbits, size_t qbits, @@ -242,7 +242,7 @@ const size_t PRIME_TABLE_SIZE = 6541; /** * A const array of all primes less than 65535 */ -extern const uint16_t BOTAN_DLL PRIMES[]; +extern const uint16_t BOTAN_PUBLIC_API(2,0) PRIMES[]; } diff --git a/src/lib/math/numbertheory/pow_mod.h b/src/lib/math/numbertheory/pow_mod.h index 50695c2bc..64439acbd 100644 --- a/src/lib/math/numbertheory/pow_mod.h +++ b/src/lib/math/numbertheory/pow_mod.h @@ -15,7 +15,7 @@ namespace Botan { /** * Modular Exponentiator Interface */ -class BOTAN_DLL Modular_Exponentiator +class BOTAN_PUBLIC_API(2,0) Modular_Exponentiator { public: virtual void set_base(const BigInt&) = 0; @@ -32,7 +32,7 @@ class BOTAN_DLL Modular_Exponentiator /** * Modular Exponentiator Proxy */ -class BOTAN_DLL Power_Mod +class BOTAN_PUBLIC_API(2,0) Power_Mod { public: @@ -101,7 +101,7 @@ class BOTAN_DLL Power_Mod /** * Fixed Exponent Modular Exponentiator Proxy */ -class BOTAN_DLL Fixed_Exponent_Power_Mod : public Power_Mod +class BOTAN_PUBLIC_API(2,0) Fixed_Exponent_Power_Mod : public Power_Mod { public: BigInt operator()(const BigInt& b) const @@ -117,7 +117,7 @@ class BOTAN_DLL Fixed_Exponent_Power_Mod : public Power_Mod /** * Fixed Base Modular Exponentiator Proxy */ -class BOTAN_DLL Fixed_Base_Power_Mod : public Power_Mod +class BOTAN_PUBLIC_API(2,0) Fixed_Base_Power_Mod : public Power_Mod { public: BigInt operator()(const BigInt& e) const diff --git a/src/lib/math/numbertheory/reducer.h b/src/lib/math/numbertheory/reducer.h index 4de1e3d04..e2782a3f7 100644 --- a/src/lib/math/numbertheory/reducer.h +++ b/src/lib/math/numbertheory/reducer.h @@ -15,7 +15,7 @@ namespace Botan { /** * Modular Reducer (using Barrett's technique) */ -class BOTAN_DLL Modular_Reducer +class BOTAN_PUBLIC_API(2,0) Modular_Reducer { public: const BigInt& get_modulus() const { return m_modulus; } |