The global magnetic field of Mars and implications for crustal evolution