-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option for destruction of intermediate values
FIPS-203, Section 3.3 demands the destruction of intermediate values before returning to the caller. This commit adds a compile-time option MLK_DESTRUCT_INTERMEDIATES which implements that. When set, MLK_DESTRUCT_INTERMEDIATES causes all intermediate stack buffers to be wiped prior to function return, via a new function ct_zeroize() in verify.h. (NB: The constant-time'ness is not relevant here, but conceptually the function is still best-placed in verify.h alongside other functions which, when naively implemented, would be prone to harmful compiler optimization -- ct_zeroize fits this category). By default, ct_zeroize() is implemented via SecureZeroMemory on Windows, and a plain memset + compiler barrier otherwise. Using memset_s would be preferred, but there is no portable way of detecting whether it is available. If users need to register a custom ct_zeroize, they can do so by defining MLK_CT_ZEROIZE_NATIVE and defining ct_zeroize_native, similar to how the arithmetic and FIPS-202 backends work. Even if MLK_DESTRUCT_INTERMEDIATES is not set, there are still dummy function calls to ct_zeroize() in the code. Those are no-ops, but are kept nonetheless to force the CBMC proofs to consider them, based on a contract for ct_zeroize(). Signed-off-by: Hanno Becker <[email protected]>
- Loading branch information
1 parent
11f923e
commit f2af0aa
Showing
20 changed files
with
209 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.