Skip to content

Commit

Permalink
Merge pull request #720 from JasonFengJ9/mergetmp
Browse files Browse the repository at this point in the history
Merge master jdk-11.0.21+9 into openj9-staging
  • Loading branch information
keithc-ca authored Oct 18, 2023
2 parents bf1e281 + 090e722 commit 45b9d06
Show file tree
Hide file tree
Showing 58 changed files with 1,301 additions and 376 deletions.
4 changes: 4 additions & 0 deletions closed/JPP.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ J9TOOLS_DIR := $(SUPPORT_OUTPUTDIR)/j9tools
JPP_JAR := $(J9TOOLS_DIR)/jpp.jar
JPP_TAGS := PLATFORM-$(OPENJ9_PLATFORM_CODE)

ifeq (true,$(OPENJ9_ENABLE_CRAC_SUPPORT))
JPP_TAGS += CRAC_SUPPORT
endif # OPENJ9_ENABLE_CRAC_SUPPORT

ifeq (true,$(OPENJ9_ENABLE_CRIU_SUPPORT))
JPP_TAGS += CRIU_SUPPORT
endif # OPENJ9_ENABLE_CRIU_SUPPORT
Expand Down
13 changes: 13 additions & 0 deletions closed/OpenJ9.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,13 @@ else
FEATURE_SED_SCRIPT += $(call SedDisable,opt_jitserver)
endif

# Adjust CRAC Support enablement flags.
ifeq (true,$(OPENJ9_ENABLE_CRAC_SUPPORT))
FEATURE_SED_SCRIPT += $(call SedEnable,opt_cracSupport)
else # OPENJ9_ENABLE_CRAC_SUPPORT
FEATURE_SED_SCRIPT += $(call SedDisable,opt_cracSupport)
endif # OPENJ9_ENABLE_CRAC_SUPPORT

# Adjust CRIU Support enablement flags.
ifeq (true,$(OPENJ9_ENABLE_CRIU_SUPPORT))
FEATURE_SED_SCRIPT += $(call SedEnable,opt_criuSupport)
Expand Down Expand Up @@ -438,6 +445,12 @@ ifeq (true,$(OPENJ9_ENABLE_CMAKE))
CMAKE_ARGS += -DJ9VM_OPT_CUDA=OFF
endif # OPENJ9_ENABLE_CUDA

ifeq (true,$(OPENJ9_ENABLE_CRAC_SUPPORT))
CMAKE_ARGS += -DJ9VM_OPT_CRAC_SUPPORT=ON
else # OPENJ9_ENABLE_CRAC_SUPPORT
CMAKE_ARGS += -DJ9VM_OPT_CRAC_SUPPORT=OFF
endif # OPENJ9_ENABLE_CRAC_SUPPORT

ifeq (true,$(OPENJ9_ENABLE_CRIU_SUPPORT))
CMAKE_ARGS += -DJ9VM_OPT_CRIU_SUPPORT=ON
else # OPENJ9_ENABLE_CRIU_SUPPORT
Expand Down
30 changes: 29 additions & 1 deletion closed/autoconf/custom-hook.m4
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ AC_DEFUN_ONCE([CUSTOM_EARLY_HOOK],
OPENJ9_PLATFORM_SETUP
OPENJ9_CONFIGURE_CMAKE
OPENJ9_CONFIGURE_COMPILERS
OPENJ9_CONFIGURE_CRAC_SUPPORT
OPENJ9_CONFIGURE_CRIU_SUPPORT
OPENJ9_CONFIGURE_CUDA
OPENJ9_CONFIGURE_DDR
Expand Down Expand Up @@ -365,10 +366,37 @@ AC_DEFUN([OPENJ9_CONFIGURE_JITSERVER],
AC_SUBST(OPENJ9_ENABLE_JITSERVER)
])

AC_DEFUN([OPENJ9_CONFIGURE_CRAC_SUPPORT],
[
AC_MSG_CHECKING([for CRAC support])
AC_ARG_ENABLE([crac-support], [AS_HELP_STRING([--enable-crac-support], [enable CRAC support @<:@platform dependent@:>@])])
OPENJ9_ENABLE_CRAC_SUPPORT=false
if test "x$enable_crac_support" = xyes ; then
AC_MSG_RESULT([yes (explicitly enabled)])
OPENJ9_ENABLE_CRAC_SUPPORT=true
elif test "x$enable_crac_support" = xno ; then
AC_MSG_RESULT([no (explicitly disabled)])
elif test "x$enable_crac_support" = x ; then
case "$OPENJ9_PLATFORM_CODE" in
xa64)
AC_MSG_RESULT([yes (default)])
OPENJ9_ENABLE_CRAC_SUPPORT=true
;;
*)
AC_MSG_RESULT([no (default)])
;;
esac
else
AC_MSG_ERROR([--enable-crac-support accepts no argument])
fi
AC_SUBST(OPENJ9_ENABLE_CRAC_SUPPORT)
])

AC_DEFUN([OPENJ9_CONFIGURE_CRIU_SUPPORT],
[
AC_MSG_CHECKING([for CRIU support])
AC_ARG_ENABLE([criu-support], [AS_HELP_STRING([--enable-criu-support], [enable CRIU support @<:@disabled@:>@])])
AC_ARG_ENABLE([criu-support], [AS_HELP_STRING([--enable-criu-support], [enable CRIU support @<:@platform dependent@:>@])])
OPENJ9_ENABLE_CRIU_SUPPORT=false
if test "x$enable_criu_support" = xyes ; then
AC_MSG_RESULT([yes (explicitly enabled)])
Expand Down
1 change: 1 addition & 0 deletions closed/autoconf/custom-spec.gmk.in
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export GDK_HOME := @OPENJ9_GDK_HOME@
endif

# feature enablement flags
OPENJ9_ENABLE_CRAC_SUPPORT := @OPENJ9_ENABLE_CRAC_SUPPORT@
OPENJ9_ENABLE_CRIU_SUPPORT := @OPENJ9_ENABLE_CRIU_SUPPORT@
OPENJ9_ENABLE_DDR := @OPENJ9_ENABLE_DDR@
OPENJ9_ENABLE_DEMOS := @OPENJ9_ENABLE_DEMOS@
Expand Down
2 changes: 1 addition & 1 deletion closed/openjdk-tag.gmk
Original file line number Diff line number Diff line change
@@ -1 +1 @@
OPENJDK_TAG := jdk-11.0.21+8
OPENJDK_TAG := jdk-11.0.21+9
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,13 @@ public KeyPair generateKeyPair() {
return this.javaImplementation.generateKeyPair();
}

boolean absent;
long nativePointer = NativeECUtil.encodeGroup(this.params);

if (nativePointer == -1) {
absent = NativeECUtil.putCurveIfAbsent(this.curve, Boolean.FALSE);
if (!absent) {
throw new ProviderException("Could not encode group");
}
NativeECUtil.putCurveIfAbsent(this.curve, Boolean.FALSE);
if (nativeCryptTrace) {
System.err.println(this.curve +
" is not supported by OpenSSL, using Java crypto implementation.");
System.err.println("Could not encode group for curve " + this.curve
+ " in OpenSSL, using Java crypto implementation.");
}
try {
this.initializeJavaImplementation();
Expand All @@ -195,13 +191,10 @@ public KeyPair generateKeyPair() {
} else if (field instanceof ECFieldF2m) {
fieldType = NativeCrypto.ECField_F2m;
} else {
absent = NativeECUtil.putCurveIfAbsent(this.curve, Boolean.FALSE);
if (!absent) {
throw new ProviderException("Field type not supported");
}
NativeECUtil.putCurveIfAbsent(this.curve, Boolean.FALSE);
if (nativeCryptTrace) {
System.err.println(this.curve +
" is not supported by OpenSSL, using Java crypto implementation.");
System.err.println("Field type not supported for curve " + this.curve
+ " by OpenSSL, using Java crypto implementation.");
}
try {
this.initializeJavaImplementation();
Expand All @@ -226,13 +219,10 @@ public KeyPair generateKeyPair() {
fieldType);

if (ret == -1) {
absent = NativeECUtil.putCurveIfAbsent(this.curve, Boolean.FALSE);
if (!absent) {
throw new ProviderException("Could not generate key pair");
}
NativeECUtil.putCurveIfAbsent(this.curve, Boolean.FALSE);
if (nativeCryptTrace) {
System.err.println(this.curve +
" is not supported by OpenSSL, using Java crypto implementation for key generation.");
System.err.println("Could not generate key pair for curve " + this.curve
+ " using OpenSSL, using Java crypto implementation for key generation.");
}
try {
this.initializeJavaImplementation();
Expand Down
2 changes: 1 addition & 1 deletion make/autoconf/version-numbers
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ DEFAULT_VERSION_DATE=2023-10-17
DEFAULT_VERSION_CLASSFILE_MAJOR=55 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
DEFAULT_VERSION_CLASSFILE_MINOR=0
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="10 11"
DEFAULT_PROMOTED_VERSION_PRE=ea
DEFAULT_PROMOTED_VERSION_PRE=

LAUNCHER_NAME=openjdk
PRODUCT_NAME=OpenJDK
Expand Down
27 changes: 21 additions & 6 deletions src/java.base/share/classes/com/sun/crypto/provider/DESKey.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023, 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,6 +25,8 @@

package com.sun.crypto.provider;

import java.io.IOException;
import java.io.InvalidObjectException;
import java.lang.ref.Reference;
import java.security.MessageDigest;
import java.security.KeyRep;
Expand All @@ -43,7 +45,7 @@

final class DESKey implements SecretKey {

static final long serialVersionUID = 7724971015953279128L;
private static final long serialVersionUID = 7724971015953279128L;

private byte[] key;

Expand Down Expand Up @@ -112,7 +114,7 @@ public int hashCode() {
for (int i = 1; i < this.key.length; i++) {
retval += this.key[i] * i;
}
return(retval ^= "des".hashCode());
return(retval ^ "des".hashCode());
}

public boolean equals(Object obj) {
Expand All @@ -133,14 +135,27 @@ public boolean equals(Object obj) {
}

/**
* readObject is called to restore the state of this key from
* a stream.
* Restores the state of this object from the stream.
*
* @param s the {@code ObjectInputStream} from which data is read
* @throws IOException if an I/O error occurs
* @throws ClassNotFoundException if a serialized class cannot be loaded
*/
private void readObject(java.io.ObjectInputStream s)
throws java.io.IOException, ClassNotFoundException
throws IOException, ClassNotFoundException
{
s.defaultReadObject();
if ((key == null) || (key.length != DESKeySpec.DES_KEY_LEN)) {
throw new InvalidObjectException("Wrong key size");
}
key = key.clone();

DESKeyGenerator.setParityBit(key, 0);

// Use the cleaner to zero the key when no longer referenced
final byte[] k = key;
CleanerFactory.cleaner().register(this,
() -> java.util.Arrays.fill(k, (byte)0x00));
}

/**
Expand Down
29 changes: 23 additions & 6 deletions src/java.base/share/classes/com/sun/crypto/provider/DESedeKey.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023, 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,6 +25,8 @@

package com.sun.crypto.provider;

import java.io.IOException;
import java.io.InvalidObjectException;
import java.lang.ref.Reference;
import java.security.MessageDigest;
import java.security.KeyRep;
Expand All @@ -43,7 +45,7 @@

final class DESedeKey implements SecretKey {

static final long serialVersionUID = 2463986565756745178L;
private static final long serialVersionUID = 2463986565756745178L;

private byte[] key;

Expand Down Expand Up @@ -111,7 +113,7 @@ public int hashCode() {
for (int i = 1; i < this.key.length; i++) {
retval += this.key[i] * i;
}
return(retval ^= "desede".hashCode());
return(retval ^ "desede".hashCode());
}

public boolean equals(Object obj) {
Expand All @@ -133,14 +135,29 @@ public boolean equals(Object obj) {
}

/**
* readObject is called to restore the state of this key from
* a stream.
* Restores the state of this object from the stream.
*
* @param s the {@code ObjectInputStream} from which data is read
* @throws IOException if an I/O error occurs
* @throws ClassNotFoundException if a serialized class cannot be loaded
*/
private void readObject(java.io.ObjectInputStream s)
throws java.io.IOException, ClassNotFoundException
throws IOException, ClassNotFoundException
{
s.defaultReadObject();
if ((key == null) || (key.length != DESedeKeySpec.DES_EDE_KEY_LEN)) {
throw new InvalidObjectException("Wrong key size");
}
key = key.clone();

DESKeyGenerator.setParityBit(key, 0);
DESKeyGenerator.setParityBit(key, 8);
DESKeyGenerator.setParityBit(key, 16);

// Use the cleaner to zero the key when no longer referenced
final byte[] k = key;
CleanerFactory.cleaner().register(this,
() -> java.util.Arrays.fill(k, (byte)0x00));
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023, 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 Down Expand Up @@ -40,15 +40,13 @@
* algorithm.
*
* @author Jan Luehe
*
*
* @see DHPublicKey
* @see java.security.KeyAgreement
*/
final class DHPrivateKey implements PrivateKey,
javax.crypto.interfaces.DHPrivateKey, Serializable {

static final long serialVersionUID = 7565477590005668886L;
private static final long serialVersionUID = 7565477590005668886L;

// only supported version of PKCS#8 PrivateKeyInfo
private static final BigInteger PKCS8_VERSION = BigInteger.ZERO;
Expand All @@ -63,10 +61,10 @@ final class DHPrivateKey implements PrivateKey,
private byte[] encodedKey;

// the prime modulus
private BigInteger p;
private final BigInteger p;

// the base generator
private BigInteger g;
private final BigInteger g;

// the private-value length (optional)
private int l;
Expand Down Expand Up @@ -317,4 +315,27 @@ private Object writeReplace() throws java.io.ObjectStreamException {
getFormat(),
getEncoded());
}

/**
* Restores the state of this object from the stream.
* <p>
* JDK 1.5+ objects use <code>KeyRep</code>s instead.
*
* @param stream the {@code ObjectInputStream} from which data is read
* @throws IOException if an I/O error occurs
* @throws ClassNotFoundException if a serialized class cannot be loaded
*/
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
if ((key == null) || (key.length == 0)) {
throw new InvalidObjectException("key not deserializable");
}
this.key = key.clone();
if ((encodedKey == null) || (encodedKey.length == 0)) {
throw new InvalidObjectException(
"encoded key not deserializable");
}
this.encodedKey = encodedKey.clone();
}
}
Loading

0 comments on commit 45b9d06

Please sign in to comment.