Chiral perturbation theory at O(a**2) for lattice QCD