US national security adviser resigns amid controversy