Finding all primes $p$ satisfying $p=a^2+b^2$ and $p$ divides $a^3+b^3-4$ . 
Determine all primes $p$ such that there exist integers $a, b$ satisfying $p=a^2+b^2$ and $a^3+b^3-4$ is divisible by $p$.

So, $p | ab(a+b)+4$ after writing $a^3+b^3-4=(a+b)(p-ab)-4$ and $p=2$ is a solution if $p|4$. If $p$ doesn't divide $4$, $ab(a+b)\equiv -4 \pmod p$. Also, $p=4m+1$ for some integer $m$ by Fermat's 2-square theorem.It seems like $5$ and $2$ are the only primes that satisfy the conditions but I can't seem to prove it.
I've tried manipulating the stuff around but I'm not getting anything. Can anyone give a small hint? Thanks.

Observe, $$\begin{align*} 2ab(a+b)+8&\equiv 0 &&\pmod p \\  2ab&\equiv (a+b)^2&&\pmod p\\ \therefore\;\; (a+b)^3+8&\equiv 0 &&\pmod p \end{align*}$$
So, $$p|(a+b+2)\; \;\text{or}\; \;p|(a+b)^2-2(a+b)+4$$

Case 1: $$p|a+b+2$$
$$a^2+b^2|a+b+2\implies a^2+b^2\le a+b+2 \le \sqrt{2(a^2+b^2)}+2$$
$$\therefore\;\; p\le \sqrt{2p}+2 \;\Leftrightarrow\; p\in \{2,3,5\}$$

Case 2:
$$p|2ab-2(a+b)+4\implies p=2 \;\; \text{or}\;\; p|ab-a-b+4$$
$$a^2+b^2|ab-a-b+4\implies a^2+b^2\le ab-a-b+4\le ab+4\le \frac{a^2+b^2}{2}+4$$
$$\therefore\;\; p\le \frac{p}{2}+4 \;\Leftrightarrow\; p\in \{2,3,5,7\} $$

If $p=2$, we can set, $(a,b)=(1,1)$
If $p=5$, we can set, $(a,b)=(1,2)$
If $p=3$ or $p=7$,we have, $p=a^2+b^2$ is impossible by Fermat's theorem on sums of two squares.
