Botan 3.9.0
Crypto and TLS for C&
|
#include <pcurves_impl.h>
Public Types | |
using | Self = MontgomeryRep<Params> |
typedef Params::W | W |
Static Public Member Functions | |
static constexpr std::array< W, N > | from_rep (const std::array< W, N > &z) |
static constexpr std::array< W, N > | one () |
static constexpr std::array< W, N > | redc (const std::array< W, 2 *N > &z) |
static constexpr std::array< W, N > | to_rep (const std::array< W, N > &x) |
static constexpr std::array< W, N > | wide_to_rep (const std::array< W, 2 *N > &x) |
Static Public Attributes | |
static constexpr size_t | N = Params::N |
static constexpr auto | P = Params::P |
static constexpr auto | P_dash = monty_inverse(P[0]) |
static constexpr auto | R1 = montygomery_r(P) |
static constexpr auto | R2 = mul_mod(R1, R1, P) |
static constexpr auto | R3 = mul_mod(R1, R2, P) |
Montomgomery Representation of Integers
Integers modulo a prime (IntMod, see below) use some representation that allows for fast arithmetic.
The default representation used is Montgomery arithmetic. Curves with specialized fields (eg Mersenne primes, Solinas primes, or Crandall primes) provide a different type as the FieldRep parameter to the EllipticCurve template.
Since the curve parameters are public and known at compile time, we can similarly compute the Montgomery parameters at compile time.
Definition at line 59 of file pcurves_impl.h.
using Botan::MontgomeryRep< Params >::Self = MontgomeryRep<Params> |
Definition at line 61 of file pcurves_impl.h.
typedef Params::W Botan::MontgomeryRep< Params >::W |
Definition at line 65 of file pcurves_impl.h.
|
inlinestaticconstexpr |
Convert an integer out of Montgomery representation
Definition at line 116 of file pcurves_impl.h.
References Botan::copy_mem(), and redc().
|
inlinestaticconstexpr |
Return the constant one, pre-converted into Montgomery form
Definition at line 78 of file pcurves_impl.h.
References R1.
|
inlinestaticconstexpr |
Modular reduction
Definition at line 83 of file pcurves_impl.h.
References Botan::monty_redc(), Botan::monty_redc_pdash1(), P, and P_dash.
Referenced by from_rep(), to_rep(), and wide_to_rep().
|
inlinestaticconstexpr |
Convert an integer into Montgomery representation
Definition at line 94 of file pcurves_impl.h.
References Botan::comba_mul(), R2, and redc().
|
inlinestaticconstexpr |
Wide reduction modulo the prime
Modular reduces an input of up to twice the length of the modulus, and converts it into Montgomery form.
Definition at line 106 of file pcurves_impl.h.
References Botan::comba_mul(), R3, and redc().
|
staticconstexpr |
Definition at line 64 of file pcurves_impl.h.
|
staticconstexpr |
Definition at line 63 of file pcurves_impl.h.
Referenced by redc().
|
staticconstexpr |
Definition at line 69 of file pcurves_impl.h.
Referenced by redc().
|
staticconstexpr |
Definition at line 71 of file pcurves_impl.h.
Referenced by one().
|
staticconstexpr |
Definition at line 72 of file pcurves_impl.h.
Referenced by to_rep().
|
staticconstexpr |
Definition at line 73 of file pcurves_impl.h.
Referenced by wide_to_rep().