Structural, electronic and magnetic properties of the surfaces of tetragonal and cubic HfO2