Botan 3.9.0
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
15
17 public:
18 EC_Point_Base_Point_Precompute(const EC_Point& base_point, const Barrett_Reduction& 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 Barrett_Reduction& m_mod_order;
28
29 static constexpr size_t WindowBits = 3;
30 static constexpr size_t WindowSize = (1 << WindowBits) - 1;
31
32 const size_t m_p_words;
33
34 /*
35 * This is a table of T_size * 3*p_word words
36 */
37 std::vector<word> m_W;
38};
39
41 public:
42 EC_Point_Var_Point_Precompute(const EC_Point& point, RandomNumberGenerator& rng, std::vector<BigInt>& ws);
43
44 EC_Point mul(const BigInt& k,
46 const BigInt& group_order,
47 std::vector<BigInt>& ws) const;
48
49 private:
50 static constexpr size_t WindowBits = 4;
51
52 const CurveGFp m_curve;
53 const size_t m_p_words;
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 Barrett_Reduction &mod_order)
Definition point_mul.cpp:40
EC_Point mul(const BigInt &k, RandomNumberGenerator &rng, const BigInt &group_order, std::vector< BigInt > &ws) const
Definition point_mul.cpp:86
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
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:69