Thermochemical sulfate reduction