replaced mp_set_int with mp_set_long, just in case
This commit is contained in:
parent
6ee0829d62
commit
06c8f3ec4e
@ -31,7 +31,7 @@ int mp_mul_si(const mp_int *a, long d, mp_int *c)
|
|||||||
|
|
||||||
// mp_digit might be smaller than a long, which excludes
|
// mp_digit might be smaller than a long, which excludes
|
||||||
// the use of mp_mul_d() here.
|
// the use of mp_mul_d() here.
|
||||||
if ((err = mp_set_int(&t, (unsigned long) d)) != MP_OKAY) {
|
if ((err = mp_set_long(&t, (unsigned long) d)) != MP_OKAY) {
|
||||||
goto LBL_MPMULSI_ERR;
|
goto LBL_MPMULSI_ERR;
|
||||||
}
|
}
|
||||||
if ((err = mp_mul(a, &t, c)) != MP_OKAY) {
|
if ((err = mp_mul(a, &t, c)) != MP_OKAY) {
|
||||||
|
@ -48,7 +48,7 @@ int mp_prime_frobenius_underwood(const mp_int *N, int *result)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// (32764^2 - 4) < 2^31, no bigint for >MP_8BIT needed)
|
// (32764^2 - 4) < 2^31, no bigint for >MP_8BIT needed)
|
||||||
if ((e = mp_set_int(&T1z,(unsigned long)a)) != MP_OKAY) {
|
if ((e = mp_set_long(&T1z,(unsigned long)a)) != MP_OKAY) {
|
||||||
goto LBL_FU_ERR;
|
goto LBL_FU_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ int mp_prime_frobenius_underwood(const mp_int *N, int *result)
|
|||||||
goto LBL_FU_ERR;
|
goto LBL_FU_ERR;
|
||||||
}
|
}
|
||||||
// Composite if N and (a+4)*(2*a+5) are not coprime
|
// Composite if N and (a+4)*(2*a+5) are not coprime
|
||||||
if ((e = mp_set_int(&T1z, (unsigned long)((a+4)*(2*a+5)))) != MP_OKAY) {
|
if ((e = mp_set_long(&T1z, (unsigned long)((a+4)*(2*a+5)))) != MP_OKAY) {
|
||||||
goto LBL_FU_ERR;
|
goto LBL_FU_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ int mp_prime_frobenius_underwood(const mp_int *N, int *result)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((e = mp_set_int(&T1z, (unsigned long)(2 * a + 5))) != MP_OKAY) {
|
if ((e = mp_set_long(&T1z, (unsigned long)(2 * a + 5))) != MP_OKAY) {
|
||||||
goto LBL_FU_ERR;
|
goto LBL_FU_ERR;
|
||||||
}
|
}
|
||||||
if ((e = mp_mod(&T1z,N,&T1z)) != MP_OKAY) {
|
if ((e = mp_mod(&T1z,N,&T1z)) != MP_OKAY) {
|
||||||
|
@ -63,7 +63,7 @@ int mp_prime_strong_lucas_selfridge(const mp_int *a, int *result)
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
Ds = sign * D;
|
Ds = sign * D;
|
||||||
sign = -sign;
|
sign = -sign;
|
||||||
if ((e = mp_set_int(&Dz,(unsigned long) D)) != MP_OKAY) {
|
if ((e = mp_set_long(&Dz,(unsigned long) D)) != MP_OKAY) {
|
||||||
goto LBL_LS_ERR;
|
goto LBL_LS_ERR;
|
||||||
}
|
}
|
||||||
if ((e = mp_gcd(a, &Dz, &gcd)) != MP_OKAY) {
|
if ((e = mp_gcd(a, &Dz, &gcd)) != MP_OKAY) {
|
||||||
@ -155,14 +155,14 @@ int mp_prime_strong_lucas_selfridge(const mp_int *a, int *result)
|
|||||||
|
|
||||||
if (Q < 0) {
|
if (Q < 0) {
|
||||||
Q = -Q;
|
Q = -Q;
|
||||||
if ((e = mp_set_int(&Qmz, (unsigned long) Q)) != MP_OKAY) {
|
if ((e = mp_set_long(&Qmz, (unsigned long) Q)) != MP_OKAY) {
|
||||||
goto LBL_LS_ERR;
|
goto LBL_LS_ERR;
|
||||||
}
|
}
|
||||||
if ((e = mp_mul_2(&Qmz, &Q2mz)) != MP_OKAY) {
|
if ((e = mp_mul_2(&Qmz, &Q2mz)) != MP_OKAY) {
|
||||||
goto LBL_LS_ERR;
|
goto LBL_LS_ERR;
|
||||||
}
|
}
|
||||||
/* Initializes calculation of Q^d */
|
/* Initializes calculation of Q^d */
|
||||||
if ((e = mp_set_int(&Qkdz, (unsigned long) Q)) != MP_OKAY) {
|
if ((e = mp_set_long(&Qkdz, (unsigned long) Q)) != MP_OKAY) {
|
||||||
goto LBL_LS_ERR;
|
goto LBL_LS_ERR;
|
||||||
}
|
}
|
||||||
Qmz.sign = MP_NEG;
|
Qmz.sign = MP_NEG;
|
||||||
@ -170,14 +170,14 @@ int mp_prime_strong_lucas_selfridge(const mp_int *a, int *result)
|
|||||||
Qkdz.sign = MP_NEG;
|
Qkdz.sign = MP_NEG;
|
||||||
Q = -Q;
|
Q = -Q;
|
||||||
} else {
|
} else {
|
||||||
if ((e = mp_set_int(&Qmz, (unsigned long) Q)) != MP_OKAY) {
|
if ((e = mp_set_long(&Qmz, (unsigned long) Q)) != MP_OKAY) {
|
||||||
goto LBL_LS_ERR;
|
goto LBL_LS_ERR;
|
||||||
}
|
}
|
||||||
if ((e = mp_mul_2(&Qmz, &Q2mz)) != MP_OKAY) {
|
if ((e = mp_mul_2(&Qmz, &Q2mz)) != MP_OKAY) {
|
||||||
goto LBL_LS_ERR;
|
goto LBL_LS_ERR;
|
||||||
}
|
}
|
||||||
/* Initializes calculation of Q^d */
|
/* Initializes calculation of Q^d */
|
||||||
if ((e = mp_set_int(&Qkdz, (unsigned long) Q)) != MP_OKAY) {
|
if ((e = mp_set_long(&Qkdz, (unsigned long) Q)) != MP_OKAY) {
|
||||||
goto LBL_LS_ERR;
|
goto LBL_LS_ERR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user