From 9afed4e3d11badbc5e2586fdf1518179577e95e7 Mon Sep 17 00:00:00 2001 From: Francisco Ferrari Bihurriet Date: Fri, 28 Oct 2022 14:47:48 -0300 Subject: [PATCH] Remove forgotten dead code from #13 and #14 #13 isn't a perfect revert of 0af22dc limited to SSLContextImpl.java and SunJSSE.java, since it doesn't remove the SharedSecrets import. This was already in this way in rh2020290-support_tls_1_3_in_fips.v1.patch, I'm now realizing this when doing the OpenJDK 11 backport and retrying the same approach in OpenJDK 17: ~~~ # Revert #13 git show 0bd5ca9ccc5890b009b927b541424d0aacbb0463 | git apply -R # Redo #13 by reverting 0af22dc in SSLContextImpl.java and SunJSSE.java git show 0af22dcc391ff38f65ff7d7cfcc2f933e29e9126 | git apply -R --include=src/java.base/share/classes/sun/security/ssl/* ~~~ In #14, I forgot to delete the DHKF and DHKFLock static variables from FIPSKeyImporter, which are no longer used, see https://github.com/rh-openjdk/jdk/pull/14#discussion_r1003709626. --- .../share/classes/sun/security/ssl/SSLContextImpl.java | 1 - .../share/classes/sun/security/pkcs11/FIPSKeyImporter.java | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java b/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java index 82e896170f0cf..6ffdfeda18def 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java @@ -32,7 +32,6 @@ import java.util.*; import java.util.concurrent.locks.ReentrantLock; import javax.net.ssl.*; -import jdk.internal.access.SharedSecrets; import sun.security.action.GetPropertyAction; import sun.security.provider.certpath.AlgorithmChecker; import sun.security.validator.Validator; diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/FIPSKeyImporter.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/FIPSKeyImporter.java index 8cfa2734d4ec5..d3f0bffb821b0 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/FIPSKeyImporter.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/FIPSKeyImporter.java @@ -72,9 +72,6 @@ final class FIPSKeyImporter { private static volatile Provider sunECProvider = null; private static final ReentrantLock sunECProviderLock = new ReentrantLock(); - private static volatile KeyFactory DHKF = null; - private static final ReentrantLock DHKFLock = new ReentrantLock(); - static Long importKey(SunPKCS11 sunPKCS11, long hSession, CK_ATTRIBUTE[] attributes) throws PKCS11Exception { long keyID = -1; @@ -319,8 +316,7 @@ private static void exportPrivateKey( CKA_PRIVATE_EXPONENT, CKA_PRIME_1, CKA_PRIME_2, CKA_EXPONENT_1, CKA_EXPONENT_2, CKA_COEFFICIENT); RSAPrivateKey rsaPKey = RSAPrivateCrtKeyImpl.newKey( - RSAUtil.KeyType.RSA, "PKCS#8", plainExportedKey - ); + RSAUtil.KeyType.RSA, "PKCS#8", plainExportedKey); CK_ATTRIBUTE attr; if ((attr = sensitiveAttrs.get(CKA_PRIVATE_EXPONENT)) != null) { attr.pValue = rsaPKey.getPrivateExponent().toByteArray();