Skip to content

Commit

Permalink
Remove Platform.logEvent(). (#1169)
Browse files Browse the repository at this point in the history
Long past obsolete.
  • Loading branch information
prbprbprb authored Sep 29, 2023
1 parent a05fd9e commit 23ca210
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 66 deletions.
22 changes: 0 additions & 22 deletions android/src/main/java/org/conscrypt/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 0 additions & 7 deletions common/src/main/java/org/conscrypt/ConscryptEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 0 additions & 6 deletions openjdk/src/main/java/org/conscrypt/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
21 changes: 0 additions & 21 deletions platform/src/main/java/org/conscrypt/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 23ca210

Please sign in to comment.