Skip to content
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

Add a build option to the assembler to retain local symbols. #1252

Merged
merged 6 commits into from
Oct 25, 2023

Conversation

nebeid
Copy link
Contributor

@nebeid nebeid commented Oct 16, 2023

Issues:

Resolves CryptoAlg-2142

Description of changes:

Formal verification needed some local symbols to be visible in the symbol table. This build option helps achieve that.

Testing:

Building with cmake -DKEEP_LOCAL_SYMBOLS=1 -DCMAKE_BUILD_TYPE=Release -GNinja ..

  • On Graviton3, searching for K512 in the output of objdump --syms crypto_test | less yielded a result.
  • On Intel x86_64 (with avx capability but not vaes and vpclmulqdq, which are needed for AES AVX512 implementation), searching for the desired symbols in the symbol table of crypto_test yielded results as well.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

@nebeid nebeid requested a review from a team as a code owner October 16, 2023 19:55
@nebeid
Copy link
Contributor Author

nebeid commented Oct 16, 2023

Is it worth adding a test to tests/ci/run_minimal_tests.sh?

skmcgrail
skmcgrail previously approved these changes Oct 16, 2023
@skmcgrail
Copy link
Member

skmcgrail commented Oct 16, 2023

Is it worth adding a test to tests/ci/run_minimal_tests.sh?

If this will be used by the formal verification tooling then I assume that would provide coverage? Regardless I'm not sure how useful this is to test if its just for visibility to aid in debugging / writing FV tooling.

Out of curiosity odes this cause issues if you do this with a FIPS build? (-DFIPS=1) (Edit: I guess no since the CI passed).

CMakeLists.txt Outdated
@@ -633,6 +633,10 @@ if(GCOV)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
endif()

if(KEEP_LOCAL_SYMBOLS)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this only affects the assembler should the flag be KEEP_LOCAL_ASM_SYMBOLS?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to KEEP_ASM_LOCAL_SYMBOLS.

@nebeid
Copy link
Contributor Author

nebeid commented Oct 19, 2023

Out of curiosity odes this cause issues if you do this with a FIPS build? (-DFIPS=1) (Edit: I guess no since the CI passed).

I added a test to the FIPS tests and used a side effect of break-hash.go to check that the module hash didn't change with this option in a FIPS release build.
I can revert it if deemed to be an overkill.

@nebeid
Copy link
Contributor Author

nebeid commented Oct 20, 2023

I added a test to the FIPS tests and used a side effect of break-hash.go to check that the module hash didn't change with this option in a FIPS release build. I can revert it if deemed to be an overkill.

The hash with and without the option is the same in Release and Debug FIPS builds. But Release build with gcc7 doesn't finish the break-kat tests. This could be one reason why the test uses a Debug build. Note that higher gcc versions complete the test on a release build.

@nebeid nebeid merged commit 50384cf into aws:main Oct 25, 2023
andrewhop added a commit that referenced this pull request Feb 6, 2025
### Description of changes: 
The original intention of #1005 was to
ensure break-kat.go always worked with the library.
#1252 then used a side effect to get
the module hash but didn't actually fail the build if the hash was
different.

Turn on `pipefail` so the script exits unsuccessfully if any command
fails even in a pipe. Previously if test-break-kat.sh failed the script
didn't exit, instead it would continue to the grep which would also fail
to find any matching string, and then the `|| true` ensured the script
always continued on.

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license and the ISC license.
andrewhop added a commit to andrewhop/aws-lc that referenced this pull request Feb 6, 2025
### Description of changes:
The original intention of aws#1005 was to
ensure break-kat.go always worked with the library.
aws#1252 then used a side effect to get
the module hash but didn't actually fail the build if the hash was
different.

Turn on `pipefail` so the script exits unsuccessfully if any command
fails even in a pipe. Previously if test-break-kat.sh failed the script
didn't exit, instead it would continue to the grep which would also fail
to find any matching string, and then the `|| true` ensured the script
always continued on.

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license and the ISC license.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants