Add error check to mp_sqrtmod_prime()
Signed-off-by: Tom St Denis <tstdenis82@gmail.com>
This commit is contained in:
parent
5b3178d83e
commit
575d9bac4b
@ -30,7 +30,9 @@ int mp_sqrtmod_prime(mp_int *n, mp_int *prime, mp_int *ret)
|
||||
if ((res = mp_jacobi(n, prime, &legendre)) != MP_OKAY) return res;
|
||||
if (legendre == -1) return MP_VAL; /* quadratic non-residue mod prime */
|
||||
|
||||
mp_init_multi(&t1, &C, &Q, &S, &Z, &M, &T, &R, &two, NULL);
|
||||
if ((res = mp_init_multi(&t1, &C, &Q, &S, &Z, &M, &T, &R, &two, NULL)) != MP_OKAY) {
|
||||
return res;
|
||||
}
|
||||
|
||||
/* SPECIAL CASE: if prime mod 4 == 3
|
||||
* compute directly: res = n^(prime+1)/4 mod prime
|
||||
|
Loading…
x
Reference in New Issue
Block a user