Skip to content

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

Merged
pushkarnk merged 1 commit intocanonical:mainfrom
pushkarnk:fix-cyclic-dependency-error
Dec 10, 2024
Merged

Don't use Files.createTempFile() while loading libjssl.so#52
pushkarnk merged 1 commit intocanonical:mainfrom
pushkarnk:fix-cyclic-dependency-error

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
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