Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

8265500: Some impls of javax.crypto.Cipher.init() do not throw UnsupportedOperationExc for unsupported modes #69

Closed
wants to merge 1 commit into from

Conversation

valeriepeng
Copy link
Contributor

@valeriepeng valeriepeng commented Jun 15, 2021

Could someone please help review this trivial fix? The real changes are the two PKCS11 cipher impl classes under src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/. The rest of classes are just cleanups, e.g. dead code or unused code. The test/jdk/javax/crypto/Cipher/TestCipherMode.java is updated to cover more cipher impls for completeness sake. It passes without this fix, so I only add the bug id to the the other test, i.e. test/jdk/sun/security/pkcs11/Cipher/TestCipherMode.java, which verifies the PKCS#11 cipher impls.

Thanks,
Valerie


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8265500: Some impls of javax.crypto.Cipher.init() do not throw UnsupportedOperationExc for unsupported modes

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk17 pull/69/head:pull/69
$ git checkout pull/69

Update a local copy of the PR:
$ git checkout pull/69
$ git pull https://git.openjdk.java.net/jdk17 pull/69/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 69

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk17/pull/69.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 15, 2021

👋 Welcome back valeriep! 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 added the rfr Pull request is ready for review label Jun 15, 2021
@openjdk
Copy link

openjdk bot commented Jun 15, 2021

@valeriepeng The following label will be automatically applied to this pull request:

  • security

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the security security-dev@openjdk.java.net label Jun 15, 2021
@mlbridge
Copy link

mlbridge bot commented Jun 15, 2021

Webrevs

Copy link
Member

@XueleiFan XueleiFan 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 to me.

default:
// should never happen; checked by Cipher.init()
throw new AssertionError("Unknown mode: " + opmode);
Copy link
Member

Choose a reason for hiding this comment

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

This update looks good to me. But there is a potential issues, maybe for all switch statements. If the cipher modes is extended to support more items, we may have to look for and update all the switch uses and make sure there is no broken. Anyway, for my personal understanding, there is nothing we could do right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, if new modes are added, we need to go through all cipher impl and update the switch statements. This change is just to make sure our handling is consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks much for the review~

@openjdk
Copy link

openjdk bot commented Jun 16, 2021

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

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

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

8265500: Some impls of javax.crypto.Cipher.init() do not throw UnsupportedOperationExc for unsupported modes

Reviewed-by: xuelei

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 18 new commits pushed to the master branch:

  • 8ea0606: 8268714: [macos-aarch64] 7 java/net/httpclient/websocket tests failed
  • 38dbe05: 8268901: JDK-8268768 missed removing two files
  • 9ad19f7: 8256934: C2: assert(C->live_nodes() <= C->max_node_limit()) failed: Live Node limit exceeded limit
  • 19f5fab: 8268861: Disable Windows-Aarch64 build in GitHub Actions
  • 59de99d: 8267271: Fix gc/arguments/TestNewRatioFlag.java expectedNewSize calculation
  • 4d545a1: 8267988: C2: assert(!addp->is_AddP() || addp->in(AddPNode::Base)->is_top() || addp->in(AddPNode::Base) == n->in(AddPNode::Base)) failed: Base pointers must match (addp 1301)
  • b18de6c: 8268851: ProblemList jdk/jfr/event/gc/detailed/TestEvacuationFailedEvent.java on linux-X64
  • 10068c1: 8268830: ProblemList 3 serviceability/dcmd/framework tests with ZGC on win-x64
  • 788b309: 8268768: idea.sh has been updated in surprising and incompatible ways
  • 9ac0609: 8268828: ProblemList compiler/intrinsics/VectorizedMismatchTest.java on win-x64
  • ... and 8 more: https://git.openjdk.java.net/jdk17/compare/f69e2d5651f239209543bc1daf707a1c1114f6e5...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this 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.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jun 16, 2021
@valeriepeng
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Jun 17, 2021

Going to push as commit 80dc262.
Since your change was applied there have been 35 commits pushed to the master branch:

  • 9130b8a: 8268371: C2: assert(_gvn.type(obj)->higher_equal(tjp)) failed: cast_up is no longer needed
  • 8545269: 8268676: assert(!ik->is_interface() && !ik->has_subklass()) failed: inconsistent klass hierarchy
  • c98d508: 8268265: MutableSpaceUsedHelper::take_sample() hits assert(left >= right) failed: avoid overflow
  • b66001a: 8268971: ProblemList tools/jpackage/windows/WinInstallerIconTest.java on win-x64
  • 0011b52: 8264843: Javac crashes with NullPointerException when finding unencoded XML in
     tag
  • 2047da7: 8265297: javax/net/ssl/SSLSession/TestEnabledProtocols.java failed with "RuntimeException: java.net.SocketException: Connection reset"
  • 091bc4a: 8268353: Test libsvml.so is and is not present in jdk image
  • 69d01b6: 8249899: jdk/javadoc/tool/InlineTagsWithBraces.java uses @ignore w/o bug-id
  • 7d7bdbe: 8268776: Test ADatagramSocket.java missing /othervm from @run tag
  • 344e3ed: 8268080: java/util/concurrent/forkjoin/AsyncShutdownNow.java fails with java.util.concurrent.RejectedExecutionException
  • ... and 25 more: https://git.openjdk.java.net/jdk17/compare/f69e2d5651f239209543bc1daf707a1c1114f6e5...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Jun 17, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jun 17, 2021
@openjdk
Copy link

openjdk bot commented Jun 17, 2021

@valeriepeng Pushed as commit 80dc262.

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

@valeriepeng valeriepeng deleted the JDK-8265500 branch June 18, 2021 02:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
integrated Pull request has been integrated security security-dev@openjdk.java.net
2 participants