If m is odd and if every prime dividing m is congruent to 1 modulo 4, prove that m can be written as the sum of two squares $\displaystyle m = a^{2} + b^{2}$ where gcd(a,b) = 1.

So it's easy enough to prove that it is the sum of two squares (the product of two primes that be written as the sum of two squares is also the sum of two squares), but I don't know how to prove that the gcd would be 1. A follow up question is , if m is even and m/2 and every prime dividing m/2 is congruent to 1 modulo 4, prove that m can be wrtten as a sum of two squares $\displaystyle m= a^{2} + b^{2}$ with gcd(a,b)=1. Thanks