Electroweak baryogenesis and dark matter via a gauge singlet scalar