Critical Ising correlation functions in the plane and on the torus