Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mp_montgomery_reduce.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mp_err mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho)
digs = (n->used * 2) + 1;
if ((digs < MP_WARRAY) &&
(x->used <= MP_WARRAY) &&
(n->used < MP_MAXFAST)) {
(n->used < MP_MAX_COMBA)) {
return s_mp_montgomery_reduce_comba(x, n, rho);
}

Expand Down
2 changes: 1 addition & 1 deletion mp_mul.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ mp_err mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
* digits won't affect carry propagation
*/
(digs < MP_WARRAY) &&
(min <= MP_MAXFAST)) {
(min <= MP_MAX_COMBA)) {
err = s_mp_mul_comba(a, b, c, digs);
} else if (MP_HAS(S_MP_MUL)) {
err = s_mp_mul(a, b, c, digs);
Expand Down
2 changes: 1 addition & 1 deletion mp_sqr.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mp_err mp_sqr(const mp_int *a, mp_int *b)
err = s_mp_sqr_karatsuba(a, b);
} else if (MP_HAS(S_MP_SQR_COMBA) && /* can we use the fast comba multiplier? */
(((a->used * 2) + 1) < MP_WARRAY) &&
(a->used < (MP_MAXFAST / 2))) {
(a->used < (MP_MAX_COMBA / 2))) {
err = s_mp_sqr_comba(a, b);
} else if (MP_HAS(S_MP_SQR)) {
err = s_mp_sqr(a, b);
Expand Down
2 changes: 1 addition & 1 deletion s_mp_exptmod_fast.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ mp_err s_mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_i
/* automatically pick the comba one if available (saves quite a few calls/ifs) */
if (MP_HAS(S_MP_MONTGOMERY_REDUCE_COMBA) &&
(((P->used * 2) + 1) < MP_WARRAY) &&
(P->used < MP_MAXFAST)) {
(P->used < MP_MAX_COMBA)) {
redux = s_mp_montgomery_reduce_comba;
} else if (MP_HAS(MP_MONTGOMERY_REDUCE)) {
/* use slower baseline Montgomery method */
Expand Down
2 changes: 1 addition & 1 deletion s_mp_mul.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mp_err s_mp_mul(const mp_int *a, const mp_int *b, mp_int *c, int digs)

/* can we use the fast multiplier? */
if ((digs < MP_WARRAY) &&
(MP_MIN(a->used, b->used) < MP_MAXFAST)) {
(MP_MIN(a->used, b->used) < MP_MAX_COMBA)) {
return s_mp_mul_comba(a, b, c, digs);
}

Expand Down
2 changes: 1 addition & 1 deletion s_mp_mul_high.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mp_err s_mp_mul_high(const mp_int *a, const mp_int *b, mp_int *c, int digs)
/* can we use the fast multiplier? */
if (MP_HAS(S_MP_MUL_HIGH_COMBA)
&& ((a->used + b->used + 1) < MP_WARRAY)
&& (MP_MIN(a->used, b->used) < MP_MAXFAST)) {
&& (MP_MIN(a->used, b->used) < MP_MAX_COMBA)) {
return s_mp_mul_high_comba(a, b, c, digs);
}

Expand Down
2 changes: 1 addition & 1 deletion tommath_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ extern void MP_FREE(void *mem, size_t size);
#define MP_STATIC_ASSERT(msg, cond) typedef char mp_static_assert_##msg[(cond) ? 1 : -1];

#define MP_SIZEOF_BITS(type) ((size_t)CHAR_BIT * sizeof(type))
#define MP_MAXFAST (int)(1uL << (MP_SIZEOF_BITS(mp_word) - (2u * (size_t)MP_DIGIT_BIT)))

#define MP_MAX_COMBA (int)(1uL << (MP_SIZEOF_BITS(mp_word) - (2u * (size_t)MP_DIGIT_BIT)))
#define MP_WARRAY (int)(1uL << ((MP_SIZEOF_BITS(mp_word) - (2u * (size_t)MP_DIGIT_BIT)) + 1u))

#if defined(MP_16BIT)
Expand Down