Module cryptoxide::constant_time
source · Expand description
Constant time operations
This module exports traits to do basic checking operation in constant time, those operations are:
- CtZero : constant time zero and non-zero checking
- CtEqual : constant time equality and non-equality checking
- CtLesser : constant time less (<) and opposite greater-equal (>=) checking
- CtGreater : constant time greater (>) and opposite lesser-equal (<=) checking
And simple types to manipulate those capabilities in a safer way:
- Choice : Constant time boolean and safe methods. this was initially called CtBool but aligned to other implementation.
- CtOption : Constant time Option type.
Great care has been done to make operation constant so that it’s useful in cryptographic context, but we’re not protected from implementation bug, compiler optimisations, gamma rays and other Moon-Mars alignments.
The general functionality would be a great addition to the rust core library to have those type of things built-in and crucially more eyeballs.