Abstract
Constant-time programming is the de facto standard to protect security-sensitive software against cache-based timing attacks. This software countermeasure is effective but may incur a significant performance overhead and require a substantial rewrite of the code. In this work, we study a secure cache-locking hardware mechanism which eases the writing of secure code and has little execution overhead. To reason about the security of software, we propose a high-level leakage model such that accesses to locked memory addresses do not generate any observable leakage. To ensure the adequacy of this leakage model, we also propose a concrete hardware leakage model for a RISC-V microcontroller where the secure code may be interrupted, at any time, by some arbitrary malicious code. Using the Observational Non-Interference setting, we show formally that the security of the software model is preserved at the hardware level. We evaluate the effectiveness and performance of this mechanism, notably on block ciphers. We also propose and evaluate a new constant-time sorting algorithm.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Agat, J.: Transforming out timing leaks. In: POPL. ACM (2000)
Almeida, J.B., Barbosa, M., Barthe, G., Dupressoir, F., Emmi, M.: Verifying constant-time implementations. In: USENIX Security Symposium, pp. 53–70. USENIX Association (2016)
Barthe, G., Betarte, G., Campo, J.D., Luna, C.: System-level non-interference of constant-time cryptography. Part I: model. J. Autom. Reason. 63, 1–51 (2019)
Barthe, G., Betarte, G., Campo, J.D., Luna, C., Pichardie, D.: System-level non-interference of constant-time cryptography. part II: verified static analysis and stealth memory. J. Autom. Reason. 64(8), 1685–1729 (2020)
Barthe, G., Betarte, G., Campo, J.D., Luna, C.D., Pichardie, D.: System-level Non-interference for Constant-time Cryptography. In: CCS, pp. 1267–1279. ACM (2014)
Barthe, G., et al.: Formal verification of a constant-time preserving C compiler. Proc. ACM Program. Lang. 4(POPL) (2019)
Barthe, G., Blazy, S., Hutin, R., Pichardie, D.: Secure compilation of constant-resource programs. In: CSF, pp. 1–12. IEEE (2021)
Barthe, G., Grégoire, B., Laporte, V.: Secure compilation of side- channel countermeasures: the case of cryptographic “Constant-Time”. In: CSF, pp. 328–343. IEEE Computer Society (2018)
Batcher, K.E.: Sorting networks and their applications. In: AFIPS Conference Proceedings, vol. 32. Thomson Book Company (1968)
Bernstein, D.J., Lange, T., Schwabe, P.: The security impact of a new cryptographic library. In: Hevia, A., Neven, G. (eds.) LATINCRYPT 2012. LNCS, vol. 7533, pp. 159–176. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-33481-8_9
Blazy, S., Pichardie, D., Trieu, A.: Verifying constant-time implementations by abstract interpretation. J. Comput. Secur. 27(1), 137–163 (2019)
Cauligi, S., et al.: FaCT: a DSL for timing-sensitive computation. In: PLDI, pp. 174–189. ACM (2019)
Dijkstra, E.W.: The Mathematics Behind the Banker’s Algorithm. Springer-Verlag, Heidelberg (1982). isbn: 0387906525
Domnitser, L., Jaleel, A., Loew, J., Abu-Ghazaleh, N.B., Ponomarev, D.: Non-monopolizable caches: low-complexity mitigation of cache side channel attacks. ACM Trans. Archit. Code Optim. 8(4), 35:1–35:21 (2012)
Doychev, G., Köpf, B., Mauborgne, L., Reineke, J.: CacheAudit: a tool for the static analysis of cache side channels. ACM Trans. Inf. Syst. Secur. 18(1), 4:1–4:32 (2015)
Gaudin, N., Cotret, P., Guy, G., Lapotre, V.: A fine-grained dynamic partitioning against cache-based timing attacks via cache locking. In: ISVLSI 2024 (2024)
Gaudin, N., et al.: Work in progress: thwarting timing attacks in microcontrollers using fine-grained hardware protections. In: EuroS &P Workshops, pp. 304–310. IEEE (2023)
Ge, Q., Yarom, Y., Heiser, G.: No security without time protection: we need a new hardware-software contract. In: APSys, pp. 1:1–1:9. ACM (2018)
Guarnieri, M., Köpf, B., Reineke, J., Vila, P.: Hardware-software contracts for secure speculation. In: SP, pp. 1868–1883. IEEE (2021)
Kim, T., Peinado, M., Mainar-Ruiz, G.: STEALTHMEM: system-level protection against cache-based side channel attacks in the cloud. In: USENIX Security Symposium, pp. 189–204. USENIX Association (2012)
Liu, C., Harris, A., Maas, M., Hicks, M.W., Tiwari, M., Shi, E.: GhostRider: a hardware-software system for memory trace oblivious computation. In: ASPLOS, pp. 87–101. ACM (2015)
Liu, C., Hicks, M., Shi, E.: Memory trace oblivious program execution. In: CSF, pp. 51–65. IEEE Computer Society (2013)
Miao, Y., Kandemir, M.T., Zhang, D., Zhang, Y., Tan, G., Wu, D.: Hardware support for constant-time programming. In: MICRO, pp. 856–870. ACM (2023)
Molnar, D., Piotrowski, M., Schultz, D., Wagner, D.: The program counter security model: automatic detection and removal of control-flow side channel attacks. In: Won, D.H., Kim, S. (eds.) ICISC 2005. LNCS, vol. 3935, pp. 156–168. Springer, Heidelberg (2006). https://doi.org/10.1007/11734727_14
Mushtaq, M., Mukhtar, M.A., Lapotre, V., Bhatti, M.K., Gogniat, G.: Winter is here! a decade of cache-based side-channel attacks, detection & mitigation for RSA. Inf. Syst. 92, 101524 (2020)
Stefanov, E., et al.: Path ORAM: an extremely simple oblivious RAM protocol. J. ACM 65(4), 18:1–18:26 (2018)
Tromer, E., Osvik, D.A., Shamir, A.: Efficient cache attacks on AES, and countermeasures. J. Cryptol. 23(1), 37–71 (2010)
Wang, Z., Lee, R.B.: New cache designs for thwarting software cachebased side channel attacks. In: ISCA, pp. 494–505. ACM (2007)
Yarom, Y., Falkner, K.: FLUSH+RELOAD: a high resolution, low noise, L3 cache side-channel attack. In: USENIX Security Symposium, pp. 719–732. USENIX Association (2014)
Acknowledgment
This work is supported by the SCRATCHS project of the Cominlabs excellence laboratory (grant ANR-10-LABX-07-01) funded by the French National Research Agency.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Appendices
A Evaluation of Algorithms with Input Dependent Locks
The evaluation results for Histogram, Permuation, Heap-pop and Dijkstra can be found in Fig. 5, Fig. 6, Fig. 7 and Fig. 8.
B Semantics of Instructions
The semantics of instructions is given in Fig. 9.
C Proof of Theorem 1
Proof
To prove \( ONI (\psi ,H)\), we suppose that we have two derivations \(\alpha \xrightarrow [\textbf{H}]{t} ^{n} \beta \) and \(\alpha ' \xrightarrow [\textbf{H}]{t'} ^{n} \beta '\) and two inputs \((i,i')\) such that \(\alpha \in I_\textbf{H}(i)\) and \(\beta \in I_\textbf{H}(i')\) and \(\psi (\alpha , \alpha ')\). By the backward simulation, there is also a pair of software states \((a,a')\in I_\textbf{S}(i) \times I_\textbf{S}(i')\) such that \( a \approx \alpha \) and \(a' \approx \alpha '\). By definition of the lockstep 2-simulation we also have \(a \equiv _\textbf{S}a'\) and \(\alpha \equiv _\textbf{H}\alpha '\).
We need to prove that \(t=t'\) and that \(\beta \in \mathcal {F}(H) \iff \beta ' \in \mathcal {F}(H)\). The proof is by induction over the length of the derivation.
-
Base case. 0-step derivations generate the empty trace: the traces are equal. \( ONI \) gives us \(a\in \mathcal {F}(\textbf{S}) \iff a' \in \mathcal {F}(\textbf{S})\). We prove that \(\alpha \in \mathcal {F}(\textbf{H}) \iff \alpha ' \in \mathcal {F}(\textbf{H})\).
-
If \(a\in \mathcal {F}(\textbf{S})\), then \(a' \in \mathcal {F}(\textbf{S})\), and by the backward simulation, we get that \(\alpha \in \mathcal {F}(\textbf{H})\) and \(\alpha '\in \mathcal {F}(\textbf{H})\).
-
If \(a\notin \mathcal {F}\), there exist t, b, \(t'\) and \(b'\) such that \(a \xrightarrow [\textbf{S}]{t} b\) and \(a' \xrightarrow [\textbf{S}]{t'} {b'}\). By \( ONI \), \(t=t'\). The property follows by the lockstep 2-simulation.
-
-
Inductive case. Suppose that we have two derivations of length \(n+1\) of the form \( \alpha \xrightarrow [\textbf{H}]{\tau _1} ^{1} \beta _1 \xrightarrow [\textbf{H}]{\tau } ^{n} \beta \mathrm {~and~} \alpha ' \xrightarrow [\textbf{H}]{\tau _1'} ^{1} \beta '_1 \xrightarrow [\textbf{H}]{\tau '} ^{n} \beta ' \). We need to prove that \(\tau _1\cdot \tau = \tau _1' \cdot \tau '\) and \(\beta \in \mathcal {F}\iff \beta ' \in \mathcal {F}\). By the backward simulation, we can exhibit two software derivations \(a\xrightarrow [\textbf{S}]{t_1} ^{1} b_1\) and \(a'\xrightarrow [\textbf{S}]{t_1'} ^{1} b_1'\) for some \(t_1\), \(b_1\), \(t_1'\) and \(b_1'\) such that \(b_1 \approx \beta _1\) and \(b_1' \approx \beta _1'\). By \( ONI \), \(t_1 = t_1'\), and by the lockstep 2-simulation, \(\tau _1 = \tau _1'\). The property then follows by the induction hypothesis. \(\square \)
Rights and permissions
Copyright information
© 2024 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Hatchikian-Houdot, JL., Wilke, P., Besson, F., Hiet, G. (2024). Formal Hardware/Software Models for Cache Locking Enabling Fast and Secure Code. In: Garcia-Alfaro, J., Kozik, R., Choraś, M., Katsikas, S. (eds) Computer Security – ESORICS 2024. ESORICS 2024. Lecture Notes in Computer Science, vol 14984. Springer, Cham. https://doi.org/10.1007/978-3-031-70896-1_8
Download citation
DOI: https://doi.org/10.1007/978-3-031-70896-1_8
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-70895-4
Online ISBN: 978-3-031-70896-1
eBook Packages: Computer ScienceComputer Science (R0)