Skip to content

Commit

Permalink
Address review comments 4
Browse files Browse the repository at this point in the history
  • Loading branch information
KostasTsiounis committed Jan 9, 2025
1 parent fffa9eb commit 6bb291e
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions closed/src/java.base/share/native/libjncrypto/NativeCrypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ find_crypto_library(jboolean traceEnabled, const char *chomepath)
"libcrypto.so.3", /* 3.x library name */
"libcrypto.a(libcrypto64.so.1.1)", /* 1.1.x library name from archive file */
"libcrypto.so.1.1", /* 1.1.x library name */
"libcrypto.a(libcrypto.so.1.0.0)", /* 1.1.x library name from archive file */
"libcrypto.so.1.0.0", /* 1.0.x library name */
#elif defined(__APPLE__) /* defined(_AIX) */
"libcrypto.3.dylib", /* 3.x library name */
Expand Down Expand Up @@ -765,23 +766,19 @@ find_crypto_library(jboolean traceEnabled, const char *chomepath)
continue;
}

if (i >= num_of_generic) {
/* If library checked is not a generic one, there is no need to check further. */
if (previousVersion > tempVersion) {
unload_crypto_library(result);
return prevResult;
} else {
if (previousVersion != 0) {
unload_crypto_library(prevResult);
}
return result;
if (tempVersion > previousVersion) {
if (0 != previousVersion) {
unload_crypto_library(prevResult);
}
previousVersion = tempVersion;
prevResult = result;
} else {
/* If library checked is a generic one, we need to keep checking for higher versions. */
if (tempVersion > previousVersion) {
previousVersion = tempVersion;
prevResult = result;
}
unload_crypto_library(result);
}

/* If library checked is not a generic one, there is no need to check further. */
if (i >= num_of_generic) {
break;
}
}

Expand Down

0 comments on commit 6bb291e

Please sign in to comment.