Botan 3.6.1
Crypto and TLS for C&
point_mul.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_POINT_MUL_H_
8#define BOTAN_POINT_MUL_H_
9
10#include <botan/ec_point.h>
11
12namespace Botan {
13
14class Modular_Reducer;
15
17 public:
18 EC_Point_Base_Point_Precompute(const EC_Point& base_point, const Modular_Reducer& mod_order);
19
20 EC_Point mul(const BigInt& k,
22 const BigInt& group_order,
23 std::vector<BigInt>& ws) const;
24
25 private:
26 const EC_Point& m_base_point;
27 const Modular_Reducer& m_mod_order;
28
29 enum { WINDOW_BITS = 3 };
30
31 enum { WINDOW_SIZE = (1 << WINDOW_BITS) - 1 };
32
33 const size_t m_p_words;
34
35 /*
36 * This is a table of T_size * 3*p_word words
37 */
38 std::vector<word> m_W;
39};
40
42 public:
43 EC_Point_Var_Point_Precompute(const EC_Point& point, RandomNumberGenerator& rng, std::vector<BigInt>& ws);
44
45 EC_Point mul(const BigInt& k,
47 const BigInt& group_order,
48 std::vector<BigInt>& ws) const;
49
50 private:
51 const CurveGFp m_curve;
52 const size_t m_p_words;
53 const size_t m_window_bits;
54
55 /*
56 * Table of 2^window_bits * 3*2*p_word words
57 * Kept in locked vector since the base point might be sensitive
58 * (normally isn't in most protocols but hard to say anything
59 * categorically.)
60 */
62};
63
65 public:
67
68 /*
69 * Return (g1*k1 + g2*k2)
70 * Not constant time, intended to use with public inputs
71 */
72 EC_Point multi_exp(const BigInt& k1, const BigInt& k2) const;
73
74 private:
75 std::vector<EC_Point> m_M;
76 bool m_no_infinity;
77};
78
79} // namespace Botan
80
81#endif
EC_Point_Base_Point_Precompute(const EC_Point &base_point, const Modular_Reducer &mod_order)
Definition point_mul.cpp:35
EC_Point mul(const BigInt &k, RandomNumberGenerator &rng, const BigInt &group_order, std::vector< BigInt > &ws) const
Definition point_mul.cpp:79
EC_Point_Multi_Point_Precompute(const EC_Point &g1, const EC_Point &g2)
EC_Point multi_exp(const BigInt &k1, const BigInt &k2) const
EC_Point_Var_Point_Precompute(const EC_Point &point, RandomNumberGenerator &rng, std::vector< BigInt > &ws)
EC_Point mul(const BigInt &k, RandomNumberGenerator &rng, const BigInt &group_order, std::vector< BigInt > &ws) const
int(* final)(unsigned char *, CTX *)
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:61