I have a question: what differentiates photons which make up different wavelengths of light?

I know, the probable answer is the energy, E=hf (f=frequency), that the photons possess. Now answer this: where does this energy come from, considering that photons have no mass ( no mass energy and no kinetic energy)?

Also, since photons have zero mass, they have zero momentum and so, infinite De' Broglie wavelength. But this isn't the fact. why does de' broglie's equation fail here?