| 1 |
This is a WIP document offering some advice on how to implement cryptographic |
| 2 |
algorithms securely for Hare. |
| 3 |
|
| 4 |
All cryptographic algorithms must be constant time, such that an attacker cannot |
| 5 |
learn any secret information by analysis of the time required to complete a |
| 6 |
cryptographic operation. Not all of the math performed by cryptographic |
| 7 |
algorithms in Hare needs to be constant-time: just math whose inputs include |
| 8 |
secret information. |
| 9 |
|
| 10 |
It is important to know that secret data has been securely erased from memory |
| 11 |
when it is no longer required. A few items to note about Hare: |
| 12 |
|
| 13 |
- Return-by-value will leave garbage on the stack which is copied into the |
| 14 |
caller's stack frame and abandoned. You cannot return-by-value any objects |
| 15 |
which contain secret information. |
| 16 |
- To securely erase an array's contents, use bytes::zero. |