Fiqh-us-Sunnah Volume 3, Zakaat and Fasting, Fiqh 3.101A.

Section : Giving What is Unlawful as Sadaqah.

Allah does not accept sadaqah if it is from what is unlawful: The Messenger of Allah, upon whom be peace, said: “O people! Allah is good and accepts only good, and He has instructed the believers through the Messengers. Allah, the Mighty and the Majestic, says: ‘O Messengers! Consume what is good and work righteously. I am well-acquainted with what you do’ [al-Mu’minum 51].” He also calls upon [you]: ‘O you who believe! Consume of the good that We have provided for you’ [al-Baqarah 172]. Then [the Messenger] mentioned a man who had travelled for a long time. Unkempt and covered in dust, he raised his hands to the heavens (and cried): ‘O my Lord! O my Lord!’ His food was unlawful, his drink was unlawful, his clothing was unlawful, and what he had provided to sustain himself with was also unlawful. How could his invocation be accepted?” This is related by Muslim.

Also: “If one gives a date bought from honestly earned money (and Allah accepts only good), Allah accepts it in His right hand and enlarges [its rewards] for its owner (as one rears his foal) until it becomes as big as a mountain.” This is related by al-Bukhari.