Do we need to check this? Isn't it guaranteed that `x**2 = a (mod p)` ?