From b8c2b0105b42f81f44ad0553a0d28f477cdefcb7 Mon Sep 17 00:00:00 2001 From: Yawning Angel Date: Sat, 8 Apr 2023 10:11:04 +0900 Subject: [PATCH] core/crypto: Disable optimization for the ct byte compare Hedge against the possibility of a compiler getting clever enough to optimize this pattern as well. --- core/crypto/crypto.odin | 1 + 1 file changed, 1 insertion(+) diff --git a/core/crypto/crypto.odin b/core/crypto/crypto.odin index 35e88c5ed..6cdcacb9c 100644 --- a/core/crypto/crypto.odin +++ b/core/crypto/crypto.odin @@ -26,6 +26,7 @@ compare_constant_time :: proc "contextless" (a, b: []byte) -> int { // // The execution time of this routine is constant regardless of the // contents of the memory being compared. +@(optimization_mode="none") compare_byte_ptrs_constant_time :: proc "contextless" (a, b: ^byte, n: int) -> int { x := mem.slice_ptr(a, n) y := mem.slice_ptr(b, n)