changeset 55855:f459f98aa30d

8228668: compiler/codegen/aes/TestAESMain.java failed with GCM mode must be used with NoPadding Summary: Updated test to use NoPadding as default if the mode is one of GCM, CTR and CTS Reviewed-by: xuelei
author valeriep
date Mon, 29 Jul 2019 20:18:43 +0000
parents b20a319fdd35
children 66e4cf5ade6f
files test/hotspot/jtreg/compiler/codegen/aes/TestAESBase.java test/jdk/com/sun/crypto/provider/Cipher/AES/TestNoPaddingModes.java
diffstat 2 files changed, 4 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/test/hotspot/jtreg/compiler/codegen/aes/TestAESBase.java	Mon Jul 29 11:23:49 2019 -0700
+++ b/test/hotspot/jtreg/compiler/codegen/aes/TestAESBase.java	Mon Jul 29 20:18:43 2019 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,9 @@
     int decodeMsgSize;
     String algorithm = System.getProperty("algorithm", "AES");
     String mode = System.getProperty("mode", "CBC");
-    String paddingStr = System.getProperty("paddingStr", "PKCS5Padding");
+    String paddingStr = System.getProperty("paddingStr",
+        (mode.equals("GCM") || mode.equals("CTR") || mode.equals("CTS")) ?
+         "NoPadding" : "PKCS5Padding");
     byte[] input;
     byte[] encode;
     byte[] expectedEncode;
--- a/test/jdk/com/sun/crypto/provider/Cipher/AES/TestNoPaddingModes.java	Mon Jul 29 11:23:49 2019 -0700
+++ b/test/jdk/com/sun/crypto/provider/Cipher/AES/TestNoPaddingModes.java	Mon Jul 29 20:18:43 2019 +0000
@@ -65,45 +65,4 @@
         }
         System.out.println("Test Passed");
     }
-
-    public static class MyCipImpl extends CipherSpi {
-        public MyCipImpl() {
-            super();
-            System.out.println("MyCipImpl is created");
-        }
-        protected void engineSetMode(String mode)
-            throws NoSuchAlgorithmException {};
-        protected void engineSetPadding(String padding)
-            throws NoSuchPaddingException {};
-        protected int engineGetBlockSize() { return 16; }
-        protected int engineGetOutputSize(int inputLen) { return 0; }
-        protected byte[] engineGetIV() { return null; }
-        protected AlgorithmParameters engineGetParameters() { return null; }
-        protected void engineInit(int opmode, Key key, SecureRandom random)
-            throws InvalidKeyException {};
-        protected void engineInit(int opmode, Key key,
-                                  AlgorithmParameterSpec params,
-                                  SecureRandom random)
-            throws InvalidKeyException, InvalidAlgorithmParameterException {};
-        protected void engineInit(int opmode, Key key,
-                                  AlgorithmParameters params,
-                                  SecureRandom random)
-            throws InvalidKeyException, InvalidAlgorithmParameterException {};
-        protected byte[] engineUpdate(byte[] input, int inputOffset,
-                                      int inputLen) { return null; }
-        protected int engineUpdate(byte[] input, int inputOffset,
-                                   int inputLen, byte[] output,
-                                   int outputOffset)
-            throws ShortBufferException { return 0; };
-        protected byte[] engineDoFinal(byte[] input, int inputOffset,
-                                       int inputLen)
-            throws IllegalBlockSizeException, BadPaddingException {
-            return null;
-        }
-        protected int engineDoFinal(byte[] input, int inputOffset,
-                                    int inputLen, byte[] output,
-                                    int outputOffset)
-            throws ShortBufferException, IllegalBlockSizeException,
-                   BadPaddingException  { return 0; }
-    }
 }