Botan 3.5.0
Crypto and TLS for C&
Botan::word3< W > Class Template Reference

#include <mp_asmi.h>

Public Member Functions

constexpr void add (W x)
 
constexpr W extract ()
 
constexpr W monty_step (W p0, W p_dash)
 
constexpr W monty_step_pdash1 ()
 
constexpr void mul (W x, W y)
 
constexpr void mul_x2 (W x, W y)
 
constexpr word3 ()
 

Detailed Description

template<WordType W>
class Botan::word3< W >

Helper for 3-word accumulators

A number of algorithms especially Comba multiplication and Montgomery reduction can take advantage of wide accumulators, which consume inputs via addition with outputs extracted from the low bits.

Definition at line 596 of file mp_asmi.h.

Constructor & Destructor Documentation

◆ word3()

template<WordType W>
Botan::word3< W >::word3 ( )
inlineconstexpr

Definition at line 635 of file mp_asmi.h.

635 {
636 m_w2 = 0;
637 m_w1 = 0;
638 m_w0 = 0;
639 }

Member Function Documentation

◆ add()

template<WordType W>
void Botan::word3< W >::add ( W x)
inlineconstexpr

◆ extract()

◆ monty_step()

template<WordType W>
W Botan::word3< W >::monty_step ( W p0,
W p_dash )
inlineconstexpr

Definition at line 655 of file mp_asmi.h.

655 {
656 W r = m_w0 * p_dash;
657 mul(r, p0);
658 m_w0 = m_w1;
659 m_w1 = m_w2;
660 m_w2 = 0;
661 return r;
662 }
constexpr void mul(W x, W y)
Definition mp_asmi.h:641

References Botan::word3< W >::mul().

Referenced by Botan::bigint_monty_redc_16(), Botan::bigint_monty_redc_24(), Botan::bigint_monty_redc_32(), Botan::bigint_monty_redc_4(), Botan::bigint_monty_redc_6(), Botan::bigint_monty_redc_8(), and Botan::bigint_monty_redc_generic().

◆ monty_step_pdash1()

template<WordType W>
W Botan::word3< W >::monty_step_pdash1 ( )
inlineconstexpr

Definition at line 664 of file mp_asmi.h.

664 {
665 // If p_dash == 1 then p[0] = -1 and everything simplifies
666 const W r = m_w0;
667 m_w0 += m_w1;
668 m_w1 = m_w2 + (m_w0 < m_w1);
669 m_w2 = 0;
670 return r;
671 }

◆ mul()

◆ mul_x2()

template<WordType W>
void Botan::word3< W >::mul_x2 ( W x,
W y )
inlineconstexpr

Definition at line 643 of file mp_asmi.h.

643{ word3_muladd_2(&m_w2, &m_w1, &m_w0, x, y); }
constexpr void word3_muladd_2(W *w2, W *w1, W *w0, W x, W y)
Definition mp_asmi.h:547

References Botan::word3_muladd_2().

Referenced by Botan::bigint_comba_sqr16(), Botan::bigint_comba_sqr24(), Botan::bigint_comba_sqr4(), Botan::bigint_comba_sqr6(), Botan::bigint_comba_sqr7(), Botan::bigint_comba_sqr8(), and Botan::bigint_comba_sqr9().


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