In the United States it is perfectly legal to give a truthful reference, good or bad. If the truth appears to be debatable, just stick to the facts. If the person inquiring asks for a "deep reference," (someone else who knows the applicant besides you), it is also perfectly legal in the United States to provide that information. (This surprises a lot of job-seekers in the United States, who would like to believe that the law is otherwise, but this is the law. In general, you can say truthful things about current or former employees, including identifying other people who know about them.)
I have been looking up information about employment law (mainly in the United States, but also around the world) as part of a promised update to my FAQ on company hiring procedures
https://news.ycombinator.com/item?id=5227923
that I will post to my personal website.