7#ifndef BOTAN_MONTY_INT_H_
8#define BOTAN_MONTY_INT_H_
10#include <botan/bigint.h>
12#include <botan/internal/ct_utils.h>
41 const BigInt&
p()
const {
return m_data->p(); }
43 const BigInt&
R1()
const {
return m_data->r1(); }
45 const BigInt&
R2()
const {
return m_data->r2(); }
47 const BigInt&
R3()
const {
return m_data->r3(); }
56 size_t p_bits()
const {
return m_data->p_bits(); }
58 size_t p_words()
const {
return m_data->p_size(); }
87 const BigInt& p()
const {
return m_p; }
89 const BigInt& r1()
const {
return m_r1; }
91 const BigInt& r2()
const {
return m_r2; }
93 const BigInt& r3()
const {
return m_r3; }
95 word p_dash()
const {
return m_p_dash; }
97 word p_top_mu()
const {
return m_p_top_mu; }
99 size_t p_bits()
const {
return m_p_bits; }
101 size_t p_size()
const {
return m_p_words; }
103 void _const_time_poison()
const { CT::poison_all(m_p, m_r1, m_r2, m_r3, m_p_dash, m_p_top_mu); }
105 void _const_time_unpoison()
const { CT::unpoison_all(m_p, m_r1, m_r2, m_r3, m_p_dash, m_p_top_mu); }
118 std::shared_ptr<const Data> m_data;
208 void ct_cond_negate(
bool predicate);
210 bool is_zero()
const;
222 void add_mod_p(std::span<const word> other);
void _const_time_unpoison() const
static Montgomery_Int from_wide_int(const Montgomery_Params ¶ms, const BigInt &x)
const secure_vector< word > & repr() const
static Montgomery_Int one(const Montgomery_Params ¶ms)
Montgomery_Int(const Montgomery_Params ¶ms)
void _const_time_poison() const
const Montgomery_Params & _params() const
std::vector< uint8_t > serialize() const
void _const_time_unpoison() const
bool operator!=(const Montgomery_Params &other) const
bool operator==(const Montgomery_Params &other) const
Montgomery_Params(const BigInt &p, const Barrett_Reduction &mod_p)
const BigInt & R3() const
const BigInt & R2() const
const BigInt & R1() const
void _const_time_poison() const
constexpr void unpoison(const T *p, size_t n)
constexpr void poison(const T *p, size_t n)
BigInt square(const BigInt &x)
OctetString operator+(const OctetString &k1, const OctetString &k2)
BigInt operator-(const BigInt &x, const BigInt &y)
std::vector< T, Alloc > & operator+=(std::vector< T, Alloc > &out, const std::vector< T, Alloc2 > &in)
std::vector< T, secure_allocator< T > > secure_vector
std::conditional_t< HasNative64BitRegisters, std::uint64_t, uint32_t > word
The native machine word, used as the limb type for multiprecision integers.
constexpr auto operator-=(Strong< T1, Tags... > &a, T2 b)