Botan  2.7.0
Crypto and TLS for C++11
def_powm.h
Go to the documentation of this file.
1 /*
2 * Modular Exponentiation
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7 
8 #ifndef BOTAN_DEFAULT_MODEXP_H_
9 #define BOTAN_DEFAULT_MODEXP_H_
10 
11 #include <botan/pow_mod.h>
12 #include <botan/reducer.h>
13 #include <vector>
14 
15 namespace Botan {
16 
17 /**
18 * Fixed Window Exponentiator
19 */
21  {
22  public:
23  void set_exponent(const BigInt&) override;
24  void set_base(const BigInt&) override;
25  BigInt execute() const override;
26 
27  Modular_Exponentiator* copy() const override
28  { return new Fixed_Window_Exponentiator(*this); }
29 
31  private:
32  Modular_Reducer m_reducer;
33  BigInt m_exp;
34  size_t m_window_bits;
35  std::vector<BigInt> m_g;
36  Power_Mod::Usage_Hints m_hints;
37  };
38 
39 class Montgomery_Params;
40 class Montgomery_Exponentation_State;
41 
42 /**
43 * Montgomery Exponentiator
44 */
46  {
47  public:
48  void set_exponent(const BigInt&) override;
49  void set_base(const BigInt&) override;
50  BigInt execute() const override;
51 
52  Modular_Exponentiator* copy() const override
53  { return new Montgomery_Exponentiator(*this); }
54 
56  private:
57  BigInt m_p;
58  Modular_Reducer m_mod_p;
59  std::shared_ptr<const Montgomery_Params> m_monty_params;
60  std::shared_ptr<const Montgomery_Exponentation_State> m_monty;
61 
62  BigInt m_e;
63  Power_Mod::Usage_Hints m_hints;
64  };
65 
66 }
67 
68 #endif
void set_base(const BigInt &) override
Definition: powm_fw.cpp:24
Fixed_Window_Exponentiator(const BigInt &, Power_Mod::Usage_Hints)
Definition: powm_fw.cpp:60
void set_exponent(const BigInt &) override
Definition: powm_fw.cpp:16
Modular_Exponentiator * copy() const override
Definition: def_powm.h:27
BigInt execute() const override
Definition: powm_mnt.cpp:28
void set_exponent(const BigInt &) override
Definition: powm_mnt.cpp:17
Montgomery_Exponentiator(const BigInt &, Power_Mod::Usage_Hints)
Definition: powm_mnt.cpp:37
void set_base(const BigInt &) override
Definition: powm_mnt.cpp:22
Definition: alg_id.cpp:13
Modular_Exponentiator * copy() const override
Definition: def_powm.h:52
BigInt execute() const override
Definition: powm_fw.cpp:39