changeset 14663:655f1d059a8c

Merge
author andrew
date Thu, 06 Aug 2020 06:23:30 +0100
parents 22eb5e7d689b (current diff) d5c69bd5f7ad (diff)
children b9ec89d5d8fa
files
diffstat 18 files changed, 452 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/crypto/provider/GaloisCounterMode.java	Tue Nov 21 17:39:04 2017 +0100
+++ b/src/share/classes/com/sun/crypto/provider/GaloisCounterMode.java	Thu Aug 06 06:23:30 2020 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -60,6 +60,9 @@
     // can only be returned by the doFinal(...) call.
     private static final int MAX_BUF_SIZE = Integer.MAX_VALUE;
 
+    // data size when buffer is divided up to aid in intrinsics
+    private static final int TRIGGERLEN = 65536;  // 64k
+
     // buffer for AAD data; if null, meaning update has been called
     private ByteArrayOutputStream aadBuffer = new ByteArrayOutputStream();
     private int sizeOfAAD = 0;
@@ -379,12 +382,10 @@
     // Utility to process the last block; used by encryptFinal and decryptFinal
     void doLastBlock(byte[] in, int inOfs, int len, byte[] out, int outOfs,
                      boolean isEncrypt) throws IllegalBlockSizeException {
-        // process data in 'in'
-        gctrPAndC.doFinal(in, inOfs, len, out, outOfs);
-        processed += len;
-
         byte[] ct;
         int ctOfs;
+        int ilen = len;  // internal length
+
         if (isEncrypt) {
             ct = out;
             ctOfs = outOfs;
@@ -392,14 +393,37 @@
             ct = in;
             ctOfs = inOfs;
         }
-        int lastLen = len  % AES_BLOCK_SIZE;
+
+        // Divide up larger data sizes to trigger CTR & GHASH intrinsic quicker
+        if (len > TRIGGERLEN) {
+            int i = 0;
+            int tlen;  // incremental lengths
+            final int plen = AES_BLOCK_SIZE * 6;
+            // arbitrary formula to aid intrinsic without reaching buffer end
+            final int count = len / 1024;
+
+            while (count > i) {
+                tlen = gctrPAndC.update(in, inOfs, plen, out, outOfs);
+                ghashAllToS.update(ct, ctOfs, tlen);
+                inOfs += tlen;
+                outOfs += tlen;
+                ctOfs += tlen;
+                i++;
+            }
+            ilen -= count * plen;
+            processed += count * plen;
+        }
+
+        gctrPAndC.doFinal(in, inOfs, ilen, out, outOfs);
+        processed += ilen;
+
+        int lastLen = ilen % AES_BLOCK_SIZE;
         if (lastLen != 0) {
-            ghashAllToS.update(ct, ctOfs, len - lastLen);
-            byte[] padded =
-                expandToOneBlock(ct, (ctOfs + len - lastLen), lastLen);
-            ghashAllToS.update(padded);
+            ghashAllToS.update(ct, ctOfs, ilen - lastLen);
+            ghashAllToS.update(
+                    expandToOneBlock(ct, (ctOfs + ilen - lastLen), lastLen));
         } else {
-            ghashAllToS.update(ct, ctOfs, len);
+            ghashAllToS.update(ct, ctOfs, ilen);
         }
     }
 
@@ -559,15 +583,19 @@
         System.arraycopy(in, inOfs + len - tagLenBytes, tag, 0, tagLenBytes);
         len -= tagLenBytes;
 
-        if (len > 0) {
-            ibuffer.write(in, inOfs, len);
-        }
+        // If decryption is in-place or there is buffered "ibuffer" data, copy
+        // the "in" byte array into the ibuffer before proceeding.
+        if (in == out || ibuffer.size() > 0) {
+            if (len > 0) {
+                ibuffer.write(in, inOfs, len);
+            }
 
-        // refresh 'in' to all buffered-up bytes
-        in = ibuffer.toByteArray();
-        inOfs = 0;
-        len = in.length;
-        ibuffer.reset();
+            // refresh 'in' to all buffered-up bytes
+            in = ibuffer.toByteArray();
+            inOfs = 0;
+            len = in.length;
+            ibuffer.reset();
+        }
 
         if (len > 0) {
             doLastBlock(in, inOfs, len, out, outOfs, false);
--- a/src/share/classes/jdk/jfr/internal/PlatformRecorder.java	Tue Nov 21 17:39:04 2017 +0100
+++ b/src/share/classes/jdk/jfr/internal/PlatformRecorder.java	Thu Aug 06 06:23:30 2020 +0100
@@ -316,7 +316,7 @@
     private void dumpMemoryToDestination(PlatformRecording recording)  {
         WriteableUserPath dest = recording.getDestination();
         if (dest != null) {
-            MetadataRepository.getInstance().setOutput(dest.getText());
+            MetadataRepository.getInstance().setOutput(dest.getRealPathText());
             recording.clearDestination();
         }
     }
@@ -407,7 +407,7 @@
                     event.id = r.getId();
                     event.name = r.getName();
                     WriteableUserPath p = r.getDestination();
-                    event.destination = p == null ? null : p.getText();
+                    event.destination = p == null ? null : p.getRealPathText();
                     Duration d = r.getDuration();
                     event.recordingDuration = d == null ? Long.MAX_VALUE : d.toMillis();
                     Duration age = r.getMaxAge();
--- a/src/share/classes/jdk/jfr/internal/PlatformRecording.java	Tue Nov 21 17:39:04 2017 +0100
+++ b/src/share/classes/jdk/jfr/internal/PlatformRecording.java	Thu Aug 06 06:23:30 2020 +0100
@@ -132,7 +132,7 @@
                     options.add("duration=" + Utils.formatTimespan(duration, ""));
                 }
                 if (destination != null) {
-                    options.add("filename=" + destination.getText());
+                    options.add("filename=" + destination.getRealPathText());
                 }
                 String optionText = options.toString();
                 if (optionText.length() != 0) {
@@ -165,7 +165,7 @@
         if (dest != null) {
             try {
                 dumpStopped(dest);
-                Logger.log(LogTag.JFR, LogLevel.INFO, "Wrote recording \"" + getName() + "\" (" + getId() + ") to " + dest.getText());
+                Logger.log(LogTag.JFR, LogLevel.INFO, "Wrote recording \"" + getName() + "\" (" + getId() + ") to " + dest.getRealPathText());
                 notifyIfStateChanged(newState, oldState);
                 close(); // remove if copied out
             } catch(IOException e) {
--- a/src/share/classes/jdk/jfr/internal/WriteableUserPath.java	Tue Nov 21 17:39:04 2017 +0100
+++ b/src/share/classes/jdk/jfr/internal/WriteableUserPath.java	Thu Aug 06 06:23:30 2020 +0100
@@ -50,7 +50,8 @@
     private final AccessControlContext controlContext;
     private final Path original;
     private final Path real;
-    private final String text;
+    private final String realPathText;
+    private final String originalText;
 
     // Not to ensure security, but to help
     // against programming errors
@@ -68,8 +69,9 @@
         BufferedWriter fw = Files.newBufferedWriter(path);
         fw.close();
         this.original = path;
+        this.originalText = path.toString();
         this.real = path.toRealPath();
-        this.text = real.toString();
+        this.realPathText = real.toString();
     }
 
     /**
@@ -85,15 +87,25 @@
     }
 
     /**
-     * Returns a string representation of the path.
+     * Returns a string representation of the real path.
      *
      * @return path as text
      */
-    public String getText() {
-        return text;
+    public String getRealPathText() {
+        return realPathText;
     }
 
     /**
+     * Returns a string representation of the original path.
+     *
+     * @return path as text
+     */
+    public String getOriginalText() {
+        return originalText;
+    }
+
+
+    /**
      * Returns a potentially malicious path where the user may have implemented
      * their own version of Path. This method should never be called in an
      * unsafe context and the Path value should never be passed along to other
--- a/src/share/classes/jdk/jfr/internal/management/ManagementSupport.java	Tue Nov 21 17:39:04 2017 +0100
+++ b/src/share/classes/jdk/jfr/internal/management/ManagementSupport.java	Thu Aug 06 06:23:30 2020 +0100
@@ -31,12 +31,16 @@
 import java.util.List;
 
 import jdk.jfr.EventType;
+import jdk.jfr.Recording;
 import jdk.jfr.internal.JVMSupport;
 import jdk.jfr.internal.LogLevel;
 import jdk.jfr.internal.LogTag;
 import jdk.jfr.internal.Logger;
 import jdk.jfr.internal.MetadataRepository;
+import jdk.jfr.internal.PlatformRecording;
+import jdk.jfr.internal.PrivateAccess;
 import jdk.jfr.internal.Utils;
+import jdk.jfr.internal.WriteableUserPath;
 import jdk.jfr.internal.instrument.JDKEvents;
 
 /**
@@ -86,4 +90,12 @@
     public static void logError(String message) {
         Logger.log(LogTag.JFR, LogLevel.ERROR, message);
     }
+
+    // Get the textual representation when the destination was set, which
+    // requires access to jdk.jfr.internal.PlatformRecording
+    public static String getDestinationOriginalText(Recording recording) {
+        PlatformRecording pr = PrivateAccess.getInstance().getPlatformRecording(recording);
+        WriteableUserPath wup = pr.getDestination();
+        return wup == null ? null : wup.getOriginalText();
+    }
 }
--- a/src/share/classes/jdk/jfr/internal/tool/Command.java	Tue Nov 21 17:39:04 2017 +0100
+++ b/src/share/classes/jdk/jfr/internal/tool/Command.java	Thu Aug 06 06:23:30 2020 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 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
@@ -243,7 +243,7 @@
             }
             rad.read(); // try to read 1 byte
         } catch (FileNotFoundException e) {
-            throw new UserDataException("could not find file '" + path + "'");
+            throw new UserDataException("could not open file " + e.getMessage());
         } catch (IOException e) {
             throw new UserDataException("i/o error reading file '" + path + "', " + e.getMessage());
         }
--- a/src/share/classes/jdk/management/jfr/RecordingInfo.java	Tue Nov 21 17:39:04 2017 +0100
+++ b/src/share/classes/jdk/management/jfr/RecordingInfo.java	Thu Aug 06 06:23:30 2020 +0100
@@ -25,7 +25,6 @@
 
 package jdk.management.jfr;
 
-import java.nio.file.Path;
 import java.time.Duration;
 import java.time.Instant;
 import java.util.LinkedHashMap;
@@ -37,6 +36,7 @@
 
 import jdk.jfr.Recording;
 import jdk.jfr.RecordingState;
+import jdk.jfr.internal.management.ManagementSupport;
 
 /**
  * Management representation of a {@code Recording}.
@@ -80,8 +80,7 @@
         startTime = s == null ? 0L : s.toEpochMilli();
         Instant st = recording.getStopTime();
         stopTime = st == null ? 0L : st.toEpochMilli();
-        Path p = recording.getDestination();
-        destination = p == null ? null : p.toString();
+        destination = ManagementSupport.getDestinationOriginalText(recording);
         Duration duration = recording.getDuration();
         durationInSeconds = duration == null ? 0 : duration.getSeconds();
         settings = recording.getSettings();
--- a/src/share/classes/sun/security/smartcardio/ChannelImpl.java	Tue Nov 21 17:39:04 2017 +0100
+++ b/src/share/classes/sun/security/smartcardio/ChannelImpl.java	Thu Aug 06 06:23:30 2020 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -150,6 +150,7 @@
         return res;
     }
 
+    private final static int RESPONSE_ITERATIONS = 256;
     private final static byte[] B0 = new byte[0];
 
     private byte[] doTransmit(byte[] command) throws CardException {
@@ -182,8 +183,9 @@
             int k = 0;
             byte[] result = B0;
             while (true) {
-                if (++k >= 32) {
-                    throw new CardException("Could not obtain response");
+                if (++k > RESPONSE_ITERATIONS) {
+                    throw new CardException("Number of response iterations" +
+                            " exceeded maximum " + RESPONSE_ITERATIONS);
                 }
                 byte[] response = SCardTransmit
                     (card.cardId, card.protocol, command, 0, n);
--- a/src/solaris/native/java/lang/childproc.c	Tue Nov 21 17:39:04 2017 +0100
+++ b/src/solaris/native/java/lang/childproc.c	Thu Aug 06 06:23:30 2020 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -33,6 +33,7 @@
 
 #include "childproc.h"
 
+const char * const *parentPathv;
 
 ssize_t
 restartableWrite(int fd, const void *buf, size_t count)
--- a/src/solaris/native/java/lang/childproc.h	Tue Nov 21 17:39:04 2017 +0100
+++ b/src/solaris/native/java/lang/childproc.h	Thu Aug 06 06:23:30 2020 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -119,7 +119,7 @@
  * The cached and split version of the JDK's effective PATH.
  * (We don't support putenv("PATH=...") in native code)
  */
-const char * const *parentPathv;
+extern const char * const *parentPathv;
 
 ssize_t restartableWrite(int fd, const void *buf, size_t count);
 int restartableDup2(int fd_from, int fd_to);
--- a/src/solaris/native/sun/nio/ch/sctp/Sctp.h	Tue Nov 21 17:39:04 2017 +0100
+++ b/src/solaris/native/sun/nio/ch/sctp/Sctp.h	Thu Aug 06 06:23:30 2020 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -322,12 +322,12 @@
 
 #endif /* __linux__ */
 
-sctp_getladdrs_func* nio_sctp_getladdrs;
-sctp_freeladdrs_func* nio_sctp_freeladdrs;
-sctp_getpaddrs_func* nio_sctp_getpaddrs;
-sctp_freepaddrs_func* nio_sctp_freepaddrs;
-sctp_bindx_func* nio_sctp_bindx;
-sctp_peeloff_func* nio_sctp_peeloff;
+extern sctp_getladdrs_func* nio_sctp_getladdrs;
+extern sctp_freeladdrs_func* nio_sctp_freeladdrs;
+extern sctp_getpaddrs_func* nio_sctp_getpaddrs;
+extern sctp_freepaddrs_func* nio_sctp_freepaddrs;
+extern sctp_bindx_func* nio_sctp_bindx;
+extern sctp_peeloff_func* nio_sctp_peeloff;
 
 jboolean loadSocketExtensionFuncs(JNIEnv* env);
 
--- a/src/solaris/native/sun/nio/ch/sctp/SctpNet.c	Tue Nov 21 17:39:04 2017 +0100
+++ b/src/solaris/native/sun/nio/ch/sctp/SctpNet.c	Thu Aug 06 06:23:30 2020 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -43,6 +43,13 @@
 static const char* nativeSctpLib = "libsctp.so.1";
 static jboolean funcsLoaded = JNI_FALSE;
 
+sctp_getladdrs_func* nio_sctp_getladdrs;
+sctp_freeladdrs_func* nio_sctp_freeladdrs;
+sctp_getpaddrs_func* nio_sctp_getpaddrs;
+sctp_freepaddrs_func* nio_sctp_freepaddrs;
+sctp_bindx_func* nio_sctp_bindx;
+sctp_peeloff_func* nio_sctp_peeloff;
+
 JNIEXPORT jint JNICALL JNI_OnLoad
   (JavaVM *vm, void *reserved) {
     return JNI_VERSION_1_2;
--- a/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.c	Tue Nov 21 17:39:04 2017 +0100
+++ b/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.c	Thu Aug 06 06:23:30 2020 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -28,6 +28,9 @@
 #include <dlfcn.h>
 #include "NativeFunc.h"
 
+/* global GSS function table */
+GSS_FUNCTION_TABLE_PTR ftab;
+
 /* standard GSS method names (ordering is from mapfile) */
 static const char RELEASE_NAME[]                = "gss_release_name";
 static const char IMPORT_NAME[]                 = "gss_import_name";
--- a/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.h	Tue Nov 21 17:39:04 2017 +0100
+++ b/src/solaris/native/sun/security/jgss/wrapper/NativeFunc.h	Thu Aug 06 06:23:30 2020 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -265,6 +265,6 @@
 typedef GSS_FUNCTION_TABLE *GSS_FUNCTION_TABLE_PTR;
 
 /* global GSS function table */
-GSS_FUNCTION_TABLE_PTR ftab;
+extern GSS_FUNCTION_TABLE_PTR ftab;
 
 #endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/crypto/provider/Cipher/AEAD/GCMLargeDataKAT.java	Thu Aug 06 06:23:30 2020 +0100
@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.GCMParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.security.MessageDigest;
+import java.util.HashMap;
+
+/*
+ * @test
+ * @bug 8220165
+ * @summary Verify correctness of large data sizes for GCM.
+ */
+
+/**
+ * This test stores the MD5 hash of correctly encrypted AES/GCM data for
+ * particular data lengths.  Those lengths are run on SunJCE to verify returns
+ * the same MD5 hash of the encrypted data.  These are not NIST data sets or
+ * provided by any other organization.  The data sets are known good values,
+ * verified with two different JCE providers (solaris-sparcv9 ucrypto and
+ * linux SunJCE).
+ *
+ * Lengths around 64k are chosen because 64k is the point where
+ * com.sun.crypto.provider.GaloisCounterMode#doLastBlock() starts it's
+ * intrinsic warmup
+ *
+ * Plaintext is all zeros.  Preset key and IV.
+ *
+ * The choice of MD5 is for speed.  Shortcoming of the algorithm are
+ * not relevant for this test.
+ */
+
+public class GCMLargeDataKAT {
+
+    // Hash of encrypted results of AES/GCM for particular lengths.
+    // <data size, hash>
+    static final HashMap<Integer, String> results = new HashMap<Integer, String>() {{
+        put(65534, "1397b91c31ce793895edace4e175bfee");  //64k-2
+        put(65535, "4ad101c9f450e686668b3f8f05db96f0");  //64k-1
+        put(65536, "fbfaee3451acd3f603200d6be0f39b24");  //64k
+        put(65537, "e7dfca4a71495c65d20982c3c9b9813f");  //64k+1
+        put(67583, "c8ebdcb3532ec6c165de961341af7635");  //66k-1
+        put(67584, "36559d108dfd25dd29da3fec3455b9e5");  //66k
+        put(67585, "1d21b42d80ea179810744fc23dc228b6");  //66k+1
+        put(102400, "0d1544fcab20bbd4c8103b9d273f2c82"); //100k
+        put(102401, "f2d53ef65fd12d0a861368659b23ea2e"); //100k+1
+        put(102402, "97f0f524cf63d2d9d23d81e64d416ee0"); //100k+2
+        put(102403, "4a6b4af55b7d9016b64114d6813d639c"); //100k+3
+        put(102404, "ba63cc131fcde2f12ddf2ac634201be8"); //100k+4
+        put(102405, "673d05c7fe5e283e42e5c0d049fdcea6"); //100k+5
+        put(102406, "76cc99a7850ce857eb3cb43049cf9877"); //100k+6
+        put(102407, "65863f99072cf2eb7fce18bd78b33f4e"); //100k+7
+        put(102408, "b9184f0f272682cc1f791fa7070eddd4"); //100k+8
+        put(102409, "45fe36afef43cc665bf22a9ca200c3c2"); //100k+9
+        put(102410, "67249e41646edcb37a78a61b0743cf11"); //100k+0
+        put(102411, "ffdc611e29c8849842e81ec78f32c415"); //100k+11
+        put(102412, "b7fde7fd52221057dccc1c181a140125"); //100k+12
+        put(102413, "4b1d6c64d56448105e5613157e69c0ae"); //100k+13
+        put(102414, "6d2c0b26c0c8785c8eec3298a5f0080c"); //100k+14
+        put(102415, "1df2061b114fbe56bdf3717e3ee61ef9"); //100k+15
+        put(102416, "a691742692c683ac9d1254df5fc5f768"); //100k+16
+    }};
+    static final int HIGHLEN = 102416;
+
+    static final int GCM_TAG_LENGTH = 16;
+    static final byte[] iv = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
+    static final byte[] key_code = {
+            0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
+    };
+    static final GCMParameterSpec spec =
+            new GCMParameterSpec(GCM_TAG_LENGTH * 8, iv);
+    static final SecretKey key = new SecretKeySpec(key_code, "AES");
+    static boolean testresult = true;
+    static byte[] plaintext = new byte[HIGHLEN];
+    static MessageDigest md5;
+    Cipher cipher;
+
+    GCMLargeDataKAT() {
+    }
+
+    byte[] encrypt(int inLen) {
+        try {
+            cipher = Cipher.getInstance("AES/GCM/NoPadding", "SunJCE");
+            cipher.init(Cipher.ENCRYPT_MODE, key, spec);
+            return cipher.doFinal(plaintext, 0, inLen);
+        } catch (Exception e) {
+            System.err.println("Encrypt Failure (length = " + inLen + ") : " +
+                    e.getMessage());
+            e.printStackTrace();
+        }
+        return new byte[0];
+    }
+
+    static byte[] hash(byte[] data) {
+        return md5.digest(data);
+    }
+
+    // Decrypt the data and return a boolean if the plaintext is all 0's.
+    boolean decrypt(byte[] data) {
+        byte[] result = null;
+        int len = data.length - GCM_TAG_LENGTH;
+        if (data.length == 0) {
+            return false;
+        }
+        try {
+            cipher = Cipher.getInstance("AES/GCM/NoPadding", "SunJCE");
+            cipher.init(Cipher.DECRYPT_MODE, key, spec);
+            result = cipher.doFinal(data);
+        } catch (Exception e) {
+            System.err.println("Decrypt Failure (length = " + len + ") : " +
+                    e.getMessage());
+            e.printStackTrace();
+            return false;
+        }
+
+        if (result.length != len) {
+            System.err.println("Decrypt Failure (length = " + len +
+                    ") : plaintext length invalid = " + result.length);
+        }
+        // Return false if we find a non zero.
+        int i = 0;
+        while (result.length > i) {
+            if (result[i++] != 0) {
+                System.err.println("Decrypt Failure (length = " + len +
+                        ") : plaintext invalid, char index " + i);
+                return false;
+            }
+        }
+        return true;
+    }
+
+    void test() throws Exception {
+
+        // results order is not important
+        for (int l : results.keySet()) {
+            byte[] enc = new GCMLargeDataKAT().encrypt(l);
+
+            // verify hash with stored hash of that length
+            String hashstr = toHex(hash(enc));
+            boolean r = (hashstr.compareTo(results.get(l)) == 0);
+
+            System.out.println("---------------------------------------------");
+
+            // Encrypted test & results
+            System.out.println("Encrypt data size " + l + " \tResult: " +
+                    (r ? "Pass" : "Fail"));
+            if (!r) {
+                if (enc.length != 0) {
+                    System.out.println("\tExpected: " + results.get(l));
+                    System.out.println("\tReturned: " + hashstr);
+                }
+                testresult = false;
+                continue;
+            }
+
+            // Decrypted test & results
+            r = decrypt(enc);
+            System.out.println("Decrypt data size " + l + " \tResult: " +
+                    (r ? "Pass" : "Fail"));
+            if (!r) {
+                testresult = false;
+            }
+        }
+
+        // After test complete, throw an error if there was a failure
+        if (!testresult) {
+            throw new Exception("Tests failed");
+        }
+    }
+
+    /**
+     * With no argument, the test will run the predefined data lengths
+     *
+     * With an integer argument, this test will print the hash of the encrypted
+     * data of that integer length.
+     *
+     */
+    public static void main(String args[]) throws Exception {
+        md5 = MessageDigest.getInstance("MD5");
+
+        if (args.length > 0) {
+            int len = Integer.parseInt(args[0]);
+            byte[] e = new GCMLargeDataKAT().encrypt(len);
+            System.out.println(toHex(hash(e)));
+            return;
+        }
+
+        new GCMLargeDataKAT().test();
+    }
+
+    // bytes to hex string
+    static String toHex(byte[] bytes) {
+        StringBuffer hexStringBuffer = new StringBuffer(32);
+        for (int i = 0; i < bytes.length; i++) {
+            hexStringBuffer.append(byteToHex(bytes[i]));
+        }
+        return hexStringBuffer.toString();
+    }
+    // byte to hex
+    static String byteToHex(byte num) {
+        char[] hexDigits = new char[2];
+        hexDigits[0] = Character.forDigit((num >> 4) & 0xF, 16);
+        hexDigits[1] = Character.forDigit((num & 0xF), 16);
+        return new String(hexDigits);
+    }
+}
--- a/test/java/awt/FontClass/CreateFont/fileaccess/FontFile.java	Tue Nov 21 17:39:04 2017 +0100
+++ b/test/java/awt/FontClass/CreateFont/fileaccess/FontFile.java	Thu Aug 06 06:23:30 2020 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -25,6 +25,16 @@
  * @test
  * @bug 6652929
  * @summary verify handling of File.getPath()
+ * @compile FontFile.java
+ * @run shell TestFontFile.sh
+ */
+
+/*
+ * When using jtreg this test needs to be run by shell script,
+ * since otherwise jtreg reflectively invokes the main method
+ * and the codebase for the purposes of the security manager
+ * is that of the jtreg harness, not the codebase (class file location)
+ * of this program, thus access to read to that location is not available.
  */
 
 import java.awt.*;
@@ -34,10 +44,21 @@
     public static void main(String[] args) throws Exception {
         String sep = System.getProperty("file.separator");
         String fname = ".." + sep + "A.ttf";
-        String dir = System.getProperty("test.src");
+        //String dir = System.getProperty("test.src");
+        String dir = System.getenv("TESTSRC");
         if (dir != null) {
             fname = dir + sep + fname;
         }
+        //String classesDir = System.getProperty("test.classes");
+        String classesDir = System.getenv("TESTCLASSES");
+        System.out.println("classesDir="+classesDir);
+        String testfile = "somefile";
+        if (classesDir != null) {
+            testfile = classesDir + sep + testfile;
+        }
+        final String somefile = testfile;
+        System.out.println("somefile="+somefile);
+        System.out.println("userdir="+System.getProperty("user.dir"));
         final String name = fname;
         System.out.println("Will try to access " + name);
         if (!(new File(name)).canRead()) {
@@ -66,7 +87,7 @@
                             return name;
                         } else {
                             read = true;
-                            return "somefile";
+                            return somefile;
                         }
                     }
                     @Override public boolean canRead() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/FontClass/CreateFont/fileaccess/TestFontFile.sh	Thu Aug 06 06:23:30 2020 +0100
@@ -0,0 +1,84 @@
+#
+# 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
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#!/bin/sh
+
+if [ "${TESTSRC}" = "" ]
+then TESTSRC=.
+fi
+
+if [ "${TESTJAVA}" = "" ]
+then
+  PARENT=`dirname \`which java\``
+  TESTJAVA=`dirname ${PARENT}`
+  echo "TESTJAVA not set, selecting " ${TESTJAVA}
+  echo "If this is incorrect, try setting the variable manually."
+fi
+
+if [ "${TESTCLASSES}" = "" ]
+then
+  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
+  exit 1
+fi
+
+BIT_FLAG=""
+
+# set platform-dependent variables
+OS=`uname -s`
+case "$OS" in
+  SunOS | Linux | Darwin )
+    NULL=/dev/null
+    PS=":"
+    FS="/"
+    ## for solaris, linux it's HOME
+    FILE_LOCATION=$HOME
+    if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ]
+    then
+        BIT_FLAG=`cat ${FILE_LOCATION}${FS}JDK64BIT`
+    fi
+    ;;
+  Windows_* | CYGWIN* )
+    NULL=NUL
+    PS=";"
+    FS="\\"
+    ;;
+  * )
+    echo "Unrecognized system!"
+    exit 1;
+    ;;
+esac
+
+JEMMYPATH=${CPAPPEND}
+CLASSPATH=.${PS}${TESTCLASSES}${PS}${JEMMYPATH} ; export CLASSPATH
+
+THIS_DIR=`pwd`
+
+${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} -version
+
+${TESTJAVA}${FS}bin${FS}java ${BIT_FLAG} FontFile > test.out 2>&1
+
+STATUS=$?
+
+cat test.out
+
+exit $STATUS
--- a/test/jdk/jfr/tool/TestPrint.java	Tue Nov 21 17:39:04 2017 +0100
+++ b/test/jdk/jfr/tool/TestPrint.java	Thu Aug 06 06:23:30 2020 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 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
@@ -47,7 +47,7 @@
         output.shouldContain("missing file");
 
         output = ExecuteHelper.jfr("print", "missing.jfr");
-        output.shouldContain("could not find file ");
+        output.shouldContain("could not open file ");
 
         Path file = Utils.createTempFile("faked-print-file",  ".jfr");
         FileWriter fw = new FileWriter(file.toFile());