Soundness of the Standard Decision Procedure for Binary and Ternary Quadratic Diophantine Equations