Skip to content

Commit 6cfc4bc

Browse files
committed
Merge master jdk-17.0.5+5 into openj9-staging
Signed-off-by: J9 Build <[email protected]>
2 parents 2c6e9f8 + bf5b0f9 commit 6cfc4bc

File tree

4 files changed

+98
-5
lines changed

4 files changed

+98
-5
lines changed

src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11SecretKeyFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -69,6 +69,7 @@ final class P11SecretKeyFactory extends SecretKeyFactorySpi {
6969
addKeyType("AES", CKK_AES);
7070
addKeyType("Blowfish", CKK_BLOWFISH);
7171
addKeyType("ChaCha20", CKK_CHACHA20);
72+
addKeyType("ChaCha20-Poly1305", CKK_CHACHA20);
7273

7374
// we don't implement RC2 or IDEA, but we want to be able to generate
7475
// keys for those SSL/TLS ciphersuites.

test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,8 @@ private static void testMemorySoftLimit(String valueToSet, String expectedTraceV
114114
private static void testOOM(String dockerMemLimit, int sizeToAllocInMb) throws Exception {
115115
Common.logNewTestCase("OOM");
116116

117-
// add "--memory-swappiness 0" so as to disable anonymous page swapping.
118117
DockerRunOptions opts = Common.newOpts(imageName, "AttemptOOM")
119-
.addDockerOpts("--memory", dockerMemLimit, "--memory-swappiness", "0", "--memory-swap", dockerMemLimit);
118+
.addDockerOpts("--memory", dockerMemLimit, "--memory-swap", dockerMemLimit);
120119
opts.classParams.add("" + sizeToAllocInMb);
121120

122121
// make sure we avoid inherited Xmx settings from the jtreg vmoptions

test/jdk/jdk/jfr/api/recording/dump/TestDumpDevNull.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@
2424
package jdk.jfr.api.recording.dump;
2525

2626
import java.nio.file.Path;
27-
2827
import jdk.jfr.Recording;
2928

3029
/**
3130
* @test
3231
* @summary Tests that it's possible to dump to /dev/null without a livelock
3332
* @key jfr
34-
* @requires vm.hasJFR
33+
* @requires vm.hasJFR & (os.family != "windows")
3534
* @library /test/lib
3635
* @run main/othervm -Xlog:jfr jdk.jfr.api.recording.dump.TestDumpDevNull
3736
*/
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/*
2+
* Copyright (c) 2022, Red Hat, Inc.
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 8288985
27+
* @summary Tests that P11TlsKeyMaterialGenerator works with ChaCha20-Poly1305
28+
* @library /test/lib ..
29+
* @modules java.base/sun.security.internal.spec
30+
* jdk.crypto.cryptoki
31+
* @run main/othervm TestKeyMaterialChaCha20
32+
*/
33+
34+
import javax.crypto.KeyGenerator;
35+
import javax.crypto.SecretKey;
36+
import java.security.Provider;
37+
import java.security.NoSuchAlgorithmException;
38+
import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec;
39+
import sun.security.internal.spec.TlsMasterSecretParameterSpec;
40+
import sun.security.internal.spec.TlsKeyMaterialParameterSpec;
41+
42+
43+
public class TestKeyMaterialChaCha20 extends PKCS11Test {
44+
45+
public static void main(String[] args) throws Exception {
46+
main(new TestKeyMaterialChaCha20(), args);
47+
}
48+
49+
@Override
50+
public void main(Provider provider) throws Exception {
51+
KeyGenerator kg1, kg2, kg3;
52+
try {
53+
kg1 = KeyGenerator.getInstance("SunTlsRsaPremasterSecret", provider);
54+
} catch (Exception e) {
55+
System.out.println("Skipping, SunTlsRsaPremasterSecret KeyGenerator not supported");
56+
return;
57+
}
58+
try {
59+
kg2 = KeyGenerator.getInstance("SunTls12MasterSecret", provider);
60+
} catch (Exception e) {
61+
System.out.println("Skipping, SunTls12MasterSecret KeyGenerator not supported");
62+
return;
63+
}
64+
try {
65+
kg3 = KeyGenerator.getInstance("SunTls12KeyMaterial", provider);
66+
} catch (Exception e) {
67+
System.out.println("Skipping, SunTls12KeyMaterial KeyGenerator not supported");
68+
return;
69+
}
70+
71+
kg1.init(new TlsRsaPremasterSecretParameterSpec(0x0303, 0x0303));
72+
SecretKey preMasterSecret = kg1.generateKey();
73+
74+
TlsMasterSecretParameterSpec spec = new TlsMasterSecretParameterSpec(
75+
preMasterSecret,
76+
3, 3,
77+
new byte[32],
78+
new byte[32],
79+
"SHA-256", 32, 64);
80+
kg2.init(spec);
81+
SecretKey masterSecret = kg2.generateKey();
82+
83+
TlsKeyMaterialParameterSpec params = new TlsKeyMaterialParameterSpec(
84+
masterSecret, 3, 3,
85+
new byte[32],
86+
new byte[32],
87+
"ChaCha20-Poly1305", 32, 32,
88+
12, 0,
89+
"SHA-256", 32, 64);
90+
kg3.init(params);
91+
kg3.generateKey();
92+
}
93+
94+
}

0 commit comments

Comments
 (0)