[jdk17] RFR: 8265500: Some impls of javax.crypto.Cipher.init() do not throw UnsupportedOperationExc for unsupported modes
Valerie Peng
valeriep at openjdk.java.net
Wed Jun 16 18:12:55 UTC 2021
On Wed, 16 Jun 2021 17:44:13 GMT, Xue-Lei Andrew Fan <xuelei at openjdk.org> wrote:
>> 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
>
> src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11AEADCipher.java line 365:
>
>> 363: default:
>> 364: // should never happen; checked by Cipher.init()
>> 365: throw new AssertionError("Unknown mode: " + opmode);
>
> 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.
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.
-------------
PR: https://git.openjdk.java.net/jdk17/pull/69
More information about the security-dev
mailing list