forked from wolfSSL/wolfssl
Fast math correction of "sizeof" to use (). Updates to tfm and ecc comments.
This commit is contained in:
@@ -2788,7 +2788,7 @@ int wc_ecc_export_x963_ex(ecc_key* key, byte* out, word32* outLen,
|
|||||||
}
|
}
|
||||||
#endif /* HAVE_ECC_KEY_EXPORT */
|
#endif /* HAVE_ECC_KEY_EXPORT */
|
||||||
|
|
||||||
/* is ec point on curve described by dp ? */
|
/* is ecc point on curve described by dp ? */
|
||||||
static int ecc_is_point(const ecc_set_type* dp, ecc_point* ecp, mp_int* prime)
|
static int ecc_is_point(const ecc_set_type* dp, ecc_point* ecp, mp_int* prime)
|
||||||
{
|
{
|
||||||
mp_int b, t1, t2;
|
mp_int b, t1, t2;
|
||||||
|
@@ -1554,7 +1554,7 @@ int fp_cmp_mag(fp_int *a, fp_int *b)
|
|||||||
return FP_EQ;
|
return FP_EQ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* setups the montgomery reduction */
|
/* sets up the montgomery reduction */
|
||||||
int fp_montgomery_setup(fp_int *a, fp_digit *rho)
|
int fp_montgomery_setup(fp_int *a, fp_digit *rho)
|
||||||
{
|
{
|
||||||
fp_digit x, b;
|
fp_digit x, b;
|
||||||
@@ -1653,7 +1653,7 @@ static void fp_montgomery_reduce_mulx(fp_int *a, fp_int *m, fp_digit mp)
|
|||||||
|
|
||||||
|
|
||||||
/* now zero the buff */
|
/* now zero the buff */
|
||||||
XMEMSET(c, 0, sizeof c);
|
XMEMSET(c, 0, sizeof(c));
|
||||||
pa = m->used;
|
pa = m->used;
|
||||||
|
|
||||||
/* copy the input */
|
/* copy the input */
|
||||||
@@ -1733,7 +1733,7 @@ void fp_montgomery_reduce(fp_int *a, fp_int *m, fp_digit mp)
|
|||||||
|
|
||||||
|
|
||||||
/* now zero the buff */
|
/* now zero the buff */
|
||||||
XMEMSET(c, 0, sizeof c);
|
XMEMSET(c, 0, sizeof(c));
|
||||||
pa = m->used;
|
pa = m->used;
|
||||||
|
|
||||||
/* copy the input */
|
/* copy the input */
|
||||||
@@ -1872,7 +1872,7 @@ void fp_set(fp_int *a, fp_digit b)
|
|||||||
a->used = a->dp[0] ? 1 : 0;
|
a->used = a->dp[0] ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* chek if a bit is set */
|
/* check if a bit is set */
|
||||||
int fp_is_bit_set (fp_int *a, fp_digit b)
|
int fp_is_bit_set (fp_int *a, fp_digit b)
|
||||||
{
|
{
|
||||||
fp_digit i;
|
fp_digit i;
|
||||||
@@ -2246,49 +2246,39 @@ void fp_init_copy(fp_int *a, fp_int* b)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* fast math conversion */
|
/* fast math wrappers */
|
||||||
int mp_copy(fp_int* a, fp_int* b)
|
int mp_copy(fp_int* a, fp_int* b)
|
||||||
{
|
{
|
||||||
fp_copy(a, b);
|
fp_copy(a, b);
|
||||||
return MP_OKAY;
|
return MP_OKAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* fast math conversion */
|
|
||||||
int mp_isodd(mp_int* a)
|
int mp_isodd(mp_int* a)
|
||||||
{
|
{
|
||||||
return fp_isodd(a);
|
return fp_isodd(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* fast math conversion */
|
|
||||||
int mp_iszero(mp_int* a)
|
int mp_iszero(mp_int* a)
|
||||||
{
|
{
|
||||||
return fp_iszero(a);
|
return fp_iszero(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* fast math conversion */
|
|
||||||
int mp_count_bits (mp_int* a)
|
int mp_count_bits (mp_int* a)
|
||||||
{
|
{
|
||||||
return fp_count_bits(a);
|
return fp_count_bits(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int mp_leading_bit (mp_int* a)
|
int mp_leading_bit (mp_int* a)
|
||||||
{
|
{
|
||||||
return fp_leading_bit(a);
|
return fp_leading_bit(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* fast math conversion */
|
|
||||||
void mp_rshb (mp_int* a, int x)
|
void mp_rshb (mp_int* a, int x)
|
||||||
{
|
{
|
||||||
fp_rshb(a, x);
|
fp_rshb(a, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* fast math wrappers */
|
|
||||||
int mp_set_int(mp_int *a, mp_digit b)
|
int mp_set_int(mp_int *a, mp_digit b)
|
||||||
{
|
{
|
||||||
fp_set(a, b);
|
fp_set(a, b);
|
||||||
|
Reference in New Issue
Block a user