Skip to content

Commit

Permalink
CRYPTO-166 Library is reloaded multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbASF committed Nov 24, 2023
1 parent 02fff56 commit 8d72f6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
<body>
<release version="1.2.1" date="202X-MM-DD" description="Minor release (Java 8, OpenSSL 1.1.1)">
<!-- FIX -->
<action issue="CRYPTO-166" type="fix" dev="sebb">Library is reloaded multiple times</action>
<action issue="CRYPTO-175" type="fix" dev="sebb">JNA tests rely on JNI code</action>
<action issue="CRYPTO-178" type="fix" dev="sebb">OpenSslCryptoRandom.isNativeCodeEnabled() throws if library cannot be loaded</action>
<action issue="CRYPTO-173" type="fix" dev="sebb">docker build does not work on macOS M1</action>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,19 @@ static void get_methods(JNIEnv *env, HMODULE openssl)
#endif
}

static bool loaded = false; // have we successfully loaded the library and the methods?

static int load_library(JNIEnv *env)
{
HMODULE openssl = open_library(env); // calls THROW and returns 0 on error

if (!openssl) {
return 0;
}
get_methods(env, openssl);
if (!loaded) {
get_methods(env, openssl);
loaded = true;
}
return 1;
}

Expand Down

0 comments on commit 8d72f6c

Please sign in to comment.