The three-square theorem states that $n\in\mathbb N=\{0,1,2,\ldots\}$ is the sum of three squares if and only if it is not of the form $4^k(8m+7)$ ($k,m\in\mathbb N$). This was first proved by Legendre during 1797-1798. In 1837 Dirichlet proved his famous theorem on primes in arithmetic progressions. Now I can only find proofs of Legendre's three-square theorem using Dirichlet's theorem, see, e.g., M. B. Nathanson's book "Additive Number Theory-The Classical Bases" (GTM 164, Springer, 1996).

Legendre's original proof did not involve Dirichlet's theorem which was proved later. A proof without using Dirichlet's theorem might be self-contained and hence suitable for the course of elementary number theory.

QUESTION: Where can I find a proof of the three-square theorem without using Dirichlet's theorem?