diff options
author | lloyd <[email protected]> | 2009-12-16 02:52:12 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-12-16 02:52:12 +0000 |
commit | 317b76d71dca1840c9e72f9a26407590719c1423 (patch) | |
tree | 2eb49072e6e27f6ee41e704004aa8689b1e98bb3 /src/math | |
parent | 457ce43934a4e51ead4d21e43013eef9d448d0e1 (diff) | |
parent | 12afeca214c4414a0ced0bc4654d0fc5908dc77b (diff) |
propagate from branch 'net.randombit.botan' (head 744dccf92270cf16b80b50ee2759424c9866b256)
to branch 'net.randombit.botan.c++0x' (head 2aa1acac1d05e8ea9991fe39015b1db9abc3b24e)
Diffstat (limited to 'src/math')
42 files changed, 149 insertions, 131 deletions
diff --git a/src/math/bigint/big_ops2.cpp b/src/math/bigint/big_ops2.cpp index 488eca909..1137fe4b2 100644 --- a/src/math/bigint/big_ops2.cpp +++ b/src/math/bigint/big_ops2.cpp @@ -6,8 +6,8 @@ */ #include <botan/bigint.h> -#include <botan/mp_core.h> -#include <botan/bit_ops.h> +#include <botan/internal/mp_core.h> +#include <botan/internal/bit_ops.h> #include <algorithm> namespace Botan { diff --git a/src/math/bigint/big_ops3.cpp b/src/math/bigint/big_ops3.cpp index ad8b7bbd0..b92b71543 100644 --- a/src/math/bigint/big_ops3.cpp +++ b/src/math/bigint/big_ops3.cpp @@ -7,8 +7,8 @@ #include <botan/bigint.h> #include <botan/divide.h> -#include <botan/mp_core.h> -#include <botan/bit_ops.h> +#include <botan/internal/mp_core.h> +#include <botan/internal/bit_ops.h> #include <algorithm> namespace Botan { diff --git a/src/math/bigint/bigint.cpp b/src/math/bigint/bigint.cpp index c777e770b..1d234391c 100644 --- a/src/math/bigint/bigint.cpp +++ b/src/math/bigint/bigint.cpp @@ -6,10 +6,10 @@ */ #include <botan/bigint.h> -#include <botan/mp_core.h> -#include <botan/loadstor.h> +#include <botan/internal/mp_core.h> +#include <botan/internal/loadstor.h> #include <botan/parsing.h> -#include <botan/rounding.h> +#include <botan/internal/rounding.h> namespace Botan { diff --git a/src/math/bigint/bigint.h b/src/math/bigint/bigint.h index 3db9a1a04..2612850c3 100644 --- a/src/math/bigint/bigint.h +++ b/src/math/bigint/bigint.h @@ -40,7 +40,7 @@ class BOTAN_DLL BigInt /** * DivideByZero Exception */ - struct DivideByZero : public Exception + struct BOTAN_DLL DivideByZero : public Exception { DivideByZero() : Exception("BigInt divide by zero") {} }; /** diff --git a/src/math/bigint/divide.cpp b/src/math/bigint/divide.cpp index 45d31350d..a5f2462d8 100644 --- a/src/math/bigint/divide.cpp +++ b/src/math/bigint/divide.cpp @@ -6,7 +6,7 @@ */ #include <botan/divide.h> -#include <botan/mp_core.h> +#include <botan/internal/mp_core.h> namespace Botan { diff --git a/src/math/bigint/info.txt b/src/math/bigint/info.txt index 30018b795..d5741943f 100644 --- a/src/math/bigint/info.txt +++ b/src/math/bigint/info.txt @@ -2,11 +2,17 @@ load_on auto define BIGINT -<add> +<header:public> bigint.h divide.h -mp_core.h mp_types.h +</header:public> + +<header:internal> +mp_core.h +</header:internal> + +<source> big_code.cpp big_io.cpp big_ops2.cpp @@ -19,7 +25,7 @@ mp_comba.cpp mp_karat.cpp mp_misc.cpp mp_shift.cpp -</add> +</source> <requires> alloc diff --git a/src/math/bigint/monty_amd64/info.txt b/src/math/bigint/monty_amd64/info.txt index 657cd0353..bb16dbe8f 100644 --- a/src/math/bigint/monty_amd64/info.txt +++ b/src/math/bigint/monty_amd64/info.txt @@ -2,9 +2,9 @@ mp_bits 64 load_on never -<add> +<source> mp_monty.S -</add> +</source> <arch> amd64 diff --git a/src/math/bigint/monty_amd64/mp_monty.S b/src/math/bigint/monty_amd64/mp_monty.S index fa493aaa2..9eab9f766 100644 --- a/src/math/bigint/monty_amd64/mp_monty.S +++ b/src/math/bigint/monty_amd64/mp_monty.S @@ -5,7 +5,7 @@ * Distributed under the terms of the Botan license */ -#include <botan/asm_macr_amd64.h> +#include <botan/internal/asm_macr_amd64.h> START_LISTING(mp_monty.S) diff --git a/src/math/bigint/monty_generic/info.txt b/src/math/bigint/monty_generic/info.txt index c709229e6..cd05ccdc0 100644 --- a/src/math/bigint/monty_generic/info.txt +++ b/src/math/bigint/monty_generic/info.txt @@ -1,5 +1,5 @@ load_on dep -<add> +<source> mp_monty.cpp -</add> +</source> diff --git a/src/math/bigint/monty_generic/mp_monty.cpp b/src/math/bigint/monty_generic/mp_monty.cpp index 5409e2569..ba1071e21 100644 --- a/src/math/bigint/monty_generic/mp_monty.cpp +++ b/src/math/bigint/monty_generic/mp_monty.cpp @@ -6,9 +6,9 @@ * Distributed under the terms of the Botan license */ -#include <botan/mp_core.h> -#include <botan/mp_asm.h> -#include <botan/mp_asmi.h> +#include <botan/internal/mp_core.h> +#include <botan/internal/mp_asm.h> +#include <botan/internal/mp_asmi.h> namespace Botan { diff --git a/src/math/bigint/mp_amd64/info.txt b/src/math/bigint/mp_amd64/info.txt index a7da8806e..616fb2840 100644 --- a/src/math/bigint/mp_amd64/info.txt +++ b/src/math/bigint/mp_amd64/info.txt @@ -1,11 +1,11 @@ -mp_bits 64 - load_on dep -<add> +mp_bits 64 + +<header:internal> mp_asm.h mp_asmi.h -</add> +</header:internal> <arch> amd64 diff --git a/src/math/bigint/mp_amd64/mp_asmi.h b/src/math/bigint/mp_amd64/mp_asmi.h index 1a3ac1aaa..d8f681d77 100644 --- a/src/math/bigint/mp_amd64/mp_asmi.h +++ b/src/math/bigint/mp_amd64/mp_asmi.h @@ -9,7 +9,7 @@ #ifndef BOTAN_MP_ASM_INTERNAL_H__ #define BOTAN_MP_ASM_INTERNAL_H__ -#include <botan/mp_asm.h> +#include <botan/internal/mp_asm.h> namespace Botan { diff --git a/src/math/bigint/mp_asm.cpp b/src/math/bigint/mp_asm.cpp index ea9738d30..9827bff06 100644 --- a/src/math/bigint/mp_asm.cpp +++ b/src/math/bigint/mp_asm.cpp @@ -6,9 +6,9 @@ * Distributed under the terms of the Botan license */ -#include <botan/mp_asm.h> -#include <botan/mp_asmi.h> -#include <botan/mp_core.h> +#include <botan/internal/mp_asm.h> +#include <botan/internal/mp_asmi.h> +#include <botan/internal/mp_core.h> #include <botan/mem_ops.h> namespace Botan { diff --git a/src/math/bigint/mp_asm64/info.txt b/src/math/bigint/mp_asm64/info.txt index 7bdbffb2c..fd0242a7a 100644 --- a/src/math/bigint/mp_asm64/info.txt +++ b/src/math/bigint/mp_asm64/info.txt @@ -2,10 +2,10 @@ mp_bits 64 load_on dep -<add> +<header:internal> mp_asm.h mp_generic:mp_asmi.h -</add> +</header:internal> <arch> #amd64 diff --git a/src/math/bigint/mp_comba.cpp b/src/math/bigint/mp_comba.cpp index 218038d8a..2770d3f0a 100644 --- a/src/math/bigint/mp_comba.cpp +++ b/src/math/bigint/mp_comba.cpp @@ -5,8 +5,8 @@ * Distributed under the terms of the Botan license */ -#include <botan/mp_core.h> -#include <botan/mp_asmi.h> +#include <botan/internal/mp_core.h> +#include <botan/internal/mp_asmi.h> namespace Botan { diff --git a/src/math/bigint/mp_generic/info.txt b/src/math/bigint/mp_generic/info.txt index 28f258ebb..ab4d7406a 100644 --- a/src/math/bigint/mp_generic/info.txt +++ b/src/math/bigint/mp_generic/info.txt @@ -1,6 +1,6 @@ load_on dep -<add> +<header:internal> mp_asm.h mp_asmi.h -</add> +</header:internal> diff --git a/src/math/bigint/mp_generic/mp_asmi.h b/src/math/bigint/mp_generic/mp_asmi.h index 21c4db248..9913c6ba9 100644 --- a/src/math/bigint/mp_generic/mp_asmi.h +++ b/src/math/bigint/mp_generic/mp_asmi.h @@ -9,7 +9,7 @@ #ifndef BOTAN_MP_ASM_INTERNAL_H__ #define BOTAN_MP_ASM_INTERNAL_H__ -#include <botan/mp_asm.h> +#include <botan/internal/mp_asm.h> namespace Botan { diff --git a/src/math/bigint/mp_ia32/info.txt b/src/math/bigint/mp_ia32/info.txt index 6e093a7e5..182f34eb7 100644 --- a/src/math/bigint/mp_ia32/info.txt +++ b/src/math/bigint/mp_ia32/info.txt @@ -1,11 +1,11 @@ -mp_bits 32 +load_on dep -load_on asm_ok +mp_bits 32 -<add> +<header:internal> mp_asm.h mp_asmi.h -</add> +</header:internal> <arch> ia32 diff --git a/src/math/bigint/mp_ia32/mp_asmi.h b/src/math/bigint/mp_ia32/mp_asmi.h index 46bf302d5..0b8708e53 100644 --- a/src/math/bigint/mp_ia32/mp_asmi.h +++ b/src/math/bigint/mp_ia32/mp_asmi.h @@ -9,7 +9,7 @@ #ifndef BOTAN_MP_ASM_INTERNAL_H__ #define BOTAN_MP_ASM_INTERNAL_H__ -#include <botan/mp_asm.h> +#include <botan/internal/mp_asm.h> namespace Botan { diff --git a/src/math/bigint/mp_ia32_msvc/info.txt b/src/math/bigint/mp_ia32_msvc/info.txt index 52839d89b..55a42c310 100644 --- a/src/math/bigint/mp_ia32_msvc/info.txt +++ b/src/math/bigint/mp_ia32_msvc/info.txt @@ -2,10 +2,10 @@ mp_bits 32 load_on dep -<add> +<header:internal> mp_generic:mp_asm.h mp_asmi.h -</add> +</header:internal> <arch> ia32 diff --git a/src/math/bigint/mp_ia32_msvc/mp_asmi.h b/src/math/bigint/mp_ia32_msvc/mp_asmi.h index 33ce6eb3d..4c3027fde 100644 --- a/src/math/bigint/mp_ia32_msvc/mp_asmi.h +++ b/src/math/bigint/mp_ia32_msvc/mp_asmi.h @@ -9,7 +9,7 @@ #ifndef BOTAN_MP_ASM_INTERNAL_H__ #define BOTAN_MP_ASM_INTERNAL_H__ -#include <botan/mp_asm.h> +#include <botan/internal/mp_asm.h> namespace Botan { diff --git a/src/math/bigint/mp_karat.cpp b/src/math/bigint/mp_karat.cpp index f30d418cc..a50e4ee0c 100644 --- a/src/math/bigint/mp_karat.cpp +++ b/src/math/bigint/mp_karat.cpp @@ -5,9 +5,9 @@ * Distributed under the terms of the Botan license */ -#include <botan/mp_core.h> +#include <botan/internal/mp_core.h> #include <botan/mem_ops.h> -#include <botan/mp_asmi.h> +#include <botan/internal/mp_asmi.h> namespace Botan { diff --git a/src/math/bigint/mp_misc.cpp b/src/math/bigint/mp_misc.cpp index 6b7fc651b..86d5f3d50 100644 --- a/src/math/bigint/mp_misc.cpp +++ b/src/math/bigint/mp_misc.cpp @@ -5,8 +5,8 @@ * Distributed under the terms of the Botan license */ -#include <botan/mp_core.h> -#include <botan/mp_asm.h> +#include <botan/internal/mp_core.h> +#include <botan/internal/mp_asm.h> namespace Botan { diff --git a/src/math/bigint/mp_shift.cpp b/src/math/bigint/mp_shift.cpp index a7de79c77..f1d609bfb 100644 --- a/src/math/bigint/mp_shift.cpp +++ b/src/math/bigint/mp_shift.cpp @@ -5,7 +5,7 @@ * Distributed under the terms of the Botan license */ -#include <botan/mp_core.h> +#include <botan/internal/mp_core.h> #include <botan/mem_ops.h> namespace Botan { diff --git a/src/math/bigint/mulop_amd64/info.txt b/src/math/bigint/mulop_amd64/info.txt index 704e4dad8..4a82ff5be 100644 --- a/src/math/bigint/mulop_amd64/info.txt +++ b/src/math/bigint/mulop_amd64/info.txt @@ -2,9 +2,9 @@ mp_bits 64 load_on never -<add> +<source> mp_mulop_amd64.S -</add> +</source> <arch> amd64 diff --git a/src/math/bigint/mulop_amd64/mp_mulop.cpp b/src/math/bigint/mulop_amd64/mp_mulop.cpp index cbd723e28..e2f38a104 100644 --- a/src/math/bigint/mulop_amd64/mp_mulop.cpp +++ b/src/math/bigint/mulop_amd64/mp_mulop.cpp @@ -5,9 +5,9 @@ * Distributed under the terms of the Botan license */ -#include <botan/mp_asm.h> -#include <botan/mp_asmi.h> -#include <botan/mp_core.h> +#include <botan/internal/mp_asm.h> +#include <botan/internal/mp_asmi.h> +#include <botan/internal/mp_core.h> #include <botan/mem_ops.h> namespace Botan { diff --git a/src/math/bigint/mulop_amd64/mp_mulop_amd64.S b/src/math/bigint/mulop_amd64/mp_mulop_amd64.S index dd794bccd..d0bb3325f 100644 --- a/src/math/bigint/mulop_amd64/mp_mulop_amd64.S +++ b/src/math/bigint/mulop_amd64/mp_mulop_amd64.S @@ -5,7 +5,7 @@ * Distributed under the terms of the Botan license */ -#include <botan/asm_macr_amd64.h> +#include <botan/internal/asm_macr_amd64.h> START_LISTING(mp_mulop.S) diff --git a/src/math/bigint/mulop_generic/info.txt b/src/math/bigint/mulop_generic/info.txt index 8fa2a40c9..548d0f44b 100644 --- a/src/math/bigint/mulop_generic/info.txt +++ b/src/math/bigint/mulop_generic/info.txt @@ -1,5 +1,5 @@ load_on dep -<add> +<source> mp_mulop.cpp -</add> +</source> diff --git a/src/math/bigint/mulop_generic/mp_mulop.cpp b/src/math/bigint/mulop_generic/mp_mulop.cpp index 4647d00d5..33ee2af32 100644 --- a/src/math/bigint/mulop_generic/mp_mulop.cpp +++ b/src/math/bigint/mulop_generic/mp_mulop.cpp @@ -5,9 +5,9 @@ * Distributed under the terms of the Botan license */ -#include <botan/mp_asm.h> -#include <botan/mp_asmi.h> -#include <botan/mp_core.h> +#include <botan/internal/mp_asm.h> +#include <botan/internal/mp_asmi.h> +#include <botan/internal/mp_core.h> #include <botan/mem_ops.h> namespace Botan { diff --git a/src/math/bigint/mulop_ia32/info.txt b/src/math/bigint/mulop_ia32/info.txt index dd554773f..7afa2ca2f 100644 --- a/src/math/bigint/mulop_ia32/info.txt +++ b/src/math/bigint/mulop_ia32/info.txt @@ -4,9 +4,9 @@ mp_bits 32 load_on request -<add> +<source> mp_mulop.S -</add> +</source> <arch> ia32 diff --git a/src/math/bigint/mulop_ia32/mp_mulop.S b/src/math/bigint/mulop_ia32/mp_mulop.S index 0ca559659..34cd58112 100644 --- a/src/math/bigint/mulop_ia32/mp_mulop.S +++ b/src/math/bigint/mulop_ia32/mp_mulop.S @@ -5,7 +5,7 @@ * Distributed under the terms of the Botan license */ -#include <botan/asm_macr_ia32.h> +#include <botan/internal/asm_macr_ia32.h> START_LISTING(mp_muladd.S) diff --git a/src/math/gfpmath/gfp_element.cpp b/src/math/gfpmath/gfp_element.cpp index 872000a58..1a48fdc92 100644 --- a/src/math/gfpmath/gfp_element.cpp +++ b/src/math/gfpmath/gfp_element.cpp @@ -9,9 +9,8 @@ #include <botan/gfp_element.h> #include <botan/numthry.h> #include <botan/def_powm.h> -#include <botan/mp_types.h> -#include <botan/mp_asm.h> -#include <botan/mp_asmi.h> +#include <botan/internal/mp_asm.h> +#include <botan/internal/mp_asmi.h> #include <ostream> #include <assert.h> diff --git a/src/math/gfpmath/gfp_element.h b/src/math/gfpmath/gfp_element.h index d340c77b1..c84806f9a 100644 --- a/src/math/gfpmath/gfp_element.h +++ b/src/math/gfpmath/gfp_element.h @@ -218,14 +218,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; /** @@ -252,31 +244,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/info.txt b/src/math/gfpmath/info.txt index e1bf892c7..55ae8b5e6 100644 --- a/src/math/gfpmath/info.txt +++ b/src/math/gfpmath/info.txt @@ -1,16 +1,25 @@ define BIGINT_GFP -load_on auto +<header:public> +curve_gfp.h +gfp_element.h +gfp_modulus.h +point_gfp.h +</header:public> +<<<<<<< variant A +<source> +>>>>>>> variant B <add> +####### Ancestor +define BIGINT_GFP + +<add> +======= end curve_gfp.cpp -curve_gfp.h gfp_element.cpp -gfp_element.h -gfp_modulus.h point_gfp.cpp -point_gfp.h -</add> +</source> <requires> bigint diff --git a/src/math/gfpmath/point_gfp.cpp b/src/math/gfpmath/point_gfp.cpp index b19687537..4dae1afc8 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 ce2bf1626..10fc404bf 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 diff --git a/src/math/numbertheory/info.txt b/src/math/numbertheory/info.txt index 527f4fa29..4a3e3436b 100644 --- a/src/math/numbertheory/info.txt +++ b/src/math/numbertheory/info.txt @@ -2,25 +2,28 @@ load_on auto define BIGINT_MATH -<add> -blinding.cpp +<header:public> blinding.h def_powm.h +numthry.h +pow_mod.h +reducer.h +</header:public> + +<source> +blinding.cpp dsa_gen.cpp jacobi.cpp make_prm.cpp mp_numth.cpp numthry.cpp -numthry.h pow_mod.cpp -pow_mod.h powm_fw.cpp powm_mnt.cpp primes.cpp reducer.cpp -reducer.h ressol.cpp -</add> +</source> <requires> algo_factory diff --git a/src/math/numbertheory/mp_numth.cpp b/src/math/numbertheory/mp_numth.cpp index 2cb36b8a3..03eb8d9db 100644 --- a/src/math/numbertheory/mp_numth.cpp +++ b/src/math/numbertheory/mp_numth.cpp @@ -6,8 +6,8 @@ */ #include <botan/numthry.h> -#include <botan/mp_core.h> -#include <botan/rounding.h> +#include <botan/internal/mp_core.h> +#include <botan/internal/rounding.h> #include <algorithm> namespace Botan { diff --git a/src/math/numbertheory/numthry.cpp b/src/math/numbertheory/numthry.cpp index 5e36288ff..42e83fa4a 100644 --- a/src/math/numbertheory/numthry.cpp +++ b/src/math/numbertheory/numthry.cpp @@ -6,7 +6,7 @@ */ #include <botan/numthry.h> -#include <botan/bit_ops.h> +#include <botan/internal/bit_ops.h> #include <algorithm> namespace Botan { diff --git a/src/math/numbertheory/powm_fw.cpp b/src/math/numbertheory/powm_fw.cpp index b764ee7aa..8f39830a7 100644 --- a/src/math/numbertheory/powm_fw.cpp +++ b/src/math/numbertheory/powm_fw.cpp @@ -16,8 +16,8 @@ namespace { /* * Try to choose a good window size */ -u32bit choose_window_bits(u32bit exp_bits, u32bit, - Power_Mod::Usage_Hints hints) +u32bit fw_powm_window_bits(u32bit exp_bits, u32bit, + Power_Mod::Usage_Hints hints) { static const u32bit wsize[][2] = { { 2048, 7 }, { 1024, 6 }, { 256, 5 }, { 128, 4 }, { 64, 3 }, { 0, 0 } @@ -62,7 +62,7 @@ void Fixed_Window_Exponentiator::set_exponent(const BigInt& e) */ void Fixed_Window_Exponentiator::set_base(const BigInt& base) { - window_bits = choose_window_bits(exp.bits(), base.bits(), hints); + window_bits = fw_powm_window_bits(exp.bits(), base.bits(), hints); g.resize((1 << window_bits) - 1); g[0] = base; diff --git a/src/math/numbertheory/powm_mnt.cpp b/src/math/numbertheory/powm_mnt.cpp index e6d8cc3f0..d18081c6a 100644 --- a/src/math/numbertheory/powm_mnt.cpp +++ b/src/math/numbertheory/powm_mnt.cpp @@ -7,7 +7,7 @@ #include <botan/def_powm.h> #include <botan/numthry.h> -#include <botan/mp_core.h> +#include <botan/internal/mp_core.h> namespace Botan { @@ -16,8 +16,8 @@ namespace { /* * Try to choose a good window size */ -u32bit choose_window_bits(u32bit exp_bits, u32bit, - Power_Mod::Usage_Hints hints) +u32bit montgomery_powm_window_bits(u32bit exp_bits, u32bit, + Power_Mod::Usage_Hints hints) { static const u32bit wsize[][2] = { { 2048, 4 }, { 1024, 3 }, { 256, 2 }, { 128, 1 }, { 0, 0 } @@ -76,7 +76,7 @@ void Montgomery_Exponentiator::set_exponent(const BigInt& exp) */ void Montgomery_Exponentiator::set_base(const BigInt& base) { - window_bits = choose_window_bits(exp.bits(), base.bits(), hints); + window_bits = montgomery_powm_window_bits(exp.bits(), base.bits(), hints); g.resize((1 << window_bits) - 1); diff --git a/src/math/numbertheory/reducer.cpp b/src/math/numbertheory/reducer.cpp index fbd675ea6..aa53f1a0e 100644 --- a/src/math/numbertheory/reducer.cpp +++ b/src/math/numbertheory/reducer.cpp @@ -7,7 +7,7 @@ #include <botan/reducer.h> #include <botan/numthry.h> -#include <botan/mp_core.h> +#include <botan/internal/mp_core.h> namespace Botan { |