MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / Multiply

Method Multiply

src/cryptlib/integer.cpp:2247–2258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2245}
2246
2247Integer MontgomeryRepresentation::Multiply(const Integer &a, const Integer &b) const
2248{
2249 word *const T = workspace.ptr;
2250 word *const R = result.reg.ptr;
2251 const unsigned int N = modulus.reg.size;
2252 assert(a.reg.size<=N && b.reg.size<=N);
2253
2254 AsymmetricMultiply(T, T+2*N, a.reg, a.reg.size, b.reg, b.reg.size);
2255 SetWords(T+a.reg.size+b.reg.size, 0, 2*N-a.reg.size-b.reg.size);
2256 MontgomeryReduce(R, T+2*N, T, modulus.reg, u.reg, N);
2257 return result;
2258}
2259
2260Integer MontgomeryRepresentation::Square(const Integer &a) const
2261{

Callers 1

LucasFunction · 0.45

Calls 4

AsymmetricMultiplyFunction · 0.85
SetWordsFunction · 0.85
MontgomeryReduceFunction · 0.85
HalfMontgomeryReduceFunction · 0.85

Tested by

no test coverage detected