Minimize the scope of the |BN_*_SIZE_*| constants.
mul.c is the only file that uses these values.
Change-Id: I50a685cbff0f26357229e742f42e014434e9cebe
Reviewed-on: https://boringssl-review.googlesource.com/7061
Reviewed-by: David Benjamin <davidben@google.com>
diff --git a/crypto/bn/internal.h b/crypto/bn/internal.h
index 7ee94fc..cb57bb4 100644
--- a/crypto/bn/internal.h
+++ b/crypto/bn/internal.h
@@ -181,12 +181,6 @@
#endif
-/* Pentium pro 16,16,16,32,64 */
-/* Alpha 16,16,16,16.64 */
-#define BN_MULL_SIZE_NORMAL (16) /* 32 */
-#define BN_MUL_RECURSIVE_SIZE_NORMAL (16) /* 32 less than */
-#define BN_SQR_RECURSIVE_SIZE_NORMAL (16) /* 32 */
-
#define STATIC_BIGNUM(x) \
{ \
(BN_ULONG *)x, sizeof(x) / sizeof(BN_ULONG), \
diff --git a/crypto/bn/mul.c b/crypto/bn/mul.c
index 84dc24c..d2d8fd8 100644
--- a/crypto/bn/mul.c
+++ b/crypto/bn/mul.c
@@ -62,6 +62,10 @@
#include "internal.h"
+#define BN_MUL_RECURSIVE_SIZE_NORMAL 16
+#define BN_SQR_RECURSIVE_SIZE_NORMAL BN_MUL_RECURSIVE_SIZE_NORMAL
+
+
void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb) {
BN_ULONG *rr;
@@ -593,7 +597,8 @@
}
}
- if ((al >= BN_MULL_SIZE_NORMAL) && (bl >= BN_MULL_SIZE_NORMAL)) {
+ static const int kMulNormalSize = 16;
+ if (al >= kMulNormalSize && bl >= kMulNormalSize) {
if (i >= -1 && i <= 1) {
/* Find out the power of two lower or equal
to the longest of the two numbers */