aboutsummaryrefslogtreecommitdiffstats
path: root/src/math/bigint
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-15 15:42:03 +0000
committerlloyd <[email protected]>2010-03-15 15:42:03 +0000
commit4ddc00f49519fc7661678417536bd02d4201b436 (patch)
treeec8921a56fbed0b5b4c80af804418efaab98c000 /src/math/bigint
parent1935eebb275a9770ba017e519b0e5b9182523159 (diff)
If workspace is NULL, skip Karatsuba mul/sqr
Diffstat (limited to 'src/math/bigint')
-rw-r--r--src/math/bigint/mp_karat.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/math/bigint/mp_karat.cpp b/src/math/bigint/mp_karat.cpp
index a50e4ee0c..8ae346f1e 100644
--- a/src/math/bigint/mp_karat.cpp
+++ b/src/math/bigint/mp_karat.cpp
@@ -273,8 +273,12 @@ void bigint_mul(word z[], u32bit z_size, word workspace[],
{
bigint_comba_mul16(z, x, y);
}
- else if(x_sw < BOTAN_KARAT_MUL_THRESHOLD || y_sw < BOTAN_KARAT_MUL_THRESHOLD)
+ else if(x_sw < BOTAN_KARAT_MUL_THRESHOLD ||
+ y_sw < BOTAN_KARAT_MUL_THRESHOLD ||
+ !workspace)
+ {
bigint_simple_mul(z, x, x_sw, y, y_sw);
+ }
else
{
const u32bit N = karatsuba_size(z_size, x_size, x_sw, y_size, y_sw);
@@ -315,7 +319,7 @@ void bigint_sqr(word z[], u32bit z_size, word workspace[],
{
bigint_comba_sqr16(z, x);
}
- else if(x_size < BOTAN_KARAT_SQR_THRESHOLD)
+ else if(x_size < BOTAN_KARAT_SQR_THRESHOLD || !workspace)
{
bigint_simple_sqr(z, x, x_sw);
}