Formal Approaches To Countering Side-Channel Attacks