Skip to content

Commit

Permalink
Merge branch 'openjdk:master' into pr_windows_system_dump_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
stooke authored Dec 12, 2024
2 parents 58e34a8 + 18e0b34 commit 8af708a
Show file tree
Hide file tree
Showing 34 changed files with 867 additions and 249 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ HeapWord* ShenandoahFreeSet::allocate_single(ShenandoahAllocRequest& req, bool&
// Free set maintains mutator and collector partitions. Normally, each allocates only from its partition,
// except in special cases when the collector steals regions from the mutator partition.

// Overwrite with non-zero (non-NULL) values only if necessary for allocation bookkeeping.
// Overwrite with non-zero (non-null) values only if necessary for allocation bookkeeping.

switch (req.type()) {
case ShenandoahAllocRequest::_alloc_tlab:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ void ShenandoahGenerationalEvacuationTask::promote_in_place(ShenandoahHeapRegion
while (obj_addr < tams) {
oop obj = cast_to_oop(obj_addr);
if (marking_context->is_marked(obj)) {
assert(obj->klass() != nullptr, "klass should not be NULL");
assert(obj->klass() != nullptr, "klass should not be null");
// This thread is responsible for registering all objects in this region. No need for lock.
scanner->register_object_without_lock(obj_addr);
obj_addr += obj->size();
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/gc/z/zUtils.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -25,8 +25,6 @@
#include "gc/z/zUtils.hpp"
#include "runtime/nonJavaThread.hpp"

#include <algorithm>

const char* ZUtils::thread_name() {
const Thread* const thread = Thread::current();
if (thread->is_Named_thread()) {
Expand All @@ -38,5 +36,7 @@ const char* ZUtils::thread_name() {
}

void ZUtils::fill(uintptr_t* addr, size_t count, uintptr_t value) {
std::fill_n(addr, count, value);
for (size_t i = 0; i < count; ++i) {
addr[i] = value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,22 @@ public static void registerDefaultAlgorithms() {
XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA512,
new Algorithm("EC", "SHA512withECDSA", "Signature")
);
algorithmsMap.put(
XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_224,
new Algorithm("EC", "SHA3-224withECDSA", "Signature")
);
algorithmsMap.put(
XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_256,
new Algorithm("EC", "SHA3-256withECDSA", "Signature")
);
algorithmsMap.put(
XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_384,
new Algorithm("EC", "SHA3-384withECDSA", "Signature")
);
algorithmsMap.put(
XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_512,
new Algorithm("EC", "SHA3-512withECDSA", "Signature")
);
algorithmsMap.put(
XMLSignature.ALGO_ID_SIGNATURE_ECDSA_RIPEMD160,
new Algorithm("EC", "RIPEMD160withECDSA", "Signature")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static MessageDigestAlgorithm getInstance(
return new MessageDigestAlgorithm(doc, algorithmURI);
}

private static MessageDigest getDigestInstance(String algorithmURI) throws XMLSignatureException {
public static MessageDigest getDigestInstance(String algorithmURI) throws XMLSignatureException {
String algorithmID = JCEMapper.translateURItoJCEID(algorithmURI);

if (algorithmID == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,18 @@ public static void registerDefaultAlgorithms() {
algorithmHash.put(
XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA512, SignatureECDSA.SignatureECDSASHA512.class
);
algorithmHash.put(
XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_224, SignatureECDSA.SignatureECDSASHA3_224.class
);
algorithmHash.put(
XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_256, SignatureECDSA.SignatureECDSASHA3_256.class
);
algorithmHash.put(
XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_384, SignatureECDSA.SignatureECDSASHA3_384.class
);
algorithmHash.put(
XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_512, SignatureECDSA.SignatureECDSASHA3_512.class
);
algorithmHash.put(
XMLSignature.ALGO_ID_SIGNATURE_ECDSA_RIPEMD160, SignatureECDSA.SignatureECDSARIPEMD160.class
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,46 @@ public static byte[] convertXMLDSIGtoASN1(byte[] xmldsigBytes) throws IOExceptio
"0340340340340340340340340340340340340340340340340340340323c313fab50589703b5ec68d3587fec60d161cc149c1ad4a91",
0x2760)
);

ecCurveDefinitions.add(
new ECCurveDefinition(
"brainpoolP256r1 [RFC 5639]",
"1.3.36.3.3.2.8.1.1.7",
"a9fb57dba1eea9bc3e660a909d838d726e3bf623d52620282013481d1f6e5377",
"7d5a0975fc2c3057eef67530417affe7fb8055c126dc5c6ce94a4b44f330b5d9",
"26dc5c6ce94a4b44f330b5d9bbd77cbf958416295cf7e1ce6bccdc18ff8c07b6",
"8bd2aeb9cb7e57cb2c4b482ffc81b7afb9de27e1e3bd23c23a4453bd9ace3262",
"547ef835c3dac4fd97f8461a14611dc9c27745132ded8e545c1d54c72f046997",
"a9fb57dba1eea9bc3e660a909d838d718c397aa3b561a6f7901e0e82974856a7",
1)
);

ecCurveDefinitions.add(
new ECCurveDefinition(
"brainpoolP384r1 [RFC 5639]",
"1.3.36.3.3.2.8.1.1.11",
"8cb91e82a3386d280f5d6f7e50e641df152f7109ed5456b412b1da197fb71123acd3a729901d1a71874700133107ec53",
"7bc382c63d8c150c3c72080ace05afa0c2bea28e4fb22787139165efba91f90f8aa5814a503ad4eb04a8c7dd22ce2826",
"04a8c7dd22ce28268b39b55416f0447c2fb77de107dcd2a62e880ea53eeb62d57cb4390295dbc9943ab78696fa504c11",
"1d1c64f068cf45ffa2a63a81b7c13f6b8847a3e77ef14fe3db7fcafe0cbd10e8e826e03436d646aaef87b2e247d4af1e",
"8abe1d7520f9c2a45cb1eb8e95cfd55262b70b29feec5864e19c054ff99129280e4646217791811142820341263c5315",
"8cb91e82a3386d280f5d6f7e50e641df152f7109ed5456b31f166e6cac0425a7cf3ab6af6b7fc3103b883202e9046565",
1)
);

ecCurveDefinitions.add(
new ECCurveDefinition(
"brainpoolP512r1 [RFC 5639]",
"1.3.36.3.3.2.8.1.1.13",
"aadd9db8dbe9c48b3fd4e6ae33c9fc07cb308db3b3c9d20ed6639cca703308717d4d9b009bc66842aecda12ae6a380e62881ff2f2d82c68528aa6056583a48f3",
"7830a3318b603b89e2327145ac234cc594cbdd8d3df91610a83441caea9863bc2ded5d5aa8253aa10a2ef1c98b9ac8b57f1117a72bf2c7b9e7c1ac4d77fc94ca",
"3df91610a83441caea9863bc2ded5d5aa8253aa10a2ef1c98b9ac8b57f1117a72bf2c7b9e7c1ac4d77fc94cadc083e67984050b75ebae5dd2809bd638016f723",
"81aee4bdd82ed9645a21322e9c4c6a9385ed9f70b5d916c1b43b62eef4d0098eff3b1f78e2d0d48d50d1687b93b97d5f7c6d5047406a5e688b352209bcb9f822",
"7dde385d566332ecc0eabfa9cf7822fdf209f70024a57b1aa000c55b881f8111b2dcde494a5f485e5bca4bd88a2763aed1ca2b2fa8f0540678cd1e0f3ad80892",
"aadd9db8dbe9c48b3fd4e6ae33c9fc07cb308db3b3c9d20ed6639cca70330870553e5c414ca92619418661197fac10471db1d381085ddaddb58796829ca90069",
1)
);

}

public static String getOIDFromPublicKey(ECPublicKey ecPublicKey) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ public SignatureBaseRSA() throws XMLSignatureException {
public SignatureBaseRSA(Provider provider) throws XMLSignatureException {
String algorithmID = JCEMapper.translateURItoJCEID(this.engineGetURI());
this.signatureAlgorithm = getSignature(provider, algorithmID);
LOG.debug("Created SignatureRSA using {0} and provider {1}",
algorithmID, signatureAlgorithm.getProvider());
LOG.debug("Created SignatureRSA using {0}", algorithmID);
}

Signature getSignature(Provider provider, String algorithmID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,110 @@ public String engineGetURI() {
}
}

/**
* Class SignatureECDSASHA3-224
*
*/
public static class SignatureECDSASHA3_224 extends SignatureECDSA {

/**
* Constructor SignatureECDSASHA3-224
*
* @throws XMLSignatureException
*/
public SignatureECDSASHA3_224() throws XMLSignatureException {
super();
}

public SignatureECDSASHA3_224(Provider provider) throws XMLSignatureException {
super(provider);
}

/** {@inheritDoc} */
@Override
public String engineGetURI() {
return XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_224;
}
}

/**
* Class SignatureECDSASHA3-256
*
*/
public static class SignatureECDSASHA3_256 extends SignatureECDSA {

/**
* Constructor SignatureECDSASHA3-256
*
* @throws XMLSignatureException
*/
public SignatureECDSASHA3_256() throws XMLSignatureException {
super();
}

public SignatureECDSASHA3_256(Provider provider) throws XMLSignatureException {
super(provider);
}

/** {@inheritDoc} */
@Override
public String engineGetURI() {
return XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_256;
}
}

/**
* Class SignatureECDSASHA3-384
*
*/
public static class SignatureECDSASHA3_384 extends SignatureECDSA {

/**
* Constructor SignatureECDSASHA3-384
*
* @throws XMLSignatureException
*/
public SignatureECDSASHA3_384() throws XMLSignatureException {
super();
}

public SignatureECDSASHA3_384(Provider provider) throws XMLSignatureException {
super(provider);
}

/** {@inheritDoc} */
@Override
public String engineGetURI() {
return XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_384;
}
}

/**
* Class SignatureECDSASHA3-512
*
*/
public static class SignatureECDSASHA3_512 extends SignatureECDSA {

/**
* Constructor SignatureECDSASHA3-512
*
* @throws XMLSignatureException
*/
public SignatureECDSASHA3_512() throws XMLSignatureException {
super();
}

public SignatureECDSASHA3_512(Provider provider) throws XMLSignatureException {
super(provider);
}

/** {@inheritDoc} */
@Override
public String engineGetURI() {
return XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_512;
}
}

/**
* Class SignatureECDSARIPEMD160
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,7 @@
import javax.crypto.SecretKey;

import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
import com.sun.org.apache.xml.internal.security.keys.content.DEREncodedKeyValue;
import com.sun.org.apache.xml.internal.security.keys.content.KeyInfoReference;
import com.sun.org.apache.xml.internal.security.keys.content.KeyName;
import com.sun.org.apache.xml.internal.security.keys.content.KeyValue;
import com.sun.org.apache.xml.internal.security.keys.content.MgmtData;
import com.sun.org.apache.xml.internal.security.keys.content.PGPData;
import com.sun.org.apache.xml.internal.security.keys.content.RetrievalMethod;
import com.sun.org.apache.xml.internal.security.keys.content.SPKIData;
import com.sun.org.apache.xml.internal.security.keys.content.X509Data;
import com.sun.org.apache.xml.internal.security.keys.content.*;
import com.sun.org.apache.xml.internal.security.keys.content.keyvalues.DSAKeyValue;
import com.sun.org.apache.xml.internal.security.keys.content.keyvalues.RSAKeyValue;
import com.sun.org.apache.xml.internal.security.keys.keyresolver.KeyResolver;
Expand All @@ -50,7 +42,6 @@
import com.sun.org.apache.xml.internal.security.transforms.Transforms;
import com.sun.org.apache.xml.internal.security.utils.Constants;
import com.sun.org.apache.xml.internal.security.utils.ElementProxy;
import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy;
import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
Expand Down Expand Up @@ -88,7 +79,7 @@
* contains the corresponding type.
*
*/
public class KeyInfo extends SignatureElementProxy {
public class KeyInfo extends ElementProxy {

private static final com.sun.org.slf4j.internal.Logger LOG =
com.sun.org.slf4j.internal.LoggerFactory.getLogger(KeyInfo.class);
Expand Down Expand Up @@ -231,12 +222,24 @@ public void add(RSAKeyValue rsakeyvalue) {
}

/**
* Method add
* Method adds public key encoded as KeyValue. If public key type is not supported by KeyValue, then
* DEREncodedKeyValue is used. If public key type is not supported by DEREncodedKeyValue, then
* IllegalArgumentException is thrown.
*
* @param pk
* @param pk public key to be added to KeyInfo
*/
public void add(PublicKey pk) {
this.add(new KeyValue(getDocument(), pk));
public void add(PublicKey pk) {

if (KeyValue.isSupportedKeyType(pk)) {
this.add(new KeyValue(getDocument(), pk));
return;
}

try {
this.add(new DEREncodedKeyValue(getDocument(), pk));
} catch (XMLSecurityException ex) {
throw new IllegalArgumentException(ex);
}
}

/**
Expand Down Expand Up @@ -772,6 +775,7 @@ public boolean containsKeyInfoReference() {
return this.lengthKeyInfoReference() > 0;
}


/**
* This method returns the public key.
*
Expand Down Expand Up @@ -1188,4 +1192,10 @@ public void addStorageResolver(StorageResolver storageResolver) {
public String getBaseLocalName() {
return Constants._TAG_KEYINFO;
}

/** {@inheritDoc} */
@Override
public String getBaseNamespace() {
return Constants.SignatureSpecNS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
public class DEREncodedKeyValue extends Signature11ElementProxy implements KeyInfoContent {

/** JCA algorithm key types supported by this implementation. */
private static final String[] supportedKeyTypes = { "RSA", "DSA", "EC"};
private static final String[] supportedKeyTypes = { "RSA", "DSA", "EC",
"DiffieHellman", "DH", "XDH", "X25519", "X448",
"EdDSA", "Ed25519", "Ed448",
"RSASSA-PSS"};

/**
* Constructor DEREncodedKeyValue
Expand Down Expand Up @@ -144,5 +147,4 @@ protected byte[] getEncodedDER(PublicKey publicKey) throws XMLSecurityException
throw new XMLSecurityException(e, "DEREncodedKeyValue.UnsupportedPublicKey", exArgs);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
* (section 6.4). The KeyValue element may include externally defined public
* keys values represented as PCDATA or element types from an external
* namespace.
*
*/
public class KeyValue extends SignatureElementProxy implements KeyInfoContent {

Expand Down Expand Up @@ -120,6 +119,20 @@ public KeyValue(Document doc, PublicKey pk) {
}
}

/**
* Verifies that the XML KeyValue encoding is supported for the given key type. If the
* encoding is supported, it returns true else false.
*
* @return true if the public key has a KeyValue encoding, false otherwise.
*/
public static boolean isSupportedKeyType(PublicKey publicKey) {

return publicKey instanceof java.security.interfaces.DSAPublicKey
|| publicKey instanceof java.security.interfaces.RSAPublicKey
|| publicKey instanceof java.security.interfaces.ECPublicKey;

}

/**
* Constructor KeyValue
*
Expand Down
Loading

0 comments on commit 8af708a

Please sign in to comment.