blob: 61da258cc00e22402e75b1655e49959f066eab0f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/*
* (C) 2018 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
#ifndef BOTAN_MONTY_EXP_H_
#define BOTAN_MONTY_EXP_H_
#include <memory>
namespace Botan {
class BigInt;
class Modular_Reducer;
class Montgomery_Params;
class Montgomery_Exponentation_State;
/*
* Precompute for calculating values g^x mod p
*/
std::shared_ptr<const Montgomery_Exponentation_State>
monty_precompute(std::shared_ptr<const Montgomery_Params> params_p,
const BigInt& g,
size_t window_bits,
bool const_time = true);
/*
* Return g^x mod p
*/
BigInt monty_execute(const Montgomery_Exponentation_State& precomputed_state,
const BigInt& k);
/*
* Return g^x mod p taking variable time
*/
BigInt monty_execute_vartime(const Montgomery_Exponentation_State& precomputed_state,
const BigInt& k);
/**
* Return (x^z1 * y^z2) % p
*/
BigInt monty_multi_exp(std::shared_ptr<const Montgomery_Params> params_p,
const BigInt& x,
const BigInt& z1,
const BigInt& y,
const BigInt& z2);
}
#endif
|