I assume the second is older than and informed the first but I'm not certain, and would like further information.
Racism, in terms of skin colour, is largely an ideological creation of the European slave trade and colonialism, in order to provide a justification for the oppression of non-Europeans (note that this also led to odd things like claiming the Irish weren't really White: oppressing white people is wrong, oppressing non-whites is okay, and obviously the Irish are not white so we can rule them for their own good).
Associating white with goodness goes far, far back into antiquity. A good example is the Bible. Angelic and divine figures are often dressed in blazing white, to show their purity. Isiah and Pslams both say God will cleanse people "white as snow". Revelation has the hosts of Heaven, and the saints and other blessed figures, dressed in "pure white linen". Essentially, as cleanliness was associated with holiness, clean, pure white clothes became similarly associated with holiness. The Bible uses the image of dirty clothes to represent sin. It's probably worth pointing out that ancient peoples probably wouldn't have seen a connection between the ideas of white=good/black=evil and white people=good/black people=evil (18th century racists did though). After all, ancient people didn't necessarily even use "white" and "black" to describe the people we'd describe as "white" and "black". After all, "white" people are not actually white, nor are "black" people actually black. I'm not saying no-one in the medieval period ever described Europeans as white-skinned and Africans as black-skinned, they sometimes did, but it was not a universal concept. For a demonstation of how "white" and "black" people do not have to correspond to what we think of, I'll take the example of a foreign language, in this case Chinese. In China, a pale-skinned northern Chinese person might well be described as "very white" while a darker-skinned Chinese southerner might be called "black skinned". In Chinese, "black" and "white" simply refer to how dark or light your skin is, and are not automatically associated with race. They're more likely to just use "European" or "African." An Anglo-Saxon living in China might well return from a holiday in Thailand to be told by the Chinese "your skin is black now."