| 2245 | } |
| 2246 | |
| 2247 | Integer 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 | |
| 2260 | Integer MontgomeryRepresentation::Square(const Integer &a) const |
| 2261 | { |
no test coverage detected