Skip to content

Commit 3c50b42

Browse files
authored
Remove now unnecessary clinit() call (#1381)
After https://boringssl-review.googlesource.com/c/boringssl/+/69508, CRYPTO_library_init is always a no-op in BoringSSL. There is no need to call it from Conscrypt.
1 parent ca63040 commit 3c50b42

2 files changed

Lines changed: 0 additions & 12 deletions

File tree

common/src/jni/main/cpp/conscrypt/native_crypto.cc

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -825,14 +825,6 @@ void init_engine_globals() {
825825
#define THROW_SOCKETTIMEOUTEXCEPTION (-3)
826826
#define THROWN_EXCEPTION (-4)
827827

828-
/**
829-
* Initialization phase for every OpenSSL job: Loads the Error strings, the
830-
* crypto algorithms and reset the OpenSSL library
831-
*/
832-
static void NativeCrypto_clinit(JNIEnv*, jclass) {
833-
CRYPTO_library_init();
834-
}
835-
836828
/**
837829
* private static native int EVP_PKEY_new_RSA(byte[] n, byte[] e, byte[] d, byte[] p, byte[] q);
838830
*/
@@ -11853,7 +11845,6 @@ static jlong NativeCrypto_SSL_get1_session(JNIEnv* env, jclass, jlong ssl_addres
1185311845
#define REF_SSL "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeSsl;"
1185411846
#define REF_SSL_CTX "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/AbstractSessionContext;"
1185511847
static JNINativeMethod sNativeCryptoMethods[] = {
11856-
CONSCRYPT_NATIVE_METHOD(clinit, "()V"),
1185711848
CONSCRYPT_NATIVE_METHOD(CMAC_CTX_new, "()J"),
1185811849
CONSCRYPT_NATIVE_METHOD(CMAC_CTX_free, "(J)V"),
1185911850
CONSCRYPT_NATIVE_METHOD(CMAC_Init, "(" REF_CMAC_CTX "[B)V"),

common/src/main/java/org/conscrypt/NativeCrypto.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ public final class NativeCrypto {
6565
UnsatisfiedLinkError error = null;
6666
try {
6767
NativeCryptoJni.init();
68-
clinit();
6968
} catch (UnsatisfiedLinkError t) {
7069
// Don't rethrow the error, so that we can later on interrogate the
7170
// value of loadError.
@@ -75,8 +74,6 @@ public final class NativeCrypto {
7574
setTlsV1DeprecationStatus(Platform.isTlsV1Deprecated(), Platform.isTlsV1Supported());
7675
}
7776

78-
private native static void clinit();
79-
8077
/**
8178
* Checks to see whether or not the native library was successfully loaded. If not, throws
8279
* the {@link UnsatisfiedLinkError} that was encountered while attempting to load the library.

0 commit comments

Comments
 (0)