forked from aws/aws-lc
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a runtime dis/enabler of DIT Capability on AArch64. (aws#1783)
- Provide runtime functions that mask out (and back in) the DIT CPU capability by clearing (setting) an additional bit in `OPENSSL_armcap_P`. This mechanism was chosen for the following reasons: - It does not require an additional global variable. - It avoids extra checks on the path of setting/resetting the DIT bit. - It avoids re-evaluating the CPU capability if we were to clear the DIT capability bit itself. That latter bit is now left intact. There were write locks added around changing `OPENSSL_armcap_P`. However, Thread Sanitizer warned about data race possibilities when trying to run a test with concurrent threads where one disables DIT at runtime and the other tries to check for the capability. Therefore, they are documented with a warning to use them only in initialization contexts. - Make the DIT functions (enable/disable and set/restore) available regardless of whether the build flag `DENABLE_DATA_INDEPENDENT_TIMING_AARCH64=ON` was used or not. - If the build flag was not used, then the DIT flag is not set and reset with every function and the instructions used for setting it and resetting after checking the capability are omitted and don't incur extra cost. - The user now has the choice, regardless of the build flag, to place `armv8_set/restore_dit` in the user's code. Call-outs: - The API `armv8_enable_dit` is renamed to `armv8_set_dit`. - `armv8_enable_dit` now means enable back the capability at runtime. - The macro `SET_DIT_AUTO_RESET` and the functions `armv8_set_dit` and `armv8_restore_dit` are moved to be internal. - The build flag was renamed to `ENABLE_DATA_INDEPENDENT_TIMING`.
- Loading branch information
Showing
31 changed files
with
513 additions
and
238 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
Oops, something went wrong.