aboutsummaryrefslogtreecommitdiffstats
path: root/src/mp_asm.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-08-17 02:35:38 +0000
committerlloyd <[email protected]>2006-08-17 02:35:38 +0000
commit2476fc2f236c07eeb89750a9776ef6c155fff862 (patch)
treec28132450908e074e0cf9aceb1830b3aec96d2bb /src/mp_asm.cpp
parentb8d15b3286d44ce8b5fe4938be7c501bb98c2547 (diff)
Move bigint_monty_redc to its own file; profiling indicates that this
single function is using 30+% of the runtime during RSA operations, making it a strong candidate for implementation in assembly.
Diffstat (limited to 'src/mp_asm.cpp')
-rw-r--r--src/mp_asm.cpp33
1 files changed, 0 insertions, 33 deletions
diff --git a/src/mp_asm.cpp b/src/mp_asm.cpp
index 02f75f281..e45a92e2c 100644
--- a/src/mp_asm.cpp
+++ b/src/mp_asm.cpp
@@ -196,39 +196,6 @@ void bigint_simple_mul(word z[], const word x[], u32bit x_size,
}
}
-/*************************************************
-* 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 carry2 = 0;
- z_j[x_size] = word_add(z_j[x_size], carry, &carry2);
- carry = carry2;
-
- for(u32bit k = x_size + 1; carry && k != z_size - j; ++k)
- {
- ++z_j[k];
- carry = !z_j[k];
- }
- }
- }
-
}
}