1 /*
2 * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 5019096
27 * @summary Add scatter/gather APIs for SSLEngine
28 * @run main/othervm Arrays SSL
29 * @run main/othervm Arrays TLS
30 * @run main/othervm Arrays SSLv3
31 * @run main/othervm Arrays TLSv1
32 * @run main/othervm Arrays TLSv1.1
33 * @run main/othervm Arrays TLSv1.2
34 * @run main/othervm Arrays TLSv1.3
35 * @run main/othervm -Djdk.tls.acknowledgeCloseNotify=true Arrays TLSv1.3
36 */
37
38 import javax.net.ssl.*;
39 import javax.net.ssl.SSLEngineResult.*;
40 import java.io.*;
41 import java.security.*;
42 import java.nio.*;
43
44 public class Arrays {
45
46 private static boolean debug = false;
47 private static boolean acknowledgeCloseNotify =
165 case "TLSv1.2":
166 break;
167 default: // TLSv1.3
168 // TLS 1.3, half-close only.
169 ssle2.closeOutbound();
170 }
171 }
172 dataDone = true;
173 }
174 }
175 }
176 checkTransfer(appOutArray1, appIn2);
177 appInArray1[appInArray1.length - 1].limit(
178 appInArray1[appInArray1.length - 1].position());
179 checkTransfer(appInArray1, appOut2);
180 }
181
182 private static String contextVersion;
183 public static void main(String args[]) throws Exception {
184 contextVersion = args[0];
185
186 Arrays test;
187
188 test = new Arrays();
189
190 test.createSSLEngines();
191
192 test.runTest();
193
194 System.err.println("Test Passed.");
195 }
196
197 /*
198 * **********************************************************
199 * Majority of the test case is above, below is just setup stuff
200 * **********************************************************
201 */
202
203 public Arrays() throws Exception {
204 sslc = getSSLContext(keyFilename, trustFilename);
|
1 /*
2 * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 5019096
27 * @summary Add scatter/gather APIs for SSLEngine
28 * @library /lib/security
29 * @run main/othervm Arrays SSL
30 * @run main/othervm Arrays TLS
31 * @run main/othervm Arrays SSLv3
32 * @run main/othervm Arrays TLSv1
33 * @run main/othervm Arrays TLSv1.1
34 * @run main/othervm Arrays TLSv1.2
35 * @run main/othervm Arrays TLSv1.3
36 * @run main/othervm -Djdk.tls.acknowledgeCloseNotify=true Arrays TLSv1.3
37 */
38
39 import javax.net.ssl.*;
40 import javax.net.ssl.SSLEngineResult.*;
41 import java.io.*;
42 import java.security.*;
43 import java.nio.*;
44
45 public class Arrays {
46
47 private static boolean debug = false;
48 private static boolean acknowledgeCloseNotify =
166 case "TLSv1.2":
167 break;
168 default: // TLSv1.3
169 // TLS 1.3, half-close only.
170 ssle2.closeOutbound();
171 }
172 }
173 dataDone = true;
174 }
175 }
176 }
177 checkTransfer(appOutArray1, appIn2);
178 appInArray1[appInArray1.length - 1].limit(
179 appInArray1[appInArray1.length - 1].position());
180 checkTransfer(appInArray1, appOut2);
181 }
182
183 private static String contextVersion;
184 public static void main(String args[]) throws Exception {
185 contextVersion = args[0];
186 // Re-enable context version if it is disabled.
187 // If context version is SSLv3, TLSv1 needs to be re-enabled.
188 if (contextVersion.equals("SSLv3")) {
189 SecurityUtils.removeFromDisabledTlsAlgs("TLSv1");
190 } else if (contextVersion.equals("TLSv1") ||
191 contextVersion.equals("TLSv1.1")) {
192 SecurityUtils.removeFromDisabledTlsAlgs(contextVersion);
193 }
194
195 Arrays test;
196
197 test = new Arrays();
198
199 test.createSSLEngines();
200
201 test.runTest();
202
203 System.err.println("Test Passed.");
204 }
205
206 /*
207 * **********************************************************
208 * Majority of the test case is above, below is just setup stuff
209 * **********************************************************
210 */
211
212 public Arrays() throws Exception {
213 sslc = getSSLContext(keyFilename, trustFilename);
|