Sufficiency for optimal control with state and control constraints