Skip to content

Commit e2528fd

Browse files
committed
Separate list of bundled libraries
1 parent 04d1612 commit e2528fd

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

closed/src/java.base/share/native/libjncrypto/NativeCrypto.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,20 @@ find_crypto_library(jboolean traceEnabled, const char *chomepath)
669669
#endif /* defined(_AIX) */
670670
};
671671

672+
/** OpenSSL library names associated with bundled library. */
673+
static const char * const bundledLibName[] = {
674+
#if defined(_AIX)
675+
"libcrypto-semeru.so",
676+
#elif defined(__APPLE__) /* defined(_AIX) */
677+
"libcrypto-semeru.dylib",
678+
#elif defined(_WIN32) /* defined(__APPLE__) */
679+
"crypto-semeru.dll",
680+
#else /* defined(_WIN32) */
681+
"libcrypto-semeru.so",
682+
#endif /* defined(_AIX) */
683+
};
672684
const size_t numOfLibs = sizeof(libNames) / sizeof(libNames[0]);
685+
const size_t bundledNumOfLibs = sizeof(bundledLibName) / sizeof(bundledLibName[0]);
673686
#if defined(_AIX)
674687
const size_t num_of_generic = 4;
675688
#elif defined(__linux__) /* defined(_AIX) */
@@ -710,8 +723,8 @@ find_crypto_library(jboolean traceEnabled, const char *chomepath)
710723
fprintf(stdout, "Attempting to load library bundled with JDK from: %s\n", libPath);
711724
}
712725

713-
for (i = 0; i < numOfLibs; i++) {
714-
size_t file_len = strlen(libNames[i]);
726+
for (i = 0; i < bundledNumOfLibs; i++) {
727+
size_t file_len = strlen(bundledLibName[i]);
715728
/* Allocate memory for the new file name with the path. */
716729
char *libNameWithPath = (char *)malloc(path_len + file_len + 1);
717730

@@ -723,11 +736,11 @@ find_crypto_library(jboolean traceEnabled, const char *chomepath)
723736
}
724737

725738
strcpy(libNameWithPath, libPath);
726-
strcat(libNameWithPath, libNames[i]);
739+
strcat(libNameWithPath, bundledNumOfLibs[i]);
727740

728741
/* Load OpenSSL Crypto library bundled with JDK. */
729742
if (traceEnabled) {
730-
fprintf(stdout, "\tAttempting to load: %s\n", libNames[i]);
743+
fprintf(stdout, "\tAttempting to load: %s\n", bundledNumOfLibs[i]);
731744
}
732745
result = load_crypto_library(traceEnabled, libNameWithPath);
733746

0 commit comments

Comments
 (0)