--- old/test/jdk/java/security/MessageDigest/TestDigestIOStream.java 2020-05-20 18:06:40.445762634 -0700 +++ new/test/jdk/java/security/MessageDigest/TestDigestIOStream.java 2020-05-20 18:06:40.061755260 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2020, 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 @@ -68,45 +68,37 @@ public void run() throws Exception { for (String algorithm : ALGORITHM_ARRAY) { - try { - md = MessageDigest.getInstance(algorithm); - for (int length : DATA_LEN_ARRAY) { - - Random rdm = RandomFactory.getRandom(); - data = new byte[length]; - rdm.nextBytes(data); - - if (!testMDChange(algorithm, length)) { - throw new RuntimeException("testMDChange failed at:" - + algorithm + "/" + length); - } - if (!testMDShare(algorithm, length)) { - throw new RuntimeException("testMDShare failed at:" - + algorithm + "/" + length); + md = MessageDigest.getInstance(algorithm); + for (int length : DATA_LEN_ARRAY) { + + Random rdm = RandomFactory.getRandom(); + data = new byte[length]; + rdm.nextBytes(data); + + if (!testMDChange(algorithm, length)) { + throw new RuntimeException("testMDChange failed at:" + + algorithm + "/" + length); + } + if (!testMDShare(algorithm, length)) { + throw new RuntimeException("testMDShare failed at:" + + algorithm + "/" + length); + } + for (ReadModel readModel : ReadModel.values()) { + // test Digest function when digest switch on + if (!testDigestOnOff(algorithm, readModel, true, + length)) { + throw new RuntimeException( + "testDigestOn failed at:" + algorithm + "/" + + length + "/" + readModel); } - for (ReadModel readModel : ReadModel.values()) { - // test Digest function when digest switch on - if (!testDigestOnOff(algorithm, readModel, true, - length)) { - throw new RuntimeException( - "testDigestOn failed at:" + algorithm + "/" - + length + "/" + readModel); - } - // test Digest function when digest switch off - if (!testDigestOnOff(algorithm, readModel, false, - length)) { - throw new RuntimeException( - "testDigestOff failed at:" + algorithm + "/" - + length + "/" + readModel); - } + // test Digest function when digest switch off + if (!testDigestOnOff(algorithm, readModel, false, + length)) { + throw new RuntimeException( + "testDigestOff failed at:" + algorithm + "/" + + length + "/" + readModel); } } - } catch (NoSuchAlgorithmException nae) { - if (algorithm.startsWith("SHA3") && !isSHA3supported()) { - continue; - } else { - throw nae; - } } } int testNumber = ALGORITHM_ARRAY.length * ReadModel.values().length @@ -115,21 +107,6 @@ out.println("All " + testNumber + " Tests Passed"); } - // SHA-3 hash algorithms are only supported by "SUN" provider - // and "OracleUcrypto" provider on Solaris 12.0 or later - // This method checks if system supports SHA-3 - private boolean isSHA3supported() { - if (Security.getProvider("SUN") != null) { - return true; - } - if (Security.getProvider("OracleUcrypto") != null - && "SunOS".equals(System.getProperty("os.name")) - && System.getProperty("os.version").compareTo("5.12") >= 0) { - return true; - } - return false; - } - /** * Test DigestInputStream and DigestOutputStream digest function when digest * set on and off