Hi please help me on these problems

1. For p an odd prime and a any integer which is not congruent to 0 mod p, prove that the congruence x^2 = -a^2 (mod p) has solutions if and only if p=1 (mod4)

2. For integers a and b with (a,b) =1, prove that if p is any odd prime which divides a^2+b^2 then p=1 (mod4)

Thank you very much in advance!