Compare commits

..

No commits in common. 'i9' and 'c9' have entirely different histories.
i9 ... c9

@ -45,9 +45,6 @@
# Turn off the debug package as we just produce a bunch of tarballs # Turn off the debug package as we just produce a bunch of tarballs
%define debug_package %{nil} %define debug_package %{nil}
%if 0%{?rhel} == 9
%define _lto_cflags %{nil}
%endif
# note: parametrized macros are order-sensitive (unlike not-parametrized) even with normal macros # note: parametrized macros are order-sensitive (unlike not-parametrized) even with normal macros
# also necessary when passing it as parameter to other macros. If not macro, then it is considered a switch # also necessary when passing it as parameter to other macros. If not macro, then it is considered a switch

@ -1,167 +0,0 @@
commit d41618f34f1d2f5416ec3c035f33dcb15cf5ab99
Author: Alexey Bakhtin <abakhtin@openjdk.org>
Date: Tue Apr 4 10:29:11 2023 +0000
8271199: Mutual TLS handshake fails signing client certificate with custom sensitive PKCS11 key
Reviewed-by: andrew, mbalao
Backport-of: f6232982b91cb2314e96ddbde3984836a810a556
diff --git a/jdk/src/share/classes/sun/security/rsa/RSAPSSSignature.java b/jdk/src/share/classes/sun/security/rsa/RSAPSSSignature.java
index a79e97d7c74..5378446b97b 100644
--- a/jdk/src/share/classes/sun/security/rsa/RSAPSSSignature.java
+++ b/jdk/src/share/classes/sun/security/rsa/RSAPSSSignature.java
@@ -127,12 +127,15 @@ public class RSAPSSSignature extends SignatureSpi {
@Override
protected void engineInitVerify(PublicKey publicKey)
throws InvalidKeyException {
- if (!(publicKey instanceof RSAPublicKey)) {
+ if (publicKey instanceof RSAPublicKey) {
+ RSAPublicKey rsaPubKey = (RSAPublicKey)publicKey;
+ isPublicKeyValid(rsaPubKey);
+ this.pubKey = rsaPubKey;
+ this.privKey = null;
+ resetDigest();
+ } else {
throw new InvalidKeyException("key must be RSAPublicKey");
}
- this.pubKey = (RSAPublicKey) isValid((RSAKey)publicKey);
- this.privKey = null;
- resetDigest();
}
// initialize for signing. See JCA doc
@@ -146,14 +149,17 @@ public class RSAPSSSignature extends SignatureSpi {
@Override
protected void engineInitSign(PrivateKey privateKey, SecureRandom random)
throws InvalidKeyException {
- if (!(privateKey instanceof RSAPrivateKey)) {
+ if (privateKey instanceof RSAPrivateKey) {
+ RSAPrivateKey rsaPrivateKey = (RSAPrivateKey)privateKey;
+ isPrivateKeyValid(rsaPrivateKey);
+ this.privKey = rsaPrivateKey;
+ this.pubKey = null;
+ this.random =
+ (random == null ? JCAUtil.getSecureRandom() : random);
+ resetDigest();
+ } else {
throw new InvalidKeyException("key must be RSAPrivateKey");
}
- this.privKey = (RSAPrivateKey) isValid((RSAKey)privateKey);
- this.pubKey = null;
- this.random =
- (random == null? JCAUtil.getSecureRandom() : random);
- resetDigest();
}
/**
@@ -205,11 +211,57 @@ public class RSAPSSSignature extends SignatureSpi {
}
}
+ /**
+ * Validate the specified RSAPrivateKey
+ */
+ private void isPrivateKeyValid(RSAPrivateKey prKey) throws InvalidKeyException {
+ try {
+ if (prKey instanceof RSAPrivateCrtKey) {
+ RSAPrivateCrtKey crtKey = (RSAPrivateCrtKey)prKey;
+ if (RSAPrivateCrtKeyImpl.checkComponents(crtKey)) {
+ RSAKeyFactory.checkRSAProviderKeyLengths(
+ crtKey.getModulus().bitLength(),
+ crtKey.getPublicExponent());
+ } else {
+ throw new InvalidKeyException(
+ "Some of the CRT-specific components are not available");
+ }
+ } else {
+ RSAKeyFactory.checkRSAProviderKeyLengths(
+ prKey.getModulus().bitLength(),
+ null);
+ }
+ } catch (InvalidKeyException ikEx) {
+ throw ikEx;
+ } catch (Exception e) {
+ throw new InvalidKeyException(
+ "Can not access private key components", e);
+ }
+ isValid(prKey);
+ }
+
+ /**
+ * Validate the specified RSAPublicKey
+ */
+ private void isPublicKeyValid(RSAPublicKey pKey) throws InvalidKeyException {
+ try {
+ RSAKeyFactory.checkRSAProviderKeyLengths(
+ pKey.getModulus().bitLength(),
+ pKey.getPublicExponent());
+ } catch (InvalidKeyException ikEx) {
+ throw ikEx;
+ } catch (Exception e) {
+ throw new InvalidKeyException(
+ "Can not access public key components", e);
+ }
+ isValid(pKey);
+ }
+
/**
* Validate the specified RSAKey and its associated parameters against
* internal signature parameters.
*/
- private RSAKey isValid(RSAKey rsaKey) throws InvalidKeyException {
+ private void isValid(RSAKey rsaKey) throws InvalidKeyException {
try {
AlgorithmParameterSpec keyParams = rsaKey.getParams();
// validate key parameters
@@ -227,7 +279,6 @@ public class RSAPSSSignature extends SignatureSpi {
}
checkKeyLength(rsaKey, hLen, this.sigParams.getSaltLength());
}
- return rsaKey;
} catch (SignatureException e) {
throw new InvalidKeyException(e);
}
diff --git a/jdk/src/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java b/jdk/src/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java
index 6b219937981..b3c1fae9672 100644
--- a/jdk/src/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java
+++ b/jdk/src/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java
@@ -80,22 +80,28 @@ public final class RSAPrivateCrtKeyImpl
RSAPrivateCrtKeyImpl key = new RSAPrivateCrtKeyImpl(encoded);
// check all CRT-specific components are available, if any one
// missing, return a non-CRT key instead
- if ((key.getPublicExponent().signum() == 0) ||
- (key.getPrimeExponentP().signum() == 0) ||
- (key.getPrimeExponentQ().signum() == 0) ||
- (key.getPrimeP().signum() == 0) ||
- (key.getPrimeQ().signum() == 0) ||
- (key.getCrtCoefficient().signum() == 0)) {
+ if (checkComponents(key)) {
+ return key;
+ } else {
return new RSAPrivateKeyImpl(
key.algid,
key.getModulus(),
- key.getPrivateExponent()
- );
- } else {
- return key;
+ key.getPrivateExponent());
}
}
+ /**
+ * Validate if all CRT-specific components are available.
+ */
+ static boolean checkComponents(RSAPrivateCrtKey key) {
+ return !((key.getPublicExponent().signum() == 0) ||
+ (key.getPrimeExponentP().signum() == 0) ||
+ (key.getPrimeExponentQ().signum() == 0) ||
+ (key.getPrimeP().signum() == 0) ||
+ (key.getPrimeQ().signum() == 0) ||
+ (key.getCrtCoefficient().signum() == 0));
+ }
+
/**
* Generate a new key from the specified type and components.
* Returns a CRT key if possible and a non-CRT key otherwise.

@ -1,3 +1,8 @@
# To rebuild this RPM, you must first rebuild the portable
# RPM using the java-1.8.0-openjdk-portable.specfile, install
# it and then adjust portablerelease and portablesuffix
# to match the new portable.
# RPM conditionals so as to be able to dynamically produce # RPM conditionals so as to be able to dynamically produce
# slowdebug/release builds. See: # slowdebug/release builds. See:
# http://rpm.org/user_doc/conditional_builds.html # http://rpm.org/user_doc/conditional_builds.html
@ -292,7 +297,11 @@
%ifarch %{systemtap_arches}
%global with_systemtap 1
%else
%global with_systemtap 0 %global with_systemtap 0
%endif
# New Version-String scheme-style defines # New Version-String scheme-style defines
%global majorver 8 %global majorver 8
@ -349,7 +358,8 @@
%global rpmrelease 2 %global rpmrelease 2
# Settings used by the portable build # Settings used by the portable build
%global portablerelease 1 %global portablerelease 1
%global portablesuffix el%{msvsphere} %global portablerhel 8
%global portablesuffix el%{portablerhel}
%global portablebuilddir /builddir/build/BUILD %global portablebuilddir /builddir/build/BUILD
# Define milestone (EA for pre-releases, GA ("fcs") for releases) # Define milestone (EA for pre-releases, GA ("fcs") for releases)
@ -1367,7 +1377,9 @@ Provides: java-%{origin}-src%{?1} = %{epoch}:%{version}-%{release}
Name: java-%{javaver}-%{origin} Name: java-%{javaver}-%{origin}
Version: %{javaver}.%{updatever}.%{buildver} Version: %{javaver}.%{updatever}.%{buildver}
Release: %{?eaprefix}%{rpmrelease}%{?extraver}%{?dist}.inferit Release: %{?eaprefix}%{rpmrelease}%{?extraver}%{?dist}
# Equivalent for the portable build
%global prelease %{?eaprefix}%{portablerelease}%{?extraver}
# java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons # java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons
# and this change was brought into RHEL-4. java-1.5.0-ibm packages # and this change was brought into RHEL-4. java-1.5.0-ibm packages
# also included the epoch in their virtual provides. This created a # also included the epoch in their virtual provides. This created a
@ -1450,11 +1462,11 @@ Source21: NEWS
Source22: repack_reproducible_policies.sh Source22: repack_reproducible_policies.sh
# Setup variables to reference correct sources # Setup variables to reference correct sources
%global releasezip %{_jvmdir}/%{name}-portable-%{version}-%{portablerelease}.portable.unstripped.jdk.%{_arch}.tar.xz %global releasezip %{_jvmdir}/%{name}-portable-%{version}-%{prelease}.portable.unstripped.jdk.%{_arch}.tar.xz
%global docszip %{_jvmdir}/%{name}-portable-%{version}-%{portablerelease}.portable.docs.%{_arch}.tar.xz %global docszip %{_jvmdir}/%{name}-portable-%{version}-%{prelease}.portable.docs.%{_arch}.tar.xz
%global misczip %{_jvmdir}/%{name}-portable-%{version}-%{portablerelease}.portable.misc.%{_arch}.tar.xz %global misczip %{_jvmdir}/%{name}-portable-%{version}-%{prelease}.portable.misc.%{_arch}.tar.xz
%global slowdebugzip %{_jvmdir}/%{name}-portable-%{version}-%{portablerelease}.portable.slowdebug.jdk.%{_arch}.tar.xz %global slowdebugzip %{_jvmdir}/%{name}-portable-%{version}-%{prelease}.portable.slowdebug.jdk.%{_arch}.tar.xz
%global fastdebugzip %{_jvmdir}/%{name}-portable-%{version}-%{portablerelease}.portable.fastdebug.jdk.%{_arch}.tar.xz %global fastdebugzip %{_jvmdir}/%{name}-portable-%{version}-%{prelease}.portable.fastdebug.jdk.%{_arch}.tar.xz
############################################ ############################################
# #
@ -1584,8 +1596,7 @@ Patch15: jdk8141590-bundle_libffi-followup.patch
# able to be removed once that release is out # able to be removed once that release is out
# and used by this RPM. # and used by this RPM.
############################################# #############################################
# JDK-8271199, RH2175317: Mutual TLS handshake fails signing client certificate with custom sensitive PKCS11 key
Patch2001: jdk8271199-rh2175317-custom_pkcs11_provider_support.patch
############################################# #############################################
# #
@ -1654,16 +1665,16 @@ BuildRequires: zip
BuildRequires: javapackages-filesystem BuildRequires: javapackages-filesystem
%ifarch %{portable_build_arches} %ifarch %{portable_build_arches}
%if %{include_normal_build} %if %{include_normal_build}
BuildRequires: java-1.%{majorver}.0-openjdk-portable-unstripped = %{epoch}:%{version}-%{portablerelease}.%{portablesuffix} BuildRequires: java-1.%{majorver}.0-openjdk-portable-unstripped = %{epoch}:%{version}-%{prelease}.%{portablesuffix}
%endif %endif
%if %{include_fastdebug_build} %if %{include_fastdebug_build}
BuildRequires: java-1.%{majorver}.0-openjdk-portable-devel-fastdebug = %{epoch}:%{version}-%{portablerelease}.%{portablesuffix} BuildRequires: java-1.%{majorver}.0-openjdk-portable-devel-fastdebug = %{epoch}:%{version}-%{prelease}.%{portablesuffix}
%endif %endif
%if %{include_debug_build} %if %{include_debug_build}
BuildRequires: java-1.%{majorver}.0-openjdk-portable-devel-slowdebug = %{epoch}:%{version}-%{portablerelease}.%{portablesuffix} BuildRequires: java-1.%{majorver}.0-openjdk-portable-devel-slowdebug = %{epoch}:%{version}-%{prelease}.%{portablesuffix}
%endif %endif
BuildRequires: java-1.%{majorver}.0-openjdk-portable-docs = %{epoch}:%{version}-%{portablerelease}.%{portablesuffix} BuildRequires: java-1.%{majorver}.0-openjdk-portable-docs = %{epoch}:%{version}-%{prelease}.%{portablesuffix}
BuildRequires: java-1.%{majorver}.0-openjdk-portable-misc = %{epoch}:%{version}-%{portablerelease}.%{portablesuffix} BuildRequires: java-1.%{majorver}.0-openjdk-portable-misc = %{epoch}:%{version}-%{prelease}.%{portablesuffix}
%else %else
# Require a boot JDK which doesn't fail due to RH1482244 # Require a boot JDK which doesn't fail due to RH1482244
BuildRequires: java-%{buildjdkver}-openjdk-devel >= 1.7.0.151-2.6.11.3 BuildRequires: java-%{buildjdkver}-openjdk-devel >= 1.7.0.151-2.6.11.3
@ -2037,6 +2048,8 @@ popd
# Shenandoah patches # Shenandoah patches
%ifnarch %{portable_build_arches}
# Extract systemtap tapsets # Extract systemtap tapsets
%if %{with_systemtap} %if %{with_systemtap}
tar --strip-components=1 -x -I xz -f %{SOURCE8} tar --strip-components=1 -x -I xz -f %{SOURCE8}
@ -2047,7 +2060,6 @@ cp -r tapset tapset%{debug_suffix}
cp -r tapset tapset%{fastdebug_suffix} cp -r tapset tapset%{fastdebug_suffix}
%endif %endif
for suffix in %{build_loop} ; do for suffix in %{build_loop} ; do
for file in "tapset"$suffix/*.in; do for file in "tapset"$suffix/*.in; do
OUTPUT_FILE=`echo $file | sed -e "s:\.stp\.in$:-%{version}-%{release}.%{_arch}.stp:g"` OUTPUT_FILE=`echo $file | sed -e "s:\.stp\.in$:-%{version}-%{release}.%{_arch}.stp:g"`
@ -2066,6 +2078,9 @@ done
# systemtap tapsets ends # systemtap tapsets ends
%endif %endif
# non-portable_build only section ends
%endif
# Prepare desktop files # Prepare desktop files
# The _X_ syntax indicates variables that are replaced by make upstream # The _X_ syntax indicates variables that are replaced by make upstream
# The @X@ syntax indicates variables that are replaced by configure upstream # The @X@ syntax indicates variables that are replaced by configure upstream
@ -2288,6 +2303,20 @@ function customisejdk() {
fi fi
} }
%ifarch %{portable_build_arches}
mkdir -p $(dirname %{installoutputdir})
docdir=%{installoutputdir -- "-docs"}
tar -xJf %{docszip}
mv %{name}*.docs.* ${docdir}
miscdir=%{installoutputdir -- "-misc"}
tar -xJf %{misczip}
mv %{name}*.misc.* ${miscdir}
%endif
for suffix in %{build_loop} ; do for suffix in %{build_loop} ; do
%ifarch %{portable_build_arches} %ifarch %{portable_build_arches}
@ -2306,7 +2335,6 @@ for suffix in %{build_loop} ; do
# TODO: should verify checksums when using packages from buildroot # TODO: should verify checksums when using packages from buildroot
tar -xJf ${jdkzip} tar -xJf ${jdkzip}
mkdir -p $(dirname ${installdir})
mv %{name}* ${installdir} mv %{name}* ${installdir}
%ifarch %{zero_arches} %ifarch %{zero_arches}
# We do not need the local copy of libffi.so if we are building on the same platform as the portable # We do not need the local copy of libffi.so if we are building on the same platform as the portable
@ -2315,7 +2343,7 @@ for suffix in %{build_loop} ; do
%endif %endif
%endif %endif
# Fix build paths in ELF files so it looks like we built them # Fix build paths in ELF files so it looks like we built them
portablenvr="%{name}-portable-%{version}-%{portablerelease}.%{portablesuffix}.%{_arch}" portablenvr="%{name}-portable-%{version}-%{prelease}.%{portablesuffix}.%{_arch}"
for file in $(find ${installdir} -type f) ; do for file in $(find ${installdir} -type f) ; do
if ! echo ${file} | grep -q 'libffi' ; then if ! echo ${file} | grep -q 'libffi' ; then
if file ${file} | grep -q 'ELF'; then if file ${file} | grep -q 'ELF'; then
@ -2389,18 +2417,6 @@ for suffix in %{build_loop} ; do
# build cycles # build cycles
done done
%ifarch %{portable_build_arches}
docdir=%{installoutputdir -- "-docs"}
tar -xJf %{docszip}
mv %{name}*.docs.* ${docdir}
miscdir=%{installoutputdir -- "-misc"}
tar -xJf %{misczip}
mv %{name}*.misc.* ${miscdir}
%endif
%check %check
# We test debug first as it will give better diagnostics on a crash # We test debug first as it will give better diagnostics on a crash
@ -2552,7 +2568,7 @@ for suffix in %{build_loop} ; do
%ifarch %{portable_build_arches} %ifarch %{portable_build_arches}
jdk_image=%{installoutputdir -- $suffix} jdk_image=%{installoutputdir -- $suffix}
docdir=$(pwd)/%{installoutputdir -- "-docs"} docdir=$(pwd)/%{installoutputdir -- "-docs"}
miscdir=%{installoutputdir -- "-misc"} miscdir=$(pwd)/%{installoutputdir -- "-misc"}
%else %else
jdk_image=%{installoutputdir -- $suffix}/images/%{jdkimage} jdk_image=%{installoutputdir -- $suffix}/images/%{jdkimage}
docdir=%{installoutputdir -- $suffix} docdir=%{installoutputdir -- $suffix}
@ -2570,23 +2586,20 @@ for suffix in %{build_loop} ; do
cp -a %{SOURCE19} %{SOURCE20} ${commondocdir} cp -a %{SOURCE19} %{SOURCE20} ${commondocdir}
# Install the jdk # Install the jdk
pushd ${jdk_image}
# Install jsa directories so we can owe them # Install jsa directories so we can own them
mkdir -p $RPM_BUILD_ROOT%{_jvmdir}/%{jredir -- $suffix}/lib/%{archinstall}/server/ mkdir -p $RPM_BUILD_ROOT%{_jvmdir}/%{jredir -- $suffix}/lib/%{archinstall}/server/
mkdir -p $RPM_BUILD_ROOT%{_jvmdir}/%{jredir -- $suffix}/lib/%{archinstall}/client/ mkdir -p $RPM_BUILD_ROOT%{_jvmdir}/%{jredir -- $suffix}/lib/%{archinstall}/client/
# Install main files.
install -d -m 755 $RPM_BUILD_ROOT%{_jvmdir}/%{sdkdir -- $suffix}
cp -a bin include lib src.zip {ASSEMBLY_EXCEPTION,LICENSE,THIRD_PARTY_README} $RPM_BUILD_ROOT%{_jvmdir}/%{sdkdir -- $suffix}
install -d -m 755 $RPM_BUILD_ROOT%{_jvmdir}/%{jredir -- $suffix}
cp -a jre/bin jre/lib jre/{ASSEMBLY_EXCEPTION,LICENSE,THIRD_PARTY_README} $RPM_BUILD_ROOT%{_jvmdir}/%{jredir -- $suffix}
%if %{with_systemtap} %if %{with_systemtap}
# Install systemtap support files # Install systemtap support files
install -dm 755 $RPM_BUILD_ROOT%{_jvmdir}/%{sdkdir -- $suffix}/tapset install -dm 755 $RPM_BUILD_ROOT%{_jvmdir}/%{sdkdir -- $suffix}/tapset
%ifarch %{portable_build_arches}
cp -a ${miscdir}/tapset$suffix/*.stp $RPM_BUILD_ROOT%{_jvmdir}/%{sdkdir -- $suffix}/tapset/
%else
# note, that uniquesuffix is in BUILD dir in this case # note, that uniquesuffix is in BUILD dir in this case
cp -a $RPM_BUILD_DIR/%{uniquesuffix ""}/tapset$suffix/*.stp $RPM_BUILD_ROOT%{_jvmdir}/%{sdkdir -- $suffix}/tapset/ cp -a $RPM_BUILD_DIR/%{uniquesuffix ""}/tapset$suffix/*.stp $RPM_BUILD_ROOT%{_jvmdir}/%{sdkdir -- $suffix}/tapset/
%endif
pushd $RPM_BUILD_ROOT%{_jvmdir}/%{sdkdir -- $suffix}/tapset/ pushd $RPM_BUILD_ROOT%{_jvmdir}/%{sdkdir -- $suffix}/tapset/
tapsetFiles=`ls *.stp` tapsetFiles=`ls *.stp`
popd popd
@ -2602,6 +2615,14 @@ for suffix in %{build_loop} ; do
ln -sf %{jredir -- $suffix} %{jrelnk -- $suffix} ln -sf %{jredir -- $suffix} %{jrelnk -- $suffix}
popd popd
pushd ${jdk_image}
# Install main files.
install -d -m 755 $RPM_BUILD_ROOT%{_jvmdir}/%{sdkdir -- $suffix}
cp -a bin include lib src.zip {ASSEMBLY_EXCEPTION,LICENSE,THIRD_PARTY_README} $RPM_BUILD_ROOT%{_jvmdir}/%{sdkdir -- $suffix}
install -d -m 755 $RPM_BUILD_ROOT%{_jvmdir}/%{jredir -- $suffix}
cp -a jre/bin jre/lib jre/{ASSEMBLY_EXCEPTION,LICENSE,THIRD_PARTY_README} $RPM_BUILD_ROOT%{_jvmdir}/%{jredir -- $suffix}
# Remove javaws man page # Remove javaws man page
rm -f man/man1/javaws* rm -f man/man1/javaws*
@ -3176,9 +3197,6 @@ cjc.mainProgram(args)
- Resolves: rhbz#2185182 - Resolves: rhbz#2185182
- Resolves: rhbz#2189329 - Resolves: rhbz#2189329
* Wed Mar 15 2023 MSVSphere Packaging Team <packager@msvsphere.ru> - 1:1.8.0.362.b09-4
- Rebuilt for MSVSphere 9.1.
* Tue Feb 28 2023 Andrew Hughes <gnu.andrew@redhat.com> - 1:1.8.0.362.b09-4 * Tue Feb 28 2023 Andrew Hughes <gnu.andrew@redhat.com> - 1:1.8.0.362.b09-4
- Drop use of portable build on s390x due to libffi compatibility issue (needs libffi.so.6) - Drop use of portable build on s390x due to libffi compatibility issue (needs libffi.so.6)
- Related: rhbz#2150202 - Related: rhbz#2150202

Loading…
Cancel
Save