Skip to content

Conversation

@phohensee
Copy link
Member

@phohensee phohensee commented Apr 12, 2023

The backport from 11u was not clean because:

  1. the change to PKCS11Test.java affects code that does not exist in 8u, so is not included
  2. the new test, TestP11KeyFactoryGetRSAKeySpec.java, uses /lib/testlibrary instead of /test/lib

The new test and the modified existing tests pass, and the jdk/test/sun/security/pkcs11 tests pass as well as they did before this change.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk8u-dev.git pull/302/head:pull/302
$ git checkout pull/302

Update a local copy of the PR:
$ git checkout pull/302
$ git pull https://git.openjdk.org/jdk8u-dev.git pull/302/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 302

View PR using the GUI difftool:
$ git pr show -t 302

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk8u-dev/pull/302.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 12, 2023

👋 Welcome back phh! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot changed the title Backport a5d7de235101696463dba22792703c6809ff7fc4 8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec Apr 12, 2023
@openjdk
Copy link

openjdk bot commented Apr 12, 2023

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added backport Port of a pull request already in a different code base rfr Pull request is ready for review labels Apr 12, 2023
@mlbridge
Copy link

mlbridge bot commented Apr 12, 2023

Webrevs

@jerboaa
Copy link
Contributor

jerboaa commented Apr 13, 2023

@martinuy @franferrax Could you please help review this? Thanks!

Copy link
Member

@simonis simonis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good except for a small cosmetic issue in p11-nss-sensitive.txt.

CKM_DSA_SHA3_224
CKM_DSA_SHA3_256
CKM_DSA_SHA3_384
CKM_DSA_SHA3_512
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These *_SHA3_* entries here and below have been removed from the 11u-dev downport because SHA3 support was only introduced in JDK 16 (see the 11u review thread).

I suggest to remove them here as well to be on par with the 11u downport.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They should be kept. The definitions are added by JDK-8244154, not JDK-8242332. You said the tests passed before they were removed, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added them back.

Copy link
Member

@simonis simonis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now. Thanks!

@openjdk
Copy link

openjdk bot commented Apr 13, 2023

@phohensee This change now passes all automated pre-integration checks.

After integration, the commit message for the final commit will be:

8263404: RsaPrivateKeySpec is always recognized as RSAPrivateCrtKeySpec in RSAKeyFactory.engineGetKeySpec

Reviewed-by: simonis, mbalao, andrew

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@phohensee
Copy link
Member Author

This is a critical fix for 8u372, so replaced this PR with openjdk/jdk8u#41.

Copy link
Contributor

@martinuy martinuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @phohensee ,

Thanks for contributing this backport. Looks good to me.

@gnu-andrew
Copy link
Member

This is a critical fix for 8u372, so replaced this PR with openjdk/jdk8u#41.

8u is frozen as of 2023-03-24. This PR should be used, and then we can consider separately whether this should be included with the security fixes.

@phohensee
Copy link
Member Author

Thanks for the reviews, Volker and Martin. Andrew, I've additionally tagged the issue with jdk8u-fix-request. I'll push this PR as soon as it's approved.

Copy link
Member

@gnu-andrew gnu-andrew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backport looks correct, apart from the removal of the SHA3 definitions. Those values are defined in 8u by JDK-8244154, even if they are not used by the PKCS11 provider, so I see no reason to diverge the configuration, unless it causes a test failure.

@martinuy
Copy link
Contributor

I'm okay either way, but I wonder why specifying a list of disabled PKCS #11 mechanisms would be necessary for the test. This is a question for the original fix, though.

@phohensee
Copy link
Member Author

The 8u JDK-8244154 backport https://hg.openjdk.org/jdk8u/jdk8u/hotspot/rev/803cbdf0f152 includes just the readme comment update, while the 11u backport https://hg.openjdk.org/jdk-updates/jdk11u/rev/87e85e5123dd includes much else. 8u and 11u both define the SHA3 mechanisms in share/native/sun/security/pkcs11/wrapper/pkcs11t.h, but the 11u JDK-8263404 backport doesn't include them in p11-nss-sensitive.txt.

In light of the above, shall we stay with 11u backport compatibility or add the SHA3 mechanisms back to p11-nss-sensitive.txt?

@gnu-andrew
Copy link
Member

The 8u JDK-8244154 backport https://hg.openjdk.org/jdk8u/jdk8u/hotspot/rev/803cbdf0f152 includes just the readme comment update, while the 11u backport https://hg.openjdk.org/jdk-updates/jdk11u/rev/87e85e5123dd includes much else. 8u and 11u both define the SHA3 mechanisms in share/native/sun/security/pkcs11/wrapper/pkcs11t.h, but the 11u JDK-8263404 backport doesn't include them in p11-nss-sensitive.txt.

In light of the above, shall we stay with 11u backport compatibility or add the SHA3 mechanisms back to p11-nss-sensitive.txt?

There are eight 8u changesets for this change, in light of the forest of repository used at the time and the need to update THIRD_PARTY_README across all of them.

The meat of the change is c52caa9#diff-a616f7793085d46b7c847c0b4a5b81f3f7c7b7d66fd3d7212c1dd3aa49385b00R665 which includes the SHA3 definitions.

I tend towards keeping the trunk version of p11-nss-sensitive.txt because it avoids any surprises in the (unlikely) case that a provider is used with that test that has one of the SHA3 mechanisms enabled. I'm with Martin in that it isn't clear to me why non-RSA mechanisms are being disabled at all to begin with, but I'd prefer to keep the original configuration if it doesn't break the test on 8u.

Incidentally, the @modules jdk.crypto.cryptoki line in TestP11KeyFactoryGetRSAKeySpec.java could go. No-one is ever going to backport the entire module system to 8u. The lack of it is one of the main reasons people stick with 8u.

@phohensee
Copy link
Member Author

I've added the SHA3 mechanisms back to p11-nss-sensitive.txt and removed @modules from TestP11KeyFactoryGetRSAKeySpec.java.

Copy link
Member

@gnu-andrew gnu-andrew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Paul. Approved for 8u-dev.

@phohensee
Copy link
Member Author

Thanks, Andrew.

@phohensee
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Apr 13, 2023

Going to push as commit 4445e5c.

@openjdk openjdk bot added the integrated Pull request has been integrated label Apr 13, 2023
@openjdk openjdk bot closed this Apr 13, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Apr 13, 2023
@openjdk
Copy link

openjdk bot commented Apr 13, 2023

@phohensee Pushed as commit 4445e5c.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@phohensee phohensee deleted the backport-8263404 branch April 18, 2023 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Port of a pull request already in a different code base integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

5 participants