The cohomology of restricted Lie algebras and of Hopf algebras