Add additional instructions required by AES-XTS on x86_64 #215
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes:
This PR adds additional SSE/SSE2 instructions that are used in AES-XTS on x86_64, including multi-byte
NOP
,PADDD
,PADDQ
,PAND
,PCMPGTD
,PSHUFD
,PSRAD
, andPXOR
.They are tested through hand-written tests. The tests could be removed once the AES-XTS assembly program is integrated into s2n-bignum.
In addition, this PR updates the
allowed_asm
file.Notes:
The multi-byte
NOP
appeared in the assembled binary because of the.align
directive. These.align
directives are used for making sure program instructions are aligned properly (https://stackoverflow.com/questions/18113995/performance-optimisations-of-x86-64-assembly-alignment-and-branch-prediction). These.align
directives are assembled into multi-byteNOP
s to pad up the space. In this PR we add multi-byte NOP that supports from 2-bytes to 9-bytes. However, these multi-byte NOP can be really wild. See https://stackoverflow.com/questions/27714524/x86-multi-byte-nop-and-instruction-prefix, where it points out that Intel can have 11-byte NOP with redundant prefixes. 10-byte and up NOP requires changes to data structures and will be done in another PR.XORPS is subject to constant-time uncertainty because it is not part of the DOIT list. Removed and will be submitted through another PR (#225).
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.