Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions android/src/main/java/org/conscrypt/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
@Internal
final public class Platform {
private static final String TAG = "Conscrypt";
static boolean DEPRECATED_TLS_V1 = true;
static boolean ENABLED_TLS_V1 = false;
private static boolean DEPRECATED_TLS_V1 = true;
private static boolean ENABLED_TLS_V1 = false;
private static boolean FILTERED_TLS_V1 = true;

private static Method m_getCurveName;
Expand All @@ -95,7 +95,7 @@ final public class Platform {

private Platform() {}

public static void setup(boolean deprecatedTlsV1, boolean enabledTlsV1) {
public static synchronized void setup(boolean deprecatedTlsV1, boolean enabledTlsV1) {
DEPRECATED_TLS_V1 = deprecatedTlsV1;
ENABLED_TLS_V1 = enabledTlsV1;
FILTERED_TLS_V1 = !enabledTlsV1;
Expand Down Expand Up @@ -966,15 +966,15 @@ public static boolean isJavaxCertificateSupported() {
return true;
}

public static boolean isTlsV1Deprecated() {
public static synchronized boolean isTlsV1Deprecated() {
return DEPRECATED_TLS_V1;
}

public static boolean isTlsV1Filtered() {
public static synchronized boolean isTlsV1Filtered() {
return FILTERED_TLS_V1;
}

public static boolean isTlsV1Supported() {
public static synchronized boolean isTlsV1Supported() {
return ENABLED_TLS_V1;
}
public static boolean isPakeSupported() {
Expand Down
6 changes: 3 additions & 3 deletions common/src/main/java/org/conscrypt/OpenSSLProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ public OpenSSLProvider() {
@SuppressWarnings("deprecation")
public OpenSSLProvider(String providerName) {
this(providerName, Platform.provideTrustManagerByDefault(), "TLSv1.3",
Platform.DEPRECATED_TLS_V1, Platform.ENABLED_TLS_V1);
Platform.isTlsV1Deprecated(), Platform.isTlsV1Supported());
}

OpenSSLProvider(String providerName, boolean includeTrustManager,
String defaultTlsProtocol) {
this(providerName, includeTrustManager, defaultTlsProtocol,
Platform.DEPRECATED_TLS_V1, Platform.ENABLED_TLS_V1);
this(providerName, includeTrustManager, defaultTlsProtocol, Platform.isTlsV1Deprecated(),
Platform.isTlsV1Supported());
}

OpenSSLProvider(String providerName, boolean includeTrustManager,
Expand Down
13 changes: 6 additions & 7 deletions openjdk/src/main/java/org/conscrypt/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@
final public class Platform {
private static final int JAVA_VERSION = javaVersion0();
private static final Method GET_CURVE_NAME_METHOD;
static boolean DEPRECATED_TLS_V1 = true;
static boolean ENABLED_TLS_V1 = false;
private static boolean DEPRECATED_TLS_V1 = true;
private static boolean ENABLED_TLS_V1 = false;
private static boolean FILTERED_TLS_V1 = false;

static {
Expand All @@ -115,14 +115,13 @@ final public class Platform {

private Platform() {}

public static void setup(boolean deprecatedTlsV1, boolean enabledTlsV1) {
public static synchronized void setup(boolean deprecatedTlsV1, boolean enabledTlsV1) {
DEPRECATED_TLS_V1 = deprecatedTlsV1;
ENABLED_TLS_V1 = enabledTlsV1;
FILTERED_TLS_V1 = !enabledTlsV1;
NativeCrypto.setTlsV1DeprecationStatus(DEPRECATED_TLS_V1, ENABLED_TLS_V1);
}


/**
* Approximates the behavior of File.createTempFile without depending on SecureRandom.
*/
Expand Down Expand Up @@ -850,15 +849,15 @@ public static boolean isJavaxCertificateSupported() {
return JAVA_VERSION < 15;
}

public static boolean isTlsV1Deprecated() {
public static synchronized boolean isTlsV1Deprecated() {
return DEPRECATED_TLS_V1;
}

public static boolean isTlsV1Filtered() {
public static synchronized boolean isTlsV1Filtered() {
return FILTERED_TLS_V1;
}

public static boolean isTlsV1Supported() {
public static synchronized boolean isTlsV1Supported() {
return ENABLED_TLS_V1;
}

Expand Down
12 changes: 6 additions & 6 deletions platform/src/main/java/org/conscrypt/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@
@Internal
final public class Platform {
private static class NoPreloadHolder { public static final Platform MAPPER = new Platform(); }
static boolean DEPRECATED_TLS_V1 = true;
static boolean ENABLED_TLS_V1 = false;
private static boolean DEPRECATED_TLS_V1 = true;
private static boolean ENABLED_TLS_V1 = false;
private static boolean FILTERED_TLS_V1 = true;

static {
Expand All @@ -96,7 +96,7 @@ private static class NoPreloadHolder { public static final Platform MAPPER = new
/**
* Runs all the setup for the platform that only needs to run once.
*/
public static void setup(boolean deprecatedTlsV1, boolean enabledTlsV1) {
public static synchronized void setup(boolean deprecatedTlsV1, boolean enabledTlsV1) {
DEPRECATED_TLS_V1 = deprecatedTlsV1;
ENABLED_TLS_V1 = enabledTlsV1;
FILTERED_TLS_V1 = !enabledTlsV1;
Expand Down Expand Up @@ -576,19 +576,19 @@ public static boolean isJavaxCertificateSupported() {
return true;
}

public static boolean isTlsV1Deprecated() {
public static synchronized boolean isTlsV1Deprecated() {
return DEPRECATED_TLS_V1;
}

public static boolean isTlsV1Filtered() {
public static synchronized boolean isTlsV1Filtered() {
Object targetSdkVersion = getTargetSdkVersion();
if ((targetSdkVersion != null) && ((int) targetSdkVersion > 35)
&& ((int) targetSdkVersion < 100))
return false;
return FILTERED_TLS_V1;
}

public static boolean isTlsV1Supported() {
public static synchronized boolean isTlsV1Supported() {
return ENABLED_TLS_V1;
}

Expand Down
Loading