Botan 2.19.5 Crypto and TLS for C&

monty_exp.h
Go to the documentation of this file.
1/*
2* (C) 2018 Jack Lloyd
3*
4* Botan is released under the Simplified BSD License (see license.txt)
5*/
6
7#ifndef BOTAN_MONTY_EXP_H_
8#define BOTAN_MONTY_EXP_H_
9
10#include <memory>
11
12 namespace Botan {
13
14 class BigInt;
15 class Modular_Reducer;
16
17 class Montgomery_Params;
18
19 class Montgomery_Exponentation_State;
20
21/*
22* Precompute for calculating values g^x mod p
23*/
24std::shared_ptr<const Montgomery_Exponentation_State>
25 monty_precompute(std::shared_ptr<const Montgomery_Params> params_p,
26 const BigInt& g,
27 size_t window_bits,
28 bool const_time = true);
29
30/*
31* Return g^k mod p
32*/
33BigInt monty_execute(const Montgomery_Exponentation_State& precomputed_state,
34 const BigInt& k, size_t max_k_bits);
35
36/*
37* Return g^k mod p taking variable time depending on k
38* @warning only use this if k is public
39*/
40BigInt monty_execute_vartime(const Montgomery_Exponentation_State& precomputed_state,
41 const BigInt& k);
42
43/**
44* Return (x^z1 * y^z2) % p
45*/
46BigInt monty_multi_exp(std::shared_ptr<const Montgomery_Params> params_p,
47 const BigInt& x,
48 const BigInt& z1,
49 const BigInt& y,
50 const BigInt& z2);
51
52}
53
54#endif
Botan
Definition: alg_id.cpp:13
Botan::monty_multi_exp
BigInt monty_multi_exp(std::shared_ptr< const Montgomery_Params > params_p, const BigInt &x_bn, const BigInt &z1, const BigInt &y_bn, const BigInt &z2)
Definition: monty_exp.cpp:177
Botan::monty_precompute
std::shared_ptr< const Montgomery_Exponentation_State > monty_precompute(std::shared_ptr< const Montgomery_Params > params, const BigInt &g, size_t window_bits, bool const_time)
Definition: monty_exp.cpp:157
Botan::monty_execute_vartime
BigInt monty_execute_vartime(const Montgomery_Exponentation_State &precomputed_state, const BigInt &k)
Definition: monty_exp.cpp:171
Botan::monty_execute
BigInt monty_execute(const Montgomery_Exponentation_State &precomputed_state, const BigInt &k, size_t max_k_bits)
Definition: monty_exp.cpp:165