Skip to content

Commit ae33ae7

Browse files
committed
backport 640b71da48c41e1f216f6bee1e7871961322cf53
1 parent ab5cf6f commit ae33ae7

File tree

4 files changed

+75
-63
lines changed

4 files changed

+75
-63
lines changed

src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_convert.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,8 +1317,7 @@ jobject ckAttributeValueToJObject(JNIEnv *env, const CK_ATTRIBUTE_PTR ckpAttribu
13171317
case CKA_OWNER:
13181318
case CKA_AC_ISSUER:
13191319
case CKA_ATTR_TYPES:
1320-
case CKA_ECDSA_PARAMS:
1321-
/* CKA_EC_PARAMS is the same, these two are equivalent */
1320+
case CKA_EC_PARAMS:
13221321
case CKA_EC_POINT:
13231322
case CKA_PRIVATE_EXPONENT:
13241323
case CKA_PRIME_1:

src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_keymgmt.c

Lines changed: 56 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
33
*/
44

55
/* Copyright (c) 2002 Graz University of Technology. All rights reserved.
@@ -56,69 +56,78 @@
5656

5757
#ifdef P11_ENABLE_GETNATIVEKEYINFO
5858

59-
#define CK_ATTRIBUTES_TEMPLATE_LENGTH (CK_ULONG)61U
59+
#define CK_ATTRIBUTES_TEMPLATE_LENGTH (CK_ULONG)60U
6060

61+
// Group attributes based on their value types; put attributes whose values
62+
// requiring address alignments, e.g. CK_ULONG, first
6163
static CK_ATTRIBUTE ckpAttributesTemplate[CK_ATTRIBUTES_TEMPLATE_LENGTH] = {
62-
{CKA_CLASS, 0, 0},
63-
{CKA_TOKEN, 0, 0},
64-
{CKA_PRIVATE, 0, 0},
65-
{CKA_LABEL, 0, 0},
66-
{CKA_APPLICATION, 0, 0},
67-
{CKA_VALUE, 0, 0},
68-
{CKA_OBJECT_ID, 0, 0},
64+
// CK_ULONG
6965
{CKA_CERTIFICATE_TYPE, 0, 0},
70-
{CKA_ISSUER, 0, 0},
71-
{CKA_SERIAL_NUMBER, 0, 0},
72-
{CKA_AC_ISSUER, 0, 0},
73-
{CKA_OWNER, 0, 0},
74-
{CKA_ATTR_TYPES, 0, 0},
75-
{CKA_TRUSTED, 0, 0},
66+
{CKA_CLASS, 0, 0},
67+
{CKA_HW_FEATURE_TYPE, 0, 0},
68+
{CKA_KEY_GEN_MECHANISM, 0, 0},
7669
{CKA_KEY_TYPE, 0, 0},
77-
{CKA_SUBJECT, 0, 0},
78-
{CKA_ID, 0, 0},
79-
{CKA_SENSITIVE, 0, 0},
80-
{CKA_ENCRYPT, 0, 0},
81-
{CKA_DECRYPT, 0, 0},
82-
{CKA_WRAP, 0, 0},
83-
{CKA_UNWRAP, 0, 0},
84-
{CKA_SIGN, 0, 0},
85-
{CKA_SIGN_RECOVER, 0, 0},
86-
{CKA_VERIFY, 0, 0},
87-
{CKA_VERIFY_RECOVER, 0, 0},
88-
{CKA_DERIVE, 0, 0},
89-
{CKA_START_DATE, 0, 0},
90-
{CKA_END_DATE, 0, 0},
91-
{CKA_MODULUS, 0, 0},
9270
{CKA_MODULUS_BITS, 0, 0},
93-
{CKA_PUBLIC_EXPONENT, 0, 0},
94-
{CKA_PRIVATE_EXPONENT, 0, 0},
95-
{CKA_PRIME_1, 0, 0},
96-
{CKA_PRIME_2, 0, 0},
97-
{CKA_EXPONENT_1, 0, 0},
98-
{CKA_EXPONENT_2, 0, 0},
99-
{CKA_COEFFICIENT, 0, 0},
100-
{CKA_PRIME, 0, 0},
101-
{CKA_SUBPRIME, 0, 0},
102-
{CKA_BASE, 0, 0},
10371
{CKA_PRIME_BITS, 0, 0},
10472
{CKA_SUB_PRIME_BITS, 0, 0},
10573
{CKA_VALUE_BITS, 0, 0},
10674
{CKA_VALUE_LEN, 0, 0},
75+
// CK_BBOOL
76+
{CKA_ALWAYS_SENSITIVE, 0, 0},
77+
{CKA_DECRYPT, 0, 0},
78+
{CKA_DERIVE, 0, 0},
79+
{CKA_ENCRYPT, 0, 0},
10780
{CKA_EXTRACTABLE, 0, 0},
81+
{CKA_HAS_RESET, 0, 0},
10882
{CKA_LOCAL, 0, 0},
109-
{CKA_NEVER_EXTRACTABLE, 0, 0},
110-
{CKA_ALWAYS_SENSITIVE, 0, 0},
111-
{CKA_KEY_GEN_MECHANISM, 0, 0},
11283
{CKA_MODIFIABLE, 0, 0},
113-
{CKA_ECDSA_PARAMS, 0, 0},
84+
{CKA_NEVER_EXTRACTABLE, 0, 0},
85+
{CKA_PRIVATE, 0, 0},
86+
{CKA_RESET_ON_INIT, 0, 0},
87+
{CKA_SENSITIVE, 0, 0},
88+
{CKA_SIGN, 0, 0},
89+
{CKA_SIGN_RECOVER, 0, 0},
90+
{CKA_TOKEN, 0, 0},
91+
{CKA_TRUSTED, 0, 0},
92+
{CKA_UNWRAP, 0, 0},
93+
{CKA_VERIFY, 0, 0},
94+
{CKA_VERIFY_RECOVER, 0, 0},
95+
{CKA_WRAP, 0, 0},
96+
// PTR: byte[]
97+
{CKA_AC_ISSUER, 0, 0},
98+
{CKA_ATTR_TYPES, 0, 0},
99+
{CKA_BASE, 0, 0},
100+
{CKA_COEFFICIENT, 0, 0},
114101
{CKA_EC_PARAMS, 0, 0},
115102
{CKA_EC_POINT, 0, 0},
103+
{CKA_EXPONENT_1, 0, 0},
104+
{CKA_EXPONENT_2, 0, 0},
105+
{CKA_ID, 0, 0},
106+
{CKA_ISSUER, 0, 0},
107+
{CKA_MODULUS, 0, 0},
108+
{CKA_OBJECT_ID, 0, 0},
109+
{CKA_OWNER, 0, 0},
110+
{CKA_PRIME, 0, 0},
111+
{CKA_PRIME_1, 0, 0},
112+
{CKA_PRIME_2, 0, 0},
113+
{CKA_PRIVATE_EXPONENT, 0, 0},
114+
{CKA_PUBLIC_EXPONENT, 0, 0},
115+
{CKA_SERIAL_NUMBER, 0, 0},
116+
{CKA_SUBJECT, 0, 0},
117+
{CKA_SUBPRIME, 0, 0},
118+
{CKA_VALUE, 0, 0},
119+
// PTR: CK_UTF8CHAR[]
120+
{CKA_APPLICATION, 0, 0},
121+
{CKA_LABEL, 0, 0},
122+
// PTR: CK_DATE
123+
{CKA_START_DATE, 0, 0},
124+
{CKA_END_DATE, 0, 0},
125+
// deprecated
116126
{CKA_SECONDARY_AUTH, 0, 0},
117127
{CKA_AUTH_PIN_FLAGS, 0, 0},
118-
{CKA_HW_FEATURE_TYPE, 0, 0},
119-
{CKA_RESET_ON_INIT, 0, 0},
120-
{CKA_HAS_RESET, 0, 0},
128+
// misc
121129
{CKA_VENDOR_DEFINED, 0, 0},
130+
// keep this at the end to match the impl in getNativeKeyInfo(...)
122131
{CKA_NETSCAPE_DB, 0, 0},
123132
};
124133

test/jdk/java/io/File/MaxPathLength.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2025, 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
@@ -60,14 +60,7 @@ public static void main(String[] args) throws Exception {
6060

6161
// test long paths on windows
6262
// And these long pathes cannot be handled on Solaris and Mac platforms
63-
if (isWindows) {
64-
String name = fileName;
65-
while (name.length() < MAX_LENGTH) {
66-
testLongPath (20, name, false);
67-
testLongPath (20, name, true);
68-
name = getNextName(name);
69-
}
70-
}
63+
testLongPathOnWindows();
7164
}
7265

7366
private static String getNextName(String fName) {
@@ -199,4 +192,15 @@ static void testLongPath(int max, String fn,
199192
}
200193
}
201194
}
195+
196+
private static void testLongPathOnWindows () throws Exception {
197+
if (isWindows) {
198+
String name = fileName;
199+
while (name.length() < MAX_LENGTH) {
200+
testLongPath (20, name, false);
201+
testLongPath (20, name, true);
202+
name = getNextName(name);
203+
}
204+
}
205+
}
202206
}

test/jdk/java/net/httpclient/HttpsTunnelAuthTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,11 @@
3737
import java.util.stream.Stream;
3838
import javax.net.ssl.SSLContext;
3939
import jdk.httpclient.test.lib.common.HttpServerAdapters;
40-
import jdk.httpclient.test.lib.http2.Http2TestServer;
4140
import jdk.test.lib.net.SimpleSSLContext;
4241

4342
import static java.lang.System.out;
4443

45-
/**
44+
/*
4645
* @test
4746
* @bug 8262027
4847
* @summary Verify that it's possible to handle proxy authentication manually
@@ -62,7 +61,7 @@
6261
//-Djdk.internal.httpclient.debug=true -Dtest.debug=true
6362
public class HttpsTunnelAuthTest implements HttpServerAdapters, AutoCloseable {
6463

65-
static final String data[] = {
64+
static final String[] data = {
6665
"Lorem ipsum",
6766
"dolor sit amet",
6867
"consectetur adipiscing elit, sed do eiusmod tempor",
@@ -150,7 +149,7 @@ void setUp() throws IOException {
150149

151150
@Override
152151
public void close() throws Exception {
153-
if (proxy != null) close(proxy::stop);
152+
if (proxy != null) close(proxy);
154153
if (http1Server != null) close(http1Server::stop);
155154
if (https1Server != null) close(https1Server::stop);
156155
if (https2Server != null) close(https2Server::stop);
@@ -160,7 +159,8 @@ private void close(AutoCloseable closeable) {
160159
try {
161160
closeable.close();
162161
} catch (Exception x) {
163-
// OK.
162+
// OK to ignore and just log
163+
System.err.println("ignoring failure during close() of " + closeable + " due to: " + x);
164164
}
165165
}
166166

0 commit comments

Comments
 (0)