Tamper-proof circuits: How to trade leakage for tamper-resilience