diff options
author | lloyd <[email protected]> | 2012-06-19 14:01:54 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-06-19 14:01:54 +0000 |
commit | 50e5fa86a27603e463e7e70c1e76f4fe0215e022 (patch) | |
tree | 77b6de31fd3ee4cb6bbf832f4aa306ec9eca9d04 /src | |
parent | 9d65cb180326ed3009529695da170f3e23c71d0f (diff) |
Remove BOTAN_MEM_POOL_CHUNK_SIZE macro from build.h, no longer used.
Move Karatsuba cutoffs to mp_karat.cpp as that is the only place that
uses them and I doubt these get tweaked much (ever).
Diffstat (limited to 'src')
-rw-r--r-- | src/build-data/buildh.in | 9 | ||||
-rw-r--r-- | src/math/mp/mp_karat.cpp | 13 |
2 files changed, 12 insertions, 10 deletions
diff --git a/src/build-data/buildh.in b/src/build-data/buildh.in index 4668811bc..4e3788c65 100644 --- a/src/build-data/buildh.in +++ b/src/build-data/buildh.in @@ -25,15 +25,14 @@ #define BOTAN_DLL %{visibility_attribute} #endif -/* Chunk sizes */ +/* How much to allocate for a buffer of no particular size */ #define BOTAN_DEFAULT_BUFFER_SIZE 1024 -#define BOTAN_MEM_POOL_CHUNK_SIZE 64*1024 + +/* Multiplier on a block cipher's native parallelism */ #define BOTAN_BLOCK_CIPHER_PAR_MULT 4 -/* BigInt toggles */ +/* How many bits per limb in a BigInt */ #define BOTAN_MP_WORD_BITS %{mp_bits} -#define BOTAN_KARAT_MUL_THRESHOLD 32 -#define BOTAN_KARAT_SQR_THRESHOLD 32 /* PK key consistency checking toggles */ #define BOTAN_PUBLIC_KEY_STRONG_CHECKS_ON_LOAD 1 diff --git a/src/math/mp/mp_karat.cpp b/src/math/mp/mp_karat.cpp index 9bee7c42d..6d9adb4bf 100644 --- a/src/math/mp/mp_karat.cpp +++ b/src/math/mp/mp_karat.cpp @@ -13,13 +13,16 @@ namespace Botan { namespace { +static const size_t KARATSUBA_MULTIPLY_THRESHOLD = 32; +static const size_t KARATSUBA_SQUARE_THRESHOLD = 32; + /* * Karatsuba Multiplication Operation */ void karatsuba_mul(word z[], const word x[], const word y[], size_t N, word workspace[]) { - if(N < BOTAN_KARAT_MUL_THRESHOLD || N % 2) + if(N < KARATSUBA_MULTIPLY_THRESHOLD || N % 2) { if(N == 6) return bigint_comba_mul6(z, x, y); @@ -80,7 +83,7 @@ void karatsuba_mul(word z[], const word x[], const word y[], size_t N, */ void karatsuba_sqr(word z[], const word x[], size_t N, word workspace[]) { - if(N < BOTAN_KARAT_SQR_THRESHOLD || N % 2) + if(N < KARATSUBA_SQUARE_THRESHOLD || N % 2) { if(N == 6) return bigint_comba_sqr6(z, x); @@ -239,8 +242,8 @@ void bigint_mul(word z[], size_t 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 < KARATSUBA_MULTIPLY_THRESHOLD || + y_sw < KARATSUBA_MULTIPLY_THRESHOLD || !workspace) { bigint_simple_mul(z, x, x_sw, y, y_sw); @@ -285,7 +288,7 @@ void bigint_sqr(word z[], size_t z_size, word workspace[], { bigint_comba_sqr16(z, x); } - else if(x_size < BOTAN_KARAT_SQR_THRESHOLD || !workspace) + else if(x_size < KARATSUBA_SQUARE_THRESHOLD || !workspace) { bigint_simple_sqr(z, x, x_sw); } |