Botan 3.7.1
Crypto and TLS for C&
Botan::word3< W > Class Template Referencefinal

#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 597 of file mp_asmi.h.

Constructor & Destructor Documentation

◆ word3()

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

Definition at line 636 of file mp_asmi.h.

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

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 656 of file mp_asmi.h.

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

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 665 of file mp_asmi.h.

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

◆ mul()

◆ mul_x2()

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

Definition at line 644 of file mp_asmi.h.

644{ 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:548

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: