aboutsummaryrefslogtreecommitdiffstats
path: root/src/mp_monty.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-08-19 12:23:50 +0000
committerlloyd <[email protected]>2006-08-19 12:23:50 +0000
commitd6ff613df191d078ecb3175a20710d013bcfd3a5 (patch)
treef6a8e546068141298b71470a4fcaaced3e7b12fc /src/mp_monty.cpp
parent3dbff1820b79f8bf2a9ade41d2f30e73ce8d9f90 (diff)
Move Montgomery reduction algorithm into mp_asm.cpp
Move the inner-most loop of Montgomery into bigint_mul_add_words, in mp_muladd.cpp Use bigint_mul_add_words for the inner loop of bigint_simple_multiply Move the compare/subtract at the end of the Montomgery algorithm into bigint_monty_redc
Diffstat (limited to 'src/mp_monty.cpp')
-rw-r--r--src/mp_monty.cpp49
1 files changed, 0 insertions, 49 deletions
diff --git a/src/mp_monty.cpp b/src/mp_monty.cpp
deleted file mode 100644
index 3347cfa4f..000000000
--- a/src/mp_monty.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*************************************************
-* Montgomery Reduction Source File *
-* (C) 1999-2006 The Botan Project *
-*************************************************/
-
-#include <botan/mp_asm.h>
-#include <botan/mp_asmi.h>
-#include <botan/mp_core.h>
-
-namespace Botan {
-
-extern "C" {
-
-/*************************************************
-* Montgomery Reduction Algorithm *
-*************************************************/
-void bigint_monty_redc(word z[], u32bit z_size,
- const word x[], u32bit x_size, word u)
- {
- for(u32bit j = 0; j != x_size; ++j)
- {
- word* z_j = z + j;
-
- const word y = z_j[0] * u;
- word carry = 0;
-
- const u32bit blocks = x_size - (x_size % 8);
-
- for(u32bit k = 0; k != blocks; k += 8)
- carry = word8_madd3(z_j + k, x + k, y, carry);
-
- for(u32bit k = blocks; k != x_size; ++k)
- z_j[k] = word_madd3(x[k], y, z_j[k], carry, &carry);
-
- word z_sum = z_j[x_size] + carry;
- carry = (z_sum < z_j[x_size]);
- z_j[x_size] = z_sum;
-
- for(u32bit k = x_size + 1; carry && k != z_size - j; ++k)
- {
- ++z_j[k];
- carry = !z_j[k];
- }
- }
- }
-
-}
-
-}