Sufficient conditions for nonnegativity of the second variation in singular and nonsingular control problems