From dd0b582f4b691d91917f4cc6589a1d58ea0c1f5a Mon Sep 17 00:00:00 2001 From: Artem Smotrakov Date: Fri, 16 Jun 2017 17:06:35 -0700 Subject: [PATCH] 8182388: Backout 8182143 Reviewed-by: xuelei --- .../ssl/SignatureAndHashAlgorithm.java | 18 +++++++++++------- .../net/ssl/TLSv12/SignatureAlgorithms.java | 19 +++++++++++++++++-- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java b/jdk/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java index b9f11f851bf..8445a665da3 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2016, 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 @@ -411,12 +411,16 @@ final class SignatureAndHashAlgorithm { "SHA1withRSA", --p); supports(HashAlgorithm.SHA1, SignatureAlgorithm.ECDSA, "SHA1withECDSA", --p); - supports(HashAlgorithm.SHA224, SignatureAlgorithm.DSA, - "SHA224withDSA", --p); - supports(HashAlgorithm.SHA224, SignatureAlgorithm.RSA, - "SHA224withRSA", --p); - supports(HashAlgorithm.SHA224, SignatureAlgorithm.ECDSA, - "SHA224withECDSA", --p); + + if (Security.getProvider("SunMSCAPI") == null) { + supports(HashAlgorithm.SHA224, SignatureAlgorithm.DSA, + "SHA224withDSA", --p); + supports(HashAlgorithm.SHA224, SignatureAlgorithm.RSA, + "SHA224withRSA", --p); + supports(HashAlgorithm.SHA224, SignatureAlgorithm.ECDSA, + "SHA224withECDSA", --p); + } + supports(HashAlgorithm.SHA256, SignatureAlgorithm.DSA, "SHA256withDSA", --p); supports(HashAlgorithm.SHA256, SignatureAlgorithm.RSA, diff --git a/jdk/test/javax/net/ssl/TLSv12/SignatureAlgorithms.java b/jdk/test/javax/net/ssl/TLSv12/SignatureAlgorithms.java index 0533d31135e..8b51703df41 100644 --- a/jdk/test/javax/net/ssl/TLSv12/SignatureAlgorithms.java +++ b/jdk/test/javax/net/ssl/TLSv12/SignatureAlgorithms.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -30,7 +30,7 @@ /* * @test - * @bug 8049321 8182143 + * @bug 8049321 * @summary Support SHA256WithDSA in JSSE * @run main/othervm SignatureAlgorithms PKIX "SHA-224,SHA-256" * TLS_DHE_DSS_WITH_AES_128_CBC_SHA @@ -434,6 +434,21 @@ public class SignatureAlgorithms { */ parseArguments(args); + + /* + * Ignore testing on Windows if only SHA-224 is available. + */ + if ((Security.getProvider("SunMSCAPI") != null) && + (disabledAlgorithms.contains("SHA-1")) && + (disabledAlgorithms.contains("SHA-256"))) { + + System.out.println( + "Windows system does not support SHA-224 algorithms yet. " + + "Ignore the testing"); + + return; + } + /* * Expose the target algorithms by diabling unexpected algorithms. */