diff --git a/app/src/main/jniLibs/armeabi-v7a/librustls_platform_verifier.so b/app/src/main/jniLibs/armeabi-v7a/librustls_platform_verifier.so new file mode 100755 index 0000000..c132c70 Binary files /dev/null and b/app/src/main/jniLibs/armeabi-v7a/librustls_platform_verifier.so differ diff --git a/rustls-platform-verifier/src/tests/ffi.rs b/rustls-platform-verifier/src/tests/ffi.rs index f66b49d..9030cc3 100644 --- a/rustls-platform-verifier/src/tests/ffi.rs +++ b/rustls-platform-verifier/src/tests/ffi.rs @@ -29,7 +29,7 @@ mod android { const SUCCESS_MARKER: &str = "success"; fn run_android_test<'a>( - env: &'a JNIEnv, + env: &'a mut JNIEnv, cx: JObject, suite_name: &'static str, test_cases: &'static [fn()], @@ -86,53 +86,53 @@ mod android { #[export_name = "Java_org_rustls_platformverifier_CertificateVerifierTests_mockTests"] pub extern "C" fn rustls_platform_verifier_mock_test_suite( - env: JNIEnv, + mut env: JNIEnv, _class: JClass, cx: JObject, ) -> jstring { log::info!("running mock test suite..."); run_android_test( - &env, + &mut env, cx, "mock tests", tests::verification_mock::ALL_TEST_CASES, ) - .into_inner() + .into_raw() } #[export_name = "Java_org_rustls_platformverifier_CertificateVerifierTests_verifyMockRootUsage"] pub extern "C" fn rustls_platform_verifier_verify_mock_root_usage( - env: JNIEnv, + mut env: JNIEnv, _class: JClass, cx: JObject, ) -> jstring { log::info!("verifying mock roots are not used by default..."); run_android_test( - &env, + &mut env, cx, "mock root verification", &[tests::verification_mock::verification_without_mock_root], ) - .into_inner() + .into_raw() } #[export_name = "Java_org_rustls_platformverifier_CertificateVerifierTests_realWorldTests"] pub extern "C" fn rustls_platform_verifier_real_world_test_suite( - env: JNIEnv, + mut env: JNIEnv, _class: JClass, cx: JObject, ) -> jstring { log::info!("running real world suite..."); run_android_test( - &env, + &mut env, cx, "real world", tests::verification_real_world::ALL_TEST_CASES, ) - .into_inner() + .into_raw() } } diff --git a/rustls-platform-verifier/src/verification/android.rs b/rustls-platform-verifier/src/verification/android.rs index b80e41d..fa8dcc8 100644 --- a/rustls-platform-verifier/src/verification/android.rs +++ b/rustls-platform-verifier/src/verification/android.rs @@ -58,8 +58,7 @@ impl Default for Verifier { #[cfg(any(test, feature = "ffi-testing"))] impl Drop for Verifier { fn drop(&mut self) { - with_context::<_, ()>(|cx| { - let env = cx.env(); + with_context::<_, ()>(|cx, env| { env.call_static_method(CERT_VERIFIER_CLASS.get(cx)?, "clearMockRoots", "()V", &[])? .v()?; Ok(()) @@ -160,7 +159,7 @@ impl Verifier { CERT_VERIFIER_CLASS.get(cx)?, "addMockRoot", "([B)V", - &[JValue::from(mock_root)], + &[JValue::from(&mock_root)], )? .v() .expect("failed to add test root")