forked from google/conscrypt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconscrypt.patch
245 lines (231 loc) · 10.4 KB
/
conscrypt.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
diff --git a/api-doclet/build.gradle b/api-doclet/build.gradle
index 74f015a..dfdc35b 100644
--- a/api-doclet/build.gradle
+++ b/api-doclet/build.gradle
@@ -1,7 +1,7 @@
description = 'Conscrypt: API Doclet'
dependencies {
- compile fileTree(dir: "${System.properties['java.home']}/../lib", include: '*tools.jar')
+ compile fileTree(dir: "${System.properties['java.home']}/../lib")
}
// Don't include this artifact in the distribution.
diff --git a/build.gradle b/build.gradle
index f9169b8..6079d2a 100644
--- a/build.gradle
+++ b/build.gradle
@@ -71,6 +71,7 @@ subprojects {
boringsslIncludeDir = normalizePath("$boringsslHome/include")
boringssl32BuildDir = normalizePath("$boringsslHome/build32")
boringssl64BuildDir = normalizePath("$boringsslHome/build64")
+ boringsslppc64leBuildDir = normalizePath("$boringsslHome/buildppc64le")
if (project.hasProperty("jdkHome")) {
jdkHome = project.property("jdkHome")
@@ -83,11 +84,12 @@ subprojects {
build32Bit = file("$boringssl32BuildDir").exists()
build64Bit = file("$boringssl64BuildDir").exists()
+ buildppc64le = file("$boringsslppc64leBuildDir").exists()
// Ensure the environment is configured properly.
assert file("$boringsslHome").exists()
assert file("$boringsslIncludeDir").exists()
- assert build32Bit || build64Bit
+ assert build32Bit || build64Bit || buildppc64le
assert file("$jdkHome").exists()
assert file("$jdkIncludeDir").exists()
diff --git a/constants/build.gradle b/constants/build.gradle
index c1520ac..3e0564d 100644
--- a/constants/build.gradle
+++ b/constants/build.gradle
@@ -28,6 +28,29 @@ artifacts {
}
model {
+
+
+ toolChains {
+
+ clang(Clang)
+
+ gcc(Gcc){
+ target("linux_ppc64le") {
+ cppCompiler.executable = "/usr/bin/gcc"
+ }
+ }
+ }
+ platforms {
+ x86_32 {
+ architecture "x86"
+ }
+ x86_64 {
+ architecture "x86_64"
+ }
+ linux_ppc64le {
+ architecture "linux_ppc64le"
+ }
+ }
components {
// Builds exe/ which generates the content of NativeConstants.java
gen(NativeExecutableSpec) {
diff --git a/openjdk-integ-tests/src/test/java/org/conscrypt/javax/net/ssl/SSLEngineTest.java b/openjdk-integ-tests/src/test/java/org/conscrypt/javax/net/ssl/SSLEngineTest.java
index 63fc3f5..ad073f7 100644
--- a/openjdk-integ-tests/src/test/java/org/conscrypt/javax/net/ssl/SSLEngineTest.java
+++ b/openjdk-integ-tests/src/test/java/org/conscrypt/javax/net/ssl/SSLEngineTest.java
@@ -30,6 +30,7 @@ import java.nio.ByteBuffer;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.Arrays;
+import java.util.List;
import java.util.HashSet;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
@@ -582,9 +583,13 @@ public class SSLEngineTest {
assertNotNull(session);
// By the point of the handshake where we're validating certificates,
// the hostname is known and the cipher suite should be agreed
+
assertEquals(referenceContext.host.getHostName(), session.getPeerHost());
- assertEquals(referenceEngine.getEnabledCipherSuites()[0],
- session.getCipherSuite());
+
+ String sessionSuite = session.getCipherSuite();
+ List<String> enabledSuites =
+ Arrays.asList(referenceEngine.getEnabledCipherSuites());
+ assertTrue(enabledSuites.contains(sessionSuite));
wasCalled[0] = true;
} catch (Exception e) {
throw new CertificateException("Something broke", e);
@@ -646,9 +651,13 @@ public class SSLEngineTest {
// By the point of the handshake where we're validating client certificates,
// the cipher suite should be agreed and the server's own certificates
// should have been delivered
- assertEquals(referenceEngine.getEnabledCipherSuites()[0],
- session.getCipherSuite());
+ String sessionSuite = session.getCipherSuite();
+ List<String> enabledSuites =
+ Arrays.asList(referenceEngine.getEnabledCipherSuites());
+ assertTrue(enabledSuites.contains(sessionSuite));
assertNotNull(session.getLocalCertificates());
assertEquals("CN=localhost",
((X509Certificate) session.getLocalCertificates()[0])
.getSubjectDN().getName());
diff --git a/openjdk-integ-tests/src/test/java/org/conscrypt/javax/net/ssl/SSLSocketTest.java b/openjdk-integ-tests/src/test/java/org/conscrypt/javax/net/ssl/SSLSocketTest.java
index 72bc79e..630be3e 100644
--- a/openjdk-integ-tests/src/test/java/org/conscrypt/javax/net/ssl/SSLSocketTest.java
+++ b/openjdk-integ-tests/src/test/java/org/conscrypt/javax/net/ssl/SSLSocketTest.java
@@ -511,8 +511,11 @@ public class SSLSocketTest {
// By the point of the handshake where we're validating certificates,
// the hostname is known and the cipher suite should be agreed
assertEquals(referenceContext.host.getHostName(), session.getPeerHost());
- assertEquals(referenceClientSocket.getEnabledCipherSuites()[0],
- session.getCipherSuite());
+ String sessionSuite = session.getCipherSuite();
+ List<String> enabledSuites =
+ Arrays.asList(referenceClientSocket.getEnabledCipherSuites());
+ assertTrue(enabledSuites.contains(sessionSuite));
+
wasCalled[0] = true;
} catch (Exception e) {
throw new CertificateException("Something broke", e);
@@ -592,8 +595,12 @@ public class SSLSocketTest {
// By the point of the handshake where we're validating client certificates,
// the cipher suite should be agreed and the server's own certificates
// should have been delivered
- assertEquals(referenceClientSocket.getEnabledCipherSuites()[0],
- session.getCipherSuite());
+ String sessionSuite = session.getCipherSuite();
+ List<String> enabledSuites =
+ Arrays.asList(referenceClientSocket.getEnabledCipherSuites());
+ assertTrue(enabledSuites.contains(sessionSuite));
assertNotNull(session.getLocalCertificates());
assertEquals("CN=localhost",
((X509Certificate) session.getLocalCertificates()[0])
diff --git a/openjdk-uber/build.gradle b/openjdk-uber/build.gradle
index a9078df..c987d22 100644
--- a/openjdk-uber/build.gradle
+++ b/openjdk-uber/build.gradle
@@ -3,7 +3,7 @@ description = 'Conscrypt: OpenJdk UberJAR'
ext {
buildUberJar = Boolean.parseBoolean(System.getProperty('org.conscrypt.openjdk.buildUberJar', 'false'))
uberJarClassifiers = (System.getProperty('org.conscrypt.openjdk.uberJarClassifiers',
- 'osx-x86_64,linux-x86_64,windows-x86,windows-x86_64')).split(',')
+ 'osx-x86_64,linux-x86_64,windows-x86,windows-x86_64,linux-ppc64le')).split(',')
classesDir = "${buildDir}/classes"
resourcesDir = "${buildDir}/resources"
sourcesDir = "${buildDir}/sources"
diff --git a/openjdk/build.gradle b/openjdk/build.gradle
index ef05765..61a4f2b 100644
--- a/openjdk/build.gradle
+++ b/openjdk/build.gradle
@@ -12,9 +12,11 @@ ext {
// Build the list of classifiers that will be used in the build.
arch32Name = 'x86'
arch64Name = 'x86_64'
+ archppc64leName = 'ppc64le'
nativeClassifiers = []
nativeClassifier64Bit = null
nativeClassifier32Bit = null
+ nativeClassifierppc64le = null
preferredClassifier = null
preferredSourceSet = null
preferredNativeFileDir = null
@@ -35,6 +37,17 @@ ext {
preferredNativeFileDir = nativeResourcesDir(preferredClassifier)
}
}
+ if (buildppc64le) {
+ nativeClassifierppc64le = classifierFor(osName, archppc64leName)
+
+ nativeClassifiers += nativeClassifierppc64le
+
+ if (preferredClassifier == null) {
+ preferredClassifier = nativeClassifierppc64le
+ preferredSourceSet = sourceSetName(preferredClassifier)
+ preferredNativeFileDir = nativeResourcesDir(preferredClassifier)
+ }
+ }
}
sourceSets {
@@ -298,8 +311,23 @@ model {
x86_64 {
architecture arch64Name
}
+ ppc64le {
+ architecture archppc64leName
+ }
}
+ toolChains {
+
+ clang(Clang)
+
+ gcc(Gcc){
+ target("ppc64le") {
+ cppCompiler.executable = "/usr/bin/gcc"
+ }
+ }
+ }
+
+
buildTypes {
release
}
@@ -309,6 +337,7 @@ model {
conscrypt_openjdk_jni(NativeLibrarySpec) {
if (build32Bit) { targetPlatform arch32Name }
if (build64Bit) { targetPlatform arch64Name }
+ if (buildppc64le) { targetPlatform archppc64leName }
sources {
cpp {
@@ -326,12 +355,16 @@ model {
// Set up 32-bit vs 64-bit build
def building64Bit = false
+ def buildingppc64leBit = false
def libPath
if (targetPlatform.getArchitecture().getName() == "x86") {
libPath = "$boringssl32BuildDir"
} else if (targetPlatform.getArchitecture().getName() == "x86-64") {
libPath = "$boringssl64BuildDir"
building64Bit = true
+ } else if (targetPlatform.getArchitecture().getName() == "ppc64le") {
+ libPath = "$boringsslppc64leBuildDir"
+ buildingppc64leBit = true
} else {
throw new GradleException("Unknown architecture: " +
targetPlatform.getArchitecture().name)