changeset 43008:c6c74a38f1ad

8172273: SSLEngine.unwrap fails with ArrayIndexOutOfBoundsException Reviewed-by: wetmore
author xuelei
date Fri, 06 Jan 2017 01:09:03 +0000
parents 4de62a95642c
children 5af9f7aa93e5
files jdk/src/java.base/share/classes/sun/security/ssl/InputRecord.java jdk/test/javax/net/ssl/TLS/TestJSSEClientProtocol.java
diffstat 2 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/java.base/share/classes/sun/security/ssl/InputRecord.java	Mon Dec 26 23:20:57 2016 +0530
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/InputRecord.java	Fri Jan 06 01:09:03 2017 +0000
@@ -242,8 +242,9 @@
         //  2: ClientHello.client_version
         // 32: ClientHello.random
         //  1: length byte of ClientHello.session_id
+        //  2: length bytes of ClientHello.cipher_suites
         //  2: empty ClientHello.compression_methods
-        int requiredSize = 46 + sessionIdLen + ((cipherSpecLen * 2 ) / 3 );
+        int requiredSize = 48 + sessionIdLen + ((cipherSpecLen * 2 ) / 3 );
         byte[] converted = new byte[requiredSize];
 
         /*
--- a/jdk/test/javax/net/ssl/TLS/TestJSSEClientProtocol.java	Mon Dec 26 23:20:57 2016 +0530
+++ b/jdk/test/javax/net/ssl/TLS/TestJSSEClientProtocol.java	Fri Jan 06 01:09:03 2017 +0000
@@ -22,7 +22,7 @@
 
 /*
  * @test
- * @bug 8049429
+ * @bug 8049429 8172273
  * @modules java.management
  *          jdk.crypto.ec/sun.security.ec
  * @summary Test that all cipher suites work in all versions and all client
@@ -30,6 +30,21 @@
  *          and all checking is done on the client side.
  * @compile CipherTestUtils.java JSSEClient.java JSSEServer.java
  * @run main/othervm
+ *              -DSERVER_PROTOCOL=SSLv2Hello,SSLv3,TLSv1,TLSv1.1,TLSv1.2
+ *              -DCLIENT_PROTOCOL=SSLv2Hello,SSLv3,TLSv1,TLSv1.1,TLSv1.2
+ *              -DCIPHER=SSL_RSA_WITH_RC4_128_MD5
+ *          TestJSSE
+ * @run main/othervm
+ *              -DSERVER_PROTOCOL=SSLv2Hello,SSLv3,TLSv1,TLSv1.1,TLSv1.2
+ *              -DCLIENT_PROTOCOL=SSLv2Hello,SSLv3,TLSv1,TLSv1.1,TLSv1.2
+ *              -DCIPHER=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
+ *          TestJSSE
+ * @run main/othervm
+ *              -DSERVER_PROTOCOL=SSLv2Hello,SSLv3,TLSv1,TLSv1.1,TLSv1.2
+ *              -DCLIENT_PROTOCOL=SSLv2Hello,SSLv3,TLSv1,TLSv1.1,TLSv1.2
+ *              -DCIPHER=TLS_DHE_RSA_WITH_AES_128_CBC_SHA
+ *          TestJSSE
+ * @run main/othervm
  *              -DSERVER_PROTOCOL=SSLv3
  *              -DCLIENT_PROTOCOL=SSLv3
  *              -DCIPHER=SSL_RSA_WITH_RC4_128_MD5