Botan 2.13.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
Botan::PointGFp_Multi_Point_Precompute Class Referencefinal

`#include <point_mul.h>`

## Public Member Functions
PointGFp | multi_exp (const BigInt &k1, const BigInt &k2) const
| PointGFp_Multi_Point_Precompute (const PointGFp &g1, const PointGFp &g2)

## Detailed Description

Definition at line 67 of file point_mul.h.

## Constructor & Destructor Documentation

Botan::PointGFp_Multi_Point_Precompute::PointGFp_Multi_Point_Precompute | ( | const PointGFp & | g1,
|  | const PointGFp & | g2
| ) |  |

Definition at line 340 of file point_mul.cpp.

References Botan::PointGFp::force_all_affine(), Botan::PointGFp::mult2(), Botan::PointGFp::plus(), and Botan::PointGFp::WORKSPACE_SIZE.

342 {
343 std::vector<BigInt> ws(PointGFp::WORKSPACE_SIZE);
344
345 PointGFp x2 = x;
346 x2.mult2(ws);
347
348 const PointGFp x3(x2.plus(x, ws));
349
350 PointGFp y2 = y;
351 y2.mult2(ws);
352
353 const PointGFp y3(y2.plus(y, ws));
354
355 m_M.reserve(15);
356
357 m_M.push_back(x);
358 m_M.push_back(x2);
359 m_M.push_back(x3);
360
361 m_M.push_back(y);
362 m_M.push_back(y.plus(x, ws));
363 m_M.push_back(y.plus(x2, ws));
364 m_M.push_back(y.plus(x3, ws));
365
366 m_M.push_back(y2);
367 m_M.push_back(y2.plus(x, ws));
368 m_M.push_back(y2.plus(x2, ws));
369 m_M.push_back(y2.plus(x3, ws));
370
371 m_M.push_back(y3);
372 m_M.push_back(y3.plus(x, ws));
373 m_M.push_back(y3.plus(x2, ws));
374 m_M.push_back(y3.plus(x3, ws));
375
376 PointGFp::force_all_affine(m_M, ws[0].get_word_vector());
377 }
Botan::PointGFp::WORKSPACE_SIZE
Definition: point_gfp.h:56
Botan::PointGFp::force_all_affine
static void force_all_affine(std::vector< PointGFp > &points, secure_vector< word > &ws)
Definition: point_gfp.cpp:420

## Member Function Documentation

PointGFp Botan::PointGFp_Multi_Point_Precompute::multi_exp | ( | const BigInt & | k1,
|  | const BigInt & | k2
| ) |  | const

Definition at line 379 of file point_mul.cpp.

References Botan::PointGFp::add_affine(), Botan::BigInt::bits(), Botan::BigInt::get_substring(), Botan::BigInt::is_negative(), Botan::PointGFp::mult2i(), Botan::PointGFp::negate(), Botan::round_up(), and Botan::PointGFp::WORKSPACE_SIZE.

Referenced by Botan::multi_exponentiate(), and Botan::EC_Group::point_multiply().

381 {
382 std::vector<BigInt> ws(PointGFp::WORKSPACE_SIZE);
383
384 const size_t z_bits = round_up(std::max(z1.bits(), z2.bits()), 2);
385
386 PointGFp H = m_M[0].zero();
387
388 for(size_t i = 0; i != z_bits; i += 2)
389 {
390 if(i > 0)
391 {
392 H.mult2i(2, ws);
393 }
394
395 const uint32_t z1_b = z1.get_substring(z_bits - i - 2, 2);
396 const uint32_t z2_b = z2.get_substring(z_bits - i - 2, 2);
397
398 const uint32_t z12 = (4*z2_b) + z1_b;
399
400 // This function is not intended to be const time
401 if(z12)
402 {
403 H.add_affine(m_M[z12-1], ws);
404 }
405 }
406
407 if(z1.is_negative() != z2.is_negative())
408 H.negate();
409
410 return H;
411 }
Botan::PointGFp::WORKSPACE_SIZE
Definition: point_gfp.h:56
Botan::round_up
size_t round_up(size_t n, size_t align_to)
Definition: rounding.h:21

The documentation for this class was generated from the following files:

- src/lib/pubkey/ec_group/point_mul.h
- src/lib/pubkey/ec_group/point_mul.cpp