Module crypto::ct
constant-time helpers for cryptographic code.
Comparisons and selections whose running time doesn't depend on the (secret) bytes involved: no early exit, no branch on the data. Used by std's AEADs, RSA/ECDSA and TLS for tags, padding and key material. Freestanding-safe.
Functions
| ct_eq | 1 if a[0..n) == b[0..n), looking at every byte. |
| ct_is_zero | 1 if every byte of a[0..n) is zero, looking at every byte. |
| ct_copy_if | dst[0..n) = bit ? src[0..n) : dst[0..n) ('bit' is 0 or 1), touching every byte either way. |
| ct_eq_u32 | 0xFFFFFFFF when a == b, 0 otherwise (no branch). |