The best short reference for this is Lehman Math Comp 1992 PDF. A more elaborate discussion is in ME and ALEX which appeared in the Journal of Number Theory, January 2012, volume 132, number 1, pages 258-275. I attempted to include this material in a final section of the JNT paper, that did not work out, see METAMETA
A (ternary) positive quadratic form is indicated by $\langle a,b,c,r,s,t \rangle$ which refers to $$ f(x,y,z) = a x^2 + b y^2 + c z^2 + r y z + s z x + t x y. $$ The discriminant is $$ \Delta = 4 a b c + r s t - a r^2 - b s^2 - c t^2. $$ Forms are gathered together into genera when they are equivalent locally. A fundamental result of Siegel is that we may calculate the weighted average of representations, over a genus, of a given target number. Siegel's result relates quadratic forms and modular forms.
We have genera labelled $G_1, G_2, G_3.$ Given an odd prime $p,$ define useful integers $u,v$ such that $$ (-u | p) = -1, \; \; \; (-v | p) = +1. $$ The first one, $G_1,$ is the only genus of discriminant $p^2.$ Then we have two of the six genera of discriminant $4 p^2,$ these have level $4 p$ and are classically integral. Together $$ \begin{array}{lccccc} \mbox{Genus} & \Delta & \mbox{Level} & \mbox{2-adic} & \mbox{$p$-adic} & \mbox{Mass} \\\ G_1 & p^2 & 4 p & y z - x^2 & u x^2 + p(y^2 + u z^2) & (p-1)/48 \\\ G_2 & 4p^2 & 4 p & 2 y z - x^2 & u x^2 + p(y^2 + u z^2) & (p-1)/32 \\\ G_3 & 4p^2 & 4 p & x^2 + y^2 + z^2 & v x^2 + p(y^2 + v z^2) & (p+1)/96 \end{array} $$ Note that $G_1$ and $G_2$ represent exactly the same numbers, but with different representation measures. Furthermore, when $p \equiv 3 \pmod 4,$ then $h(x,y,z) = x^2 + p y^2 + p z^2 \in G_2,$ but when $p \equiv 1 \pmod 4,$ then $h(x,y,z) = x^2 + p y^2 + p z^2 \in G_3.$
Let $s(n)$ be the number of representations of $n$ as the sum of three squares. Then, taking one form $g$ per equivalence class in the specified genus, let $$ R_j(n) = \sum_{g \in G_j} \frac{r_g(n)}{|\mbox{Aut} g|} .$$
The two new identities are $$ s(p^2 n) \; - \; p s(n) \; = \; 96 \; R_1(n)\; - \; 96 \; R_2(n), $$
$$ (p+2) \; s( n) \; - \; s(p^2 n) \; = \; 96 \; R_3(n) .$$