-
Notifications
You must be signed in to change notification settings - Fork 1
RH2104724: Avoid import/export of DH private keys #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Failing test cases from OPENJDK-824 are passing in a local build of this PR + #16, executed with: separator="$(printf "%$(tput cols)s" | tr " " "=")"
highlighter="s/^\(failed\|error\)\(:\|$\)/$(tput bold && tput setaf 1)\0$(tput sgr0)/gi;
s/^passed\(:\|$\)/$(tput bold && tput setaf 2)\0$(tput sgr0)/gi;
s/^ignored\(:\|$\)/$(tput bold && tput setaf 3)\0$(tput sgr0)/gi"
function test_env_create() {
git clone --quiet "https://github.com/rh-openjdk/$1" && pushd "$1" >/dev/null &&
echo -e "$(tput bold)${separator}\n= $1\n${separator}$(tput sgr0)"
}
function test_env_destroy() {
popd >/dev/null && rm -rf "$1" && echo -e "\n"
}
function run_tests() {
export JAVA_HOME="$(find $HOME -wholename */jdk17u/build/*/images/jdk -print -quit)"
test_env_create ssl-tests || return
make TEST_PKCS11_FIPS=1 SSLTESTS_SSL_CONFIG_FILTER=SunJSSE,Default,TLSv1.2,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 \
SSLTESTS_CUSTOM_JAVA_PARAMS=-Djdk.tls.ephemeralDHKeySize=2048 ssl-tests | sed "$highlighter"
test_env_destroy ssl-tests
test_env_create CryptoTest || return
make KeyAgreementTests | sed "$highlighter"
test_env_destroy CryptoTest
unset JAVA_HOME
}
run_tests && unset run_tests test_env_destroy test_env_create highlighter separatorOutput from Output from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
| debug.println("Importing a Diffie-Hellman private key..."); | ||
| } | ||
| if (DHKF == null) { | ||
| DHKFLock.lock(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot to remove the DHKF and DHKFLock static variables from the start of the FIPSKeyImporter class.
openjdk#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 openjdk#13 git show 0bd5ca9 | git apply -R # Redo openjdk#13 by reverting 0af22dc in SSLContextImpl.java and SunJSSE.java git show 0af22dc | git apply -R --include=src/java.base/share/classes/sun/security/ssl/* ~~~ In openjdk#14, I forgot to delete the DHKF and DHKFLock static variables from FIPSKeyImporter, which are no longer used, see rh-openjdk#14 (comment).
#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 0bd5ca9 | git apply -R # Redo #13 by reverting 0af22dc in SSLContextImpl.java and SunJSSE.java git show 0af22dc | 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 #14 (comment). Reviewed-by: @gnu-andrew
openjdk#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 openjdk#13 git show 0bd5ca9 | git apply -R # Redo openjdk#13 by reverting 0af22dc in SSLContextImpl.java and SunJSSE.java git show 0af22dc | git apply -R --include=src/java.base/share/classes/sun/security/ssl/* ~~~ In openjdk#14, I forgot to delete the DHKF and DHKFLock static variables from FIPSKeyImporter, which are no longer used, see rh-openjdk#14 (comment). Reviewed-by: @gnu-andrew
Search this PR in Red Hat Jira
RH2104724 / RH2104725: Avoid import/export of DH private keys
Description
As analyzed in OPENJDK-824, NSS doesn't support wrapping/unwrapping of Diffie-Hellman private keys (
CKK_DH), so we can't import/export them from the NSS PKCS#11 software token.In addition, as part of 78df8b5 work, we started to blindly consider a private key extractable when the plain key support is enabled, preventing DH private keys from being instantiated as the opaque
P11PrivateKey. This now causes an error, as an attempt is made to extract these keys when instantiating theP11DHPrivateKeyfull-data object.This work:
P11PrivateKeyfor them (instead ofP11DHPrivateKey)CKK_DHprivate keys.