mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-20 20:54:59 -07:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user