Formalising Security in Ubiquitous and Cloud Scenarios