A Multi-Layer Approach To Designing Secure Systems: From Circuit To Software