Skip to content

Commit 2a1683f

Browse files
committed
Project import generated by Copybara.
PiperOrigin-RevId: 897544682
1 parent 097b651 commit 2a1683f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2453
-324
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
# Evolving Conscrypt's Open Source Approach
23

34
Hello Conscrypt Developers,
@@ -68,7 +69,7 @@ try {
6869
// Example: Listing providers to see what's available
6970
// val providers = Security.getProviders()
7071
// providers.forEach { provider ->
71-
// println("Provider: ${provider.name}")
72+
// println("Provider: " + provider.name)
7273
// }
7374
} catch (e: NoSuchAlgorithmException) {
7475
// Handle exception

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ void CompatibilityCloseMonitor::init() {
4343
return;
4444
}
4545
#ifdef CONSCRYPT_UNBUNDLED
46-
// Only attempt to initialise the legacy C++ API if the C API symbols were not found.
46+
// Only attempt to initialise the legacy C++ API if the C API symbols were not
47+
// found.
4748
lib = dlopen("libjavacore.so", RTLD_NOW);
4849
if (lib != nullptr) {
4950
if (asyncCloseMonitorCreate == nullptr) {

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,17 @@ jint libconscrypt_JNI_OnLoad(JavaVM* vm, void*) {
4141
// Register all of the native JNI methods.
4242
NativeCrypto::registerNativeMethods(env);
4343

44-
// Perform static initialization of the close monitor (if required on this platform).
44+
// Perform static initialization of the close monitor (if required on this
45+
// platform).
4546
CompatibilityCloseMonitor::init();
4647
return CONSCRYPT_JNI_VERSION;
4748
}
4849

4950
#ifdef STATIC_LIB
5051

51-
// A version of OnLoad called when the Conscrypt library has been statically linked to the JVM (For
52-
// Java >= 1.8). The manner in which the library is statically linked is implementation specific.
52+
// A version of OnLoad called when the Conscrypt library has been statically
53+
// linked to the JVM (For Java >= 1.8). The manner in which the library is
54+
// statically linked is implementation specific.
5355
//
5456
// See http://openjdk.java.net/jeps/178
5557
CONSCRYPT_PUBLIC jint JNI_OnLoad_conscrypt(JavaVM* vm, void* reserved) {

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ void init(JavaVM* vm, JNIEnv* env) {
9393
openSslInputStreamClass = getGlobalRefToClass(
9494
env, TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/OpenSSLBIOInputStream");
9595
sslHandshakeCallbacksClass = getGlobalRefToClass(
96-
env, TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeCrypto$SSLHandshakeCallbacks");
96+
env,
97+
TO_STRING(
98+
JNI_JARJAR_PREFIX) "org/conscrypt/"
99+
"NativeCrypto$SSLHandshakeCallbacks");
97100

98101
nativeRef_address = getFieldRef(env, nativeRefClass, "address", "J");
99102
#if defined(ANDROID) && !defined(CONSCRYPT_OPENJDK)
@@ -119,7 +122,7 @@ void init(JavaVM* vm, JNIEnv* env) {
119122
sslHandshakeCallbacks_clientCertificateRequested = getMethodRef(
120123
env, sslHandshakeCallbacksClass, "clientCertificateRequested", "([B[I[[B)V");
121124
sslHandshakeCallbacks_serverCertificateRequested =
122-
getMethodRef(env, sslHandshakeCallbacksClass, "serverCertificateRequested", "()V");
125+
getMethodRef(env, sslHandshakeCallbacksClass, "serverCertificateRequested", "([I)V");
123126
sslHandshakeCallbacks_clientPSKKeyRequested = getMethodRef(
124127
env, sslHandshakeCallbacksClass, "clientPSKKeyRequested", "(Ljava/lang/String;[B[B)I");
125128
sslHandshakeCallbacks_serverPSKKeyRequested =
@@ -178,8 +181,8 @@ int jniGetFDFromFileDescriptor(JNIEnv* env, jobject fileDescriptor) {
178181
}
179182

180183
extern bool isDirectByteBufferInstance(JNIEnv* env, jobject buffer) {
181-
// Some versions of ART do not check the buffer validity when handling GetDirectBufferAddress()
182-
// and GetDirectBufferCapacity().
184+
// Some versions of ART do not check the buffer validity when handling
185+
// GetDirectBufferAddress() and GetDirectBufferCapacity().
183186
if (buffer == nullptr) {
184187
return false;
185188
}
@@ -191,7 +194,8 @@ extern bool isDirectByteBufferInstance(JNIEnv* env, jobject buffer) {
191194

192195
bool isGetByteArrayElementsLikelyToReturnACopy(size_t size) {
193196
#if defined(ANDROID) && !defined(CONSCRYPT_OPENJDK)
194-
// ART's GetByteArrayElements creates copies only for arrays smaller than 12 kB.
197+
// ART's GetByteArrayElements creates copies only for arrays smaller than 12
198+
// kB.
195199
return size <= 12 * 1024;
196200
#else
197201
(void)size;
@@ -447,8 +451,9 @@ void throwExceptionFromBoringSSLError(JNIEnv* env, CONSCRYPT_UNUSED const char*
447451
return;
448452
}
449453

450-
// If there's an error from BoringSSL it may have been caused by an exception in Java code, so
451-
// ensure there isn't a pending exception before we throw a new one.
454+
// If there's an error from BoringSSL it may have been caused by an exception
455+
// in Java code, so ensure there isn't a pending exception before we throw a
456+
// new one.
452457
if (!env->ExceptionCheck()) {
453458
char message[256];
454459
ERR_error_string_n(error, message, sizeof(message));

0 commit comments

Comments
 (0)