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

Don't use Files.createTempFile() while loading libjssl.so #52

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

pushkarnk
Copy link
Collaborator

During initialization of OpenSSLFIPSProvider, we load libjssl.so shipped as a resource from the jar file built by maven. We create a temporary file, copy the resource into it and call System.loadLibrary() on the temporary file.

The Files.createTempFile() method needs a SecureRandom. If OpenSSLFIPSProvider is configured as the provider with top priority, this will attempt to initialize OpenSSLDRBG causing a recursive attempt to load libjssl.so and failing with an NPE.

This commit removes the use of Files.createTempFile() to make sure no other security function is not invoked while loading libjssl.so during initialization.

During initialization of OpenSSLFIPSProvider, we load libjssl.so
shipped as a resource from the jar file built by maven. We create
a temporary file, copy the resource into it and call
System.loadLibrary() on the temporary file.

The Files.createTempFile() method needs a SecureRandom. If
OpenSSLFIPSProvider is configured as the provider with top
priority, this will attempt to initialize OpenSSLDRBG causing
a recursive attempt to load libjssl.so and failing with an NPE.

This commit removes the use of Files.createTempFile() to make sure
no other security function is not invoked while loading libjssl.so
during initialization.
@pushkarnk pushkarnk merged commit 6f00af9 into canonical:main Dec 10, 2024
2 checks passed
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.

1 participant