The Mars Science Laboratory rover Curiosity found host rocks of basaltic composition and alteration assemblages containing clay minerals at Yellowknife Bay, Gale Crater. On the basis of the observed host rock and alteration minerals, we present results of equilibrium thermochemical modeling of the Sheepbed mudstones of Yellowknife Bay in order to constrain the formation conditions of its secondary mineral assemblage. Building on conclusions from sedimentary observations by the Mars Science Laboratory team, we assume diagenetic, in situ alteration. The modeling shows that the mineral assemblage formed by the reaction of a CO2-poor and oxidizing, dilute aqueous solution (Gale Portage Water) in an open system with the Fe-rich basaltic-composition sedimentary rocks at 10-50°C and water/rock ratio (mass of rock reacted with the starting fluid) of 100-1000, pH of ?7.5-12. Model alteration assemblages predominantly contain phyllosilicates (Fe-smectite, chlorite), the bulk composition of a mixture of which is close to that of saponite inferred from Chemistry and Mineralogy data and to that of saponite observed in the nakhlite Martian meteorites and terrestrial analogues. To match the observed clay mineral chemistry, inhomogeneous dissolution dominated by the amorphous phase and olivine is required. We therefore deduce a dissolving composition of approximately 70% amorphous material, with 20% olivine, and 10% whole rock component.