-
Notifications
You must be signed in to change notification settings - Fork 134
Fix FIPS static build transform issue on aarch. #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix FIPS static build transform issue on aarch. #137
Conversation
'ep_nistz256_add' in p256-armv8-asm.pl is duplicate to p256-nistz.c. Removing 'ep_nistz256_add' function is 8000 to avoid delocate.go reporting 'Duplicate symbol found'. The offset calculation expression change is to avoid 'peg' parser errors because the current delocate.peg is not comprehensive enough to parse all assembly expressions.
// so local symbols in the file need to get changed with suffix(`BCM` + `index`). | ||
// The change is to avoid potential collides with other files. | ||
// If the offset exists, append the offset. | ||
symbol = symbol + offset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should changed
be set to true so that a comment is output before this instruction? (l. 618)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didChange
is already assigned to changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I hadn't noticed that.
@@ -520,6 +520,12 @@ func (d *delocation) processAarch64Instruction(statement, instruction *node32) ( | |||
d.redirectors[symbol] = redirector | |||
symbol = redirector | |||
changed = true | |||
} else if didChange && symbolIsLocal && len(offset) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the first inputFile the compiled bcm.c? Is that why it won't have symbols with offsets that were renamed?
Are we sure that the first if will not be hit by those kinds of symbols?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the first inputFile the compiled bcm.c?
No, it's an archived file -- -a $<TARGET_FILE:bcm_c_generated_asm>
./delocate -a $<TARGET_FILE:bcm_c_generated_asm> -o bcm-delocated.S ${BCM_ASM_PROCESSED_SOURCES}
Is that why it won't have symbols with offsets that were renamed?
Case by case, need to check delocate.go. But for local symbol and the statement matching memRef rule, yes.
Are we sure that the first if will not be hit by those kinds of symbols?
For the first file, didChange
is false and the symbol is not change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation, Bryce.
Co-authored-by: Nevine Ebeid <66388554+nebeid@users.noreply.github.com>
// so local symbols in the file need to get changed with suffix(`BCM` + `index`). | ||
// The change is to avoid potential collides with other files. | ||
// If the offset exists, append the offset. | ||
symbol = symbol + offset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I hadn't noticed that.
@@ -520,6 +520,12 @@ func (d *delocation) processAarch64Instruction(statement, instruction *node32) ( | |||
d.redirectors[symbol] = redirector | |||
symbol = redirector | |||
changed = true | |||
} else if didChange && symbolIsLocal && len(offset) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation, Bryce.
Co-authored-by: Nevine Ebeid <66388554+nebeid@users.noreply.github.com>
…cate-arm-transform
* Fix FIPS static build parse issue on aarch. (#135) * Remove 'ep_nistz256_add' function, and change offset calculation. 'ep_nistz256_add' in p256-armv8-asm.pl is duplicate to p256-nistz.c. Removing 'ep_nistz256_add' function is to avoid delocate.go reporting 'Duplicate symbol found'. The offset calculation expression change is to avoid 'peg' parser errors because the current delocate.peg is not comprehensive enough to parse all assembly expressions. * Add new peg rules to address new assembly expression. * Change assembly expression. * Add delocate.peg convert README. * Remove auto-generated comment. * Add more delocate.peg.go generate commands. * Fix command. * Update build files in generated-src * Fix FIPS static build transform issue on aarch. (#137) * Remove 'ep_nistz256_add' function, and change offset calculation. 'ep_nistz256_add' in p256-armv8-asm.pl is duplicate to p256-nistz.c. Removing 'ep_nistz256_add' function is to avoid delocate.go reporting 'Duplicate symbol found'. The offset calculation expression change is to avoid 'peg' parser errors because the current delocate.peg is not comprehensive enough to parse all assembly expressions. * Add new peg rules to address new assembly expression. * Change assembly expression. * Add delocate.peg convert README. * Remove auto-generated comment. * Add more delocate.peg.go generate commands. * Fix command. * Add offset to local symbol in delocate. * Update util/fipstools/delocate/delocate.go Co-authored-by: Nevine Ebeid <66388554+nebeid@users.noreply.github.com> * Update util/fipstools/delocate/delocate.go Co-authored-by: Nevine Ebeid <66388554+nebeid@users.noreply.github.com> * Update comments. Co-authored-by: Nevine Ebeid <66388554+nebeid@users.noreply.github.com> * Add FIPS build CI on aarch. * Increase go test timeout. * Increase more timeout. * Remove timeout variable because ASAN is not enabled. * Add comment to trigger CI. Co-authored-by: Nevine Ebeid <66388554+nebeid@users.noreply.github.com>
Co-authored-by: June Blender <juneb@users.noreply.github.com>
Add hybrid `p256_montjadd` and `p256_montjdouble` for Arm, slow multipliers s2n-bignum original commit: awslabs/s2n-bignum@7ff619c
Add hybrid `p256_montjadd` and `p256_montjdouble` for Arm, slow multipliers s2n-bignum original commit: awslabs/s2n-bignum@7ff619c s2n-bignum original commit: awslabs/s2n-bignum@a35eb4b
Add hybrid `p256_montjadd` and `p256_montjdouble` for Arm, slow multipliers s2n-bignum original commit: awslabs/s2n-bignum@7ff619c
Add hybrid `p256_montjadd` and `p256_montjdouble` for Arm, slow multipliers
Add hybrid `p256_montjadd` and `p256_montjdouble` for Arm, slow multipliers s2n-bignum original commit: awslabs/s2n-bignum@7ff619c
* develop: Remove dead code and bump patch version Add logic to generate a classpath file Clarify best practices are local to ACCP Improve documentation (aws#151) Update CHANGELOG for 1.6.0 (aws#148) Handle RsaCipher#engineDoFinal with no input bytes (aws#147) Validate that AesGcmSpi#engineInit gets non-null key (aws#146) Move to OpenSSL 1.1.1j (aws#145) Add list of known differences (aws#137) Better output size estimates. Fixes aws#135 Move to openssl 1.1.1i (aws#136) Initial commit of the development guide (aws#134)
Issues:
Addresses CryptoAlg-725
Description of changes:
This PR is to fix FIPS static build
delocate transform
issue on aarch. Specifically, the currentdelocate
missed the offset when transforming below assembly statementsWith this PR, awslc build and test can work.
Call-outs:
delocate parse
issue on aarch.Testing:
aarch-fips-static-build-test-log.out
is attached to CryptoAlg-725.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.