src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotCryptoSubstitutionTest.java
changeset 58877 aec7bf35d6f5
parent 58299 6df94ce3ab2f
equal deleted inserted replaced
58876:1a8d65e71a66 58877:aec7bf35d6f5
    78         desExpected.write(runEncryptDecrypt(desKey, "DESede/CBC/PKCS5Padding"));
    78         desExpected.write(runEncryptDecrypt(desKey, "DESede/CBC/PKCS5Padding"));
    79     }
    79     }
    80 
    80 
    81     @Test
    81     @Test
    82     public void testAESCryptIntrinsics() throws Exception {
    82     public void testAESCryptIntrinsics() throws Exception {
    83         if (compileAndInstall("com.sun.crypto.provider.AESCrypt", HotSpotGraphBuilderPlugins.aesEncryptName, HotSpotGraphBuilderPlugins.aesDecryptName)) {
    83         String aesEncryptName = HotSpotGraphBuilderPlugins.lookupIntrinsicName(runtime().getVMConfig(), "com/sun/crypto/provider/AESCrypt", "implEncryptBlock", "encryptBlock");
       
    84         String aesDecryptName = HotSpotGraphBuilderPlugins.lookupIntrinsicName(runtime().getVMConfig(), "com/sun/crypto/provider/AESCrypt", "implDecryptBlock", "decryptBlock");
       
    85         if (compileAndInstall("com.sun.crypto.provider.AESCrypt", aesEncryptName, aesDecryptName)) {
    84             ByteArrayOutputStream actual = new ByteArrayOutputStream();
    86             ByteArrayOutputStream actual = new ByteArrayOutputStream();
    85             actual.write(runEncryptDecrypt(aesKey, "AES/CBC/NoPadding"));
    87             actual.write(runEncryptDecrypt(aesKey, "AES/CBC/NoPadding"));
    86             actual.write(runEncryptDecrypt(aesKey, "AES/CBC/PKCS5Padding"));
    88             actual.write(runEncryptDecrypt(aesKey, "AES/CBC/PKCS5Padding"));
    87             Assert.assertArrayEquals(aesExpected.toByteArray(), actual.toByteArray());
    89             Assert.assertArrayEquals(aesExpected.toByteArray(), actual.toByteArray());
    88         }
    90         }
    89     }
    91     }
    90 
    92 
    91     @Test
    93     @Test
    92     public void testCipherBlockChainingIntrinsics() throws Exception {
    94     public void testCipherBlockChainingIntrinsics() throws Exception {
    93         boolean implNames = HotSpotGraphBuilderPlugins.cbcUsesImplNames(runtime().getVMConfig());
    95         String cbcEncryptName = HotSpotGraphBuilderPlugins.lookupIntrinsicName(runtime().getVMConfig(), "com/sun/crypto/provider/CipherBlockChaining", "implEncrypt", "encrypt");
    94         String cbcEncryptName = implNames ? "implEncrypt" : "encrypt";
    96         String cbcDecryptName = HotSpotGraphBuilderPlugins.lookupIntrinsicName(runtime().getVMConfig(), "com/sun/crypto/provider/CipherBlockChaining", "implDecrypt", "decrypt");
    95         String cbcDecryptName = implNames ? "implDecrypt" : "decrypt";
       
    96         if (compileAndInstall("com.sun.crypto.provider.CipherBlockChaining", cbcEncryptName, cbcDecryptName)) {
    97         if (compileAndInstall("com.sun.crypto.provider.CipherBlockChaining", cbcEncryptName, cbcDecryptName)) {
    97             ByteArrayOutputStream actual = new ByteArrayOutputStream();
    98             ByteArrayOutputStream actual = new ByteArrayOutputStream();
    98             actual.write(runEncryptDecrypt(aesKey, "AES/CBC/NoPadding"));
    99             actual.write(runEncryptDecrypt(aesKey, "AES/CBC/NoPadding"));
    99             actual.write(runEncryptDecrypt(aesKey, "AES/CBC/PKCS5Padding"));
   100             actual.write(runEncryptDecrypt(aesKey, "AES/CBC/PKCS5Padding"));
   100             Assert.assertArrayEquals(aesExpected.toByteArray(), actual.toByteArray());
   101             Assert.assertArrayEquals(aesExpected.toByteArray(), actual.toByteArray());