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

Dynamically load ACCP with AWS-LC using RPath #224

Merged
merged 16 commits into from
Jun 29, 2022

Conversation

alexw91
Copy link
Contributor

@alexw91 alexw91 commented Jun 21, 2022

Issue #, if available: N/A

Description of changes:

Updates how ACCP dynamically loads it's dependencies. The changes in this PR include:

  1. libamazonCorrettoCryptoProvider.so now declares a shared library dependency on libcrypto.so
  2. libamazonCorrettoCryptoProvider.so now contains an RPATH value of $ORIGIN, which tells the runtime dynamic loader to look in the same directory as libamazonCorrettoCryptoProvider.so for any shared library dependencies before looking in system shared library directories
  3. ACCP's Loader.java class now creates a temporary directory, copies libamazonCorrettoCryptoProvider.so and libcrypto.so into that temp directory, and calls System.load() on that libACCP that was just copied.
  4. Various refactorings in Loader.java to break up large functions into smaller ones.
  5. Deletion of previous accpLcLoader shared library that loaded AWS-LC libcrypto symbols into the global object group, which would break any other JNI objects that required the use of a different version of libcrypto
  6. Improved checks for ensuring that the native ACCP libraries are loaded before attempting to use that functionality
  7. Equivalent RPath changes for test executables that depend on libACCP.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@alexw91 alexw91 force-pushed the aws-lc_rpath-dynamic-loading branch from 1b310b3 to e5a5aff Compare June 21, 2022 19:18
@alexw91 alexw91 marked this pull request as ready for review June 22, 2022 22:37
@alexw91 alexw91 changed the title [DRAFT] Dynamically load ACCP with AWS-LC using RPath Dynamically load ACCP with AWS-LC using RPath Jun 23, 2022
Copy link
Contributor

@SalusaSecondus SalusaSecondus left a comment

Choose a reason for hiding this comment

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

Very minor tweaks.

src/com/amazon/corretto/crypto/provider/Loader.java Outdated Show resolved Hide resolved
src/com/amazon/corretto/crypto/provider/Loader.java Outdated Show resolved Hide resolved
Copy link
Contributor

@SalusaSecondus SalusaSecondus left a comment

Choose a reason for hiding this comment

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

One (minor) thread safety issue and some nitpicks you can choose to ignore.

csrc/loader.cpp Outdated Show resolved Hide resolved
csrc/loader.cpp Outdated Show resolved Hide resolved
csrc/loader.cpp Outdated Show resolved Hide resolved
csrc/env.h Show resolved Hide resolved
csrc/env.h Outdated Show resolved Hide resolved
csrc/loader.cpp Show resolved Hide resolved
@alexw91 alexw91 merged commit d6ac4ab into corretto:develop Jun 29, 2022
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