aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/block/threefish_512/threefish.h6
-rw-r--r--src/lib/math/mp/mp_karat.cpp42
-rw-r--r--src/lib/pubkey/ec_group/point_gfp.cpp32
3 files changed, 43 insertions, 37 deletions
diff --git a/src/lib/block/threefish_512/threefish.h b/src/lib/block/threefish_512/threefish.h
index 2c2a2750f..6b21e9fdd 100644
--- a/src/lib/block/threefish_512/threefish.h
+++ b/src/lib/block/threefish_512/threefish.h
@@ -8,12 +8,6 @@
#ifndef BOTAN_THREEFISH_H_
#define BOTAN_THREEFISH_H_
-#if defined(__GNUC__)
- #warning "botan/threefish.h is deprecated"
-#elif defined(_MSC_VER)
- #pragma message ("botan/threefish.h is deprecated")
-#endif
-
#include <botan/threefish_512.h>
#endif
diff --git a/src/lib/math/mp/mp_karat.cpp b/src/lib/math/mp/mp_karat.cpp
index 6cf41503d..6fb217668 100644
--- a/src/lib/math/mp/mp_karat.cpp
+++ b/src/lib/math/mp/mp_karat.cpp
@@ -248,6 +248,23 @@ size_t karatsuba_size(size_t z_size, size_t x_size, size_t x_sw)
return 0;
}
+template<size_t SZ>
+inline bool sized_for_comba_mul(size_t x_sw, size_t x_size,
+ size_t y_sw, size_t y_size,
+ size_t z_size)
+ {
+ return (x_sw <= SZ && x_size >= SZ &&
+ y_sw <= SZ && y_size >= SZ &&
+ z_size >= 2*SZ);
+ }
+
+template<size_t SZ>
+inline bool sized_for_comba_sqr(size_t x_sw, size_t x_size,
+ size_t z_size)
+ {
+ return (x_sw <= SZ && x_size >= SZ && z_size >= 2*SZ);
+ }
+
}
void bigint_mul(word z[], size_t z_size,
@@ -265,28 +282,23 @@ void bigint_mul(word z[], size_t z_size,
{
bigint_linmul3(z, x, x_sw, y[0]);
}
- else if(x_sw <= 4 && x_size >= 4 &&
- y_sw <= 4 && y_size >= 4 && z_size >= 8)
+ else if(sized_for_comba_mul<4>(x_sw, x_size, y_sw, y_size, z_size))
{
bigint_comba_mul4(z, x, y);
}
- else if(x_sw <= 6 && x_size >= 6 &&
- y_sw <= 6 && y_size >= 6 && z_size >= 12)
+ else if(sized_for_comba_mul<6>(x_sw, x_size, y_sw, y_size, z_size))
{
bigint_comba_mul6(z, x, y);
}
- else if(x_sw <= 8 && x_size >= 8 &&
- y_sw <= 8 && y_size >= 8 && z_size >= 16)
+ else if(sized_for_comba_mul<8>(x_sw, x_size, y_sw, y_size, z_size))
{
bigint_comba_mul8(z, x, y);
}
- else if(x_sw <= 9 && x_size >= 9 &&
- y_sw <= 9 && y_size >= 9 && z_size >= 18)
+ else if(sized_for_comba_mul<9>(x_sw, x_size, y_sw, y_size, z_size))
{
bigint_comba_mul9(z, x, y);
}
- else if(x_sw <= 16 && x_size >= 16 &&
- y_sw <= 16 && y_size >= 16 && z_size >= 32)
+ else if(sized_for_comba_mul<16>(x_sw, x_size, y_sw, y_size, z_size))
{
bigint_comba_mul16(z, x, y);
}
@@ -320,23 +332,23 @@ void bigint_sqr(word z[], size_t z_size,
{
bigint_linmul3(z, x, x_sw, x[0]);
}
- else if(x_sw <= 4 && x_size >= 4 && z_size >= 8)
+ else if(sized_for_comba_sqr<4>(x_sw, x_size, z_size))
{
bigint_comba_sqr4(z, x);
}
- else if(x_sw <= 6 && x_size >= 6 && z_size >= 12)
+ else if(sized_for_comba_sqr<6>(x_sw, x_size, z_size))
{
bigint_comba_sqr6(z, x);
}
- else if(x_sw <= 8 && x_size >= 8 && z_size >= 16)
+ else if(sized_for_comba_sqr<8>(x_sw, x_size, z_size))
{
bigint_comba_sqr8(z, x);
}
- else if(x_sw <= 9 && x_size >= 9 && z_size >= 18)
+ else if(sized_for_comba_sqr<9>(x_sw, x_size, z_size))
{
bigint_comba_sqr9(z, x);
}
- else if(x_sw <= 16 && x_size >= 16 && z_size >= 32)
+ else if(sized_for_comba_sqr<16>(x_sw, x_size, z_size))
{
bigint_comba_sqr16(z, x);
}
diff --git a/src/lib/pubkey/ec_group/point_gfp.cpp b/src/lib/pubkey/ec_group/point_gfp.cpp
index 7974f8d79..47ca0527d 100644
--- a/src/lib/pubkey/ec_group/point_gfp.cpp
+++ b/src/lib/pubkey/ec_group/point_gfp.cpp
@@ -375,22 +375,22 @@ PointGFp multi_exponentiate(const PointGFp& x, const BigInt& z1,
const PointGFp y3(y2.plus(y, ws));
const PointGFp M[16] = {
- x.zero(), // 0000
- x, // 0001
- x2, // 0010
- x3, // 0011
- y, // 0100
- std::move(y.plus(x, ws)), // 0101
- std::move(y.plus(x2, ws)), // 0110
- std::move(y.plus(x3, ws)), // 0111
- y2, // 1000
- std::move(y2.plus(x, ws)), // 1001
- std::move(y2.plus(x2, ws)), // 1010
- std::move(y2.plus(x3, ws)), // 1011
- y3, // 1100
- std::move(y3.plus(x, ws)), // 1101
- std::move(y3.plus(x2, ws)), // 1110
- std::move(y3.plus(x3, ws)), // 1111
+ x.zero(), // 0000
+ x, // 0001
+ x2, // 0010
+ x3, // 0011
+ y, // 0100
+ y.plus(x, ws), // 0101
+ y.plus(x2, ws), // 0110
+ y.plus(x3, ws), // 0111
+ y2, // 1000
+ y2.plus(x, ws), // 1001
+ y2.plus(x2, ws), // 1010
+ y2.plus(x3, ws), // 1011
+ y3, // 1100
+ y3.plus(x, ws), // 1101
+ y3.plus(x2, ws), // 1110
+ y3.plus(x3, ws), // 1111
};
PointGFp H = x.zero();