From 23ca210d6f5e042a407f8ef6766510170b54333b Mon Sep 17 00:00:00 2001 From: Pete Bentley <44170157+prbprbprb@users.noreply.github.com> Date: Fri, 29 Sep 2023 09:48:11 +0100 Subject: [PATCH] Remove Platform.logEvent(). (#1169) Long past obsolete. --- .../src/main/java/org/conscrypt/Platform.java | 22 ------------------- .../java/org/conscrypt/ConscryptEngine.java | 7 ------ .../ConscryptFileDescriptorSocket.java | 10 --------- .../src/main/java/org/conscrypt/Platform.java | 6 ----- .../src/main/java/org/conscrypt/Platform.java | 21 ------------------ 5 files changed, 66 deletions(-) diff --git a/android/src/main/java/org/conscrypt/Platform.java b/android/src/main/java/org/conscrypt/Platform.java index 870e4c4f7..9793d804a 100644 --- a/android/src/main/java/org/conscrypt/Platform.java +++ b/android/src/main/java/org/conscrypt/Platform.java @@ -457,28 +457,6 @@ public static void checkServerTrusted(X509TrustManager tm, X509Certificate[] cha } } - /** - * Logs to the system EventLog system. - */ - @SuppressWarnings("LiteralClassName") - public static void logEvent(String message) { - try { - Class processClass = Class.forName("android.os.Process"); - Object processInstance = processClass.getDeclaredConstructor().newInstance(); - Method myUidMethod = processClass.getMethod("myUid", (Class[]) null); - int uid = (Integer) myUidMethod.invoke(processInstance); - - Class eventLogClass = Class.forName("android.util.EventLog"); - Object eventLogInstance = eventLogClass.getDeclaredConstructor().newInstance(); - Method writeEventMethod = - eventLogClass.getMethod("writeEvent", Integer.TYPE, Object[].class); - writeEventMethod.invoke(eventLogInstance, 0x534e4554 /* SNET */, - new Object[] {"conscrypt", uid, message}); - } catch (Exception e) { - // Fail silently - } - } - static SSLEngine wrapEngine(ConscryptEngine engine) { // For now, don't wrap on Android. return engine; diff --git a/common/src/main/java/org/conscrypt/ConscryptEngine.java b/common/src/main/java/org/conscrypt/ConscryptEngine.java index bf3d1c844..a58aa73cb 100644 --- a/common/src/main/java/org/conscrypt/ConscryptEngine.java +++ b/common/src/main/java/org/conscrypt/ConscryptEngine.java @@ -441,13 +441,6 @@ private void beginHandshakeInternal() throws SSLException { handshake(); releaseResources = false; } catch (IOException e) { - // Write CCS errors to EventLog - String message = e.getMessage(); - // Must match error reason string of SSL_R_UNEXPECTED_CCS (in ssl/ssl_err.c) - if (message.contains("unexpected CCS")) { - String logMessage = String.format("ssl_unexpected_ccs: host=%s", getPeerHost()); - Platform.logEvent(logMessage); - } closeAll(); throw SSLUtils.toSSLHandshakeException(e); } finally { diff --git a/common/src/main/java/org/conscrypt/ConscryptFileDescriptorSocket.java b/common/src/main/java/org/conscrypt/ConscryptFileDescriptorSocket.java index 13929636f..f5ef00d74 100644 --- a/common/src/main/java/org/conscrypt/ConscryptFileDescriptorSocket.java +++ b/common/src/main/java/org/conscrypt/ConscryptFileDescriptorSocket.java @@ -246,16 +246,6 @@ public final void startHandshake() throws IOException { return; } } - - // Write CCS errors to EventLog - String message = e.getMessage(); - // Must match error string of SSL_R_UNEXPECTED_CCS - if (message.contains("unexpected CCS")) { - String logMessage = - String.format("ssl_unexpected_ccs: host=%s", getHostnameOrIP()); - Platform.logEvent(logMessage); - } - throw e; } diff --git a/openjdk/src/main/java/org/conscrypt/Platform.java b/openjdk/src/main/java/org/conscrypt/Platform.java index b74a0dbb9..467fec7f1 100644 --- a/openjdk/src/main/java/org/conscrypt/Platform.java +++ b/openjdk/src/main/java/org/conscrypt/Platform.java @@ -343,12 +343,6 @@ static void checkServerTrusted(X509TrustManager tm, X509Certificate[] chain, Str } } - /** - * Logs to the system EventLog system. - */ - @SuppressWarnings("unused") - static void logEvent(@SuppressWarnings("unused") String message) {} - /** * For unbundled versions, SNI is always enabled by default. */ diff --git a/platform/src/main/java/org/conscrypt/Platform.java b/platform/src/main/java/org/conscrypt/Platform.java index aeb77fd16..c86a8c0a0 100644 --- a/platform/src/main/java/org/conscrypt/Platform.java +++ b/platform/src/main/java/org/conscrypt/Platform.java @@ -264,27 +264,6 @@ static void checkServerTrusted(X509TrustManager tm, X509Certificate[] chain, Str } } - /** - * Logs to the system EventLog system. - */ - static void logEvent(String message) { - try { - Class processClass = Class.forName("android.os.Process"); - Object processInstance = processClass.newInstance(); - Method myUidMethod = processClass.getMethod("myUid", (Class[]) null); - int uid = (Integer) myUidMethod.invoke(processInstance); - - Class eventLogClass = Class.forName("android.util.EventLog"); - Object eventLogInstance = eventLogClass.newInstance(); - Method writeEventMethod = eventLogClass.getMethod( - "writeEvent", new Class[] {Integer.TYPE, Object[].class}); - writeEventMethod.invoke(eventLogInstance, 0x534e4554 /* SNET */, - new Object[] {"conscrypt", uid, message}); - } catch (Exception e) { - // Do not log and fail silently - } - } - static SSLEngine wrapEngine(ConscryptEngine engine) { return new Java8EngineWrapper(engine); }