aboutsummaryrefslogtreecommitdiffstats
path: root/src/math/mp/mp_karat.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-08-01 19:32:10 +0000
committerlloyd <[email protected]>2012-08-01 19:32:10 +0000
commit7dbcedf896b78db3920368d7dabf2dbc2fa50e09 (patch)
treec6d0228cea1f0a7e7c3cf1e461a5d4ca8dde1040 /src/math/mp/mp_karat.cpp
parent3df2a2980adaa8ba598698dc988cbde0433b32f5 (diff)
Remove z_size parameter to bigint_monty_redc because it should always
be 2*(p_size+1). Document that it clears the high part of z. Don't clear the workspace before calling Karatsuba in bigint_mul or bigint_sqr - they clear it every time anyway. Don't bother masking words in the Montgomery_Exponentiator as redc zeros those words. Also don't bother calling z.clear() as the multiply operation does that already.
Diffstat (limited to 'src/math/mp/mp_karat.cpp')
-rw-r--r--src/math/mp/mp_karat.cpp6
1 files changed, 0 insertions, 6 deletions
diff --git a/src/math/mp/mp_karat.cpp b/src/math/mp/mp_karat.cpp
index 6d9adb4bf..b549a05c8 100644
--- a/src/math/mp/mp_karat.cpp
+++ b/src/math/mp/mp_karat.cpp
@@ -253,10 +253,7 @@ void bigint_mul(word z[], size_t z_size, word workspace[],
const size_t N = karatsuba_size(z_size, x_size, x_sw, y_size, y_sw);
if(N)
- {
- clear_mem(workspace, 2*N);
karatsuba_mul(z, x, y, N, workspace);
- }
else
bigint_simple_mul(z, x, x_sw, y, y_sw);
}
@@ -297,10 +294,7 @@ void bigint_sqr(word z[], size_t z_size, word workspace[],
const size_t N = karatsuba_size(z_size, x_size, x_sw);
if(N)
- {
- clear_mem(workspace, 2*N);
karatsuba_sqr(z, x, N, workspace);
- }
else
bigint_simple_sqr(z, x, x_sw);
}