Not knowing the ‘law’ is not an excuse in law, so even if you think you have ‘legal drugs’ in your possession and they turn out to be illegal, you can be prosecuted.
Drugs Law used in the UK is the Misuse of Drugs Act 1971 and in some cases The Medicine Act 1968. We have had regular additions and changes to the MDA 1971 over the years.
It is recommended that you read information from ‘Release’ on this: http://www.release.org.uk/ Please note that the role of the police in Scotland is different than England as it is up to the Prosecutor Fiscal to decide the case goes to court. Please tell Release you are Scottish, and always take a lawyers advice.