--- a/test/jdk/sun/security/ssl/HandshakeHash/HandshakeHashCloneExhaustion.java Tue Mar 06 00:59:49 2018 +0100
+++ b/test/jdk/sun/security/ssl/HandshakeHash/HandshakeHashCloneExhaustion.java Tue Mar 06 10:31:14 2018 +0000
@@ -42,6 +42,7 @@
import java.io.InputStream;
import java.io.OutputStream;
+import java.security.MessageDigest;
import java.security.Security;
import javax.net.ssl.SSLSocket;
@@ -49,6 +50,7 @@
private static String[] protocol;
private static String[] ciphersuite;
+ private static String[] mds = { "SHA", "MD5", "SHA-256" };
/*
* ==================
@@ -57,6 +59,14 @@
public static void main(String[] args) throws Exception {
// Add in a non-cloneable MD5/SHA1/SHA-256 implementation
Security.insertProviderAt(new MyProvider(), 1);
+ // make sure our provider is functioning
+ for (String s : mds) {
+ MessageDigest md = MessageDigest.getInstance(s);
+ String p = md.getProvider().getName();
+ if (!p.equals("MyProvider")) {
+ throw new RuntimeException("Unexpected provider: " + p);
+ }
+ }
if (args.length != 2) {
throw new Exception(
--- a/test/jdk/sun/security/ssl/HandshakeHash/MyProvider.java Tue Mar 06 00:59:49 2018 +0100
+++ b/test/jdk/sun/security/ssl/HandshakeHash/MyProvider.java Tue Mar 06 10:31:14 2018 +0000
@@ -28,8 +28,8 @@
public MyProvider() {
super("MyProvider", "1.0",
"Test Provider: SHA1/MD5/SHA256 exhaustion testing");
- put("MessageDigest.SHA", "DigestBase.SHADigest");
- put("MessageDigest.MD5", "DigestBase.MD5Digest");
- put("MessageDigest.SHA-256", "DigestBase.SHA256Digest");
+ put("MessageDigest.SHA", "DigestBase$SHA");
+ put("MessageDigest.MD5", "DigestBase$MD5");
+ put("MessageDigest.SHA-256", "DigestBase$SHA256");
}
}