Skip to content

Add SONAME Support to AWS-LC #2546

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Add SONAME Support to AWS-LC #2546

wants to merge 7 commits into from

Conversation

skmcgrail
Copy link
Member

@skmcgrail skmcgrail commented Jul 15, 2025

Description of changes:

The following would be the naming structure for the different flavors of the AWS-LC project for the adoption of SONAME on UNIX platforms (sans macOS/Apple and Windows devices).

Software SemVer ABI Version SONAME Shared Object Name
AWS-LC (main) 1.54.0 0 libcrypto-awslc.so.0 libcrypto-awslc.so.1.54.0
AWS-LC-FIPS (1.X) 1.1.4 0 libcrypto-awslcfips1.so.0 libcrypto-awslcfips1.so.1.1.4
AWS-LC-FIPS (2.X) 2.0.17 0 libcrypto-awslcfips2.so.0 libcrypto-awslcfips2.so.2.0.17
AWS-LC-FIPS (3.X) 3.0.0 0 libcrypto-awslcfips3.so.0 libcrypto-awslcfips3.so.3.0.0

Similarly libssl would follow a matching naming scheme to that shown in the table above. This scheme allows for possible ABI changes amongst each variant of the library we offer.

Our default CMake installation commands will continue to provide the libcrypto.so and libssl.so symlinks to the SONAME symlink file, as to not require changes to existing applications linking to AWS-LC dynamically. No changes will be made to the static build of AWS-LC, and the static archive files will continue to be named libcrypto.a and libssl.a as expected.

Here is an example install directory of what this would look like:

$ ls -lrt /opt/aws-lc/lib64
total 5612
drwxr-xr-x. 3 root root      19 Jul 15 18:08 ssl
drwxr-xr-x. 3 root root      19 Jul 15 18:08 crypto
-rwxr-xr-x. 1 root root 4523992 Jul 15 18:10 libcrypto-awslc.so.1.54.0
-rwxr-xr-x. 1 root root 1216928 Jul 15 18:10 libssl-awslc.so.1.54.0
drwxr-xr-x. 2 root root      61 Jul 15 18:11 pkgconfig
lrwxrwxrwx. 1 root root      25 Jul 15 18:11 libcrypto-awslc.so.0 -> libcrypto-awslc.so.1.54.0
lrwxrwxrwx. 1 root root      22 Jul 15 18:11 libssl-awslc.so.0 -> libssl-awslc.so.1.54.0
lrwxrwxrwx. 1 root root      20 Jul 15 18:11 libcrypto.so -> libcrypto-awslc.so.0
lrwxrwxrwx. 1 root root      17 Jul 15 18:11 libssl.so -> libssl-awslc.so.0

Call-outs:

This enables the SONAME build by default, but we might wish to either flip the default state of the ENABLE_PRE_SONAME_BUILD CMake build option to be ON by default rather then OFF if we don't wish to start using the immediately. Right now it is off by default as I wanted to validate CI passes correctly with the change without having to plumb yet another dimension that I don't believe is fully necessary for every build variation we have.

The runbook for releases will need to be updated to indicated that the software version for release is now fully controlled via the top-level CMakeLists.txt variable called SOFTWARE_VERSION. In addition two headers are now templated with static information from the CMake configuration and generated back into the include folder (for backwards compatibility for some one-off builds, though directly depending on the source include directory is discouraged, and the installation include directory is treated as the supported methodology).

Lastly a number of CI jobs has historically had logic for explicitly checking the linkage of a compiled integration or program to verify it linked the built AWS-LC libcrypto or libssl from the installation directory to ensure the test correctly used AWS-LC as expected. To facilitate the long-term ability to remain agnostic to whether a build is or is not using an SONAME a check-linage.sh shell script is provided in the AWS-LC CMake build directory output that can be used to validate that a provided file dynamically links AWS-LC from the installation prefix directory that was configured for the build. This script should be used going forward rather then using ldd and grep with a hard-coded library file name, as this script is templated with the necessary information to perform the check correctly.

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.

@codecov-commenter
Copy link

codecov-commenter commented Jul 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.73%. Comparing base (7b65d53) to head (87ec8ee).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2546      +/-   ##
==========================================
+ Coverage   78.71%   78.73%   +0.01%     
==========================================
  Files         645      645              
  Lines      110641   110642       +1     
  Branches    15648    15649       +1     
==========================================
+ Hits        87094    87109      +15     
+ Misses      22846    22834      -12     
+ Partials      701      699       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@skmcgrail skmcgrail mentioned this pull request Jul 15, 2025
@skmcgrail skmcgrail force-pushed the soname branch 12 times, most recently from 6c99a49 to 08ffcc4 Compare July 23, 2025 19:04
@skmcgrail skmcgrail marked this pull request as ready for review July 23, 2025 21:46
@skmcgrail skmcgrail requested a review from a team as a code owner July 23, 2025 21:46
@skmcgrail skmcgrail changed the title [DRAFT] Add SONAME Support to AWS-LC Add SONAME Support to AWS-LC Jul 23, 2025
@skmcgrail skmcgrail requested review from samuel40791765 and removed request for andrewhop July 29, 2025 21:51
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome change, can we remove this file now or are we still required to keep it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Same question here, can we remove include/openssl/base.h entirely and replace it with this?

@@ -4,6 +4,6 @@ includedir=@includedir_for_pc_file@

Name: AWS-LC-libcrypto
Description: AWS-LC cryptography library
Version: @VERSION@
Version: 1.1.1
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we still abstract this into CMakeLists to make the pkgconfig files easier to change?

Comment on lines +86 to +89
if(PERFORM_SONAME_BUILD)
set(CRYPTO_LIB_NAME "${CRYPTO_LIB_NAME}-${SOFTWARE_NAME}")
set(SSL_LIB_NAME "${SSL_LIB_NAME}-${SOFTWARE_NAME}")
endif()
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we fold this into the same if condition on L77?

Comment on lines +947 to +953
install(CODE "
set(TGT lib${CRYPTO_LIB_NAME}.so.${ABI_VERSION})
set(LNK \$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libcrypto.so)
message(STATUS \"Creating symlink: \${LNK} → \${TGT}\")
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink \${TGT} \${LNK})
"
COMPONENT Development)
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor nit: Indentation

Comment on lines +146 to +154
if(PERFORM_SONAME_BUILD)
install(CODE "
set(TGT lib${SSL_LIB_NAME}.so.${ABI_VERSION})
set(LNK \$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/libssl.so)
message(STATUS \"Creating symlink: \${LNK} → \${TGT}\")
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink \${TGT} \${LNK})
"
COMPONENT Development)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor nit: indentation

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.

4 participants